dtcalc: change from obsoleted MAXFLOAT to FLT_MAX from std C
[oweals/cde.git] / cde / lib / DtWidget / SpinBox.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: SpinBox.h /main/4 1995/10/26 09:34:23 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_SpinBox_h
47 #define _Dt_SpinBox_h
48
49 #include <Xm/Xm.h>
50 #if defined(DT_USE_XM_SSPINBOX)
51 #include <Xm/SSpinB.h>
52 #endif
53
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57
58
59 /*
60  * Constants
61  */
62
63 /* Resources */
64
65 #ifndef DtNarrowLayout
66 #  if defined(DT_USE_XM_SSPINBOX)
67 #  define DtNarrowLayout                XmNarrowLayout
68 #  else
69 #  define DtNarrowLayout                "arrowLayout"
70 #  endif
71 #endif
72 #ifndef DtNarrowSensitivity
73 #  if defined(DT_USE_XM_SSPINBOX)
74 #  define DtNarrowSensitivity           XmNarrowSensitivity
75 #  else
76 #  define DtNarrowSensitivity           "arrowSensitivity"
77 #  endif
78 #endif
79 #ifndef DtNarrowSize
80 #  if defined(DT_USE_XM_SSPINBOX)
81 #  define DtNarrowSize                  XmNarrowSize
82 #  else
83 #  define DtNarrowSize                  "arrowSize"
84 #  endif
85 #endif
86 #ifndef DtNspinBoxChildType
87 #  if defined(DT_USE_XM_SSPINBOX)
88 #  define DtNspinBoxChildType           XmNspinBoxChildType
89 #  else
90 #  define DtNspinBoxChildType           "spinBoxChildType"
91 #  endif
92 #endif
93 #ifndef DtNposition
94 #  if defined(DT_USE_XM_SSPINBOX)
95 #  define DtNposition                   XmNposition
96 #  else
97 #  define DtNposition                   "position"
98 #  endif
99 #endif
100 #ifndef DtNtextField
101 #  if defined(DT_USE_XM_SSPINBOX)
102 #  define DtNtextField                  XmNtextField
103 #  else
104 #  define DtNtextField                  "textField"
105 #  endif
106 #endif
107 #ifndef DtNwrap
108 #  if defined(DT_USE_XM_SSPINBOX)
109 #  define DtNwrap                       "wrap"
110 #  else
111 #  define DtNwrap                       "wrap"
112 #  endif
113 #endif
114 #ifndef DtNincrementValue
115 #  if defined(DT_USE_XM_SSPINBOX)
116 #  define DtNincrementValue             XmNincrementValue
117 #  else
118 #  define DtNincrementValue             "incrementValue"
119 #  endif
120 #endif
121 #ifndef DtNmaximumValue
122 #  if defined(DT_USE_XM_SSPINBOX)
123 #  define DtNmaximumValue               XmNmaximumValue
124 #  else
125 #  define DtNmaximumValue               "maximumValue"
126 #  endif
127 #endif
128 #ifndef DtNminimumValue
129 #  if defined(DT_USE_XM_SSPINBOX)
130 #  define DtNminimumValue               XmNminimumValue
131 #  else
132 #  define DtNminimumValue               "minimumValue"
133 #  endif
134 #endif
135 #ifndef DtNnumValues
136 #  if defined(DT_USE_XM_SSPINBOX)
137 #  define DtNnumValues                  XmNnumValues
138 #  else
139 #  define DtNnumValues                  "numValues"
140 #  endif
141 #endif
142 #ifndef DtNvalues
143 #  if defined(DT_USE_XM_SSPINBOX)
144 #  define DtNvalues                     XmNvalues
145 #  else
146 #  define DtNvalues                     "values"
147 #  endif
148 #endif
149
150 #ifndef DtNactivateCallback
151 #define DtNactivateCallback     XmNactivateCallback
152 #endif
153 #ifndef DtNalignment
154 #define DtNalignment            XmNalignment
155 #endif
156 #ifndef DtNcolumns
157 #define DtNcolumns              XmNcolumns
158 #endif
159 #ifndef DtNdecimalPoints
160 #define DtNdecimalPoints        XmNdecimalPoints
161 #endif
162 #ifndef DtNeditable
163 #define DtNeditable             XmNeditable
164 #endif
165 #ifndef DtNfocusCallback
166 #define DtNfocusCallback        XmNfocusCallback
167 #endif
168 #ifndef DtNinitialDelay
169 #define DtNinitialDelay         XmNinitialDelay
170 #endif
171 #ifndef DtNlosingFocusCallback
172 #define DtNlosingFocusCallback  XmNlosingFocusCallback
173 #endif
174 #ifndef DtNmarginHeight
175 #define DtNmarginHeight         XmNmarginHeight
176 #endif
177 #ifndef DtNmarginWidth
178 #define DtNmarginWidth          XmNmarginWidth
179 #endif
180 #ifndef DtNmaxLength
181 #define DtNmaxLength            XmNmaxLength
182 #endif
183 #ifndef DtNmodifyVerifyCallback
184 #define DtNmodifyVerifyCallback XmNmodifyVerifyCallback
185 #endif
186 #ifndef DtNrecomputeSize
187 #define DtNrecomputeSize        XmNrecomputeSize
188 #endif
189 #ifndef DtNrepeatDelay
190 #define DtNrepeatDelay          XmNrepeatDelay
191 #endif
192 #ifndef DtNvalueChangedCallback
193 #define DtNvalueChangedCallback XmNvalueChangedCallback
194 #endif
195
196 #ifndef DtCArrowLayout
197 #  if defined(DT_USE_XM_SSPINBOX)
198 #  define DtCArrowLayout                XmCArrowLayout
199 #  else
200 #  define DtCArrowLayout                "ArrowLayout"
201 #  endif
202 #endif
203 #ifndef DtCArrowSensitivity
204 #  if defined(DT_USE_XM_SSPINBOX)
205 #  define DtCArrowSensitivity           XmCArrowSensitivity
206 #  else
207 #  define DtCArrowSensitivity           "ArrowSensitivity"
208 #  endif
209 #endif
210 #ifndef DtCArrowSize
211 #  if defined(DT_USE_XM_SSPINBOX)
212 #  define DtCArrowSize                  XmCArrowSize
213 #  else
214 #  define DtCArrowSize                  "ArrowSize"
215 #  endif
216 #endif
217 #ifndef DtCSpinBoxChildType
218 #  if defined(DT_USE_XM_SSPINBOX)
219 #  define DtCSpinBoxChildType           XmCSpinBoxChildType
220 #  else
221 #  define DtCSpinBoxChildType           "SpinBoxChildType"
222 #  endif
223 #endif
224 #ifndef DtCPosition
225 #  if defined(DT_USE_XM_SSPINBOX)
226 #  define DtCPosition                   XmCPosition
227 #  else
228 #  define DtCPosition                   "Position"
229 #  endif
230 #endif
231 #ifndef DtCTextField
232 #  if defined(DT_USE_XM_SSPINBOX)
233 #  define DtCTextField                  XmCTextField
234 #  else
235 #  define DtCTextField                  "TextField"
236 #  endif
237 #endif
238 #ifndef DtCWrap
239 #  define DtCWrap                       "Wrap"
240 #endif
241 #ifndef DtCIncrementValue
242 #  if defined(DT_USE_XM_SSPINBOX)
243 #  define DtCIncrementValue             XmCIncrementValue
244 #  else
245 #  define DtCIncrementValue             "incrementValue"
246 #  endif
247 #endif
248 #ifndef DtCMaximumValue
249 #  if defined(DT_USE_XM_SSPINBOX)
250 #  define DtCMaximumValue               XmCMaximumValue
251 #  else
252 #  define DtCMaximumValue               "maximumValue"
253 #  endif
254 #endif
255 #ifndef DtCMinimumValue
256 #  if defined(DT_USE_XM_SSPINBOX)
257 #  define DtCMinimumValue               XmCMinimumValue
258 #  else
259 #  define DtCMinimumValue               "minimumValue"
260 #  endif
261 #endif
262 #ifndef DtCNumValues
263 #  if defined(DT_USE_XM_SSPINBOX)
264 #  define DtCNumValues                  XmCNumValues
265 #  else
266 #  define DtCNumValues                  "numValues"
267 #  endif
268 #endif
269 #ifndef DtCValues
270 #  if defined(DT_USE_XM_SSPINBOX)
271 #  define DtCValues                     XmCValues
272 #  else
273 #  define DtCValues                     "values"
274 #  endif
275 #endif
276
277 #ifndef DtCAlignment
278 #define DtCAlignment            XmCAlignment
279 #endif
280 #ifndef DtCCallback
281 #define DtCCallback             XmCCallback
282 #endif
283 #ifndef DtCColumns
284 #define DtCColumns              XmCColumns
285 #endif
286 #ifndef DtCDecimalPoints
287 #define DtCDecimalPoints        XmCDecimalPoints
288 #endif
289 #ifndef DtCEditable
290 #define DtCEditable             XmCEditable
291 #endif
292 #ifndef DtCInitialDelay
293 #define DtCInitialDelay         XmCInitialDelay
294 #endif
295 #ifndef DtCItems
296 #define DtCItems                XmCItems
297 #endif
298 #ifndef DtCMarginHeight
299 #define DtCMarginHeight         XmCMarginHeight
300 #endif
301 #ifndef DtCMarginWidth
302 #define DtCMarginWidth          XmCMarginWidth
303 #endif
304 #ifndef DtCMaxLength
305 #define DtCMaxLength            XmCMaxLength
306 #endif
307 #ifndef DtCPosition
308 #define DtCPosition             XmCPosition
309 #endif
310 #ifndef DtCRecomputeSize
311 #define DtCRecomputeSize        XmCRecomputeSize
312 #endif
313 #ifndef DtCRepeatDelay
314 #define DtCRepeatDelay          XmCRepeatDelay
315 #endif
316
317 /* Representation types */
318
319 #ifndef DtRIncrementValue
320 #  if defined(DT_USE_XM_SSPINBOX)
321 #  define DtRIncrementValue             XmRint
322 #  else
323 #  define DtRIncrementValue             "IncrementValue"
324 #  endif
325 #endif
326 #ifndef DtRMaximumValue
327 #  if defined(DT_USE_XM_SSPINBOX)
328 #  define DtRMaximumValue               XmRint
329 #  else
330 #  define DtRMaximumValue               "MaximumValue"
331 #  endif
332 #endif
333 #ifndef DtRMinimumValue
334 #  if defined(DT_USE_XM_SSPINBOX)
335 #  define DtRMinimumValue               XmRint
336 #  else
337 #  define DtRMinimumValue               "MinimumValue"
338 #  endif
339 #endif
340 #ifndef DtRNumValues
341 #  if defined(DT_USE_XM_SSPINBOX)
342 #  define DtRNumValues                  XmRint
343 #  else
344 #  define DtRNumValues                  "NumValues"
345 #  endif
346 #endif
347 #ifndef DtRValues
348 #  if defined(DT_USE_XM_SSPINBOX)
349 #  define DtRValues                     XmRXmStringTable
350 #  else
351 #  define DtRValues                     "Values"
352 #  endif
353 #endif
354 #ifndef DtRArrowSensitivity
355 #  if defined(DT_USE_XM_SSPINBOX)
356 #  define DtRArrowSensitivity           XmRArrowSensitivity
357 #  else
358 #  define DtRArrowSensitivity           "ArrowSensitivity"
359 #  endif
360 #endif
361 #ifndef DtRArrowLayout
362 #  if defined(DT_USE_XM_SSPINBOX)
363 #  define DtRArrowLayout                XmRArrowLayout
364 #  else
365 #  define DtRArrowLayout                "ArrowLayout"
366 #  endif
367 #endif
368 #ifndef DtRSpinBoxChildType
369 #  if defined(DT_USE_XM_SSPINBOX)
370 #  define DtRSpinBoxChildType           XmRSpinBoxChildType
371 #  else
372 #  define DtRSpinBoxChildType           "SpinBoxChildType"
373 #  endif
374 #endif
375
376 /* DtNarrowLayout values */
377
378 #ifndef DtARROWS_FLAT_BEGINNING
379 #  if defined(DT_USE_XM_SSPINBOX)
380 #  define DtARROWS_FLAT_BEGINNING       XmARROWS_FLAT_BEGINNING
381 #  else
382 #  define DtARROWS_FLAT_BEGINNING       4
383 #  endif
384 #endif
385 #ifndef DtARROWS_FLAT_END
386 #  if defined(DT_USE_XM_SSPINBOX)
387 #  define DtARROWS_FLAT_END             XmARROWS_FLAT_END
388 #  else
389 #  define DtARROWS_FLAT_END             3
390 #  endif
391 #endif
392 #ifndef DtARROWS_SPLIT
393 #  if defined(DT_USE_XM_SSPINBOX)
394 #  define DtARROWS_SPLIT                XmARROWS_SPLIT
395 #  else
396 #  define DtARROWS_SPLIT                2
397 #  endif
398 #endif
399 #ifndef DtARROWS_BEGINNING
400 #  if defined(DT_USE_XM_SSPINBOX)
401 #  define DtARROWS_BEGINNING            XmARROWS_BEGINNING
402 #  else
403 #  define DtARROWS_BEGINNING            1
404 #  endif
405 #endif
406 #ifndef DtARROWS_END
407 #  if defined(DT_USE_XM_SSPINBOX)
408 #  define DtARROWS_END                  XmARROWS_END
409 #  else
410 #  define DtARROWS_END                  0
411 #  endif
412 #endif
413
414 /* DtNarrowSensitivity values */
415
416 #ifndef DtARROWS_SENSITIVE
417 #  if defined(DT_USE_XM_SSPINBOX)
418 #  define DtARROWS_SENSITIVE            XmARROWS_SENSITIVE
419 #  else
420 #  define DtARROWS_SENSITIVE            3
421 #  endif
422 #endif
423 #ifndef DtARROWS_DECREMENT_SENSITIVE
424 #  if defined(DT_USE_XM_SSPINBOX)
425 #  define DtARROWS_DECREMENT_SENSITIVE  XmARROWS_DECREMENT_SENSITIVE
426 #  else
427 #  define DtARROWS_DECREMENT_SENSITIVE  2
428 #  endif
429 #endif
430 #ifndef DtARROWS_INCREMENT_SENSITIVE
431 #  if defined(DT_USE_XM_SSPINBOX)
432 #  define DtARROWS_INCREMENT_SENSITIVE  XmARROWS_INCREMENT_SENSITIVE
433 #  else
434 #  define DtARROWS_INCREMENT_SENSITIVE  1
435 #  endif
436 #endif
437 #ifndef DtARROWS_INSENSITIVE
438 #  if defined(DT_USE_XM_SSPINBOX)
439 #  define DtARROWS_INSENSITIVE          XmARROWS_INSENSITIVE
440 #  else
441 #  define DtARROWS_INSENSITIVE          0
442 #  endif
443 #endif
444
445 /* DtNspinBoxChildType values */
446
447 #ifndef DtNUMERIC
448 #  if defined(DT_USE_XM_SSPINBOX)
449 #  define DtNUMERIC                     XmNUMERIC
450 #  else
451 #  define DtNUMERIC                     3
452 #  endif
453 #endif
454
455 #ifndef DtSTRING
456 #  define DtSTRING                      XmSTRING
457 #endif
458
459 /* DtNalignment values */
460
461 #ifndef DtALIGNMENT_BEGINNING
462 #define DtALIGNMENT_BEGINNING           XmALIGNMENT_BEGINNING
463 #endif
464 #ifndef DtALIGNMENT_CENTER
465 #define DtALIGNMENT_CENTER              XmALIGNMENT_CENTER
466 #endif
467 #ifndef DtALIGNMENT_END
468 #define DtALIGNMENT_END                 XmALIGNMENT_END
469 #endif
470
471 /* Callback reasons */
472
473 #ifndef DtCR_OK
474 #  define DtCR_OK                       XmCR_OK
475 #endif
476 #ifndef DtCR_SPIN_NEXT
477 #  if defined(DT_USE_XM_SSPINBOX)
478 #  define DtCR_SPIN_NEXT                XmCR_SPIN_NEXT
479 #  else
480 #  define DtCR_SPIN_NEXT                62
481 #  endif
482 #endif
483 #ifndef DtCR_SPIN_PRIOR
484 #  if defined(DT_USE_XM_SSPINBOX)
485 #  define DtCR_SPIN_PRIOR               XmCR_SPIN_PRIOR
486 #  else
487 #  define DtCR_SPIN_PRIOR               63
488 #  endif
489 #endif
490
491
492 /*
493  * Types
494  */
495 #if defined(DT_USE_XM_SSPINBOX)
496 #  define DtSpinBoxCallbackStruct       XmSpinBoxCallbackStruct
497 #else
498 typedef struct {
499         int             reason;
500         XEvent          *event;
501         Widget          widget;
502         Boolean         doit;
503         int             position;
504         XmString        value;
505         Boolean         crossed_boundary;
506 } DtSpinBoxCallbackStruct;
507 #endif
508
509 /* Widget class and instance */
510 #if defined(DT_USE_XM_SSPINBOX)
511 #  define _DtSpinBoxClassRec            _XmSimpleSpinBoxClassRec
512 #  define _DtSpinBoxRec                 _XmSimpleSpinBoxRec
513 #  define DtSpinBoxWidgetClass          XmSimpleSpinBoxWidgetClass
514 #  define DtSpinBoxWidget               XmSimpleSpinBoxWidget
515 #else
516 typedef struct _DtSpinBoxClassRec *DtSpinBoxWidgetClass;
517 typedef struct _DtSpinBoxRec      *DtSpinBoxWidget;
518 #endif
519
520 /*
521  * Data
522  */
523
524 /* Widget class record */
525 #if defined(DT_USE_XM_SSPINBOX)
526 #  define dtSpinBoxWidgetClass          xmSimpleSpinBoxWidgetClass
527 #else
528 externalref WidgetClass dtSpinBoxWidgetClass;
529 #endif
530
531
532 /*
533  * Functions
534  */
535
536 #if defined(DT_USE_XM_SSPINBOX)
537 #  define DtCreateSpinBox               XmCreateSimpleSpinBox
538 #  define DtSpinBoxAddItem              XmSimpleSpinBoxAddItem
539 #  define DtSpinBoxDeletePos            XmSimpleSpinBoxDeletePos
540 #  define DtSpinBoxSetItem              XmSimpleSpinBoxSetItem
541 #else
542 extern Widget DtCreateSpinBox(
543                 Widget          parent,
544                 char            *name,
545                 ArgList         arglist,
546                 Cardinal        argcount);
547
548 extern void DtSpinBoxAddItem(
549                 Widget          widget,
550                 XmString        item,
551                 int             pos);
552
553 extern void DtSpinBoxDeletePos(
554                 Widget          widget,
555                 int             pos);
556
557 extern void DtSpinBoxSetItem(
558                 Widget          widget,
559                 XmString        item);
560 #endif
561
562 #ifdef __cplusplus
563 }
564 #endif
565
566 #endif  /* _Dt_SpinBox_h */