1 | #ifndef _WcCreate_h |
---|
2 | #define _WcCreate_h |
---|
3 | #include <X11/Wc/COPY.h> |
---|
4 | #include <stdio.h> |
---|
5 | |
---|
6 | /* |
---|
7 | * SCCS_data: %Z% %M% %I% %E% %U% |
---|
8 | * |
---|
9 | * Widget Creation Library - WcCreate.h |
---|
10 | * |
---|
11 | * Everything declared in this file is the public definition of Wcl version 2. |
---|
12 | * No interfaces will be deleted or changed until Wcl 3, but things might be |
---|
13 | * added. |
---|
14 | * |
---|
15 | ******************************************************************************* |
---|
16 | */ |
---|
17 | |
---|
18 | /****************************************************************************** |
---|
19 | * Applications should append the WCL_XRM_OPTIONS macro to their |
---|
20 | * XrmOptionDescRec declaration so a user can specify Wcl specific options |
---|
21 | * easily from the command line. |
---|
22 | * |
---|
23 | * Applications should also always call WcAppName( argv, argc ) and |
---|
24 | * WcAppClass( argc, argv ) to get the application name and class from the |
---|
25 | * command line, which can then be passed to XtInitialize(). WcAppName() and |
---|
26 | * WcAppClass() both look for -name <appName> in the argv, or else they use |
---|
27 | * argv[0]. |
---|
28 | * |
---|
29 | * Therefore, a typical Wcl based application should look something like this: |
---|
30 | ****************************************************************************** |
---|
31 | #include <X11/Wc/WcCreate.h> |
---|
32 | |
---|
33 | static XrmOptionDescRec options[] = { |
---|
34 | { ... other application specific options ... }, |
---|
35 | WCL_XRM_OPTIONS |
---|
36 | }; |
---|
37 | |
---|
38 | main( argc, argv ) |
---|
39 | int argc; |
---|
40 | char** argv; |
---|
41 | { |
---|
42 | Widget appShell = XtInitialize( |
---|
43 | WcAppName( argc, argv ), |
---|
44 | WcAppClass( argc, argv ), |
---|
45 | options, XtNumber(options), |
---|
46 | &argc, argv ); |
---|
47 | |
---|
48 | ... register widgets, callbacks, and actions ... |
---|
49 | |
---|
50 | if ( WcWidgetCreation ( appShell ) ) |
---|
51 | exit(1); |
---|
52 | |
---|
53 | XtRealize( appShell ); |
---|
54 | XtMainLoop(); |
---|
55 | } |
---|
56 | ****************************************************************************** |
---|
57 | */ |
---|
58 | |
---|
59 | #define WCL_XRM_OPTIONS \ |
---|
60 | { "-ResFile", "*wclInitResFile", XrmoptionSepArg, NULL }, \ |
---|
61 | { "-rf", "*wclInitResFile", XrmoptionSepArg, NULL }, \ |
---|
62 | { "-trrf", "*wclTraceResFiles", XrmoptionNoArg, "on" }, \ |
---|
63 | { "-Trace", "*wcTrace", XrmoptionNoArg, "on" }, \ |
---|
64 | { "-tr", "*wcTrace", XrmoptionNoArg, "on" }, \ |
---|
65 | { "-trtd", "*wclTraceTemplateDef", XrmoptionNoArg, "on" }, \ |
---|
66 | { "-trtx", "*wcTraceTemplate", XrmoptionNoArg, "on" }, \ |
---|
67 | { "-Warnings", "*wclVerboseWarnings", XrmoptionNoArg, "on" } |
---|
68 | |
---|
69 | /****************************************************************************** |
---|
70 | ** Resources Fetched By Wcl |
---|
71 | ****************************************************************************** |
---|
72 | * Resources beginning with "wcl" (class names beginning with "Wcl") apply |
---|
73 | * to an application instance. Such resources are fetched by |
---|
74 | * WcInitialize() as resources of the initial top level shell. These |
---|
75 | * resources are never fetched again during the life of an application. |
---|
76 | * |
---|
77 | * WcWidgetCreation() calls WcInitialize() before creating any widgets. |
---|
78 | * |
---|
79 | * Application Wide Resources: |
---|
80 | ****************************************************************************** |
---|
81 | * WclResFiles List of files to be loaded into resource db. |
---|
82 | * WclInitResFile ONLY set by command line. |
---|
83 | * WclTraceResFiles Trace loading of files by Wcl to stderr. |
---|
84 | * WclErrorDatabaseFile File with overrides for Wcl warning messages. |
---|
85 | * WclWidgetResourceFiles Files with widget resources not reported by |
---|
86 | * XtGetConstraintResourceList() nor by |
---|
87 | * XtGetResourceList(). ** not yet implemented ** |
---|
88 | * WclTemplateFiles List of files with templates. |
---|
89 | * WclTraceTemplateDef Trace definition of templates to stderr. |
---|
90 | * WclVerboseWarnings Some warnings are supressed normally, but this |
---|
91 | * resource causes Wcl to act like ANSI C and |
---|
92 | * give somewhat informative but usually annoying |
---|
93 | * messages. |
---|
94 | * WclDynamicLibs List of full pathnames of libraries which |
---|
95 | * can be named using "-lName" shorthand in |
---|
96 | * WcDynamicAction(), WcDynamicCallback(), and in |
---|
97 | * the new (Wcl 2.02) callback and method syntax. |
---|
98 | * WclSlowTightNames Default: False. Causes WcFullNameToWidget() |
---|
99 | * to use the same algorithm as used by the Athena |
---|
100 | * string-to-widget converter for widget names |
---|
101 | * starting with `*' - specifically, the reference |
---|
102 | * widget is moved up in the widget tree, parent |
---|
103 | * by parent, with a call to XtNameToWidget() |
---|
104 | * at each parent, until the top of the tree is |
---|
105 | * reached. This is slower than the default |
---|
106 | * algorithm which tries the reference widget, |
---|
107 | * then the root of the widget tree containing |
---|
108 | * the reference widget. |
---|
109 | * WclAppClassName If non-null, then this name will be used as |
---|
110 | * the class name for all widgets created using |
---|
111 | * WcCreateRoot(). |
---|
112 | */ |
---|
113 | #define WcNwclResFiles "wclResFiles" |
---|
114 | #define WcNwclInitResFile "wclInitResFile" |
---|
115 | #define WcNwclTraceResFiles "wclTraceResFiles" |
---|
116 | #define WcNwclErrorDatabaseFile "wclErrorDatabaseFile" |
---|
117 | #define WcNwclWidgetResourceFiles "wclWidgetResourceFiles" |
---|
118 | #define WcNwclTemplateFiles "wclTemplateFiles" |
---|
119 | #define WcNwclTraceTemplateDef "wclTraceTemplateDef" |
---|
120 | #define WcNwclVerboseWarnings "wclVerboseWarnings" |
---|
121 | #define WcNwclDynamicLibs "wclDynamicLibs" |
---|
122 | #define WcNwclSlowTightNames "wclSlowTightNames" |
---|
123 | #define WcNwclAppClassName "wclAppClassName" |
---|
124 | |
---|
125 | #define WcCWclResFiles "WclResFiles" |
---|
126 | #define WcCWclInitResFile "WclInitResFile" |
---|
127 | #define WcCWclTraceResFiles "WclTraceResFiles" |
---|
128 | #define WcCWclErrorDatabaseFile "WclErrorDatabaseFile" |
---|
129 | #define WcCWclWidgetResourceFiles "WclWidgetResourceFiles" |
---|
130 | #define WcCWclTemplateFiles "WclTemplateFiles" |
---|
131 | #define WcCWclTraceTemplateDef "WclTraceTemplateDef" |
---|
132 | #define WcCWclVerboseWarnings "WclVerboseWarnings" |
---|
133 | #define WcCWclDynamicLibs "WclDynamicLibs" |
---|
134 | #define WcCWclSlowTightNames "WclSlowTightNames" |
---|
135 | #define WcCWclAppClassName "WclAppClassName" |
---|
136 | |
---|
137 | /* Widget Creation Time Resources - Before Instance Creation: |
---|
138 | ****************************************************************************** |
---|
139 | * These resources are fetched before each widget instance is created by |
---|
140 | * the Wcl widget creation recursion. Since they are fetched before the |
---|
141 | * class of the widget is truly known, they apply to an instance (or |
---|
142 | * template) name, not to a widget class name. |
---|
143 | * |
---|
144 | * NOTE: The Wcl 1.x instance creation time resource "wcResFile" is no |
---|
145 | * longer supported. Its use was dangerous. Change all occurances of |
---|
146 | * "wcResFile" to use the new "wclResFiles" |
---|
147 | */ |
---|
148 | |
---|
149 | #define WcNwcPreCreateDumpResources "wcPreCreateDumpResources" |
---|
150 | #define WcNwcTemplate "wcTemplate" |
---|
151 | #define WcNwcTraceTemplate "wcTraceTemplate" |
---|
152 | #define WcNwcPostTemplateDumpResources "wcPostTemplateDumpResources" |
---|
153 | #define WcNwcCreate "wcCreate" |
---|
154 | #define WcNwcClassName "wcClassName" /* OBSOLETE */ |
---|
155 | #define WcNwcClass "wcClass" /* OBSOLETE */ |
---|
156 | #define WcNwcConstructor "wcConstructor" /* OBSOLETE */ |
---|
157 | |
---|
158 | #define WcCWcDumpResources "WcDumpResources" |
---|
159 | #define WcCWcTemplate "WcTemplate" |
---|
160 | #define WcCWcTraceTemplate "WcTraceTemplate" |
---|
161 | #define WcCWcCreate "WcCreate" |
---|
162 | #define WcCWcClassName "WcClassName" /* OBSOLETE */ |
---|
163 | #define WcCWcClass "WcClass" /* OBSOLETE */ |
---|
164 | #define WcCWcConstructor "WcConstructor" /* OBSOLETE */ |
---|
165 | |
---|
166 | /* Widget Creation Time Resources - After Instance Creation: |
---|
167 | ****************************************************************************** |
---|
168 | * These resources are fetched after each widget instance is created by |
---|
169 | * the Wcl widget creation recursion. The class of the widget is then |
---|
170 | * known, so these resources may be specified on a widget class basis. |
---|
171 | * |
---|
172 | * If a constructor was used to create the instance, and this constructor |
---|
173 | * creates additional parents of the instance (e.g., XmCreateMessageDialog |
---|
174 | * creates a dialog shell before creating the XmMessageBox), then these |
---|
175 | * resources MUST be preceeded by either an "*" or the name of the |
---|
176 | * automatically created parent (e.g., childName_popup in the case of |
---|
177 | * XmCreateMessageDialog). |
---|
178 | */ |
---|
179 | |
---|
180 | #define WcNwcTrace "wcTrace" |
---|
181 | #define WcNwcPostCreateDumpResources "wcPostCreateDumpResources" |
---|
182 | #define WcNwcCallback "wcCallback" |
---|
183 | #define WcNwcPopups "wcPopups" |
---|
184 | #define WcNwcChildren "wcChildren" |
---|
185 | #define WcNwcManaged "wcManaged" |
---|
186 | #define WcNwcAfterPopups "wcAfterPopups" |
---|
187 | #define WcNwcAfterChildren "wcAfterChildren" |
---|
188 | #define WcNwcAfterManageChildren "wcAfterManageChildren" |
---|
189 | |
---|
190 | #define WcCWcTrace "WcTrace" |
---|
191 | #define WcCWcCallback "WcCallback" |
---|
192 | #define WcCWcPopups "WcPopups" |
---|
193 | #define WcCWcChildren "WcChildren" |
---|
194 | #define WcCWcManaged "WcManaged" |
---|
195 | #define WcCWcAfterPopups "WcAfterPopups" |
---|
196 | #define WcCWcAfterChildren "WcAfterChildren" |
---|
197 | #define WcCWcAfterManageChildren "WcAfterManageChildren" |
---|
198 | |
---|
199 | /* Resource Types for Wcl Resources |
---|
200 | */ |
---|
201 | #define WcRDynamicLibs "DynamicLibs" |
---|
202 | #define WcRQuarkRec "QuarkRec" |
---|
203 | #define WcRQuark "Quark" |
---|
204 | |
---|
205 | /****************************************************************************** |
---|
206 | ** Macros for ANSI and K&R Function Decls |
---|
207 | ******************************************************************************/ |
---|
208 | |
---|
209 | #include <X11/Wc/PortableC.h> |
---|
210 | |
---|
211 | /****************************************************************************** |
---|
212 | ** Wcl Public Functions |
---|
213 | ******************************************************************************/ |
---|
214 | |
---|
215 | BEGIN_NOT_Cxx |
---|
216 | |
---|
217 | /* -- Wcl requires these XtR4 declarations: ********************************/ |
---|
218 | #ifndef XtSpecificationRelease |
---|
219 | #ifdef __STDC__ |
---|
220 | typedef void* XtPointer; |
---|
221 | #else |
---|
222 | typedef char* XtPointer; |
---|
223 | #endif |
---|
224 | #ifndef XtName |
---|
225 | extern char* XtName _(( Widget )); /* from ./XtName.c if not in libXt */ |
---|
226 | #endif |
---|
227 | #endif /* !XtSpecificationRelease *****************************************/ |
---|
228 | |
---|
229 | /* -- Function Pointer Typedefs |
---|
230 | */ |
---|
231 | typedef Widget (*WcWidgetConstructor) _((Widget,char*,ArgList,Cardinal)); |
---|
232 | |
---|
233 | /*==================================================================== |
---|
234 | * Widget class, constructor, and callback proc registration routines: |
---|
235 | * Registrations are kept separate for each application context. |
---|
236 | * The names are used in resource files as RHS (values). |
---|
237 | * Multiple names can be registered for any widget class, callback, etc. |
---|
238 | */ |
---|
239 | |
---|
240 | /* -- Register name of widget class pointer, so name can be used as value of |
---|
241 | * wcCreate resources. You might want to register mySpecialWidgetClass as |
---|
242 | * both "mySpecialWidgetClass" and "MySpecial", the first being the C name |
---|
243 | * for the widget class pointer, the second being the widget class name |
---|
244 | * as stored in the widget's class record. |
---|
245 | */ |
---|
246 | extern void WcRegisterClassPtr _(( |
---|
247 | XtAppContext, |
---|
248 | char*, /* name of class pointer, used for wcCreate */ |
---|
249 | WidgetClass |
---|
250 | )); |
---|
251 | |
---|
252 | extern void WcRegisterClassName _(( /* OBSOLETE - use WcRegisterClassPtr */ |
---|
253 | XtAppContext, |
---|
254 | char*, /* name of class pointer, used for wcCreate */ |
---|
255 | WidgetClass |
---|
256 | )); |
---|
257 | |
---|
258 | /* -- Register name of widget constructor function, so name can be used as |
---|
259 | * value of wcCreate resources. |
---|
260 | */ |
---|
261 | extern void WcRegisterConstructor _(( |
---|
262 | XtAppContext, |
---|
263 | char*, /* name of constructor, used for wcCreate */ |
---|
264 | WcWidgetConstructor |
---|
265 | )); |
---|
266 | |
---|
267 | /* -- Register the name of XtCallbackProcs so they may be named as callback |
---|
268 | * resources for widgets. The registration-time client data is NOT very |
---|
269 | * useful: it only gets passed to the callback if there is nothing inside |
---|
270 | * of (the optional) parenthesis following the callback name in the resource |
---|
271 | * value specification. Normally, you should use a mapping agent (see |
---|
272 | * MapAg.h) or the X Context Manager (see XFindContext, XSaveContext) to |
---|
273 | * obtain arbitrary data related to widgets. Or, use object-oriented |
---|
274 | * design and use the Wcl Method concept... |
---|
275 | */ |
---|
276 | extern void WcRegisterCallback _(( |
---|
277 | XtAppContext, |
---|
278 | char*, /* callback proc name for resource value */ |
---|
279 | XtCallbackProc, |
---|
280 | XtPointer /* not very useful... I always use NULL */ |
---|
281 | )); |
---|
282 | |
---|
283 | /* -- Provides symmetry with WcRegisterCallback(). It is more efficient |
---|
284 | * to declare your own XtActionsRec[] and call XtAppAddActions(). |
---|
285 | */ |
---|
286 | extern void WcRegisterAction _(( |
---|
287 | XtAppContext, |
---|
288 | char*, /* action proc name for translations */ |
---|
289 | XtActionProc |
---|
290 | )); |
---|
291 | |
---|
292 | /* -- If a callback proc cannot be found given a name specified in a resource |
---|
293 | * value, then the "UndefinedCallback" is invoked. The client data is the |
---|
294 | * name and arguments (more-or-less) as specified in the resource value. |
---|
295 | * You can provide your own callback which will then be invoked instead of |
---|
296 | * the default "UndefinedCallback". The return value is the address of the |
---|
297 | * previous "UndefinedCallback". |
---|
298 | */ |
---|
299 | extern XtCallbackProc WcSetUndefinedCallback _(( XtCallbackProc )); |
---|
300 | |
---|
301 | /*============================================================================= |
---|
302 | * Method Support: Callback resource value specifications can now name methods |
---|
303 | * instead of only simple callbacks. A method specification in a callback |
---|
304 | * resource value looks like this: |
---|
305 | * |
---|
306 | * <class_name>::<method_name>(<opt_args>) |
---|
307 | * |
---|
308 | * The callback method gets a pointer to a special struct as the client data. |
---|
309 | * The struct has three elements: a pointer to the "object" of the appropriate |
---|
310 | * class, an arbitrary pointer which is provided at registration time, and the |
---|
311 | * characters inside of parenthesis in the resource value (leading and trailing |
---|
312 | * whitespace stripped, at least a pointer to a null character, never a null |
---|
313 | * pointer). |
---|
314 | * |
---|
315 | * Note that this makes the registration-time client data much more useful than |
---|
316 | * the original Wcl callback registration mechanisms: the original callback |
---|
317 | * mechanism only provides the registration-time client data if there is nothing |
---|
318 | * between parens in the resource file. The new method mechanism ALWAYS |
---|
319 | * provides the registration-time client data. |
---|
320 | * |
---|
321 | * Class names CANNOT begin with the two characters "-l" in order to avoid |
---|
322 | * ambiguities with the Dynamic Linking Support (see below). |
---|
323 | * |
---|
324 | * Wcl uses late binding to invoke methods. At invocation time, Wcl resolves |
---|
325 | * the method address, and it attempts to find an object of the appropriate |
---|
326 | * class. The run-time overhead is kept low: about 20 lines of C are executed |
---|
327 | * for typical method invocations. |
---|
328 | * |
---|
329 | * Wcl provides a default mechanism for finding object which is baed on the |
---|
330 | * following observations: Often, an object in the application is mapped 1:1 |
---|
331 | * with some shell or manager widget, and the children of that shell or manager |
---|
332 | * widget provide ways to display or set attributes on the object, and invoke |
---|
333 | * methods on the object. Imagine a dialog box for a text editor which is used |
---|
334 | * to display and manipulate paragraph properties. The application changes the |
---|
335 | * "Paragraph" object related to the dialog as the insertion point moves from |
---|
336 | * paragraph to paragraph. Pressing a button labeled "Right Justify" may |
---|
337 | * invoke the RightJustify method of the current paragraph. The resource |
---|
338 | * specification would look like this: |
---|
339 | * |
---|
340 | * *parProp*rightJustify.callback: Paragraph::RightJustify() |
---|
341 | * |
---|
342 | * The default object resolution mechanism uses WcAttachThisToWidget() and |
---|
343 | * WcDetachThisFromWidget() to allow the application to set and change the |
---|
344 | * objects related to widgets in the interface. |
---|
345 | * |
---|
346 | * An application can get the address of the default object resolution function |
---|
347 | * and provide its own which replaces or envelopes the default resolution logic. |
---|
348 | * Use WcSetFindObjectFunc() to get the old resolution function and provide a |
---|
349 | * replacement which will be called to get the object pointer. |
---|
350 | * |
---|
351 | * NOTE: it is very possible that no object of the appropriate type is found |
---|
352 | * by an object resolution procedure. Wcl can optionally issue a warning |
---|
353 | * message if this occurs, BUT THE METHOD IS INVOKED ANYWAY! This means that |
---|
354 | * methods MUST detect NULL object pointers and handle them reasonably. |
---|
355 | * |
---|
356 | * Some methods do not need object pointers: object constructors are a common |
---|
357 | * and useful example. |
---|
358 | */ |
---|
359 | extern void WcRegisterMethod _(( |
---|
360 | XtAppContext, |
---|
361 | char*, /* object class name - CANNOT begin with "-l" */ |
---|
362 | char*, /* method name */ |
---|
363 | XtCallbackProc, /* method is still an XtCallbackProc */ |
---|
364 | XtPointer /* registered client data - can be useful */ |
---|
365 | )); |
---|
366 | |
---|
367 | /* -- A pointer to this struct is passed as client data to methods. This struct |
---|
368 | * may become longer in future releases. The object pointer my be NULL! The |
---|
369 | * method must detect NULL object pointers. |
---|
370 | */ |
---|
371 | typedef struct _WcMethodDataRec { |
---|
372 | |
---|
373 | XtPointer object; /* pointer to application obj or NULL */ |
---|
374 | XtPointer closure; /* client data registered with method name */ |
---|
375 | char* args; /* from between parens in resource value */ |
---|
376 | |
---|
377 | } WcMethodDataRec, *WcMethodData; |
---|
378 | |
---|
379 | /* -- Set the function used to find an object of a particular class from |
---|
380 | * a widget invoking a callback. The default function provided by Wcl |
---|
381 | * searches up the widget tree, looking for objects attached to widgets. |
---|
382 | * Some applications may want to use different approaches to finding an |
---|
383 | * object, such as using a server, loading objects from files, collections, |
---|
384 | * MappingAgents, etc... |
---|
385 | * The previous function is returned. |
---|
386 | */ |
---|
387 | typedef XtPointer (*WcFindObjectFunc) _(( |
---|
388 | Widget, /* widget invoking the callback */ |
---|
389 | XrmQuark /* quarkified case sensitive class name */ |
---|
390 | )); |
---|
391 | |
---|
392 | extern WcFindObjectFunc WcSetFindObjectFunc _(( |
---|
393 | WcFindObjectFunc /* application provided function ptr */ |
---|
394 | )); |
---|
395 | |
---|
396 | /* -- Set the object pointer related to a widget. These may become useless |
---|
397 | * if you use WcSetFindObjectFunc... |
---|
398 | */ |
---|
399 | extern void WcAttachThisToWidget _(( |
---|
400 | XtPointer, /* "this" pointer, pointer to application obj */ |
---|
401 | char*, /* object class name - CANNOT begin with "-l" */ |
---|
402 | Widget /* object will be `attached' to the widget */ |
---|
403 | )); |
---|
404 | |
---|
405 | /* -- Un-set the object pointer related to a widget. |
---|
406 | * The "this" pointer is unused: actually, any object of the indicated |
---|
407 | * class is detached from the widget. |
---|
408 | */ |
---|
409 | extern void WcDetachThisFromWidget _(( |
---|
410 | XtPointer, /* "this" pointer, pointer to application obj */ |
---|
411 | char*, /* object class name - CANNOT begin with "-l" */ |
---|
412 | Widget /* any object of "class" will be detached */ |
---|
413 | )); |
---|
414 | |
---|
415 | /* -- Un-set the object pointer related to all widgets. |
---|
416 | * All references to the "this" pointer are removed. |
---|
417 | */ |
---|
418 | extern void WcDetachThis _(( |
---|
419 | XtPointer /* "this" pointer, pointer to application obj */ |
---|
420 | )); |
---|
421 | |
---|
422 | /*============================================================================ |
---|
423 | * Dynamic Linking Support: Callback resource value specifications can now |
---|
424 | * name dynamic libraries which can be used to resolve callback procedure |
---|
425 | * addresses. Both "old-fashioned" Wcl style callbacks and "new-fangled" |
---|
426 | * Wcl style methods can be bound using this mechanism. The resolution of |
---|
427 | * addresses is done once, before the first invocation of a callback or a |
---|
428 | * method. Callback resource specification which use dynamic libraries look |
---|
429 | * like this: |
---|
430 | * |
---|
431 | * -l<library_abbreviation>::<callback_name>(<opt_args>) |
---|
432 | * or -l<library_abbreviation>::<class_name>::<method_name>(<opt_args>) |
---|
433 | * |
---|
434 | * Note that the initial "-l" of library specifications eliminated any |
---|
435 | * ambiguity between library names and class names used for methods. |
---|
436 | * |
---|
437 | * The library abbreviation is the same as that used by the "ld" command: |
---|
438 | * the library /usr/X11R5/lib/libXop.so.2.2 can be named by "-lXop". |
---|
439 | * |
---|
440 | * Libraries must be registered with Wcl before they are needed (before the |
---|
441 | * first callback invokation which names the library). Libraries may be |
---|
442 | * registered using the function below, and by using the application-wide |
---|
443 | * resource "wclDynamicLibs" which is fetched and evaluated during Wcl |
---|
444 | * initialization. Multiple libraries can be registered at once: each full |
---|
445 | * pathname is separated by whitespace and/or a comma. |
---|
446 | */ |
---|
447 | extern void WcRegisterDynamicLibs _(( |
---|
448 | XtAppContext, |
---|
449 | char* /* full path names of dynamic libraries */ |
---|
450 | )); |
---|
451 | |
---|
452 | /*============================================================================ |
---|
453 | * Initialization and initial widget tree creation routines: |
---|
454 | * |
---|
455 | * Many applications simply use the function WcWidgetCreation() to initialize |
---|
456 | * Wcl, install the Wcl provided Xrm converters, and to create the initial |
---|
457 | * non-empty widget tree. WcWidgetCreation() complains and returns 1 if no |
---|
458 | * popups or children of the application shell could be created. |
---|
459 | * |
---|
460 | * WcInitialize() must be called before any widgets are created by Wcl. If |
---|
461 | * your application starts out without an initial widget tree, then you |
---|
462 | * should invoke WcInitialize() and then dynamically create the widget trees |
---|
463 | * later as you need them. |
---|
464 | * |
---|
465 | * WcAddConverters() installs the Wcl provided Xrm converters: |
---|
466 | * StringToWidget, StringToWidgetList, StringToCallback, , and Wcl private |
---|
467 | * converters StringToQuarkRec and StringToDynamicLibs. Most applications |
---|
468 | * do not need to call WcAddConverters(), as it is called by |
---|
469 | * WcInitialize(). However, if you do something which might clobber the |
---|
470 | * installed converters, then you need to call WcAddConverters() to ensure |
---|
471 | * the Wcl converters are used. This probably only happens after you |
---|
472 | * initialize a widget class which installs a string-to-widget converter, |
---|
473 | * such as the Athena Form widget or any Motif widget. FYI, libXmp and |
---|
474 | * libXp know this, and they ensure that the Wcl converters are installed |
---|
475 | * after all Motif or Athena converters are installed. See Xmp/Xmp.c and |
---|
476 | * Xp/Xp.c for details, specifically XmpRegisterMotif() and |
---|
477 | * XpRegisterAthena(). |
---|
478 | */ |
---|
479 | extern int WcWidgetCreation _(( /* 1 if failed, 0 if OK */ |
---|
480 | Widget /* appShell from XtInitialize */ |
---|
481 | )); |
---|
482 | |
---|
483 | extern void WcInitialize _(( /* called by WcWidgetCreation */ |
---|
484 | Widget /* appShell from XtInitialize */ |
---|
485 | )); |
---|
486 | |
---|
487 | extern void WcAddConverters _(( /* called by WcInitialize */ |
---|
488 | XtAppContext |
---|
489 | )); |
---|
490 | |
---|
491 | /*============================================================================ |
---|
492 | * Create Widgets Dynamically: Each of these functions can create an entire |
---|
493 | * widget tree starting with the named child. Functions which create a single |
---|
494 | * direct descendent child return the widget id of the new child. Functions |
---|
495 | * which may create multiple direct descendents return void. |
---|
496 | * |
---|
497 | * Child names are always single elements (like "newChild", not like |
---|
498 | * "somechild*aDistantDescendant"). Names of children are passed as a single |
---|
499 | * null terminated string, with whitespace and/or a comma separating each |
---|
500 | * child name. |
---|
501 | * |
---|
502 | * The type of the child as well as other Wcl creation-time resources of the |
---|
503 | * child are fetched and evaluated. Therefore, wcPopups and wcChildren |
---|
504 | * resources of the child widget can cause arbitrarily complex widget trees to |
---|
505 | * be created. However, NONE of the parent's resources are re-evaluated. |
---|
506 | * Specifically, this means the Wcl creation-time callbacks of the parent are |
---|
507 | * NOT invoked. |
---|
508 | * WcCreateChild(): Child is NOT managed. |
---|
509 | * WcCreateChildFromTemplate(): Child is NOT managed. |
---|
510 | * WcCreateNamedPopups(): Children are NOT popped up. |
---|
511 | * WcCreatePopup(): Child is NOT popped up. |
---|
512 | * WcCreatePopupFromTemplate(): Child is NOT popped up. |
---|
513 | * WcCreateRoot(): Shell is realized. |
---|
514 | */ |
---|
515 | |
---|
516 | /* -- Each child of the parent may be managed as controlled by child's |
---|
517 | * wcManaged resource. |
---|
518 | */ |
---|
519 | extern void WcCreateNamedChildren _(( |
---|
520 | Widget, /* parent widget */ |
---|
521 | char* /* names of children to be created */ |
---|
522 | )); |
---|
523 | |
---|
524 | /* -- Child is NOT managed. |
---|
525 | */ |
---|
526 | extern Widget WcCreateChild _(( |
---|
527 | Widget, /* parent widget */ |
---|
528 | char* /* name of child to be created */ |
---|
529 | )); |
---|
530 | |
---|
531 | /* -- Child is NOT managed. Template applied before creation. |
---|
532 | */ |
---|
533 | extern Widget WcCreateChildFromTemplate _(( |
---|
534 | Widget, /* parent widget */ |
---|
535 | char*, /* name of child to be created */ |
---|
536 | char* /* template name */ |
---|
537 | )); |
---|
538 | |
---|
539 | /* -- Children are NOT popped up. |
---|
540 | */ |
---|
541 | extern void WcCreateNamedPopups _(( |
---|
542 | Widget, /* parent widget */ |
---|
543 | char* /* names of popup children to be created */ |
---|
544 | )); |
---|
545 | |
---|
546 | /* -- Child is NOT popped up. |
---|
547 | */ |
---|
548 | extern Widget WcCreatePopup _(( |
---|
549 | Widget, /* parent widget */ |
---|
550 | char* /* name of popup child to be created */ |
---|
551 | )); |
---|
552 | |
---|
553 | /* -- Child is NOT popped up. Template applied before creation. |
---|
554 | */ |
---|
555 | extern Widget WcCreatePopupFromTemplate _(( |
---|
556 | Widget, /* parent widget */ |
---|
557 | char*, /* name of popup child to be created */ |
---|
558 | char* /* template name */ |
---|
559 | )); |
---|
560 | |
---|
561 | /* -- Creates an application shell. Therefore, this MUST be created |
---|
562 | * on a new display connection to avoid problems. The shell is realized, |
---|
563 | * which generally causes it to appear. |
---|
564 | */ |
---|
565 | extern Widget WcCreateRoot _(( |
---|
566 | Display*, /* A different connection than other roots! */ |
---|
567 | char* /* name of shell to be created */ |
---|
568 | )); |
---|
569 | |
---|
570 | /*=========================================================================== |
---|
571 | * Resource Database Dumping Capabilities - require X11R5 |
---|
572 | * These allow you to dump portions of the resource database into stdio files. |
---|
573 | */ |
---|
574 | |
---|
575 | /* -- Dump resources which apply to a widget before it is created, note that |
---|
576 | * we do not know the class name yet, so no resources which are terminally |
---|
577 | * named by a widget class name (like *XpTable.defaultOptions) will be |
---|
578 | * found. |
---|
579 | */ |
---|
580 | extern void WcPreCreateDumpResources _(( |
---|
581 | Widget, /* parent widget */ |
---|
582 | char*, /* name of (usually) not-yet-created child */ |
---|
583 | FILE* /* stderr, stdout, or opened with fopen() */ |
---|
584 | )); |
---|
585 | |
---|
586 | /* -- Dump all resources which apply to a widget after the widget has been |
---|
587 | * created. The class is now known, the final full path of the child is |
---|
588 | * known, and templates have been applied. The resources shown will be |
---|
589 | * the same which the widget sees and responds to in its core.Initialize() |
---|
590 | * method. |
---|
591 | */ |
---|
592 | extern void WcPostCreateDumpResources _(( |
---|
593 | Widget, /* the widget */ |
---|
594 | FILE* /* stderr, stdout, or opened with fopen() */ |
---|
595 | )); |
---|
596 | |
---|
597 | /*=========================================================================== |
---|
598 | * Widget name routines |
---|
599 | */ |
---|
600 | |
---|
601 | /* -- Find named widget starting from reference widget. |
---|
602 | * WcFullNameToWidget examines the first few characters of the `name' |
---|
603 | * argument in order to determine where the search will begin. |
---|
604 | * |
---|
605 | * The `name' can begin with one or more of the relative prefix operators |
---|
606 | * which are evaluated from left-to-right: |
---|
607 | * |
---|
608 | * this must be first, means "the reference widget"; |
---|
609 | * ^ means "parent"; |
---|
610 | * ~ means "closest shell ancestor"; |
---|
611 | * . ignored, can be used stylistically. |
---|
612 | * |
---|
613 | * Following the relative pre-fix operators can be a normal widget path |
---|
614 | * name which is simply passed to XtNameToWidget(). Therefore, the rest |
---|
615 | * of the path can include "*", widget instance names and widget class |
---|
616 | * names, but of course the last component must be an instance name. |
---|
617 | * |
---|
618 | * If the name begins with `*' as the first character, then the root |
---|
619 | * widget starting from the reference widget is used as the reference |
---|
620 | * widget. This is very different from XtNameToWidget! Use "this*foo" |
---|
621 | * if you want to get the same widget which XtNameToWidget(this,"*foo") |
---|
622 | * would find. |
---|
623 | */ |
---|
624 | extern Widget WcFullNameToWidget _(( |
---|
625 | Widget, /* reference widget */ |
---|
626 | char* /* relative path name to another widget */ |
---|
627 | )); |
---|
628 | |
---|
629 | /* -- This is a bug-fixed version of XtNameToWidget(). Pre-X11R4 and early |
---|
630 | * X11R4 versions of XtNameToWidget dump core when a Gadget is encountered. |
---|
631 | * This version is the late Rr and R5 version which can deal properly with |
---|
632 | * Gadgets. |
---|
633 | */ |
---|
634 | extern Widget WcChildNameToWidget _(( |
---|
635 | Widget, /* starting widget */ |
---|
636 | char* /* path to child widget */ |
---|
637 | )); |
---|
638 | |
---|
639 | /* -- Returns the full path name of a widget starting from its root |
---|
640 | * widget. The string is XtAlloc'd, so use XtFree() when done. |
---|
641 | */ |
---|
642 | extern char* WcWidgetToFullName _(( Widget )); /* USE XtFree */ |
---|
643 | |
---|
644 | /* -- Print the widget tree starting from this widget |
---|
645 | */ |
---|
646 | extern void WcPrintTree _(( Widget )); |
---|
647 | |
---|
648 | /* -- Returns the class name of the widget - DO NOT FREE RETURN VALUE! |
---|
649 | */ |
---|
650 | extern char* WcWidgetClassName _(( Widget )); /* DONT FREE */ |
---|
651 | |
---|
652 | /* -- Returns the name of the XEvent - DO NOT FREE RETURN VALUE! |
---|
653 | */ |
---|
654 | extern char* WcXEventName _(( XEvent* )); /* DONT FREE */ |
---|
655 | |
---|
656 | /*============================================================================ |
---|
657 | * Parsing and various string utilities. |
---|
658 | */ |
---|
659 | |
---|
660 | /* -- Obtain application name and class from the argv passed to main(). |
---|
661 | * The caller must free return values with XtFree(). |
---|
662 | */ |
---|
663 | extern char* WcAppName _(( |
---|
664 | int, /* argc passed to main() */ |
---|
665 | char** /* argv passed to main() */ |
---|
666 | )); |
---|
667 | |
---|
668 | extern char* WcAppClass _(( |
---|
669 | int, /* argc passed to main() */ |
---|
670 | char** /* argv passed to main() */ |
---|
671 | )); |
---|
672 | |
---|
673 | /* -- Convert an application name into an application class name using |
---|
674 | * the X convention (capitalizes first letter, or first two if first |
---|
675 | * is already capitalized) |
---|
676 | */ |
---|
677 | extern char* WcAppNameToAppClass _(( |
---|
678 | char* /* application name (usually argv[0]) */ |
---|
679 | )); |
---|
680 | |
---|
681 | /* -- Returns the character pointer argument advanced past whitespace, |
---|
682 | * and '\0' at end of string. |
---|
683 | */ |
---|
684 | extern char* WcSkipWhitespace _(( char* )); |
---|
685 | |
---|
686 | /* -- Returns the character pointer argument advanced past whitespace and |
---|
687 | * optional comma. Commas can be used to indicate null fields. If a |
---|
688 | * field is null, the comma is returned. Returns '\0' at end of string. |
---|
689 | */ |
---|
690 | extern char* WcSkipWhitespace_Comma _(( char* )); /* optional comma */ |
---|
691 | |
---|
692 | /* -- WcCleanName is ugly, but effective. The first argument is the string to |
---|
693 | * find a name surrounded by whitespace. The second is a buffer provided |
---|
694 | * by the caller into which WcCleanName builds a null terminated string. |
---|
695 | * The return value points at the next character WcCleanName should process |
---|
696 | * if continuing to get names from the same initial string. |
---|
697 | */ |
---|
698 | extern char* WcCleanName _(( |
---|
699 | char*, /* string with a bunch of words */ |
---|
700 | char* /* pre-allocd char array to be filled in */ |
---|
701 | )); |
---|
702 | |
---|
703 | /* -- get quark of lower case copy of string - the incoming arg is NOT changed |
---|
704 | */ |
---|
705 | extern XrmQuark WcStringToQuark _(( |
---|
706 | char* /* copied, flattened, then quarkified */ |
---|
707 | )); |
---|
708 | |
---|
709 | extern XrmQuark WcSubStringToQuark _(( |
---|
710 | char*, /* ptr to starting character in an array */ |
---|
711 | char* /* ptr to ending character in same array */ |
---|
712 | )); |
---|
713 | |
---|
714 | /* -- get case-sensitive quark of sub-string (without flattening case) |
---|
715 | */ |
---|
716 | extern XrmQuark WcCsSubStringToQuark _(( |
---|
717 | char*, /* ptr to starting character in an array */ |
---|
718 | char* /* ptr to ending character in same array */ |
---|
719 | )); |
---|
720 | |
---|
721 | /* -- Various safe wrappers around string functions |
---|
722 | */ |
---|
723 | extern char* WcStrStr _(( char*, char* )); /* find str1 in str2 */ |
---|
724 | extern char* WcStrCpy _(( char*, char* )); /* safe strcpy */ |
---|
725 | extern char* WcStrCat _(( char*, char* )); /* safe strcat */ |
---|
726 | extern int WcStrCmp _(( char*, char* )); /* safe strcmp */ |
---|
727 | extern int WcStrCmpN _(( char*, char*, int )); /* safe strncmp */ |
---|
728 | |
---|
729 | #define WcNonNull(str) (int)((str) && *(str)) |
---|
730 | #define WcNull(str) (int)(!((str) && *(str))) |
---|
731 | #define WcStrLen(str) (int)(((str) && *(str))?strlen(str):0) |
---|
732 | #define WcStrEq(s1,s2) (int)(!WcStrCmp((s1),(s2))) |
---|
733 | #define WcStrEqN(s1,s2,n) (int)(!WcStrCmpN((s1),(s2),(n))) |
---|
734 | |
---|
735 | /* -- This is used to determine the number of `%s' replacement characters in |
---|
736 | * a string which is intended to be passed to printf() as a format |
---|
737 | * specification. It returns 0 if something other than strings are expected |
---|
738 | * by the format specification. It also returns 0 if a string format |
---|
739 | * specification contains a '*' which means the width or precision is |
---|
740 | * parametric. Therefore, a positive return value means printf() can be |
---|
741 | * safely called with the returned number of strings as arguments following |
---|
742 | * the format. |
---|
743 | */ |
---|
744 | extern int WcPrintfFormatStrings _(( char* )); |
---|
745 | |
---|
746 | /* -- Break and Splice Lines using columns per line. |
---|
747 | * |
---|
748 | * WcBreakIntoLines() takes the argument string and inserts newlines to |
---|
749 | * make lines less than or equal to columnsPerLine characters on each line. |
---|
750 | * It tries to be intelligent, breaking lines at whitespace, or at |
---|
751 | * columnsPerLine if no whitespace in the line. Multiple blanks following |
---|
752 | * `.' are collapsed into a single blank. |
---|
753 | * |
---|
754 | * WcSpliceLines() removes newlines which look like they were inserted by |
---|
755 | * WcBreakIntoLines(). Newlines which preceed lines beginning with |
---|
756 | * whitespace are kept, as are newlines which seem intentional: i.e., |
---|
757 | * following punctuation where the next word could have fit on the line. |
---|
758 | * |
---|
759 | * Both functions allocate the return value using XtMalloc(), so free after |
---|
760 | * use with XtFree(). |
---|
761 | */ |
---|
762 | extern char* WcBreakIntoLines _(( String, int columnsPerLine )); |
---|
763 | extern char* WcSpliceLines _(( String, int columnsPerLine )); |
---|
764 | |
---|
765 | /*============================================================================ |
---|
766 | * Set resource values on widgets |
---|
767 | * These procedures make it easier to use strings as the base protocol for |
---|
768 | * communicating with widgets. This means you can use the same strings to |
---|
769 | * dynamically change widget resources as you do to initialize them in the |
---|
770 | * resource files. The widget provided converters are used to convert the |
---|
771 | * strings into the types required by the widget. |
---|
772 | */ |
---|
773 | |
---|
774 | /* -- Set resource values on widgets. The string is of the format: |
---|
775 | * <set_string> ::= <res_spec_list> |
---|
776 | * | <res_spec> |
---|
777 | * |
---|
778 | * <res_spec_list> ::= ( <res_spec> ) |
---|
779 | * | <res_spec_list> ( <res_spec> ) |
---|
780 | * |
---|
781 | * <res_spec> ::= <targetName>.<resName>: <resValue> |
---|
782 | * | <targetName>.<resName>(<resType>): <resValue> |
---|
783 | * |
---|
784 | * <targetName> ::= <empty> |
---|
785 | * | this |
---|
786 | * | <relative_opt><widget_path> |
---|
787 | * |
---|
788 | * If there are multiple resource specs, then each must be enclosed |
---|
789 | * in parens. |
---|
790 | * |
---|
791 | * In other words, a resource spec looks just like a line in a resource file, |
---|
792 | * except that it may include an optional resource type specification in |
---|
793 | * parens, and the name of the targetWidget may be 'this' or a relative path |
---|
794 | * as well as the standard wildcarded paths. An empty targetName is the |
---|
795 | * same as 'this'. |
---|
796 | * |
---|
797 | * The special resource value of "this" means "this widget." Typically, |
---|
798 | * using "this" as the resource value is used to set the "XmNdefaultButton" |
---|
799 | * resource on a XmbulletinBoard, "menuBar", "workArea", etc on XmMainWindows, |
---|
800 | * the subMenuId resource on menuBar cascade buttons, and so on. |
---|
801 | * |
---|
802 | * The targetName must resolve to a specific widget: therefore the last |
---|
803 | * component of the targetName must be the name of a Widget instance, and |
---|
804 | * the targetName MUST be followed by a '.' and NOT a '*'. |
---|
805 | * |
---|
806 | * Caution: only use resource_type when you REALLY must, as this is not safe. |
---|
807 | * With sub-resources you will need it. |
---|
808 | */ |
---|
809 | extern void WcSetValue _(( |
---|
810 | Widget, /* refernce widget, not necessarly altered! */ |
---|
811 | char* /* <set_string> as defined above */ |
---|
812 | )); |
---|
813 | |
---|
814 | /* -- Set a single resource on a single widget |
---|
815 | */ |
---|
816 | extern void WcSetValueFromString _(( |
---|
817 | Widget, /* widget to change */ |
---|
818 | char*, /* name of resource (like XtNforground) */ |
---|
819 | char* /* value of resource (like "red") */ |
---|
820 | )); |
---|
821 | |
---|
822 | /* -- Set a single resource on a single widget. Use only if the widget |
---|
823 | * does not include the resource in its class resources rec, nor in its |
---|
824 | * constraint resources. With sub-resources you will need it. |
---|
825 | * You can try to get the type with WcGetResourceType(), and if you get |
---|
826 | * NULL, then the widget is mis-implemented (or its a sub-resource) and |
---|
827 | * you will need to somehow figure out the appropriate type, like XtRWidget. |
---|
828 | */ |
---|
829 | extern void WcSetValueFromStringAndType _(( |
---|
830 | Widget, /* widget to change */ |
---|
831 | char*, /* resource name (like "fontList") */ |
---|
832 | char*, /* resource value (like "*times*--14-*") */ |
---|
833 | char* /* resource type (like "FontList") */ |
---|
834 | )); |
---|
835 | |
---|
836 | /* -- Determine the type of the named resource. Checks both normal widget |
---|
837 | * resources and constraint resources which may apply to an instance. |
---|
838 | * XtFree the return value. Returns NULL if the widget pretends it does |
---|
839 | * not have this resource (which is generally a widget bug, and usually |
---|
840 | * implies the resource is a sub-resource). |
---|
841 | */ |
---|
842 | extern char* WcGetResourceType _(( |
---|
843 | Widget, /* Check resource types for this instance */ |
---|
844 | char* /* return type of this resource, or NULL */ |
---|
845 | )); |
---|
846 | |
---|
847 | /* -- Set translations on a widget based on a translation string which includes |
---|
848 | * #augment, #replace, or #override directives (default to #replace). |
---|
849 | */ |
---|
850 | extern void WcSetTranslations _(( |
---|
851 | Widget, /* set translations on this widget */ |
---|
852 | char* /* string describing translations */ |
---|
853 | )); |
---|
854 | |
---|
855 | /* -- Load a resource file (file is loaded once only per display), returns |
---|
856 | * TRUE if loaded. Note that in general you must be careful when using |
---|
857 | * this function. If you load resources which override existing values, |
---|
858 | * the overriden values are free'd. If someone is trying to use resource |
---|
859 | * values in-place (which they should not, but...) then you may eventually |
---|
860 | * get a core dump. Or maybe not. Wcl uses this function, but only during |
---|
861 | * Wcl initialization. At this time, there are few users of the database, |
---|
862 | * and those users (applicationShellWidgetClass, Wcl, Xt) do not use |
---|
863 | * in-place resource values, only copies. Be careful! |
---|
864 | */ |
---|
865 | extern int WcLoadResourceFile _(( |
---|
866 | Widget, /* for Display* and XtAppContext */ |
---|
867 | char* /* name of file to load */ |
---|
868 | )); |
---|
869 | |
---|
870 | /*============================================================================ |
---|
871 | * Callback And Action Support |
---|
872 | * Applications can export their methods to the widgets in the form of |
---|
873 | * XtCallbackProcs or XtActionProcs. Wcl and the XtTranslationManager provide |
---|
874 | * the argument(s) between parentheses as character strings to the methods. |
---|
875 | * Callback procs receive the string between parenthesis as a single string, |
---|
876 | * actions receive the same string broken up into words. If the method needs |
---|
877 | * to parse the arguments, one or the other form may be more convenient. |
---|
878 | * |
---|
879 | * For example, WcUnmanage() requires no real parsing if implemented as an |
---|
880 | * XtActionProc as it only uses the arguments as individual words. However, |
---|
881 | * WcSetValue() must do more sophisticated parsing, and so it is easier to |
---|
882 | * implement as a callback. Wcl implements each of the 30 odd conveneince |
---|
883 | * procedures as either callbacks or actions (choosing the form which is most |
---|
884 | * convenient for implementation) and then it simply invokes the convenient |
---|
885 | * form from the less convenient form: WcManageCB() invokes WcManageACT(), |
---|
886 | * whereas WcSetValuesACT() invokes WcSetValuesCB(). |
---|
887 | */ |
---|
888 | |
---|
889 | /* -- Invoke an XtActionProc easily from an XtCallbackProc |
---|
890 | */ |
---|
891 | extern void WcInvokeAction _(( |
---|
892 | XtActionProc, /* invoke this action proc */ |
---|
893 | Widget, /* the widget the callback proc received */ |
---|
894 | char* /* the client data string Wcl gave the CB */ |
---|
895 | )); |
---|
896 | |
---|
897 | extern void WcInvokeNamedAction _(( |
---|
898 | char*, /* Name of action proc to invoke (needs R4) */ |
---|
899 | Widget, /* the widget the callback proc received */ |
---|
900 | char* /* the client data string Wcl gave the CB */ |
---|
901 | )); |
---|
902 | |
---|
903 | /* -- Invoke an XtCallbackProc easily from an XtActionProc |
---|
904 | */ |
---|
905 | extern void WcInvokeCallback _(( |
---|
906 | XtCallbackProc, /* invoke this callback proc */ |
---|
907 | Widget, /* the widget the action proc received */ |
---|
908 | char**, /* the "params" recvd from XtTranslationMgr */ |
---|
909 | Cardinal* /* "num_params" recvd from XtTranslationMgr */ |
---|
910 | )); |
---|
911 | |
---|
912 | /*============================================================================ |
---|
913 | * Convenience Callbacks and Actions provided by Wcl |
---|
914 | * |
---|
915 | * In all cases, unless explicitly stated, the names of widgets taken |
---|
916 | * as arguments to the following callbacks and actions are resolved using |
---|
917 | * WcFullNameToWidget(), and therefore the names can always be relative |
---|
918 | * widget path names. The "reference widget" is the widget which invoked |
---|
919 | * the callback or action proc. |
---|
920 | * |
---|
921 | * Also, each of these callbacks and actions are registered with Wcl with |
---|
922 | * the "CB" or "ACT" suffixes and without. Therefore, in resource files you |
---|
923 | * can name WcManageCB() with either WcManage or WcManageCB, and WcManageACT() |
---|
924 | * with either WcManage or WcManageACT. |
---|
925 | */ |
---|
926 | |
---|
927 | /* -- WcManage( widgetName [, widgetName] ... ) |
---|
928 | * Manages each of the named widgets. Uses XtManageChildren as much |
---|
929 | * as possible. |
---|
930 | */ |
---|
931 | extern void WcManageCB _(( Widget, XtPointer, XtPointer )); |
---|
932 | extern void WcManageACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
933 | |
---|
934 | /* -- WcUnmanage( widgetName [, widgetName] ... ) |
---|
935 | * Unmanages each of the named widgets. |
---|
936 | */ |
---|
937 | extern void WcUnmanageCB _(( Widget, XtPointer, XtPointer )); |
---|
938 | extern void WcUnmanageACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
939 | |
---|
940 | /* -- WcManageChildren( parentWidgetName, child [, child] ... ) |
---|
941 | * The parentWidgetName is resolved using WcFullNameToWidget(). However, |
---|
942 | * Each of the children must be single component names of direct descendents |
---|
943 | * of the parent widget. No wildcards or relative names are allowed for the |
---|
944 | * children names. |
---|
945 | */ |
---|
946 | extern void WcManageChildrenCB _(( Widget, XtPointer, XtPointer )); |
---|
947 | extern void WcManageChildrenACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
948 | |
---|
949 | /* -- WcUnmanageChildren( parentWidgetName, child [, child] ... ) |
---|
950 | * See WcManageChildren for comments about the arguments. |
---|
951 | */ |
---|
952 | extern void WcUnmanageChildrenCB _(( Widget, XtPointer, XtPointer )); |
---|
953 | extern void WcUnmanageChildrenACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
954 | |
---|
955 | /* -- WcDestroy( widgetName [, widgetName] ... ) |
---|
956 | * Calls XtDestroyWidget with each of the named widgets. The 2-phase |
---|
957 | * destroy mechanism makes this safe. |
---|
958 | */ |
---|
959 | extern void WcDestroyCB _(( Widget, XtPointer, XtPointer )); |
---|
960 | extern void WcDestroyACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
961 | |
---|
962 | /* -- WcSetSensitive( widgetName [, widgetName] ... ) |
---|
963 | * Makes each named widget sensitive by calling XtSetSensitive. Note that |
---|
964 | * gadgets cannot be made insensitive: a warning message is generated. |
---|
965 | */ |
---|
966 | extern void WcSetSensitiveCB _(( Widget, XtPointer, XtPointer )); |
---|
967 | extern void WcSetSensitiveACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
968 | |
---|
969 | /* -- WcSetInsensitive( widgetName [, widgetName] ... ) |
---|
970 | * See WcSetSensitive for comments about the arguments. |
---|
971 | */ |
---|
972 | extern void WcSetInsensitiveCB _(( Widget, XtPointer, XtPointer )); |
---|
973 | extern void WcSetInsensitiveACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
974 | |
---|
975 | /* -- WcPopup( shellWidgetName [, shellWidgetName] ... ) |
---|
976 | * Named widgets must be shells. This invokes XtPopup(), passing XtGrabNone |
---|
977 | */ |
---|
978 | extern void WcPopupCB _(( Widget, XtPointer, XtPointer )); |
---|
979 | extern void WcPopupACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
980 | |
---|
981 | /* -- WcPopupGrab( shellWidgetName [, shellWidgetName] ... ) |
---|
982 | * Requires shell widgets. This invokes XtPopup(), passing XtGrabExclusive |
---|
983 | */ |
---|
984 | extern void WcPopupGrabCB _(( Widget, XtPointer, XtPointer )); |
---|
985 | extern void WcPopupGrabACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
986 | |
---|
987 | /* -- WcPopdown( shellWidgetName [, shellWidgetName] ... ) |
---|
988 | * The named widgets must be shell widgets. Each shell is popped-down |
---|
989 | * via a call to XtPopdown. This releases any grabs by the shells. |
---|
990 | */ |
---|
991 | extern void WcPopdownCB _(( Widget, XtPointer, XtPointer )); |
---|
992 | extern void WcPopdownACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
993 | |
---|
994 | /* -- WcMap( widgetName [, widgetName] ... ) |
---|
995 | * Causes each of the named widgets to be mapped via XtMapWidget() |
---|
996 | */ |
---|
997 | extern void WcMapCB _(( Widget, XtPointer, XtPointer )); |
---|
998 | extern void WcMapACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
999 | |
---|
1000 | /* -- WcUnmap( widgetName [, widgetName] ... ) |
---|
1001 | * Causes each of the named widgets to be un-mapped via XtUnmapWidget() |
---|
1002 | */ |
---|
1003 | extern void WcUnmapCB _(( Widget, XtPointer, XtPointer )); |
---|
1004 | extern void WcUnmapACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1005 | |
---|
1006 | /* -- WcInstallAccelerators( dest, src [, src] ... ) |
---|
1007 | * dest - (root of tree) widget that can activate accelerators, |
---|
1008 | * src - widget which provides functionality, |
---|
1009 | * and defines the accel translation (accelerators resource). |
---|
1010 | */ |
---|
1011 | extern void WcInstallAcceleratorsCB _(( Widget, XtPointer, XtPointer )); |
---|
1012 | extern void WcInstallAcceleratorsACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1013 | |
---|
1014 | /* -- WcInstallAllAccelerators( dest, src ) |
---|
1015 | * dest - (root of tree) widget that can activate accelerators, |
---|
1016 | * src - root of widget tree, each widget can provide functionality, |
---|
1017 | * and can define an accel translation (accelerators resource). |
---|
1018 | */ |
---|
1019 | extern void WcInstallAllAcceleratorsCB _((Widget, XtPointer, XtPointer )); |
---|
1020 | extern void WcInstallAllAcceleratorsACT _((Widget, XEvent*, char**, Cardinal*)); |
---|
1021 | |
---|
1022 | /* -- WcCreateRoot( shell [on: display] [shell [on: display]] ... ) |
---|
1023 | * Creates a new application shell. Although the display name is optional, |
---|
1024 | * it is effectively mandatory because Xt does not fully define behavior |
---|
1025 | * when there are multiple applicationShells on the same display connection. |
---|
1026 | * The name of the shell must be a single component name: it will have no |
---|
1027 | * parent. |
---|
1028 | */ |
---|
1029 | extern void WcCreateRootCB _(( Widget, XtPointer, XtPointer )); |
---|
1030 | extern void WcCreateRootACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1031 | |
---|
1032 | /* -- WcSpawn( <cmd_arguments> ) |
---|
1033 | * Forks and execvp a new process. The <cmd_arguments> are passed to the |
---|
1034 | * main() of the new process as argc and argv. The command line is NOT |
---|
1035 | * a shell command line. See WcSystem(). |
---|
1036 | */ |
---|
1037 | extern void WcSpawnCB _(( Widget, XtPointer, XtPointer )); |
---|
1038 | extern void WcSpawnACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1039 | |
---|
1040 | /* -- WcLoadResourceFile( file [, file] ) |
---|
1041 | * Be careful when you use this!! See the comments for the function |
---|
1042 | * of the same name. |
---|
1043 | */ |
---|
1044 | extern void WcLoadResourceFileCB _(( Widget, XtPointer, XtPointer )); |
---|
1045 | extern void WcLoadResourceFileACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1046 | |
---|
1047 | /* -- WcPrintTree( widgetName [, widgetName] ) |
---|
1048 | * Prints out widget tree starting with named widget(s). |
---|
1049 | */ |
---|
1050 | extern void WcPrintTreeCB _(( Widget, XtPointer, XtPointer )); |
---|
1051 | extern void WcPrintTreeACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1052 | |
---|
1053 | /* -- WcDumpResources( widgetName [, widgetName] ) |
---|
1054 | * Print out resources under a widget instance. |
---|
1055 | */ |
---|
1056 | extern void WcDumpResourcesCB _(( Widget, XtPointer, XtPointer )); |
---|
1057 | extern void WcDumpResourcesACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1058 | |
---|
1059 | /* -- WcExit( [exitVal] ) |
---|
1060 | * Exit the application, returning the integer equivalent of exitVal. |
---|
1061 | */ |
---|
1062 | extern void WcExitCB _(( Widget, XtPointer, XtPointer )); |
---|
1063 | extern void WcExitACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1064 | |
---|
1065 | /* -- WcCreateChildren( parentWidgetName, child [,child] ... ) |
---|
1066 | * The parent name can be a relative name, but each of the children are |
---|
1067 | * named with a single component name. This procedure is equivalent to |
---|
1068 | * providing a wcChildren resource on the parent widget, except that |
---|
1069 | * the parent's creation-time resources are not evaluated: i.e., the |
---|
1070 | * creation-time callbacks of the parent are NOT invoked. |
---|
1071 | */ |
---|
1072 | extern void WcCreateChildrenCB _(( Widget, XtPointer, XtPointer )); |
---|
1073 | extern void WcCreateChildrenACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1074 | |
---|
1075 | /* -- WcCreatePopups( parentWidgetName, child [,child] ... ) |
---|
1076 | * The parent name can be a relative name, but each of the children are |
---|
1077 | * named with a single component name. This procedure is equivalent to |
---|
1078 | * providing a wcPopup resource on the parent widget, except that |
---|
1079 | * the parent's creation-time resources are not evaluated: i.e., the |
---|
1080 | * creation-time callbacks of the parent are NOT invoked. |
---|
1081 | */ |
---|
1082 | extern void WcCreatePopupsCB _(( Widget, XtPointer, XtPointer )); |
---|
1083 | extern void WcCreatePopupsACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1084 | |
---|
1085 | /* -- WcPositionTransient() |
---|
1086 | * Position a TransientShell in middle of parent widget. This callback |
---|
1087 | * is useful as a popupCallback or as an action triggered by the <MapNotify> |
---|
1088 | * event. |
---|
1089 | */ |
---|
1090 | extern void WcPositionTransientCB _(( Widget, XtPointer, XtPointer )); |
---|
1091 | extern void WcPositionTransientACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1092 | |
---|
1093 | /* -- WcSetValue( <set_string> ) |
---|
1094 | * This callback and action are simple wrappers around WcSetValue(). |
---|
1095 | * See the comments above for the sytax of the <set_string> argument. |
---|
1096 | */ |
---|
1097 | extern void WcSetValueCB _(( Widget, XtPointer, XtPointer )); |
---|
1098 | extern void WcSetValueACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1099 | |
---|
1100 | /* -- WcTrace( annotation ) |
---|
1101 | * Prints to stderr the wiget pathname of the invoking wiget, and an |
---|
1102 | * optional annotation. |
---|
1103 | */ |
---|
1104 | extern void WcTraceCB _(( Widget, XtPointer, XtPointer )); |
---|
1105 | extern void WcTraceACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1106 | |
---|
1107 | /* -- WcSystem( shellCmdString ) |
---|
1108 | * Invokes system(), passing the shellCmdString. Note this does NOT |
---|
1109 | * fork, so it will block unless you append a `&' at the end of the |
---|
1110 | * shellCmdString. |
---|
1111 | */ |
---|
1112 | extern void WcSystemCB _(( Widget, XtPointer, XtPointer )); |
---|
1113 | extern void WcSystemACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1114 | |
---|
1115 | /* -- WcAddCallbacks( widgetName callbackName CbProc(args) [CbProc(args) ...] ) |
---|
1116 | * This is the socially acceptable way to add callback procedures to |
---|
1117 | * callback resources of widgets. You generally should not use WcSetValue(). |
---|
1118 | * You must specify the callback list name (like popupCallback) as well |
---|
1119 | * as one or more callback procedure names. The args for each callback |
---|
1120 | * procedure are optional. The syntax for the callback names are discussed |
---|
1121 | * under "Method Support" and "Dynamic Library Support" above. |
---|
1122 | */ |
---|
1123 | extern void WcAddCallbacksCB _(( Widget, XtPointer, XtPointer )); |
---|
1124 | extern void WcAddCallbacksACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1125 | |
---|
1126 | /* -- WcRemoveCallbacks( widName callbackName CbProc(args) [CbProc(args) ...] ) |
---|
1127 | * This is the socially acceptable way to remove callback procedures from |
---|
1128 | * callback resources of widgets. |
---|
1129 | * You must specify the callback list name (like popupCallback) as well |
---|
1130 | * as one or more callback procedure names. The args for each callback |
---|
1131 | * procedure must be the same (except for leading and trailing whitespace). |
---|
1132 | * I.e., you must use the same internal whitespace, commas, and |
---|
1133 | * capitailization as when you set the callback resource value. |
---|
1134 | */ |
---|
1135 | extern void WcRemoveCallbacksCB _(( Widget, XtPointer, XtPointer )); |
---|
1136 | extern void WcRemoveCallbacksACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1137 | |
---|
1138 | /* -- WcOnceOnly( callbackName CbProc( args ) [CbProc( args ) ...] ) |
---|
1139 | * Note that we must have the callback list name! |
---|
1140 | * This allows the list of callbacks to each be invoked exactly once, the |
---|
1141 | * first time the callbacks on the callback list is traversed by the widget. |
---|
1142 | * The callbacks are invoked in left to right order. Note that this is |
---|
1143 | * NOT true for callbacks in other contexts! Xt does not guarantee any |
---|
1144 | * callback procedure invocation order. However, since WcOnceOnlyCB is |
---|
1145 | * the callback invoked from the callback list from Xt, and each CbProc() |
---|
1146 | * is then invoked by WcOnceOnly(), the order can be guaranteed. |
---|
1147 | */ |
---|
1148 | extern void WcOnceOnlyCB _(( Widget, XtPointer, XtPointer )); |
---|
1149 | extern void WcOnceOnlyACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1150 | |
---|
1151 | /* -- WcTranslations( widgetName translationString ) |
---|
1152 | * Augment or override translations on the named widget. |
---|
1153 | */ |
---|
1154 | extern void WcTranslationsCB _(( Widget, XtPointer, XtPointer )); |
---|
1155 | extern void WcTranslationsACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1156 | |
---|
1157 | /* -- WcDynamicCallback( sharedLibrary nameOfXtCallbackProc([optArgs]) ) |
---|
1158 | * This is really made obsolete by the new (Wcl 2.02) callback naming syntax. |
---|
1159 | * The sharedLibrary argument must be a full pathname, a path starting from |
---|
1160 | * ~, or a library abbreviation for libraries registered with the |
---|
1161 | * WclDynamicLibs resource or the WcRegisterDynamicLibs() function. See the |
---|
1162 | * discussion under "Dynamic Library Support" above. |
---|
1163 | */ |
---|
1164 | extern void WcDynamicCallbackCB _(( Widget, XtPointer, XtPointer )); |
---|
1165 | extern void WcDynamicCallbackACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1166 | |
---|
1167 | /* -- WcDynamicAction( sharedLibrary nameOfXtActionProc([optArgs]) ) |
---|
1168 | * This is not yet obsolete. Doing late binding of actions is not so |
---|
1169 | * simple... |
---|
1170 | * ~, or a library abbreviation for libraries registered with the |
---|
1171 | * WclDynamicLibs resource or the WcRegisterDynamicLibs() function. See the |
---|
1172 | * discussion under "Dynamic Library Support" above. |
---|
1173 | */ |
---|
1174 | extern void WcDynamicActionCB _(( Widget, XtPointer, XtPointer )); |
---|
1175 | extern void WcDynamicActionACT _(( Widget, XEvent*, char**, Cardinal* )); |
---|
1176 | |
---|
1177 | |
---|
1178 | /* -- For backward compatibility, these functions do nothing at all |
---|
1179 | */ |
---|
1180 | extern void WcAllowDuplicateRegistration _(( int )); |
---|
1181 | extern void WcAllowDuplicateClassPtrReg _(( int )); |
---|
1182 | extern void WcAllowDuplicateClassNameReg _(( int )); |
---|
1183 | extern void WcAllowDuplicateConstructorReg _(( int )); |
---|
1184 | extern void WcAllowDuplicateCallbackReg _(( int )); |
---|
1185 | |
---|
1186 | |
---|
1187 | END_NOT_Cxx |
---|
1188 | |
---|
1189 | #endif /* _WcCreate_h */ |
---|