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