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