2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
23 /* $XConsortium: ComboBoxP.h /main/3 1995/10/26 09:29:58 rswiston $ */
25 * DtWidget/ComboBoxP.h
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.
33 /***********************************************************
34 Copyright 1993 Interleaf, Inc.
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.
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 ******************************************************************/
50 * (C) Copyright 1991,1992, 1993
52 * Nine Hillside Avenue, Waltham, MA 02154
56 * Private header file for DtComboBoxWidget.
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>
69 #include <Xm/Separator.h>
70 #include <Xm/ScrolledWP.h>
71 #include <Xm/ScrollBarP.h>
73 #include <Xm/ManagerP.h>
81 * External definitions of syn_resources for our list widget.
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;
95 #define ARROW_MULT .45
98 #define LABEL_PADDING 2
99 #define LABEL_SHADOW 2
100 #define TEXT_FIELD_SHADOW 1
101 #define TEXT_CONTEXT_MARGIN 4
103 /****************************************************************
107 ****************************************************************/
109 #define CB_ALIGNMENT DTWIDGET_GETMESSAGE( \
110 MS_ComboBox, COMBO_ALIGNMENT, _DtMsgComboBox_0000)
112 #define CB_MARGIN_HEIGHT DTWIDGET_GETMESSAGE( \
113 MS_ComboBox, COMBO_MARGIN_HEIGHT, _DtMsgComboBox_0001)
115 #define CB_MARGIN_WIDTH DTWIDGET_GETMESSAGE( \
116 MS_ComboBox, COMBO_MARGIN_WIDTH, _DtMsgComboBox_0002)
118 #define CB_HORIZONTAL_SPACING DTWIDGET_GETMESSAGE( \
119 MS_ComboBox, COMBO_HORIZONTAL_SPACING, _DtMsgComboBox_0003)
121 #define CB_VERTICAL_SPACING DTWIDGET_GETMESSAGE( \
122 MS_ComboBox, COMBO_VERTICAL_SPACING, _DtMsgComboBox_0004)
124 #define CB_ORIENTATION DTWIDGET_GETMESSAGE( \
125 MS_ComboBox, COMBO_ORIENTATION, _DtMsgComboBox_0005)
127 #define CB_ITEM_COUNT DTWIDGET_GETMESSAGE( \
128 MS_ComboBox, COMBO_ITEM_COUNT, _DtMsgComboBox_0006)
130 #define CB_VISIBLE_ITEM DTWIDGET_GETMESSAGE( \
131 MS_ComboBox, COMBO_VISIBLE_ITEM, _DtMsgComboBox_0007)
133 #define CB_TEXT DTWIDGET_GETMESSAGE( \
134 MS_ComboBox, COMBO_TEXT, _DtMsgComboBox_0008)
136 #define CB_SET_ITEM DTWIDGET_GETMESSAGE( \
137 MS_ComboBox, COMBO_SET_ITEM, _DtMsgComboBox_0009)
139 #define CB_SELECT_ITEM DTWIDGET_GETMESSAGE( \
140 MS_ComboBox, COMBO_SELECT_ITEM, _DtMsgComboBox_0010)
142 #define CB_RESIZE DTWIDGET_GETMESSAGE( \
143 MS_ComboBox, COMBO_RESIZE, _DtMsgComboBox_0011)
145 #define CB_LABEL DTWIDGET_GETMESSAGE( \
146 MS_ComboBox, COMBO_LABEL, _DtMsgComboBox_0012)
148 #define CB_CVTSTRING DTWIDGET_GETMESSAGE( \
149 MS_ComboBox, COMBO_CVTSTRING, _DtMsgComboBox_0013)
151 #define CB_DEL_POS DTWIDGET_GETMESSAGE( \
152 MS_ComboBox, COMBO_DEL_POS, _DtMsgComboBox_0014)
157 Boolean junk; /* Need something */
158 } DtComboBoxClassPart;
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;
168 extern DtComboBoxClassRec dtComboBoxClassRec;
174 typedef struct _DtComboBoxPart {
182 Dimension old_height;
183 Dimension label_max_length;
184 Dimension label_max_height;
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.
198 Dimension max_shell_width;
199 Dimension max_shell_height;
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;
208 Dimension arrow_spacing;
210 /* ComboBox specific private resources */
211 Dimension arrow_size;
212 XtCallbackList activate_callback;
213 unsigned char alignment;
214 unsigned char arrow_type;
216 XtCallbackList focus_callback;
217 Dimension horizontal_spacing;
220 XmStringTable list_items;
221 XmString label_string;
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;
232 Boolean recompute_size;
234 int top_item_position;
235 Boolean update_label;
236 Dimension vertical_spacing;
237 int visible_item_count;
241 typedef struct _DtComboBoxRec {
243 CompositePart composite;
244 ConstraintPart constraint;
245 XmManagerPart manager;
246 DtComboBoxPart combo_box;
252 } /* Close scope of 'extern "C"' declaration which encloses file. */
255 #endif /* _XmComboBoxP_h */