dtcalc: change from obsoleted MAXFLOAT to FLT_MAX from std C
[oweals/cde.git] / cde / lib / DtWidget / ComboBoxP.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: ComboBoxP.h /main/3 1995/10/26 09:29:58 rswiston $ */
24 /*
25  * DtWidget/ComboBoxP.h
26  */
27 /*
28  *  (c) Copyright 1993, 1994 Hewlett-Packard Company
29  *  (c) Copyright 1993, 1994 International Business Machines Corp.
30  *  (c) Copyright 1993, 1994 Novell, Inc.
31  *  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
32  */
33 /***********************************************************
34 Copyright 1993 Interleaf, Inc.
35
36 Permission to use, copy, modify, and distribute this software
37 and its documentation for any purpose without fee is granted,
38 provided that the above copyright notice appear in all copies
39 and that both copyright notice and this permission notice appear
40 in supporting documentation, and that the name of Interleaf not
41 be used in advertising or publicly pertaining to distribution of
42 the software without specific written prior permission.
43
44 Interleaf makes no representation about the suitability of this
45 software for any purpose. It is provided "AS IS" without any
46 express or implied warranty. 
47 ******************************************************************/
48
49 /*
50  * (C) Copyright 1991,1992, 1993
51  * Interleaf, Inc.
52  * Nine Hillside Avenue, Waltham, MA  02154
53  *
54  * ComboBoxP.h:
55  * 
56  * Private header file for DtComboBoxWidget.
57  */
58 #ifndef _ComboBoxP_h
59 #define _ComboBoxP_h
60
61 #include <X11/IntrinsicP.h>
62 #include <X11/ShellP.h>
63 #include <Xm/DrawnB.h>
64 #include <Xm/ArrowB.h>
65 #include <Xm/TextFP.h>
66 #include <Xm/Label.h>
67 #include <Xm/Frame.h>
68 #include <Xm/ListP.h>
69 #include <Xm/Separator.h>
70 #include <Xm/ScrolledWP.h>
71 #include <Xm/ScrollBarP.h>
72
73 #include <Xm/ManagerP.h>
74 #include "ComboBox.h"
75
76 #ifdef __cplusplus
77 extern "C" {
78 #endif
79
80 /*
81  * External definitions of syn_resources for our list widget.
82  */
83 #define SYN_RESOURCE_AA (Widget w, int resource_offset, XtArgVal *value)
84 extern void _DtComboBoxGetArrowSize             SYN_RESOURCE_AA;
85 extern void _DtComboBoxGetLabelString           SYN_RESOURCE_AA;
86 extern void _DtComboBoxGetListItemCount         SYN_RESOURCE_AA;
87 extern void _DtComboBoxGetListItems             SYN_RESOURCE_AA;
88 extern void _DtComboBoxGetListFontList          SYN_RESOURCE_AA;
89 extern void _DtComboBoxGetListMarginHeight      SYN_RESOURCE_AA;
90 extern void _DtComboBoxGetListMarginWidth       SYN_RESOURCE_AA;
91 extern void _DtComboBoxGetListSpacing           SYN_RESOURCE_AA;
92 extern void _DtComboBoxGetListTopItemPosition   SYN_RESOURCE_AA;
93 extern void _DtComboBoxGetListVisibleItemCount  SYN_RESOURCE_AA;
94
95 #define ARROW_MULT          .45
96 #define ARROW_MIN           13
97 #define MARGIN              2
98 #define LABEL_PADDING       2
99 #define LABEL_SHADOW        2
100 #define TEXT_FIELD_SHADOW   1
101 #define TEXT_CONTEXT_MARGIN 4
102
103 /****************************************************************
104  *
105  *      Message Defines
106  *
107  ****************************************************************/
108
109 #define CB_ALIGNMENT    DTWIDGET_GETMESSAGE( \
110                           MS_ComboBox, COMBO_ALIGNMENT, _DtMsgComboBox_0000)
111
112 #define CB_MARGIN_HEIGHT        DTWIDGET_GETMESSAGE( \
113                           MS_ComboBox, COMBO_MARGIN_HEIGHT, _DtMsgComboBox_0001)
114
115 #define CB_MARGIN_WIDTH DTWIDGET_GETMESSAGE( \
116                           MS_ComboBox, COMBO_MARGIN_WIDTH, _DtMsgComboBox_0002)
117
118 #define CB_HORIZONTAL_SPACING   DTWIDGET_GETMESSAGE( \
119                           MS_ComboBox, COMBO_HORIZONTAL_SPACING, _DtMsgComboBox_0003)
120
121 #define CB_VERTICAL_SPACING     DTWIDGET_GETMESSAGE( \
122                           MS_ComboBox, COMBO_VERTICAL_SPACING, _DtMsgComboBox_0004)
123
124 #define CB_ORIENTATION  DTWIDGET_GETMESSAGE( \
125                           MS_ComboBox, COMBO_ORIENTATION, _DtMsgComboBox_0005)
126
127 #define CB_ITEM_COUNT   DTWIDGET_GETMESSAGE( \
128                           MS_ComboBox, COMBO_ITEM_COUNT, _DtMsgComboBox_0006)
129
130 #define CB_VISIBLE_ITEM DTWIDGET_GETMESSAGE( \
131                           MS_ComboBox, COMBO_VISIBLE_ITEM, _DtMsgComboBox_0007)
132
133 #define CB_TEXT         DTWIDGET_GETMESSAGE( \
134                           MS_ComboBox, COMBO_TEXT, _DtMsgComboBox_0008)
135
136 #define CB_SET_ITEM             DTWIDGET_GETMESSAGE( \
137                           MS_ComboBox, COMBO_SET_ITEM, _DtMsgComboBox_0009)
138
139 #define CB_SELECT_ITEM          DTWIDGET_GETMESSAGE( \
140                           MS_ComboBox, COMBO_SELECT_ITEM, _DtMsgComboBox_0010)
141
142 #define CB_RESIZE       DTWIDGET_GETMESSAGE( \
143                           MS_ComboBox, COMBO_RESIZE, _DtMsgComboBox_0011)
144
145 #define CB_LABEL        DTWIDGET_GETMESSAGE( \
146                           MS_ComboBox, COMBO_LABEL, _DtMsgComboBox_0012)
147
148 #define CB_CVTSTRING    DTWIDGET_GETMESSAGE( \
149                           MS_ComboBox, COMBO_CVTSTRING, _DtMsgComboBox_0013)
150
151 #define CB_DEL_POS      DTWIDGET_GETMESSAGE( \
152                           MS_ComboBox, COMBO_DEL_POS, _DtMsgComboBox_0014)
153 /* 
154  * Class Records
155  */
156 typedef struct {
157     Boolean junk;  /* Need something */
158 } DtComboBoxClassPart;
159
160 typedef struct _DtComboBoxClassRec {
161     CoreClassPart           core_class;
162     CompositeClassPart      composite_class;
163     ConstraintClassPart     constraint_class;
164     XmManagerClassPart      manager_class;
165     DtComboBoxClassPart     combo_box_class;
166 } DtComboBoxClassRec;
167
168 extern DtComboBoxClassRec dtComboBoxClassRec;
169
170
171 /*
172  * Instance Record.
173  */
174 typedef struct _DtComboBoxPart {
175     /* Private data */
176     Widget arrow;
177     Widget shell;
178     Widget frame;
179     Widget label;
180     Widget sep;
181     Dimension old_width;
182     Dimension old_height;
183     Dimension label_max_length;
184     Dimension label_max_height;
185     /* 
186      * max_shell_width is the width that is needed to hold the
187      * list if the longest item was visible.  We then use this
188      * width to figure out if the shell is not wide enough,
189      * when it gets popped on the screen.  This is needed in case the
190      * combo-box resizes, or if items changes (list will resize).
191      * Sometimes we change the size of the shell to fit on the screen, or
192      * to make it at least as large as the combo_box.  The next time we pop
193      * the shell up the size may be different; therefore, we set the shell
194      * size to the maximum everytime it gets popped up, then we will
195      * make adjustments, only if needed.
196      * This value gets saved every time the user updates DtNitems.
197      */
198     Dimension max_shell_width;
199     Dimension max_shell_height;
200
201     /* ComboBox specific public resources */
202     Dimension margin_height;
203     Dimension margin_width;
204     XmString selected_item;
205     int selected_position;
206     XtCallbackList selection_callback;
207     unsigned char type;
208     Dimension arrow_spacing;
209
210     /* ComboBox specific private resources */
211     Dimension arrow_size;
212     XtCallbackList activate_callback;
213     unsigned char alignment;
214     unsigned char arrow_type;
215     short text_columns;
216     XtCallbackList focus_callback;
217     Dimension horizontal_spacing;
218     int item_count;
219     XmStringTable items;
220     XmStringTable list_items;
221     XmString label_string;
222     Widget list;
223     XmFontList list_font_list;
224     Dimension list_margin_height;
225     Dimension list_margin_width;
226     Dimension list_spacing;
227     XtCallbackList losing_focus_callback;
228     unsigned int text_max_length;
229     XtCallbackList menu_post_callback;
230     unsigned char orientation;
231     Boolean popped_up;
232     Boolean recompute_size;
233     Widget text;
234     int top_item_position;
235     Boolean update_label;
236     Dimension vertical_spacing;
237     int visible_item_count;
238 } DtComboBoxPart;
239
240
241 typedef struct _DtComboBoxRec {
242     CorePart            core;
243     CompositePart       composite;
244     ConstraintPart      constraint;
245     XmManagerPart       manager;
246     DtComboBoxPart      combo_box;
247 } DtComboBoxRec;
248
249
250
251 #ifdef __cplusplus
252 }  /* Close scope of 'extern "C"' declaration which encloses file. */
253 #endif
254
255 #endif /* _XmComboBoxP_h */