libDtSvc: Change to ANSI function definitions
[oweals/cde.git] / cde / lib / DtWidget / View.c
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 /* static char rcsid[] = 
24         "$XConsortium: View.c /main/6 1996/10/14 10:48:27 pascale $";
25 */
26 /**---------------------------------------------------------------------
27 ***     
28 ***     file:           View.c
29 ***
30 ***     project:        MotifPlus Widgets
31 ***
32 ***     description:    Source code for DtView class.
33 ***     
34 ***
35 ***                     (c) Copyright 1990 by Hewlett-Packard Company.
36 ***
37 ***
38 ***-------------------------------------------------------------------*/
39
40
41 /*-------------------------------------------------------------
42 **      Include Files
43 */
44
45 #include <stdio.h>
46 #include <Xm/DialogS.h>
47 #include <Xm/LabelG.h>
48 #include <Xm/List.h>
49 #include <Xm/SeparatoG.h>
50 #include <Xm/TextF.h>
51 #include <Dt/Control.h>
52 #include <Dt/ViewP.h>
53
54
55 /*-------------------------------------------------------------
56 **      Public Interface
57 **-------------------------------------------------------------
58 */
59
60 WidgetClass     dtViewWidgetClass;
61
62 Widget          _DtCreateView ();
63
64
65 \f
66 /*-------------------------------------------------------------
67 **      Forward Declarations
68 */
69
70 #define OFFSET          12
71 #define XmCR_SELECT     XmCR_SINGLE_SELECT
72
73 /********    Public Function Declarations    ********/
74
75 extern Widget _DtCreateView( 
76                         Widget parent,
77                         String name,
78                         ArgList arglist,
79                         Cardinal argcount) ;
80
81 /********    End Public Function Declarations    ********/
82
83 /********    Static Function Declarations    ********/
84
85
86 /********    End Static Function Declarations    ********/
87
88
89 /*-------------------------------------------------------------
90 **      Translations and Actions
91 */
92
93
94 \f
95 /*-------------------------------------------------------------
96 **      Resource List
97 */
98
99 /*      Define offset macros.
100 */
101 #define R_Offset(field) \
102         XtOffset (DtViewWidget, view.field)
103
104 static XtResource resources[] = 
105 {
106         {
107                 XmNleftInset,
108                 XmCSpacing, XmRHorizontalDimension, sizeof (Dimension),
109                 R_Offset (left_inset), XmRImmediate, (caddr_t) 3
110         },
111         {
112                 XmNrightInset,
113                 XmCSpacing, XmRHorizontalDimension, sizeof (Dimension),
114                 R_Offset (right_inset), XmRImmediate, (caddr_t) 3
115         },
116         {
117                 XmNtopInset,
118                 XmCSpacing, XmRVerticalDimension, sizeof (Dimension),
119                 R_Offset (top_inset), XmRImmediate, (caddr_t) 3
120         },
121         {
122                 XmNbottomInset,
123                 XmCSpacing, XmRVerticalDimension, sizeof (Dimension),
124                 R_Offset (bottom_inset), XmRImmediate, (caddr_t) 3
125         },
126         {
127                 XmNwidthIncrement,
128                 XmCSpacing, XmRHorizontalDimension, sizeof (Dimension),
129                 R_Offset (width_increment), XmRImmediate, (caddr_t) 2
130         },
131         {
132                 XmNheightIncrement,
133                 XmCSpacing, XmRVerticalDimension, sizeof (Dimension),
134                 R_Offset (height_increment), XmRImmediate, (caddr_t) 2
135         },
136         {
137                 XmNboxType,
138                 XmCBoxType, XmRBoxType, sizeof (unsigned char),
139                 R_Offset (box_type),
140                 XmRImmediate, (XtPointer) XmBOX_NONE
141         },
142         {
143                 XmNsubpanelUnpostOnSelect,
144                 XmCSubpanelUnpostOnSelect, XmRBoolean, sizeof (Boolean),
145                 R_Offset (subpanel_unpost_on_select),
146                 XmRImmediate, (XtPointer) TRUE
147         },
148         {
149                 XmNsubpanelTorn,
150                 XmCSubpanelTorn, XmRBoolean, sizeof (Boolean),
151                 R_Offset (subpanel_torn), XmRImmediate, (XtPointer) FALSE
152         }
153 };
154
155
156 \f
157 /*-------------------------------------------------------------
158 **      Class Record
159 */
160 DtViewClassRec dtViewClassRec =
161 {
162 /*      Core Part
163 */
164         {       
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              */
174                 NULL,                           /* actions              */
175                 0,                              /* num_actions          */
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     */      
183                 NULL,                           /* destroy              */      
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            */
197         },
198
199 /*      Composite Part
200 */
201         {
202                 XtInheritGeometryManager,       /* geometry_manager     */
203                 XtInheritChangeManaged,         /* change_managed       */
204                 XtInheritInsertChild,           /* insert_child         */
205                 XtInheritDeleteChild,           /* delete_child         */
206                 NULL,                           /* extension            */
207         },
208
209 /*      Constraint Part
210 */
211         {
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            */
219         },
220
221 /*      XmManager Part
222 */
223         {
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            */
231         },
232
233 /*      XmBulletinBoard Part
234 */
235         {
236                 False,                          /* always_install_accelerators*/
237                 NULL,                           /* geo_matrix_create    */
238                 XmInheritFocusMovedProc,        /* focus_moved_proc     */
239                 NULL,                           /* extension            */
240         },
241
242 /*      XmForm Part
243 */
244         {
245                 NULL,                           /* extension            */
246         },
247
248 /*      DtView Part
249 */
250         {
251                 NULL,                           /* extension            */
252         }
253
254 };
255
256 WidgetClass dtViewWidgetClass = (WidgetClass) &dtViewClassRec;
257
258
259 \f
260 /*-------------------------------------------------------------
261 **      Private Procs
262 **-------------------------------------------------------------
263 */
264
265 /*-------------------------------------------------------------
266 **      Action Procs
267 **-------------------------------------------------------------
268 */
269
270
271 \f
272 /*-------------------------------------------------------------
273 **      Core Procs
274 **-------------------------------------------------------------
275 */
276
277 /*-------------------------------------------------------------
278 **      Initialize
279 **              Initialize a new widget instance.
280 */
281 #if 0
282 /* ARGSUSED */
283 static void 
284 Initialize(
285         Widget request_w,
286         Widget new_w )
287 {
288 DtViewWidget     request = (DtViewWidget) request_w,
289                  new = (DtViewWidget) new_w;
290 Pixmap           pix;
291
292 /*      Validate box type.
293  */
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)
298     {
299     M_BoxType (new) == XmBOX_NONE;
300     }
301 }
302 #endif /* 0 */
303
304 \f
305 /*-------------------------------------------------------------
306 **      SetValues
307 **              Handle changes in resource data.
308 */
309 #if 0
310 static Boolean 
311 SetValues(
312         Widget current_w,
313         Widget request_w,
314         Widget new_w )
315 {
316 DtViewWidget    current = (DtViewWidget) current_w,
317                 request = (DtViewWidget) request_w,
318                 new = (DtViewWidget) new_w;
319 Boolean         redraw_flag = False;
320
321 /*      Can't change box type.
322 */
323 if (M_BoxType (new) != M_BoxType (current))
324     {
325     M_BoxType (new) = M_BoxType (current);
326     }
327
328 return (redraw_flag);
329 }
330 #endif /* 0 */
331
332 \f
333 /*-------------------------------------------------------------
334 **      Composite Procs
335 **-------------------------------------------------------------
336 */
337
338
339 /*-------------------------------------------------------------
340 **      Manager Procs
341 **-------------------------------------------------------------
342 */
343
344 /*      All inherited from superclass.
345  */
346
347
348 /*-------------------------------------------------------------
349 **      View Procs
350 **-------------------------------------------------------------
351 */
352
353
354
355 \f
356 /*-------------------------------------------------------------
357 **      Public Entry Points
358 **-------------------------------------------------------------
359 */
360
361 /*-------------------------------------------------------------
362 **      _DtCreateView
363 **              Create a new DtView instance.
364 **-------------------------------------------------------------
365 */
366 Widget 
367 _DtCreateView(
368         Widget parent,
369         String name,
370         ArgList arglist,
371         Cardinal argcount )
372 {
373         return (XtCreateWidget (name, dtViewWidgetClass, 
374                         parent, arglist, argcount));
375 }
376