Lines Matching defs:list*

28  * This is a List widget.  It allows the user to select an item in a list and
52 #define HeightFree(w) !(((ListWidget)(w))->list.freedoms & HeightLock)
53 #define WidthFree(w) !(((ListWidget)(w))->list.freedoms & WidthLock)
54 #define LongestFree(w) !(((ListWidget)(w))->list.freedoms & LongestLock)
106 offset(list.foreground),
124 offset(list.font),
133 offset(list.fontset),
142 offset(list.list),
155 offset(list.default_cols),
164 offset(list.longest),
173 offset(list.nitems),
182 offset(list.paste),
191 offset(list.force_cols),
200 offset(list.vertical_cols),
209 offset(list.internal_width),
218 offset(list.internal_height),
227 offset(list.column_space),
236 offset(list.row_space),
245 offset(list.callback),
255 offset(list.show_current),
270 ListClassRec listClassRec = {
313 /* list */
319 WidgetClass listWidgetClass = (WidgetClass)&listClassRec;
329 .foreground = lw->list.foreground,
330 .font = lw->list.font->fid
334 lw->list.normgc = XtAllocateGC(w, 0, GCForeground, &values, GCFont, 0);
336 lw->list.normgc = XtGetGC(w, GCForeground | GCFont, &values);
341 lw->list.revgc = XtAllocateGC(w, 0, GCForeground, &values, GCFont, 0);
343 lw->list.revgc = XtGetGC(w, GCForeground | GCFont, &values);
346 lw->list.foreground,
352 lw->list.graygc = XtAllocateGC(w, 0, GCTile | GCFillStyle,
355 lw->list.graygc = XtGetGC(w, GCFont | GCTile | GCFillStyle, &values);
363 /* If list is NULL then the list will just be the name of the widget */
364 if (lw->list.list == NULL) {
365 lw->list.list = &lw->core.name;
366 lw->list.nitems = 1;
370 if (lw->list.nitems == 0)
371 for (; lw->list.list[lw->list.nitems] != NULL ; lw->list.nitems++)
378 lw->list.longest = 0; /* so it will accumulate real longest below */
380 for (i = 0 ; i < lw->list.nitems; i++) {
384 len = XmbTextEscapement(lw->list.fontset, lw->list.list[i],
385 (int)strlen(lw->list.list[i]));
387 len = XTextWidth(lw->list.font, lw->list.list[i],
388 (int)strlen(lw->list.list[i]));
389 if (len > lw->list.longest)
390 lw->list.longest = len;
394 lw->list.col_width = lw->list.longest + lw->list.column_space;
402 * w - list widget
407 * Resets the new list when important things change.
483 if (!lw->list.font) XtError("Aborting: no font found\n");
484 if (lw->simple.international && !lw->list.fontset)
491 lw->list.freedoms = ((XtWidth(lw) != 0) * WidthLock +
493 (lw->list.longest != 0) * LongestLock);
499 lw->list.row_height =
500 XExtentsOfFontSet(lw->list.fontset)->max_ink_extent.height +
501 lw->list.row_space;
503 lw->list.row_height = lw->list.font->max_bounds.ascent +
504 lw->list.font->max_bounds.descent +
505 lw->list.row_space;
509 lw->list.highlight = lw->list.is_highlighted = NO_HIGHLIGHT;
517 * w - list widget
534 if (lw->list.vertical_cols) {
535 one = lw->list.nrows * ((xloc - (int)lw->list.internal_width)
536 / lw->list.col_width);
537 another = (yloc - (int)lw->list.internal_height) / lw->list.row_height;
539 if (another >= lw->list.nrows) {
540 another = lw->list.nrows - 1;
545 one = (lw->list.ncols * ((yloc - (int)lw->list.internal_height)
546 / lw->list.row_height));
548 another = (xloc - (int)lw->list.internal_width) / lw->list.col_width;
549 if (another >= lw->list.ncols) {
550 another = lw->list.ncols - 1;
561 if (*item >= lw->list.nitems)
572 * w - list widget
598 * w - list widget
615 if (lw->list.vertical_cols)
616 things = lw->list.nrows;
618 things = lw->list.ncols;
640 Dimension width = (Dimension)lw->list.col_width;
641 Dimension height = (Dimension)lw->list.row_height;
642 Dimension frame_limited_width = (Dimension)(XtWidth(w) - lw->list.internal_width - x);
643 Dimension frame_limited_height= (Dimension)(XtHeight(w) - lw->list.internal_height - y);
652 if (x < lw->list.internal_width) {
653 width = (Dimension)(width - (lw->list.internal_width - x));
654 x = lw->list.internal_width;
656 if (y < lw->list.internal_height) {
657 height = (Dimension)(height - (lw->list.internal_height - y));
658 y = lw->list.internal_height;
661 if (gc == lw->list.revgc && lw->core.background_pixmap != XtUnspecifiedPixmap)
682 .y = (short)lw->list.internal_height,
684 (XtHeight(lw) - (lw->list.internal_height << 1)),
686 (XtWidth(lw) - (unsigned)lw->list.internal_width - x),
689 if (rect.width > lw->list.longest)
690 rect.width = (unsigned short)lw->list.longest;
702 XFontSetExtents *ext = XExtentsOfFontSet(lw->list.fontset);
704 if (!XtIsRealized(w) || item > lw->list.nitems)
707 if (lw->list.vertical_cols) {
708 x = lw->list.col_width * (item / lw->list.nrows)
709 + lw->list.internal_width;
710 y = lw->list.row_height * (item % lw->list.nrows)
711 + lw->list.internal_height;
714 x = lw->list.col_width * (item % lw->list.ncols)
715 + lw->list.internal_width;
716 y = lw->list.row_height * (item / lw->list.ncols)
717 + lw->list.internal_height;
723 str_y = y + lw->list.font->max_bounds.ascent;
725 if (item == lw->list.is_highlighted) {
726 if (item == lw->list.highlight) {
727 gc = lw->list.revgc;
728 HighlightBackground(w, x, y, lw->list.normgc);
732 gc = lw->list.normgc;
734 gc = lw->list.graygc;
735 HighlightBackground(w, x, y, lw->list.revgc);
736 lw->list.is_highlighted = NO_HIGHLIGHT;
740 if (item == lw->list.highlight) {
741 gc = lw->list.revgc;
742 HighlightBackground(w, x, y, lw->list.normgc);
743 lw->list.is_highlighted = item;
747 gc = lw->list.normgc;
749 gc = lw->list.graygc;
758 x += lw->list.column_space >> 1;
759 str_y += lw->list.row_space >> 1;
761 str = lw->list.list[item]; /* draw it */
766 XmbDrawString(XtDisplay(w), XtWindow(w), lw->list.fontset,
783 lr_item = lw->list.nrows * lw->list.ncols - 1;
792 for (item = ul_item; item <= lr_item && item < lw->list.nitems; item++)
861 * lays out the item in the list.
866 * we are going to layout the list widget to,
882 if (lw->list.force_cols) {
883 lw->list.ncols = lw->list.default_cols;
884 if (lw->list.ncols <= 0)
885 lw->list.ncols = 1;
886 lw->list.nrows = ((lw->list.nitems - 1) / lw->list.ncols) + 1;
891 width2 = (unsigned long)(lw->list.ncols * lw->list.col_width +
892 (lw->list.internal_width << 1));
896 height2 = (unsigned long)(lw->list.nrows * lw->list.row_height +
897 (lw->list.internal_height << 1));
908 lw->list.ncols = lw->list.default_cols;
909 if (lw->list.ncols <= 0) {
910 int wid = (int)XtWidth(lw) - (int)(lw->list.internal_width << 1)
911 + (int)lw->list.column_space;
913 if (wid <= 0 || lw->list.col_width <= 0
914 || (lw->list.ncols = wid / lw->list.col_width) <= 0)
915 lw->list.ncols = 1;
917 width2 = (unsigned long)((lw->list.ncols * lw->list.col_width)
918 + (lw->list.internal_width << 1));
919 height2 = (unsigned long)((lw->list.nrows * lw->list.row_height)
920 + (lw->list.internal_height << 1));
927 * of the widget to fit the current list exactly
930 lw->list.ncols = ((int)(*width - (lw->list.internal_width << 1))
931 / (int)lw->list.col_width);
932 if (lw->list.ncols <= 0)
933 lw->list.ncols = 1;
934 lw->list.nrows = ((lw->list.nitems - 1) / lw->list.ncols) + 1;
936 height2 = (unsigned long)((lw->list.nrows * lw->list.row_height) +
937 (lw->list.internal_height << 1));
948 lw->list.nrows = ((int)(*height - (lw->list.internal_height << 1))
949 / (int)lw->list.row_height);
950 if (lw->list.nrows <= 0)
951 lw->list.nrows = 1;
952 lw->list.ncols = ((lw->list.nitems - 1) / lw->list.nrows) + 1;
953 width2 = (unsigned long)((lw->list.ncols * lw->list.col_width) +
954 (lw->list.internal_width << 1));
958 if (!lw->list.force_cols && lw->list.nrows) {
961 lw->list.nrows = ((lw->list.nitems - 1) / lw->list.ncols) + 1;
962 width2 = (unsigned long)((lw->list.ncols * lw->list.col_width) +
963 (lw->list.internal_width << 1));
964 height2 = (unsigned long)((lw->list.nrows * lw->list.row_height) +
965 (lw->list.internal_height << 1));
969 ++lw->list.ncols;
970 else if (width2 > MaxSize && lw->list.ncols > 1)
971 --lw->list.ncols;
1003 || lw->list.highlight != item) {
1005 if (!lw->list.show_current || lw->list.selected == NO_HIGHLIGHT)
1008 XawListHighlight(w, lw->list.selected);
1015 item_len = (int)strlen(lw->list.list[item]);
1017 if (lw->list.paste) /* if XtNpasteBuffer set then paste it */
1018 XStoreBytes(XtDisplay(w), lw->list.list[item], item_len);
1021 lw->list.selected = item;
1028 .string = lw->list.list[item],
1029 .list_index = item
1057 lw->list.selected = lw->list.highlight;
1061 else if (lw->list.is_highlighted != item) /* If this item is not */
1077 XFontSetExtents *ext = XExtentsOfFontSet(nl->list.fontset);
1082 nl->list.freedoms |= WidthLock;
1084 nl->list.freedoms &= ~WidthLock;
1087 nl->list.freedoms |= HeightLock;
1089 nl->list.freedoms &= ~HeightLock;
1091 if (nl->list.longest != cl->list.longest)
1092 nl->list.freedoms |= LongestLock;
1093 if (nl->list.longest == 0)
1094 nl->list.freedoms &= ~LongestLock;
1096 if (cl->list.foreground != nl->list.foreground ||
1098 cl->list.font != nl->list.font) {
1101 XGetGCValues(XtDisplay(current), cl->list.graygc, GCTile, &values);
1103 XtReleaseGC(current, cl->list.graygc);
1104 XtReleaseGC(current, cl->list.revgc);
1105 XtReleaseGC(current, cl->list.normgc);
1110 if (cl->list.font != nl->list.font && cl->simple.international == False)
1111 nl->list.row_height = nl->list.font->max_bounds.ascent
1112 + nl->list.font->max_bounds.descent
1113 + nl->list.row_space;
1114 else if (cl->list.fontset != nl->list.fontset
1116 nl->list.row_height = ext->max_ink_extent.height + nl->list.row_space;
1121 else if (cl->list.row_space != nl->list.row_space) {
1123 nl->list.row_height = ext->max_ink_extent.height + nl->list.row_space;
1125 nl->list.row_height = nl->list.font->max_bounds.ascent
1126 + nl->list.font->max_bounds.descent
1127 + nl->list.row_space;
1131 || cl->list.internal_width != nl->list.internal_width
1132 || cl->list.internal_height != nl->list.internal_height
1133 || cl->list.column_space != nl->list.column_space
1134 || cl->list.row_space != nl->list.row_space
1135 || cl->list.default_cols != nl->list.default_cols
1136 || (cl->list.force_cols != nl->list.force_cols
1137 && rl->list.force_cols != nl->list.ncols)
1138 || cl->list.vertical_cols != nl->list.vertical_cols
1139 || cl->list.longest != nl->list.longest
1140 || cl->list.nitems != nl->list.nitems
1141 || cl->list.font != nl->list.font
1144 || cl->list.fontset != nl->list.fontset
1145 || cl->list.list != nl->list.list) {
1152 if (cl->list.list != nl->list.list || cl->list.nitems != nl->list.nitems)
1153 nl->list.is_highlighted = nl->list.highlight = NO_HIGHLIGHT;
1157 nl->list.highlight = NO_HIGHLIGHT;
1170 XGetGCValues(XtDisplay(w), lw->list.graygc, GCTile, &values);
1172 XtReleaseGC(w, lw->list.graygc);
1173 XtReleaseGC(w, lw->list.revgc);
1174 XtReleaseGC(w, lw->list.normgc);
1182 * w - list widget
1183 * list - new list
1184 * nitems - number of items in the list
1185 * longest - length (in Pixels) of the longest element in the list
1186 * resize - if True the the list widget will try to resize itself
1189 * Changes the list being used and shown.
1193 * If nitems is <= 0 then the list needs to be NULL terminated
1196 XawListChange(Widget w, String *list, int nitems, int longest,
1208 lw->list.list = list;
1212 lw->list.nitems = nitems;
1218 lw->list.freedoms |= LongestLock;
1220 lw->list.freedoms &= ~LongestLock;
1223 lw->list.freedoms &= ~WidthLock & ~HeightLock;
1225 lw->list.longest = longest;
1232 lw->list.is_highlighted = lw->list.highlight = NO_HIGHLIGHT;
1242 lw->list.highlight = NO_HIGHLIGHT;
1243 if (lw->list.is_highlighted != NO_HIGHLIGHT)
1244 PaintItemName(w, lw->list.is_highlighted);
1253 lw->list.highlight = item;
1254 if (lw->list.is_highlighted != NO_HIGHLIGHT)
1255 PaintItemName(w, lw->list.is_highlighted);
1265 * w - list widget
1278 ret_val->list_index = lw->list.highlight;
1279 if (ret_val->list_index == XAW_LIST_NONE)
1282 ret_val->string = lw->list.list[ret_val->list_index];