dthelp: Change to ANSI function definitions
[oweals/cde.git] / cde / programs / dtfile / Encaps.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: Encaps.h /main/4 1995/11/02 14:36:49 rswiston $ */
24 /************************************<+>*************************************
25  ****************************************************************************
26  *
27  *   FILE:           Encaps.h
28  *
29  *   COMPONENT_NAME: Desktop File Manager
30  *
31  *   DESCRIPTION:    Public include file for the dialog encapsulation functions.
32  *
33  *   (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
34  *   (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
35  *   (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
36  *   (c) Copyright 1993, 1994, 1995 Novell, Inc.
37  *
38  ****************************************************************************
39  ************************************<+>*************************************/
40
41 #ifndef _Encapsulate_h
42 #define _Encapsulate_h
43
44
45 /* Timer globals */
46 extern int initialTimeoutLength;
47 extern int activeTimeoutLength;
48 extern int idleTimeoutLength;
49
50 /* Dialog positioning offset value */
51 extern int topPositionOffset;
52
53
54
55 /*
56  *  Common dialog instance data.
57  */
58
59 typedef struct
60 {
61    Boolean   displayed;
62    Position  x;
63    Position  y;
64    Dimension width;
65    Dimension height;
66 } DialogInstanceData, * DialogInstanceDataPtr;
67
68
69 /*
70  *  DialogData contains the dialog type specific data shared between
71  *  the dialog and the application.
72  */
73
74 typedef struct
75 {
76    int     type;
77    XtPointer data;
78 } DialogData;
79
80
81 /*
82  *  The following typedefs are the function definitions used by the
83  *  Dialog Class structure.
84  */
85
86 typedef void (*DialogCreateProc)(
87     Display * display,
88     Widget    parent,
89     Widget  * shell,
90     XtPointer * dialog
91 );
92
93 typedef void (*DialogInstallChangeProc)(
94     XtPointer        dialog,
95     XtCallbackProc callback,
96     XtPointer        client_data
97 );
98
99 typedef void (*DialogInstallCloseProc)(
100     XtPointer        dialog,
101     XtCallbackProc callback,
102     XtPointer        client_data
103 );
104
105 typedef void (*DialogDestroyProc)(
106     XtPointer dialog
107 );
108
109 typedef XtPointer (*DialogGetValuesProc)(
110     XtPointer dialog
111 );
112
113 typedef XtPointer (*DialogGetDefaultValuesProc)(
114     void
115 );
116
117
118 typedef XtPointer (*DialogGetResourceValuesProc)(
119     XrmDatabase    data_base,
120     char        ** name_list
121 );
122
123 typedef void (*DialogSetValuesProc)(
124     XtPointer     dialog,
125     XtPointer     values
126 );
127 typedef void (*DialogWriteResourceValuesProc)(
128     DialogData *  values,
129     int           fd,
130     char       ** name_list
131 );
132
133 typedef void (*DialogFreeValuesProc)(
134     XtPointer     values
135 );
136
137 typedef void (*DialogSetFocusProc)(
138     XtPointer     dialog,
139     XtPointer     values
140 );
141
142
143 typedef void (*DialogMapWindowProc)(
144     Widget    parent,
145     XtPointer  dialog
146 );
147
148
149 /*
150  *  Resource write proc and structure used for dialog resources. 
151  */
152
153 typedef void (*WriteResourceProc)();
154 /*  XtPointer resource_val;   */
155
156 typedef struct 
157 {
158    String  name;
159    String  type;
160    int     size;
161    int     offset;
162    XtPointer default_value;
163    WriteResourceProc write_resource;   
164 } DialogResource;
165
166
167 /*
168  *  The Dialog Class structure.
169  */
170
171 typedef struct
172 {
173    DialogResource              * resources;
174    int                           resource_count;
175    DialogCreateProc              create;
176    DialogInstallChangeProc       install_change_callback;
177    DialogInstallCloseProc        install_close_callback;
178    DialogDestroyProc             destroy;
179    DialogGetValuesProc           get_values;
180    DialogGetDefaultValuesProc    get_default_values;
181    DialogGetResourceValuesProc   get_resource_values;
182    DialogSetValuesProc           set_values;
183    DialogWriteResourceValuesProc write_resource_values;
184    DialogFreeValuesProc          free_values;
185    DialogMapWindowProc           map;
186    DialogSetFocusProc            set_focus;
187 } DialogClass;
188
189
190
191 /*
192  *  Procedure types used by the application for functions to be passed
193  *  to the encapsulation mechanism.
194  */
195
196 typedef void (*DialogChangedProc)(
197     XtPointer      change_data,
198     DialogData * old_data,
199     DialogData * new_data,
200     XtPointer      call_data
201 );
202
203 typedef void (*DialogClosedProc)(
204     XtPointer      close_data,
205     DialogData * old_data,
206     DialogData * new_data
207 );
208
209
210
211 /********    Public Function Declarations    ********/
212
213 extern void _DtInitializeEncapsulation( 
214                         Display *display,
215                         char *name,
216                         char *class) ;
217 extern int _DtInstallDialog( 
218                         DialogClass *dialog_class,
219                         Boolean cache,
220                         Boolean destroyPopups) ;
221 extern DialogData * _DtGetDialogData( 
222                         DialogData *dialog_data) ;
223 extern DialogData * _DtGetDefaultDialogData( 
224                         int dialog_type) ;
225 extern DialogData * _DtGetResourceDialogData( 
226                         int dialog_type,
227                         XrmDatabase data_base,
228                         char **name_list) ;
229 extern void _DtShowDialog( 
230                         Widget parent,
231                         Widget map_parent,
232                         XtPointer top_rec,
233                         DialogData *dialog_data,
234                         DialogChangedProc change_proc,
235                         XtPointer change_data,
236                         DialogClosedProc close_proc,
237                         XtPointer close_data,
238                         char *workspaces,
239                         Boolean iconify_state,
240                         Boolean ignoreCache,
241                         char * title,
242                         XClassHint * classHints) ;
243 extern void _DtHideDialog( 
244                         DialogData *dialog_data,
245                         Boolean call_callbacks) ;
246 extern Widget _DtGetDialogShell( 
247                         DialogData *dialog_data) ;
248 extern XtPointer _DtGetDialogInstance( 
249                         DialogData *dialog_data) ;
250 extern DialogData * _DtGetInstanceData( 
251                         XtPointer instance) ;
252 extern Boolean _DtIsDialogShowing( 
253                         DialogData *dialog_data) ;
254 extern void _DtWriteDialogData( 
255                         DialogData *dialog_data,
256                         int fd,
257                         char **name_list) ;
258 extern void _DtFreeDialogData( 
259                         DialogData *dialog_data) ;
260 extern void _DtDialogGetResources( 
261                         XrmDatabase database,
262                         char **name_list,
263                         char *dialog_name,
264                         char *base,
265                         DialogResource *resources,
266                         int resource_count) ;
267 extern void _DtDialogPutResources( 
268                         int fd,
269                         char **name_list,
270                         char *dialog_name,
271                         char *base,
272                         DialogResource *resources,
273                         int resource_count) ;
274 extern void _DtIntToString( 
275                         int fd,
276                         int *value,
277                         char *out_buf) ;
278 extern void _DtShortToString( 
279                         int fd,
280                         short *value,
281                         char *out_buf) ;
282 extern void _DtPositionToString( 
283                         int fd,
284                         Position *value,
285                         char *out_buf) ;
286 extern void _DtDimensionToString( 
287                         int fd,
288                         Dimension *value,
289                         char *out_buf) ;
290 extern void _DtBooleanToString( 
291                         int fd,
292                         Boolean *value,
293                         char *out_buf) ;
294 extern void _DtXmStringToString( 
295                         int fd,
296                         XmString *value,
297                         char *out_buf) ;
298 extern void _DtXmStringTableToString( 
299                         int fd,
300                         XmStringTable *value,
301                         char *out_buf) ;
302 extern void _DtStringToString( 
303                         int fd,
304                         char **value,
305                         char *out_buf) ;
306 extern void _DtmapCB(
307                         Widget w,
308                         XtPointer client_data,
309                         XtPointer call_data) ;
310 extern void _DtEncapSetWorkSpaceHints( 
311                         Widget shell,
312                         char *workspaces) ;
313 extern void _DtBuildDialog(
314                         Widget parent,
315                         Widget map_parent,
316                         XtPointer top_rec,
317                         DialogData *dialog_data,
318                         DialogChangedProc change_proc,
319                         XtPointer change_data,
320                         DialogClosedProc close_proc,
321                         XtPointer close_data,
322                         char *workspaces,
323                         Boolean iconify_state,
324                         Boolean ignoreCache,
325                         char * title,
326                         XClassHint * classHints ) ;
327 extern void _DtShowBuiltDialog(
328                         Widget parent,
329                         Widget map_parent,
330                         DialogData *dialog_data,
331                         char *workspaces,
332                         Boolean iconify_state,
333                         XClassHint * classHints ) ;
334
335 extern void _DtChangeTo(
336                         XtPointer client_data,
337                         char  *directory) ;
338
339 extern void _DtFreeDialog(
340                         DialogData *dialog_data);
341 /********    End Public Function Declarations    ********/
342
343 #endif /* _Encapsulate_h */
344 /* DON'T ADD ANYTHING AFTER THIS #endif */