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 /* static char rcsid[] =
24 "$XConsortium: View.c /main/6 1996/10/14 10:48:27 pascale $";
26 /**---------------------------------------------------------------------
30 *** project: MotifPlus Widgets
32 *** description: Source code for DtView class.
35 *** (c) Copyright 1990 by Hewlett-Packard Company.
38 ***-------------------------------------------------------------------*/
41 /*-------------------------------------------------------------
46 #include <Xm/DialogS.h>
47 #include <Xm/LabelG.h>
49 #include <Xm/SeparatoG.h>
51 #include <Dt/Control.h>
55 /*-------------------------------------------------------------
57 **-------------------------------------------------------------
60 WidgetClass dtViewWidgetClass;
62 Widget _DtCreateView ();
66 /*-------------------------------------------------------------
67 ** Forward Declarations
71 #define XmCR_SELECT XmCR_SINGLE_SELECT
73 /******** Public Function Declarations ********/
75 extern Widget _DtCreateView(
81 /******** End Public Function Declarations ********/
83 /******** Static Function Declarations ********/
86 /******** End Static Function Declarations ********/
89 /*-------------------------------------------------------------
90 ** Translations and Actions
95 /*-------------------------------------------------------------
99 /* Define offset macros.
101 #define R_Offset(field) \
102 XtOffset (DtViewWidget, view.field)
104 static XtResource resources[] =
108 XmCSpacing, XmRHorizontalDimension, sizeof (Dimension),
109 R_Offset (left_inset), XmRImmediate, (caddr_t) 3
113 XmCSpacing, XmRHorizontalDimension, sizeof (Dimension),
114 R_Offset (right_inset), XmRImmediate, (caddr_t) 3
118 XmCSpacing, XmRVerticalDimension, sizeof (Dimension),
119 R_Offset (top_inset), XmRImmediate, (caddr_t) 3
123 XmCSpacing, XmRVerticalDimension, sizeof (Dimension),
124 R_Offset (bottom_inset), XmRImmediate, (caddr_t) 3
128 XmCSpacing, XmRHorizontalDimension, sizeof (Dimension),
129 R_Offset (width_increment), XmRImmediate, (caddr_t) 2
133 XmCSpacing, XmRVerticalDimension, sizeof (Dimension),
134 R_Offset (height_increment), XmRImmediate, (caddr_t) 2
138 XmCBoxType, XmRBoxType, sizeof (unsigned char),
140 XmRImmediate, (XtPointer) XmBOX_NONE
143 XmNsubpanelUnpostOnSelect,
144 XmCSubpanelUnpostOnSelect, XmRBoolean, sizeof (Boolean),
145 R_Offset (subpanel_unpost_on_select),
146 XmRImmediate, (XtPointer) TRUE
150 XmCSubpanelTorn, XmRBoolean, sizeof (Boolean),
151 R_Offset (subpanel_torn), XmRImmediate, (XtPointer) FALSE
157 /*-------------------------------------------------------------
160 DtViewClassRec dtViewClassRec =
165 (WidgetClass) &xmFormClassRec, /* superclass */
166 "Box", /* class_name */
167 sizeof (DtViewRec), /* widget_size */
168 NULL, /* class_initialize */
169 NULL, /* class_part_initialize*/
170 False, /* class_inited */
171 (XtInitProc) NULL, /* initialize */
172 NULL, /* initialize_hook */
173 XtInheritRealize, /* realize */
176 resources, /* resources */
177 XtNumber (resources), /* num_resources */
178 NULLQUARK, /* xrm_class */
179 True, /* compress_motion */
180 XtExposeCompressMaximal, /* compress_exposure */
181 True, /* compress_enterleave */
182 False, /* visible_interest */
184 XtInheritResize, /* resize */
185 XtInheritExpose, /* expose */
186 (XtSetValuesFunc) NULL, /* set_values */
187 NULL, /* set_values_hook */
188 XtInheritSetValuesAlmost, /* set_values_almost */
189 NULL, /* get_values_hook */
190 NULL, /* accept_focus */
191 XtVersion, /* version */
192 NULL, /* callback private */
193 XtInheritTranslations, /* tm_table */
194 XtInheritQueryGeometry, /* query_geometry */
195 NULL, /* display_accelerator */
196 NULL, /* extension */
202 XtInheritGeometryManager, /* geometry_manager */
203 XtInheritChangeManaged, /* change_managed */
204 XtInheritInsertChild, /* insert_child */
205 XtInheritDeleteChild, /* delete_child */
206 NULL, /* extension */
212 NULL, /* constraint_resources */
213 0, /* num_constraint_resources */
214 sizeof (DtViewConstraintRec),/* constraint_record */
215 NULL, /* constraint_initialize */
216 NULL, /* constraint_destroy */
217 NULL, /* constraint_set_values */
218 NULL, /* extension */
224 XtInheritTranslations, /* default_translations */
225 NULL, /* syn_resources */
226 0, /* num_syn_resources */
227 NULL, /* syn_cont_resources */
228 0, /* num_syn_cont_resources */
229 XmInheritParentProcess, /* parent_process */
230 NULL, /* extension */
233 /* XmBulletinBoard Part
236 False, /* always_install_accelerators*/
237 NULL, /* geo_matrix_create */
238 XmInheritFocusMovedProc, /* focus_moved_proc */
239 NULL, /* extension */
245 NULL, /* extension */
251 NULL, /* extension */
256 WidgetClass dtViewWidgetClass = (WidgetClass) &dtViewClassRec;
260 /*-------------------------------------------------------------
262 **-------------------------------------------------------------
265 /*-------------------------------------------------------------
267 **-------------------------------------------------------------
272 /*-------------------------------------------------------------
274 **-------------------------------------------------------------
277 /*-------------------------------------------------------------
279 ** Initialize a new widget instance.
288 DtViewWidget request = (DtViewWidget) request_w,
289 new = (DtViewWidget) new_w;
292 /* Validate box type.
294 if (M_BoxType (new) != XmBOX_NONE &&
295 M_BoxType (new) != XmBOX_PRIMARY &&
296 M_BoxType (new) != XmBOX_SECONDARY &&
297 M_BoxType (new) != XmBOX_SUBPANEL)
299 M_BoxType (new) == XmBOX_NONE;
305 /*-------------------------------------------------------------
307 ** Handle changes in resource data.
316 DtViewWidget current = (DtViewWidget) current_w,
317 request = (DtViewWidget) request_w,
318 new = (DtViewWidget) new_w;
319 Boolean redraw_flag = False;
321 /* Can't change box type.
323 if (M_BoxType (new) != M_BoxType (current))
325 M_BoxType (new) = M_BoxType (current);
328 return (redraw_flag);
333 /*-------------------------------------------------------------
335 **-------------------------------------------------------------
339 /*-------------------------------------------------------------
341 **-------------------------------------------------------------
344 /* All inherited from superclass.
348 /*-------------------------------------------------------------
350 **-------------------------------------------------------------
356 /*-------------------------------------------------------------
357 ** Public Entry Points
358 **-------------------------------------------------------------
361 /*-------------------------------------------------------------
363 ** Create a new DtView instance.
364 **-------------------------------------------------------------
373 return (XtCreateWidget (name, dtViewWidgetClass,
374 parent, arglist, argcount));