Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / lib / DtWidget / SpinBoxP.h
1 /* $XConsortium: SpinBoxP.h /main/4 1996/03/26 19:54:14 drk $ */
2 /*
3  * SpinBoxP.h, Interleaf, 16aug93 2:37pm Version 1.1.
4  */
5
6 /***********************************************************
7 Copyright 1993 Interleaf, Inc.
8
9 Permission to use, copy, modify, and distribute this software
10 and its documentation for any purpose without fee is granted,
11 provided that the above copyright notice appear in all copies
12 and that both copyright notice and this permission notice appear
13 in supporting documentation, and that the name of Interleaf not
14 be used in advertising or publicly pertaining to distribution of
15 the software without specific written prior permission.
16
17 Interleaf makes no representation about the suitability of this
18 software for any purpose. It is provided "AS IS" without any
19 express or implied warranty. 
20 ******************************************************************/
21
22 /*
23  * (C) Copyright 1991,1992, 1993
24  * Interleaf, Inc.
25  * 9 Hillside Avenue, Waltham, MA  02154
26  *
27  * SpinBoxP.h:
28  *
29  * Private header file for DtSpinBoxWidget.
30  */
31 #ifndef _SpinBoxP_h
32 #define _SpinBoxP_h
33
34 #include <Xm/Label.h>
35 #include <Xm/TextFP.h>
36 #include <Xm/ArrowB.h>
37 #include <Xm/ManagerP.h>
38 #include "SpinBox.h"
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 /*
45  * External definitions of syn_resources for our list widget.
46  */
47 #define SYN_RESOURCE_AA (Widget w, int resource_offset, XtArgVal *value)
48 extern void _DtSpinBoxGetArrowSize      SYN_RESOURCE_AA;
49
50 #define ARROW_MULT          .45
51 #define ARROW_MIN           13
52 #define MAX_FLOAT_DECIMALS  6
53 #define NUMERIC_LENGTH      128
54 #define MARGIN              2
55 #define LABEL_PADDING       2
56 #define LABEL_SHADOW        2
57 #define TEXT_FIELD_SHADOW   1
58 #define TEXT_CONTEXT_MARGIN 4
59
60 /****************************************************************
61  *
62  *      Message Defines
63  *
64  ****************************************************************/
65
66 #define SB_ARROW_SENSITIVE      DTWIDGET_GETMESSAGE( \
67                           MS_SpinBox, SPIN_ARROW_SENSITIVE, _DtMsgSpinBox_0000)
68
69 #define SB_ALIGNMENT    DTWIDGET_GETMESSAGE( \
70                           MS_SpinBox, SPIN_ALIGNMENT, _DtMsgSpinBox_0001)
71
72 #define SB_INIT_DELAY   DTWIDGET_GETMESSAGE( \
73                           MS_SpinBox, SPIN_INIT_DELAY, _DtMsgSpinBox_0002)
74
75 #define SB_MARGIN_HEIGHT        DTWIDGET_GETMESSAGE( \
76                           MS_SpinBox, SPIN_MARGIN_HEIGHT, _DtMsgSpinBox_0003)
77
78 #define SB_MARGIN_WIDTH DTWIDGET_GETMESSAGE( \
79                           MS_SpinBox, SPIN_MARGIN_WIDTH, _DtMsgSpinBox_0004)
80
81 #define SB_ARROW_LAYOUT DTWIDGET_GETMESSAGE( \
82                           MS_SpinBox, SPIN_ARROW_LAYOUT, _DtMsgSpinBox_0005)
83
84 #define SB_REPEAT_DELAY DTWIDGET_GETMESSAGE( \
85                           MS_SpinBox, SPIN_REPEAT_DELAY, _DtMsgSpinBox_0006)
86
87 #define SB_ITEM_COUNT   DTWIDGET_GETMESSAGE( \
88                           MS_SpinBox, SPIN_ITEM_COUNT, _DtMsgSpinBox_0007)
89
90 #define SB_POSITION_STRING      DTWIDGET_GETMESSAGE( \
91                           MS_SpinBox, SPIN_POSITION_STRING, _DtMsgSpinBox_0008)
92
93 #define SB_POSITION_NUMERIC     DTWIDGET_GETMESSAGE( \
94                           MS_SpinBox, SPIN_POSITION_NUMERIC, _DtMsgSpinBox_0009)
95
96 #define SB_DECIMAL_POINTS       DTWIDGET_GETMESSAGE( \
97                           MS_SpinBox, SPIN_DECIMAL_POINTS, _DtMsgSpinBox_0010)
98
99 #define SB_MIN_MAX      DTWIDGET_GETMESSAGE( \
100                           MS_SpinBox, SPIN_MIN_MAX, _DtMsgSpinBox_0011)
101
102 #define SB_TEXT DTWIDGET_GETMESSAGE( \
103                           MS_SpinBox, SPIN_TEXT, _DtMsgSpinBox_0012)
104
105 #define SB_SET_ITEM     DTWIDGET_GETMESSAGE( \
106                           MS_SpinBox, SPIN_SET_ITEM, _DtMsgSpinBox_0013)
107
108 #define SB_LABEL        DTWIDGET_GETMESSAGE( \
109                           MS_SpinBox, SPIN_LABEL, _DtMsgSpinBox_0014)
110 /* 
111  * Class Records
112  */
113 typedef struct {
114     Boolean junk;
115 } DtSpinBoxClassPart;
116
117 typedef struct _DtSpinBoxClassRec {
118     CoreClassPart               core_class;
119     CompositeClassPart          composite_class;
120     ConstraintClassPart         constraint_class;
121     XmManagerClassPart          manager_class;
122     DtSpinBoxClassPart          spin_box_class;
123 } DtSpinBoxClassRec;
124
125 extern DtSpinBoxClassRec dtSpinBoxClassRec;
126
127
128 /*
129  * Instance Record.
130  */
131 typedef struct _DtSpinBoxPart {
132     /* Private data */
133     Widget label;
134     Widget up_arrow;
135     Widget down_arrow;
136     unsigned char which_arrow;
137     Boolean init_cb;
138     Boolean grabbed;
139     int base;
140     float min, max;
141     float increment, current;
142     char float_format[10];
143     Dimension old_width;
144     Dimension old_height;
145     Dimension label_max_length;
146     Dimension label_max_height;
147
148     /* Resource-related data */
149     unsigned char arrow_sensitivity;
150     short decimal_points;
151     int numeric_increment;
152     int maximum;
153     int minimum;
154     int item_count;
155     int position;
156     unsigned char child_type;
157     XmStringTable items;
158     XtCallbackList activate_callback;
159     unsigned char alignment;
160     unsigned char arrow_layout;
161     Dimension arrow_size;
162     short text_columns;
163     Boolean editable;
164     XtCallbackList focus_callback;
165     unsigned int initial_delay;
166     XtCallbackList losing_focus_callback;
167     Dimension margin_height;
168     Dimension margin_width;
169     int text_max_length;
170     XtCallbackList modify_verify_callback;
171     Boolean recompute_size;
172     unsigned int repeat_delay;
173     Widget text;
174     XtCallbackList value_changed_callback;
175     Boolean wrap;
176
177     /* Spin timer. */
178     XtIntervalId timer;
179
180     /* String list related resources */
181
182     /* Numeric related resources */
183
184     /* TextField resources */
185 } DtSpinBoxPart;
186
187
188 /* Full instance record declaration */
189 typedef struct _DtSpinBoxRec {
190     CorePart            core;
191     CompositePart       composite;
192     ConstraintPart      constraint;
193     XmManagerPart       manager;
194     DtSpinBoxPart       spin_box;
195 } DtSpinBoxRec;
196
197 #ifdef __cplusplus
198 }  /* Close scope of 'extern "C"' declaration which encloses file. */
199 #endif
200
201 #endif /* _SpinBoxP_h */