Lines Matching refs:list

30  * This is the List widget, it is useful to display a list, without the
31 * overhead of having a widget for each item in the list. It allows
32 * the user to select an item in a list and notifies the application through
72 offset(list.foreground), XtRString, "XtDefaultForeground"},
76 offset(list.font),XtRString, "XtDefaultFont"},
78 offset(list.list), XtRString, NULL},
80 offset(list.default_cols), XtRImmediate, (caddr_t)2},
82 offset(list.longest), XtRImmediate, (caddr_t)0},
84 offset(list.nitems), XtRImmediate, (caddr_t)0},
86 offset(list.paste), XtRString, (caddr_t) "False"},
88 offset(list.force_cols), XtRString, (caddr_t) "False"},
90 offset(list.vertical_cols), XtRString, (caddr_t) "False"},
92 offset(list.internal_width), XtRImmediate, (caddr_t)4},
94 offset(list.internal_height), XtRImmediate, (caddr_t)2},
96 offset(list.column_space), XtRImmediate, (caddr_t)6},
98 offset(list.row_space), XtRImmediate, (caddr_t)2},
100 offset(list.callback), XtRCallback, NULL},
174 values.foreground = lw->list.foreground;
175 values.font = lw->list.font->fid;
176 lw->list.normgc = XtGetGC(w, (unsigned) GCForeground | GCFont,
180 lw->list.revgc = XtGetGC(w, (unsigned) GCForeground | GCFont,
184 lw->list.foreground,
189 lw->list.graygc = XtGetGC(w, (unsigned) GCFont | GCTile | GCFillStyle,
194 * Description: Resets the new list when important things change.
211 * If list is NULL then the list will just be the name of the widget.
214 if (lw->list.list == NULL) {
215 lw->list.list = &(lw->core.name);
216 lw->list.nitems = 1;
219 if (lw->list.nitems == 0) /* Get number of items. */
220 for ( ; lw->list.list[lw->list.nitems] != NULL ; lw->list.nitems++);
222 if (lw->list.longest == 0) /* Get column width. */
223 for ( i = 0 ; i < lw->list.nitems; i++) {
224 len = XTextWidth(lw->list.font, lw->list.list[i],
225 strlen(lw->list.list[i]));
226 if (len > lw->list.longest)
227 lw->list.longest = len;
230 lw->list.col_width = lw->list.longest + lw->list.column_space;
313 lw->list.row_height = lw->list.font->max_bounds.ascent
314 + lw->list.font->max_bounds.descent
315 + lw->list.row_space;
319 lw->list.highlight = lw->list.is_highlighted = NO_HIGHLIGHT;
326 * Arguments: w - the list widget.
341 if (lw->list.vertical_cols) {
342 one = lw->list.nrows * ((xloc - (int) lw->list.internal_width)
343 / lw->list.col_width);
344 another = (yloc - (int) lw->list.internal_height)
345 / lw->list.row_height;
347 if (another >= lw->list.nrows) {
348 another = lw->list.nrows - 1;
353 one = (lw->list.ncols * ((yloc - (int) lw->list.internal_height)
354 / lw->list.row_height)) ;
356 another = (xloc - (int) lw->list.internal_width) / lw->list.col_width;
357 if (another >= lw->list.ncols) {
358 another = lw->list.ncols - 1;
367 if (*item >= lw->list.nitems) return(OUT_OF_RANGE);
373 * Arguments: w - the list widget.
396 * Arguments: w - the list widget.
412 if (lw->list.vertical_cols)
413 things = lw->list.nrows;
415 things = lw->list.ncols;
440 hl_x = x - lw->list.column_space/2;
441 width = XTextWidth(lw->list.font, lw->list.list[item],
442 strlen(lw->list.list[item])) + lw->list.column_space;
443 hl_y = y - lw->list.row_space/2;
444 height = lw->list.row_height + lw->list.row_space;
451 * Arguments: w - the list widget.
470 if (lw->list.vertical_cols) {
471 x = lw->list.col_width * (item / lw->list.nrows)
472 + lw->list.internal_width;
473 y = lw->list.row_height * (item % lw->list.nrows)
474 + lw->list.internal_height;
477 x = lw->list.col_width * (item % lw->list.ncols)
478 + lw->list.internal_width;
479 y = lw->list.row_height * (item / lw->list.ncols)
480 + lw->list.internal_height;
483 str_y = y + lw->list.font->max_bounds.ascent;
485 if (item == lw->list.is_highlighted) {
486 if (item == lw->list.highlight) {
487 gc = lw->list.revgc;
488 HighlightBackground(w, x, y, item, lw->list.normgc);
492 gc = lw->list.normgc;
494 gc = lw->list.graygc;
495 HighlightBackground(w, x, y, item, lw->list.revgc);
496 lw->list.is_highlighted = NO_HIGHLIGHT;
500 if (item == lw->list.highlight) {
501 gc = lw->list.revgc;
502 HighlightBackground(w, x, y, item, lw->list.normgc);
503 lw->list.is_highlighted = item;
507 gc = lw->list.normgc;
509 gc = lw->list.graygc;
513 str = lw->list.list[item]; /* draw it */
519 * Arguments: w - the list widget.
538 lr_item = lw->list.nrows * lw->list.ncols - 1;
544 for (item = ul_item; (item <= lr_item && item < lw->list.nitems) ; item++)
622 * Description: lays out the item in the list.
627 * we are going to layout the list widget to,
647 if (lw->list.force_cols) {
648 lw->list.ncols = lw->list.default_cols;
649 if (lw->list.ncols <= 0) lw->list.ncols = 1;
651 lw->list.nrows = ( ( lw->list.nitems - 1) / lw->list.ncols) + 1 ;
653 *width = lw->list.ncols * lw->list.col_width
654 + 2 * lw->list.internal_width;
658 *height = (lw->list.nrows * lw->list.row_height)
659 + 2 * lw->list.internal_height;
672 lw->list.ncols = lw->list.default_cols;
673 if (lw->list.ncols <= 0) lw->list.ncols = 1;
674 lw->list.nrows = ( ( lw->list.nitems - 1) / lw->list.ncols) + 1 ;
675 *width = lw->list.ncols * lw->list.col_width
676 + 2 * lw->list.internal_width;
677 *height = (lw->list.nrows * lw->list.row_height)
678 + 2 * lw->list.internal_height;
684 * of the widget to fit the current list exactly.
687 lw->list.ncols = ( (*width - 2 * lw->list.internal_width)
688 / lw->list.col_width);
689 if (lw->list.ncols <= 0) lw->list.ncols = 1;
690 lw->list.nrows = ( ( lw->list.nitems - 1) / lw->list.ncols) + 1 ;
692 *height = (lw->list.nrows * lw->list.row_height)
693 + 2 * lw->list.internal_height;
703 lw->list.nrows = (*height - 2 * lw->list.internal_height)
704 / lw->list.row_height;
705 if (lw->list.nrows <= 0) lw->list.nrows = 1;
706 lw->list.ncols = (( lw->list.nitems - 1 ) / lw->list.nrows) + 1;
707 *width = lw->list.ncols * lw->list.col_width
708 + 2 * lw->list.internal_width;
745 == OUT_OF_RANGE) || (lw->list.highlight != item) ) {
750 item_len = strlen(lw->list.list[item]);
752 if ( lw->list.paste ) /* if XtNpasteBuffer set then paste it. */
753 XStoreBytes(XtDisplay(w), lw->list.list[item], item_len);
759 ret_value.string = lw->list.list[item];
806 else if ( lw->list.is_highlighted != item ) /* If this item is not */
823 if ((cl->list.foreground != rl->list.foreground) ||
825 (cl->list.font != rl->list.font) ) {
826 XtDestroyGC(cl->list.normgc);
827 XtDestroyGC(cl->list.graygc);
828 XtDestroyGC(cl->list.revgc);
835 if ((cl->list.row_space != rl->list.row_space) ||
836 (cl->list.font != rl->list.font))
837 nl->list.row_height = nl->list.font->max_bounds.ascent
838 + nl->list.font->max_bounds.descent
839 + nl->list.row_space;
843 (cl->list.internal_width != rl->list.internal_width) ||
844 (cl->list.internal_height != rl->list.internal_height) ||
845 (cl->list.column_space != rl->list.column_space) ||
846 (cl->list.row_space != rl->list.row_space) ||
847 (cl->list.default_cols != rl->list.default_cols) ||
848 ( (cl->list.force_cols != rl->list.force_cols) &&
849 (rl->list.force_cols != rl->list.ncols) ) ||
850 (cl->list.vertical_cols != rl->list.vertical_cols) ||
851 (cl->list.longest != rl->list.longest) ||
852 (cl->list.nitems != rl->list.nitems) ||
853 (cl->list.font != rl->list.font) ||
854 (cl->list.list != rl->list.list) ) {
860 if (cl->list.list != rl->list.list)
861 nl->list.highlight = NO_HIGHLIGHT;
865 nl->list.highlight = NO_HIGHLIGHT;
878 * Description: Changes the list being used and shown.
879 * Arguments: w - the list widget.
880 * list - the new list.
881 * nitems - the number of items in the list.
883 * in the list.
884 * resize - if TRUE the the list widget will
888 * If nitems is <= 0 then the list needs to be NULL terminated.
892 XawListChange(w, list, nitems, longest, resize_it)
894 char ** list;
900 lw->list.list = list;
903 lw->list.nitems = nitems;
905 lw->list.longest = longest;
908 lw->list.is_highlighted = lw->list.highlight = NO_HIGHLIGHT;
925 lw->list.highlight = NO_HIGHLIGHT;
926 if (lw->list.is_highlighted != NO_HIGHLIGHT)
927 PaintItemName(w, lw->list.is_highlighted); /* unhighlight this one. */
932 * Arguments: w - the list widget.
945 lw->list.highlight = item;
946 if (lw->list.is_highlighted != NO_HIGHLIGHT)
947 PaintItemName(w, lw->list.is_highlighted); /* Unhighlight. */
954 * Arguments: w - the list widget.
967 ret_val->list_index = lw->list.highlight;
971 ret_val->string = lw->list.list[ ret_val->list_index ];