Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / lib / DtWidget / ComboBox.h
1 /* $XConsortium: ComboBox.h /main/4 1995/10/26 09:29:51 rswiston $ */
2 /*
3  *  (c) Copyright 1993, 1994 Hewlett-Packard Company
4  *  (c) Copyright 1993, 1994 International Business Machines Corp.
5  *  (c) Copyright 1993, 1994 Novell, Inc.
6  *  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
7  */
8 /***********************************************************
9 Copyright 1993 Interleaf, Inc.
10
11 Permission to use, copy, modify, and distribute this software
12 and its documentation for any purpose without fee is granted,
13 provided that the above copyright notice appear in all copies
14 and that both copyright notice and this permission notice appear
15 in supporting documentation, and that the name of Interleaf not
16 be used in advertising or publicly pertaining to distribution of
17 the software without specific written prior permission.
18
19 Interleaf makes no representation about the suitability of this
20 software for any purpose. It is provided "AS IS" without any
21 express or implied warranty.
22 ******************************************************************/
23
24 #ifndef _Dt_ComboBox_h
25 #define _Dt_ComboBox_h
26
27 /*
28  * This widget is deprecated in favor of XmComboBox.  The two are very
29  * similar, but do have minor differences.  Applications doing new
30  * development are encouraged to use XmComboBox directly.  Existing
31  * applications may wish to recompile with DT_USE_XM_COMBOBOX.
32  */
33
34 #include <Xm/Xm.h>
35 #ifdef DT_USE_XM_COMBOBOX
36 #include <Xm/ComboBox.h>
37 #endif
38
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44
45 /*
46  * Constants
47  */
48
49 /* Resources */
50
51 #ifndef DT_USE_XM_COMBOBOX
52
53 /***********************************************************************
54  *
55  * NOTE:
56  *      Because of future development of the ComboBox, not all of the 
57  *      following resources should be used.  The only ones which are
58  *      supported are the ones found in the Common Desktop Environment:
59  *      Programmer's Guide.  The supported resources include:
60  *      DtNmarginHeight, DtNmarginWidth, DtNselectedItem, 
61  *      DtNselectedPosition, DtNselectionCallback, and DtNcomboBoxType.
62  *
63  *      The use of the unsupported resources found in this header
64  *      file may cause dangerous and unexpected behavior.
65  *
66  **********************************************************************/
67
68 /* WARNING: DtNactivateCallback is an unsupported resource in CDE 1.0 */
69 #ifndef DtNactivateCallback
70 #define DtNactivateCallback     XmNactivateCallback
71 #endif
72 /* WARNING: DtNalignment is an unsupported resource in CDE 1.0 */
73 #ifndef DtNalignment
74 #define DtNalignment            XmNalignment
75 #endif
76 /* WARNING: DtNarrowSize is an unsupported resource in CDE 1.0 */
77 #ifndef DtNarrowSize
78 #define DtNarrowSize            "arrowSize"
79 #endif
80 /* WARNING: DtNarrowSpacing is an unsupported resource in CDE 1.0 */
81 #ifndef DtNarrowSpacing
82 #define DtNarrowSpacing         "arrowSpacing"
83 #endif
84 /* WARNING: DtNarrowType is an unsupported resource in CDE 1.0 */
85 #ifndef DtNarrowType
86 #define DtNarrowType            "arrowType"
87 #endif
88 /* WARNING: DtNcolumns is an unsupported resource in CDE 1.0 */
89 #ifndef DtNcolumns
90 #define DtNcolumns              XmNcolumns
91 #endif
92 #ifndef DtNcomboBoxType
93 #define DtNcomboBoxType         "comboBoxType"
94 #endif
95 /* WARNING: DtNfocusCallback is an unsupported resource in CDE 1.0 */
96 #ifndef DtNfocusCallback
97 #define DtNfocusCallback        XmNfocusCallback
98 #endif
99 /* WARNING: DtNhorizontalSpacing is an unsupported resource in CDE 1.0 */
100 #ifndef DtNhorizontalSpacing
101 #define DtNhorizontalSpacing    XmNhorizontalSpacing
102 #endif
103 /* WARNING: DtNitemCount is an unsupported resource in CDE 1.0 */
104 #ifndef DtNitemCount
105 #define DtNitemCount            XmNitemCount
106 #endif
107 /* WARNING: DtNitems is an unsupported resource in CDE 1.0 */
108 #ifndef DtNitems
109 #define DtNitems                XmNitems
110 #endif
111 /* WARNING: DtNlabelString is an unsupported resource in CDE 1.0 */
112 #ifndef DtNlabelString
113 #define DtNlabelString          XmNlabelString
114 #endif
115 /* WARNING: DtNlist is an unsupported resource in CDE 1.0 */
116 #ifndef DtNlist
117 #define DtNlist                 "list"
118 #endif
119 /* WARNING: DtNlistFontList is an unsupported resource in CDE 1.0 */
120 #ifndef DtNlistFontList
121 #define DtNlistFontList         "listFontList"
122 #endif
123 /* WARNING: DtNlistMarginHeight is an unsupported resource in CDE 1.0 */
124 #ifndef DtNlistMarginHeight
125 #define DtNlistMarginHeight     XmNlistMarginHeight
126 #endif
127 /* WARNING: DtNlistMarginWidth is an unsupported resource in CDE 1.0 */
128 #ifndef DtNlistMarginWidth
129 #define DtNlistMarginWidth      XmNlistMarginWidth
130 #endif
131 /* WARNING: DtNlistSpacing is an unsupported resource in CDE 1.0 */
132 #ifndef DtNlistSpacing
133 #define DtNlistSpacing          XmNlistSpacing
134 #endif
135 /* WARNING: DtNlosingFocusCallback is an unsupported resource in CDE 1.0 */
136 #ifndef DtNlosingFocusCallback
137 #define DtNlosingFocusCallback  XmNlosingFocusCallback
138 #endif
139 #ifndef DtNmarginHeight
140 #define DtNmarginHeight         XmNmarginHeight
141 #endif
142 #ifndef DtNmarginWidth
143 #define DtNmarginWidth          XmNmarginWidth
144 #endif
145 /* WARNING: DtNmaxLength is an unsupported resource in CDE 1.0 */
146 #ifndef DtNmaxLength
147 #define DtNmaxLength            XmNmaxLength
148 #endif
149 /* WARNING: DtNmenuPostCallback is an unsupported resource in CDE 1.0 */
150 #ifndef DtNmenuPostCallback
151 #define DtNmenuPostCallback     "menuPostCallback"
152 #endif
153 /* WARNING: DtNorientation is an unsupported resource in CDE 1.0 */
154 #ifndef DtNorientation
155 #define DtNorientation          XmNorientation
156 #endif
157 /* WARNING: DtNpoppedUp is an unsupported resource in CDE 1.0 */
158 #ifndef DtNpoppedUp
159 #define DtNpoppedUp             "poppedUp"
160 #endif
161 /* WARNING: DtNrecomputeSize is an unsupported resource in CDE 1.0 */
162 #ifndef DtNrecomputeSize
163 #define DtNrecomputeSize        XmNrecomputeSize
164 #endif
165 #ifndef DtNselectedItem
166 #define DtNselectedItem         "selectedItem"
167 #endif
168 #ifndef DtNselectedPosition
169 #define DtNselectedPosition     "selectedPosition"
170 #endif
171 #ifndef DtNselectionCallback
172 #define DtNselectionCallback    "selectionCallback"
173 #endif
174 /* WARNING: DtNtextField is an unsupported resource in CDE 1.0 */
175 #ifndef DtNtextField
176 #define DtNtextField            "textField"
177 #endif
178 /* WARNING: DtNtopItemPosition is an unsupported resource in CDE 1.0 */
179 #ifndef DtNtopItemPosition
180 #define DtNtopItemPosition      XmNtopItemPosition
181 #endif
182 /* WARNING: DtNupdateLabel is an unsupported resource in CDE 1.0 */
183 #ifndef DtNupdateLabel
184 #define DtNupdateLabel          "updateLabel"
185 #endif
186 /* WARNING: DtNverticalSpacing is an unsupported resource in CDE 1.0 */
187 #ifndef DtNverticalSpacing
188 #define DtNverticalSpacing      XmNverticalSpacing
189 #endif
190 /* WARNING: DtNvisibleItemCount is an unsupported resource in CDE 1.0 */
191 #ifndef DtNvisibleItemCount
192 #define DtNvisibleItemCount     XmNvisibleItemCount
193 #endif
194
195 #ifndef DtCAlignment
196 #define DtCAlignment            XmCAlignment
197 #endif
198 #ifndef DtCArrowSize
199 #define DtCArrowSize            "ArrowSize"
200 #endif
201 #ifndef DtCArrowSpacing
202 #define DtCArrowSpacing         "ArrowSpacing"
203 #endif
204 #ifndef DtCArrowType
205 #define DtCArrowType            "ArrowType"
206 #endif
207 #ifndef DtCCallback
208 #define DtCCallback             XmCCallback
209 #endif
210 #ifndef DtCColumns
211 #define DtCColumns              XmCColumns
212 #endif
213 #ifndef DtCComboBoxType
214 #define DtCComboBoxType         "ComboBoxType"
215 #endif
216 #ifndef DtCHorizontalSpacing
217 #define DtCHorizontalSpacing    "HorizontalSpacing"
218 #endif
219 #ifndef DtCItemCount
220 #define DtCItemCount            XmCItemCount
221 #endif
222 #ifndef DtCItems
223 #define DtCItems                XmCItems
224 #endif
225 #ifndef DtCList
226 #define DtCList                 "List"
227 #endif
228 #ifndef DtCListFontList
229 #define DtCListFontList         "ListFontList"
230 #endif
231 #ifndef DtCListMarginHeight
232 #define DtCListMarginHeight     XmCListMarginHeight
233 #endif
234 #ifndef DtCListMarginWidth
235 #define DtCListMarginWidth      XmCListMarginWidth
236 #endif
237 #ifndef DtCListSpacing
238 #define DtCListSpacing          XmCListSpacing
239 #endif
240 #ifndef DtCMarginHeight
241 #define DtCMarginHeight         XmCMarginHeight
242 #endif
243 #ifndef DtCMarginWidth
244 #define DtCMarginWidth          XmCMarginWidth
245 #endif
246 #ifndef DtCMaxLength
247 #define DtCMaxLength            XmCMaxLength
248 #endif
249 #ifndef DtCOrientation
250 #define DtCOrientation          XmCOrientation
251 #endif
252 #ifndef DtCPoppedUp
253 #define DtCPoppedUp             "PoppedUp"
254 #endif
255 #ifndef DtCRecomputeSize
256 #define DtCRecomputeSize        XmCRecomputeSize
257 #endif
258 #ifndef DtCSelectedItem
259 #define DtCSelectedItem         "SelectedItem"
260 #endif
261 #ifndef DtCSelectedPosition
262 #define DtCSelectedPosition     "SelectedPosition"
263 #endif
264 #ifndef DtCTextField
265 #define DtCTextField            "TextField"
266 #endif
267 #ifndef DtCTopItemPosition
268 #define DtCTopItemPosition      XmCTopItemPosition
269 #endif
270 #ifndef DtCUpdateLabel
271 #define DtCUpdateLabel          "UpdateLabel"
272 #endif
273 #ifndef DtCVerticalSpacing
274 #define DtCVerticalSpacing      "VerticalSpacing"
275 #endif
276 #ifndef DtCVisibleItemCount
277 #define DtCVisibleItemCount     XmCVisibleItemCount
278 #endif
279 #ifndef DtCXmString
280 #define DtCXmString             XmCXmString
281 #endif
282
283 #else /* DT_USE_XM_COMBOBOX */
284
285 #ifndef DtNarrowSize
286 #define DtNarrowSize            XmNarrowSize
287 #endif
288 #ifndef DtNarrowSpacing
289 #define DtNarrowSpacing         XmNarrowSpacing
290 #endif
291 #ifndef DtNcolumns
292 #define DtNcolumns              XmNcolumns
293 #endif
294 #ifndef DtNcomboBoxType
295 #define DtNcomboBoxType         XmNcomboBoxType
296 #endif
297 #ifndef DtNitemCount
298 #define DtNitemCount            XmNitemCount
299 #endif
300 #ifndef DtNitems
301 #define DtNitems                XmNitems
302 #endif
303 #ifndef DtNlabelString
304 #define DtNlabelString          XmNlabelString
305 #endif
306 #ifndef DtNlist
307 #define DtNlist                 XmNlist
308 #endif
309 #ifndef DtNmarginHeight
310 #define DtNmarginHeight         XmNmarginHeight
311 #endif
312 #ifndef DtNmarginWidth
313 #define DtNmarginWidth          XmNmarginWidth
314 #endif
315 #ifndef DtNselectedItem
316 #define DtNselectedItem         XmNselectedItem
317 #endif
318 #ifndef DtNselectedPosition
319 #define DtNselectedPosition     XmNselectedPosition
320 #endif
321 #ifndef DtNselectionCallback
322 #define DtNselectionCallback    XmNselectionCallback
323 #endif
324 #ifndef DtNtextField
325 #define DtNtextField            XmNtextField
326 #endif
327 #ifndef DtNvisibleItemCount
328 #define DtNvisibleItemCount     XmNvisibleItemCount
329 #endif
330
331 #ifndef DtCArrowSize
332 #define DtCArrowSize            XmCArrowSize
333 #endif
334 #ifndef DtCArrowSpacing
335 #define DtCArrowSpacing         XmCArrowSpacing
336 #endif
337 #ifndef DtCCallback
338 #define DtCCallback             XmCCallback
339 #endif
340 #ifndef DtCColumns
341 #define DtCColumns              XmCColumns
342 #endif
343 #ifndef DtCComboBoxType
344 #define DtCComboBoxType         XmCComboBoxType
345 #endif
346 #ifndef DtCItemCount
347 #define DtCItemCount            XmCItemCount
348 #endif
349 #ifndef DtCItems
350 #define DtCItems                XmCItems
351 #endif
352 #ifndef DtCList
353 #define DtCList                 XmCList
354 #endif
355 #ifndef DtCMarginHeight
356 #define DtCMarginHeight         XmCMarginHeight
357 #endif
358 #ifndef DtCMarginWidth
359 #define DtCMarginWidth          XmCMarginWidth
360 #endif
361 #ifndef DtCSelectedItem
362 #define DtCSelectedItem         XmCSelectedItem
363 #endif
364 #ifndef DtCSelectedPosition
365 #define DtCSelectedPosition     XmCSelectedPosition
366 #endif
367 #ifndef DtCTextField
368 #define DtCTextField            XmCTextField
369 #endif
370 #ifndef DtCVisibleItemCount
371 #define DtCVisibleItemCount     XmCVisibleItemCount
372 #endif
373 #ifndef DtCXmString
374 #define DtCXmString             XmCXmString
375 #endif
376
377 #endif /* DT_USE_XM_COMBOBOX */
378
379 /* Representation types */
380
381 #ifndef DT_USE_XM_COMBOBOX
382
383 #ifndef DtRArrowType
384 #define DtRArrowType            "ArrowType"
385 #endif
386 #ifndef DtRComboBoxType
387 #define DtRComboBoxType         "ComboBoxType"
388 #endif
389
390 #else /* DT_USE_XM_COMBOBOX */
391
392 #ifndef DtRComboBoxType
393 #define DtRComboBoxType         XmRComboBoxType
394 #endif
395
396 #endif /* DT_USE_XM_COMBOBOX */
397
398 /* DtNorientation values */
399
400 #ifndef DT_USE_XM_COMBOBOX
401
402 #ifndef DtLEFT
403 #define DtLEFT          1
404 #endif
405 #ifndef DtRIGHT
406 #define DtRIGHT         2
407 #endif
408
409 #endif /* not DT_USE_XM_COMBOBOX */
410
411 /* DtNarrowType values */
412
413 #ifndef DT_USE_XM_COMBOBOX
414
415 #ifndef DtMOTIF
416 #define DtMOTIF         0
417 #endif
418 #ifndef DtWINDOWS
419 #define DtWINDOWS       1
420 #endif
421
422 #endif /* not DT_USE_XM_COMBOBOX */
423
424 /* DtNcomboBoxType values */
425
426 #ifndef DT_USE_XM_COMBOBOX
427
428 #ifndef DtDROP_DOWN_LIST
429 #define DtDROP_DOWN_LIST        2
430 #endif
431 #ifndef DtDROP_DOWN_COMBO_BOX
432 #define DtDROP_DOWN_COMBO_BOX   1
433 #endif
434
435 #else /* DT_USE_XM_COMBOBOX */
436
437 #ifndef DtDROP_DOWN_LIST
438 #define DtDROP_DOWN_LIST        XmDROP_DOWN_LIST
439 #endif
440 #ifndef DtDROP_DOWN_COMBO_BOX
441 #define DtDROP_DOWN_COMBO_BOX   XmDROP_DOWN_COMBO_BOX
442 #endif
443
444 #endif /* DT_USE_XM_COMBOBOX */
445
446 /* DtNalignment values */
447
448 #ifndef DT_USE_XM_COMBOBOX
449
450 #ifndef DtALIGNMENT_BEGINNING
451 #define DtALIGNMENT_BEGINNING   XmALIGNMENT_BEGINNING
452 #endif
453 #ifndef DtALIGNMENT_CENTER
454 #define DtALIGNMENT_CENTER      XmALIGNMENT_CENTER
455 #endif
456 #ifndef DtALIGNMENT_END
457 #define DtALIGNMENT_END         XmALIGNMENT_END
458 #endif
459
460 #endif /* not DT_USE_XM_COMBOBOX */
461
462 /* Callback reasons */
463
464 #ifndef DT_USE_XM_COMBOBOX
465
466 #ifndef DtCR_SELECT
467 #define DtCR_SELECT         57 /* Large #, so no collisions with XM */
468 #endif
469 #ifndef DtCR_MENU_POST
470 #define DtCR_MENU_POST      129 /* Large #, so no collisions with XM */
471 #endif
472
473 #endif /* not DT_USE_XM_COMBOBOX */
474
475
476 /*
477  * Types
478  */
479
480 #ifndef DT_USE_XM_COMBOBOX
481
482 typedef struct {
483         int             reason;
484         XEvent          *event;
485         XmString        item_or_text;
486         int             item_position;
487 } DtComboBoxCallbackStruct;
488
489
490 /* Widget class and instance */
491
492 typedef struct _DtComboBoxClassRec *DtComboBoxWidgetClass;
493 typedef struct _DtComboBoxRec      *DtComboBoxWidget;
494
495 #else /* DT_USE_XM_COMBOBOX */
496
497 #define DtComboBoxCallbackStruct        XmComboBoxCallbackStruct
498 #define DtComboBoxWidgetClass           XmComboBoxWidgetClass
499 #define DtComboBoxWidget                XmComboBoxWidget
500
501 #endif /* DT_USE_XM_COMBOBOX */
502
503
504 /*
505  * Data
506  */
507
508 #ifndef DT_USE_XM_COMBOBOX
509
510 /* Widget class record */
511
512 externalref WidgetClass dtComboBoxWidgetClass;
513
514 #else /* DT_USE_XM_COMBOBOX */
515
516 #define dtComboBoxWidgetClass xmComboBoxWidgetClass;
517
518 #endif /* DT_USE_XM_COMBOBOX */
519
520
521 /*
522  * Functions
523  */
524
525 #ifndef DT_USE_XM_COMBOBOX
526
527 extern Widget DtCreateComboBox(
528                 Widget          parent,
529                 char            *name,
530                 ArgList         arglist,
531                 Cardinal        argcount);
532
533 extern void DtComboBoxAddItem(
534                 Widget          combo,
535                 XmString        item,
536                 int             pos,
537                 Boolean         unique);
538
539 extern void DtComboBoxDeletePos(
540                 Widget          combo,
541                 int             pos);
542
543 extern void DtComboBoxSetItem(
544                 Widget          combo,
545                 XmString        item);
546
547 extern void DtComboBoxSelectItem(
548                 Widget          combo,
549                 XmString        item);
550
551 #else /* DT_USE_XM_COMBOBOX */
552
553 #define DtCreateComboBox        XmCreateComboBox
554 #define DtComboBoxAddItem       XmComboBoxAddItem
555 #define DtComboBoxDeletePos     XmComboBoxDeletePos
556 #define DtComboBoxSetItem       XmComboBoxSetItem
557 #define DtComboBoxSelectItem    XmComboBoxSelectItem
558
559 #endif /* DT_USE_XM_COMBOBOX */
560
561 #ifdef __cplusplus
562 }
563 #endif
564
565 #endif  /* _Dt_ComboBox_h */