Lines Matching defs:list

31  * This is a List widget.  It allows the user to select an item in a list and
52 I also added the freedoms member of the list widget part. */
58 #define HeightFree( w ) !(((ListWidget)(w))->list.freedoms & HeightLock )
59 #define WidthFree( w ) !(((ListWidget)(w))->list.freedoms & WidthLock )
60 #define LongestFree( w ) !(((ListWidget)(w))->list.freedoms & LongestLock )
82 offset(list.foreground), XtRString, XtDefaultForeground},
86 offset(list.font),XtRString, XtDefaultFont},
88 offset(list.fontset),XtRString, XtDefaultFontSet},
90 offset(list.list), XtRString, NULL},
92 offset(list.default_cols), XtRImmediate, (XtPointer)2},
94 offset(list.longest), XtRImmediate, (XtPointer)0},
96 offset(list.nitems), XtRImmediate, (XtPointer)0},
98 offset(list.paste), XtRImmediate, (XtPointer) False},
100 offset(list.force_cols), XtRImmediate, (XtPointer) False},
102 offset(list.vertical_cols), XtRImmediate, (XtPointer) False},
104 offset(list.internal_width), XtRImmediate, (XtPointer)2},
106 offset(list.internal_height), XtRImmediate, (XtPointer)2},
108 offset(list.column_space), XtRImmediate, (XtPointer)6},
110 offset(list.row_space), XtRImmediate, (XtPointer)2},
112 offset(list.callback), XtRCallback, NULL},
189 values.foreground = lw->list.foreground;
190 values.font = lw->list.font->fid;
193 lw->list.normgc = XtAllocateGC( w, 0, (unsigned) GCForeground,
196 lw->list.normgc = XtGetGC( w, (unsigned) GCForeground | GCFont,
202 lw->list.revgc = XtAllocateGC( w, 0, (unsigned) GCForeground,
205 lw->list.revgc = XtGetGC( w, (unsigned) GCForeground | GCFont,
209 lw->list.foreground,
215 lw->list.graygc = XtAllocateGC( w, 0, (unsigned) GCTile | GCFillStyle,
218 lw->list.graygc = XtGetGC( w, (unsigned) GCFont | GCTile | GCFillStyle,
240 /* If list is NULL then the list will just be the name of the widget. */
242 if (lw->list.list == NULL) {
243 lw->list.list = &(lw->core.name);
244 lw->list.nitems = 1;
249 if (lw->list.nitems == 0)
250 for ( ; lw->list.list[lw->list.nitems] != NULL ; lw->list.nitems++);
256 lw->list.longest = 0; /* so it will accumulate real longest below */
258 for ( i = 0 ; i < lw->list.nitems; i++) {
260 len = XmbTextEscapement(lw->list.fontset, lw->list.list[i],
261 strlen(lw->list.list[i]));
263 len = XTextWidth(lw->list.font, lw->list.list[i],
264 strlen(lw->list.list[i]));
265 if (len > lw->list.longest)
266 lw->list.longest = len;
270 lw->list.col_width = lw->list.longest + lw->list.column_space;
274 * Description: Resets the new list when important things change.
366 lw->list.freedoms = (lw->core.width != 0) * WidthLock +
368 (lw->list.longest != 0) * LongestLock;
375 lw->list.row_height =
376 XExtentsOfFontSet(lw->list.fontset)->max_ink_extent.height
377 + lw->list.row_space;
379 lw->list.row_height = lw->list.font->max_bounds.ascent
380 + lw->list.font->max_bounds.descent
381 + lw->list.row_space;
385 lw->list.highlight = lw->list.is_highlighted = NO_HIGHLIGHT;
392 * Arguments: w - the list widget.
407 if (lw->list.vertical_cols) {
408 one = lw->list.nrows * ((xloc - (int) lw->list.internal_width)
409 / lw->list.col_width);
410 another = (yloc - (int) lw->list.internal_height)
411 / lw->list.row_height;
413 if (another >= lw->list.nrows) {
414 another = lw->list.nrows - 1;
419 one = (lw->list.ncols * ((yloc - (int) lw->list.internal_height)
420 / lw->list.row_height)) ;
422 another = (xloc - (int) lw->list.internal_width) / lw->list.col_width;
423 if (another >= lw->list.ncols) {
424 another = lw->list.ncols - 1;
433 if (*item >= lw->list.nitems) return(OUT_OF_RANGE);
439 * Arguments: w - the list widget.
463 * Arguments: w - the list widget.
480 if (lw->list.vertical_cols)
481 things = lw->list.nrows;
483 things = lw->list.ncols;
511 Dimension width = lw->list.col_width;
512 Dimension height = lw->list.row_height;
513 Dimension frame_limited_width = w->core.width - lw->list.internal_width - x;
514 Dimension frame_limited_height= w->core.height- lw->list.internal_height- y;
525 if ( x < lw->list.internal_width ) {
526 width = width - ( lw->list.internal_width - x );
527 x = lw->list.internal_width;
529 if ( y < lw->list.internal_height) {
530 height = height - ( lw->list.internal_height - x );
531 y = lw->list.internal_height;
555 rect.y = lw->list.internal_height;
556 rect.height = lw->core.height - lw->list.internal_height * 2;
557 rect.width = lw->core.width - lw->list.internal_width - x;
558 if ( rect.width > lw->list.longest )
559 rect.width = lw->list.longest;
568 * w - the list widget.
582 XFontSetExtents *ext = XExtentsOfFontSet(lw->list.fontset);
586 if (lw->list.vertical_cols) {
587 x = lw->list.col_width * (item / lw->list.nrows)
588 + lw->list.internal_width;
589 y = lw->list.row_height * (item % lw->list.nrows)
590 + lw->list.internal_height;
593 x = lw->list.col_width * (item % lw->list.ncols)
594 + lw->list.internal_width;
595 y = lw->list.row_height * (item / lw->list.ncols)
596 + lw->list.internal_height;
602 str_y = y + lw->list.font->max_bounds.ascent;
604 if (item == lw->list.is_highlighted) {
605 if (item == lw->list.highlight) {
606 gc = lw->list.revgc;
607 HighlightBackground(w, x, y, lw->list.normgc);
611 gc = lw->list.normgc;
613 gc = lw->list.graygc;
614 HighlightBackground(w, x, y, lw->list.revgc);
615 lw->list.is_highlighted = NO_HIGHLIGHT;
619 if (item == lw->list.highlight) {
620 gc = lw->list.revgc;
621 HighlightBackground(w, x, y, lw->list.normgc);
622 lw->list.is_highlighted = item;
626 gc = lw->list.normgc;
628 gc = lw->list.graygc;
637 x += lw->list.column_space / 2;
638 str_y += lw->list.row_space / 2;
640 str = lw->list.list[item]; /* draw it */
645 XmbDrawString( XtDisplay( w ), XtWindow( w ), lw->list.fontset,
658 * w - the list widget.
675 lr_item = lw->list.nrows * lw->list.ncols - 1;
681 for (item = ul_item; (item <= lr_item && item < lw->list.nitems) ; item++)
759 * lays out the item in the list.
764 * we are going to layout the list widget to,
783 if (lw->list.force_cols) {
784 lw->list.ncols = lw->list.default_cols;
785 if (lw->list.ncols <= 0) lw->list.ncols = 1;
787 lw->list.nrows = ( ( lw->list.nitems - 1) / lw->list.ncols) + 1 ;
794 *width = lw->list.ncols * lw->list.col_width
795 + 2 * lw->list.internal_width;
799 *height = (lw->list.nrows * lw->list.row_height)
800 + 2 * lw->list.internal_height;
813 lw->list.ncols = lw->list.default_cols;
814 if (lw->list.ncols <= 0) lw->list.ncols = 1;
815 lw->list.nrows = ( ( lw->list.nitems - 1) / lw->list.ncols) + 1 ;
816 *width = lw->list.ncols * lw->list.col_width
817 + 2 * lw->list.internal_width;
818 *height = (lw->list.nrows * lw->list.row_height)
819 + 2 * lw->list.internal_height;
825 * of the widget to fit the current list exactly.
828 lw->list.ncols = ( (int)(*width - 2 * lw->list.internal_width)
829 / (int)lw->list.col_width);
830 if (lw->list.ncols <= 0) lw->list.ncols = 1;
831 lw->list.nrows = ( ( lw->list.nitems - 1) / lw->list.ncols) + 1 ;
833 *height = (lw->list.nrows * lw->list.row_height)
834 + 2 * lw->list.internal_height;
844 lw->list.nrows = (int)(*height - 2 * lw->list.internal_height)
845 / (int)lw->list.row_height;
846 if (lw->list.nrows <= 0) lw->list.nrows = 1;
847 lw->list.ncols = (( lw->list.nitems - 1 ) / lw->list.nrows) + 1;
848 *width = lw->list.ncols * lw->list.col_width
849 + 2 * lw->list.internal_width;
882 == OUT_OF_RANGE) || (lw->list.highlight != item) ) {
887 item_len = strlen(lw->list.list[item]);
889 if ( lw->list.paste ) /* if XtNpasteBuffer set then paste it. */
890 XStoreBytes(XtDisplay(w), lw->list.list[item], item_len);
896 ret_value.string = lw->list.list[item];
937 else if ( lw->list.is_highlighted != item ) /* If this item is not */
955 XFontSetExtents *ext = XExtentsOfFontSet(nl->list.fontset);
960 nl->list.freedoms |= WidthLock;
962 nl->list.freedoms &= ~WidthLock;
965 nl->list.freedoms |= HeightLock;
967 nl->list.freedoms &= ~HeightLock;
969 if ( nl->list.longest != cl->list.longest )
970 nl->list.freedoms |= LongestLock;
971 if ( nl->list.longest == 0 )
972 nl->list.freedoms &= ~LongestLock;
976 if ( (cl->list.foreground != nl->list.foreground) ||
978 (cl->list.font != nl->list.font) ) {
980 XGetGCValues(XtDisplay(current), cl->list.graygc, GCTile, &values);
982 XtReleaseGC(current, cl->list.graygc);
983 XtReleaseGC(current, cl->list.revgc);
984 XtReleaseGC(current, cl->list.normgc);
989 if ( ( cl->list.font != nl->list.font ) &&
991 nl->list.row_height = nl->list.font->max_bounds.ascent
992 + nl->list.font->max_bounds.descent
993 + nl->list.row_space;
995 else if ( ( cl->list.fontset != nl->list.fontset ) &&
997 nl->list.row_height = ext->max_ink_extent.height + nl->list.row_space;
1003 else if ( cl->list.row_space != nl->list.row_space ) {
1006 nl->list.row_height = ext->max_ink_extent.height + nl->list.row_space;
1008 nl->list.row_height = nl->list.font->max_bounds.ascent
1009 + nl->list.font->max_bounds.descent
1010 + nl->list.row_space;
1015 (cl->list.internal_width != nl->list.internal_width) ||
1016 (cl->list.internal_height != nl->list.internal_height) ||
1017 (cl->list.column_space != nl->list.column_space) ||
1018 (cl->list.row_space != nl->list.row_space) ||
1019 (cl->list.default_cols != nl->list.default_cols) ||
1020 ( (cl->list.force_cols != nl->list.force_cols) &&
1021 (rl->list.force_cols != nl->list.ncols) ) ||
1022 (cl->list.vertical_cols != nl->list.vertical_cols) ||
1023 (cl->list.longest != nl->list.longest) ||
1024 (cl->list.nitems != nl->list.nitems) ||
1025 (cl->list.font != nl->list.font) ||
1028 (cl->list.fontset != nl->list.fontset) ||
1029 (cl->list.list != nl->list.list) ) {
1037 if (cl->list.list != nl->list.list)
1038 nl->list.is_highlighted = nl->list.highlight = NO_HIGHLIGHT;
1042 nl->list.highlight = NO_HIGHLIGHT;
1058 XGetGCValues(XtDisplay(w), lw->list.graygc, GCTile, &values);
1060 XtReleaseGC(w, lw->list.graygc);
1061 XtReleaseGC(w, lw->list.revgc);
1062 XtReleaseGC(w, lw->list.normgc);
1068 * Description: Changes the list being used and shown.
1069 * Arguments: w - the list widget.
1070 * list - the new list.
1071 * nitems - the number of items in the list.
1073 * in the list.
1074 * resize - if TRUE the the list widget will
1078 * If nitems is <= 0 then the list needs to be NULL terminated.
1083 XawListChange(Widget w, char ** list, int nitems, int longest,
1090 XawListChange(w, list, nitems, longest, resize_it)
1092 char ** list;
1101 lw->list.list = list;
1104 lw->list.nitems = nitems;
1109 lw->list.freedoms |= LongestLock;
1111 lw->list.freedoms &= ~LongestLock;
1114 lw->list.freedoms &= ~WidthLock & ~HeightLock;
1117 lw->list.longest = longest;
1125 lw->list.is_highlighted = lw->list.highlight = NO_HIGHLIGHT;
1146 lw->list.highlight = NO_HIGHLIGHT;
1147 if (lw->list.is_highlighted != NO_HIGHLIGHT)
1148 PaintItemName(w, lw->list.is_highlighted); /* unhighlight this one. */
1153 * Arguments: w - the list widget.
1170 lw->list.highlight = item;
1171 if (lw->list.is_highlighted != NO_HIGHLIGHT)
1172 PaintItemName(w, lw->list.is_highlighted); /* Unhighlight. */
1179 * Arguments: w - the list widget.
1197 ret_val->list_index = lw->list.highlight;
1201 ret_val->string = lw->list.list[ ret_val->list_index ];