2 * $XConsortium: MList.h,v 1.17 90/05/08 15:18:37 converse Exp $
4 * Copyright 1989 Massachusetts Institute of Technology
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of M.I.T. not be used in advertising or
11 * publicity pertaining to distribution of the software without specific,
12 * written prior permission. M.I.T. makes no representations about the
13 * suitability of this software for any purpose. It is provided "as is"
14 * without express or implied warranty.
16 * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
18 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 /* This is the MList widget, it is useful to display a list, without the
25 * overhead of having a widget for each item in the list. It allows
26 * the user to select an item in a list and notifies the application through
27 * a callback function.
30 * By: Chris D. Peterson
37 /***********************************************************************
41 ***********************************************************************/
43 #include <X11/Xaw/Simple.h>
47 Name Class RepType Default Value
48 ---- ----- ------- -------------
49 background Background Pixel XtDefaultBackground
50 border BorderColor Pixel XtDefaultForeground
51 borderWidth BorderWidth Dimension 1
52 callback Callback XtCallbackMList NULL **6
53 columnSpacing Spacing Dimension 6
54 cursor Cursor Cursor left_ptr
55 defaultColumns Columns int 2 **5
56 destroyCallback Callback Pointer NULL
57 font Font XFontStruct* XtDefaultFont
58 forceColumns Columns Boolean False **5
59 foreground Foreground Pixel XtDefaultForeground
60 height Height Dimension 0 **1
61 insensitiveBorder Insensitive Pixmap Gray
62 internalHeight Height Dimension 2
63 internalWidth Width Dimension 4
64 list MList String * NULL **2
65 longest Longest int 0 **3 **4
66 mappedWhenManaged MappedWhenManaged Boolean True
67 numberStrings NumberStrings int 0 **4
68 pasteBuffer Boolean Boolean False
69 rowSpacing Spacing Dimension 4
70 sensitive Sensitive Boolean True
71 verticalMList Boolean Boolean False
72 width Width Dimension 0 **1
76 **1 - If the Width or Height of the list widget is zero (0) then the value
77 is set to the minimum size necessay to fit the entire list.
79 If both Width and Height are zero then they are adjusted to fit the
80 entire list that is created width the number of default columns
81 specified in the defaultColumns resource.
83 **2 - This is an array of strings the specify elements of the list.
84 This resource must be specified.
85 (What good is a list widget without a list?? :-)
87 **3 - Longest is the length of the widest string in pixels.
89 **4 - If either of these values are zero (0) then the list widget calculates
92 (This allows you to make startup faster if you already have
93 this information calculated)
95 NOTE: If the numberStrings value is zero the list must
98 **5 - By setting the MList.Columns resource you can force the application to
99 have a given number of columns.
101 **6 - This returns the name and index of the item selected in an
102 XawMListReturnStruct that is pointed to by the client_data
109 * Value returned when there are no highlighted objects.
112 #define XAW_LIST_NONE -1
114 #define XtCMList "MList"
115 #define XtCSpacing "Spacing"
116 #define XtCColumns "Columns"
117 #define XtCLongest "Longest"
118 #define XtCNumberStrings "NumberStrings"
120 #define XtNcursor "cursor"
121 #define XtNcolumnSpacing "columnSpacing"
122 #define XtNdefaultColumns "defaultColumns"
123 #define XtNforceColumns "forceColumns"
124 #define XtNlist "list"
125 #define XtNlongest "longest"
126 #define XtNnumberStrings "numberStrings"
127 #define XtNpasteBuffer "pasteBuffer"
128 #define XtNrowSpacing "rowSpacing"
129 #define XtNverticalList "verticalList"
131 /* Class record constants */
133 extern WidgetClass mlistWidgetClass;
135 typedef struct _MListClassRec *MListWidgetClass;
136 typedef struct _MListRec *MListWidget;
138 /* The list return structure. */
140 typedef struct _XawMListReturnStruct {
143 } XawMListReturnStruct;
145 /*************************************************************
146 * For Compatibility only. */
148 #define XtMListReturnStruct XawMListReturnStruct
150 #define XT_LIST_NONE XAW_LIST_NONE
152 #define XtMListChange XawMListChange
153 #define XtMListUnhighlight XawMListUnhighlight
154 #define XtMListHighlight XawMListHighlight
155 #define XtMListShowCurrent XawMListShowCurrent
157 /*************************************************************/
160 /******************************************************************
164 *****************************************************************/
167 extern "C" { /* for C++ V2.0 */
170 /* Function Name: XawMListChange.
171 * Description: Changes the list being used and shown.
172 * Arguments: w - the list widget.
173 * list - the new list.
174 * nitems - the number of items in the list.
175 * longest - the length (in Pixels) of the longest element
177 * resize - if TRUE the the list widget will
178 * try to resize itself.
180 * NOTE: If nitems of longest are <= 0 then they will be caluculated.
181 * If nitems is <= 0 then the list needs to be NULL terminated.
184 extern void XawMListChange(
185 #if NeedFunctionPrototypes
190 #if NeedWidePrototypes
191 /* Boolean */ int /* resize */
198 /* Function Name: XawMListUnhighlight
199 * Description: unlights the current highlighted element.
200 * Arguments: w - the widget.
204 extern void XawMListUnhighlight(
205 #if NeedFunctionPrototypes
211 /* Function Name: XawMListHighlight
212 * Description: Highlights the given item.
213 * Arguments: w - the list widget.
214 * item - the item to highlight.
218 extern void XawMListHighlight(
219 #if NeedFunctionPrototypes
226 /* Function Name: XawMListShowCurrent
227 * Description: returns the currently highlighted object.
228 * Arguments: w - the list widget.
229 * numselected - for return value
230 * Returns: the info about the currently highlighted objects.
231 * numselected - the number of objects returned.
234 extern XawMListReturnStruct * XawMListShowCurrent(
235 #if NeedFunctionPrototypes
237 int * /* numselected */
245 #endif /* _XawMList_h */
246 /* DON'T ADD STUFF AFTER THIS #endif */