Realized what the underlying cause of crashing on undefined "dpy"
[xcircuit.git] / Xw / XwP.h
bloba3ce6c96e7a3256061e831dfc37489c61f2c0b3f
1 /*************************************<+>*************************************
2 *****************************************************************************
3 **
4 ** File: XwP.h
5 **
6 ** Project: X Widgets
7 **
8 ** Description: This include file contains the class and instance record
9 ** definitions for all meta classes. It also contains externs
10 ** for internally shared functions and defines for internally
11 ** shared values.
13 *****************************************************************************
14 **
15 ** Copyright (c) 1988 by Hewlett-Packard Company
16 ** Copyright (c) 1988 by the Massachusetts Institute of Technology
17 **
18 ** Permission to use, copy, modify, and distribute this software
19 ** and its documentation for any purpose and without fee is hereby
20 ** granted, provided that the above copyright notice appear in all
21 ** copies and that both that copyright notice and this permission
22 ** notice appear in supporting documentation, and that the names of
23 ** Hewlett-Packard or M.I.T. not be used in advertising or publicity
24 ** pertaining to distribution of the software without specific, written
25 ** prior permission.
26 **
27 *****************************************************************************
28 *************************************<+>*************************************/
31 /***********************************************************************
33 * Miscellaneous Private Defines
35 ***********************************************************************/
37 #define XwStrlen(s) ((s) ? strlen(s) : 0)
38 #define XwBLOCK 10
39 #define XwMANAGER 1
40 #define XwPRIMITIVE 2
43 /************************************************************************
45 * The Primitive Widget Class and instance records.
47 ************************************************************************/
49 typedef void (*XwEventProc)(
50 #if NeedFunctionPrototypes
51 Widget, /* widget */
52 XEvent* /* event */
53 #endif
56 typedef struct _XwPrimitiveClassPart
58 XtWidgetProc border_highlight;
59 XtWidgetProc border_unhighlight;
60 XwEventProc select_proc;
61 XwEventProc release_proc;
62 XwEventProc toggle_proc;
63 XtTranslations translations;
64 } XwPrimitiveClassPart;
66 typedef struct _XwPrimitiveClassRec
68 CoreClassPart core_class;
69 XwPrimitiveClassPart primitive_class;
70 } XwPrimitiveClassRec;
72 extern XwPrimitiveClassRec XwprimitiveClassRec;
74 #define XtInheritBorderHighlight ((XtWidgetProc) _XtInherit)
75 #define XtInheritBorderUnhighlight ((XtWidgetProc) _XtInherit)
76 #define XtInheritSelectProc ((XwEventProc) _XtInherit)
77 #define XtInheritReleaseProc ((XwEventProc) _XtInherit)
78 #define XtInheritToggleProc ((XwEventProc) _XtInherit)
80 extern void _XwHighlightBorder();
81 extern void _XwUnhighlightBorder();
83 extern void _XwPrimitiveEnter();
84 extern void _XwPrimitiveLeave();
85 extern void _XwPrimitiveFocusIn();
86 extern void _XwPrimitiveFocusOut();
87 extern void _XwPrimitiveVisibility();
88 extern void _XwPrimitiveUnmap();
90 extern void _XwTraverseLeft();
91 extern void _XwTraverseRight();
92 extern void _XwTraverseUp();
93 extern void _XwTraverseDown();
94 extern void _XwTraverseNext();
95 extern void _XwTraversePrev();
96 extern void _XwTraverseHome();
97 extern void _XwTraverseNextTop();
100 typedef struct _XwPrimitivePart
102 Pixel foreground;
103 int background_tile;
105 Cursor cursor;
107 int traversal_type;
108 Boolean I_have_traversal;
110 int highlight_thickness;
111 int highlight_style;
112 Pixel highlight_color;
113 int highlight_tile;
116 Boolean recompute_size;
118 GC highlight_GC;
120 Boolean display_sensitive;
121 Boolean highlighted;
122 Boolean display_highlighted;
124 XtCallbackList select;
125 XtCallbackList release;
126 XtCallbackList toggle;
127 } XwPrimitivePart;
129 typedef struct _XwPrimitiveRec
131 CorePart core;
132 XwPrimitivePart primitive;
133 } XwPrimitiveRec;
137 /************************************************************************
139 * The Manager Widget Class and instance records.
141 ************************************************************************/
143 typedef void (*XwTraversalProc)(
144 #if NeedFunctionPrototypes
145 Widget, /* widget */
146 XPoint, /* ul */
147 XPoint, /* lr */
148 int /* dir */
149 #endif
152 typedef struct _XwManagerClassPart
154 XwTraversalProc traversal_handler;
155 XtTranslations translations;
156 } XwManagerClassPart;
158 typedef struct _XwManagerClassRec
160 CoreClassPart core_class;
161 CompositeClassPart composite_class;
162 ConstraintClassPart constraint_class;
163 XwManagerClassPart manager_class;
164 } XwManagerClassRec;
166 extern XwManagerClassRec XwmanagerClassRec;
168 typedef struct _XwManagerPart
170 Pixel foreground;
171 int background_tile;
173 Boolean traversal_on;
175 int highlight_thickness;
177 GC highlight_GC;
179 Widget active_child;
180 WidgetList managed_children;
181 Cardinal num_slots;
182 Cardinal num_managed_children;
183 int layout;
184 XtCallbackList next_top;
185 } XwManagerPart;
187 typedef struct _XwManagerRec
189 CorePart core;
190 CompositePart composite;
191 ConstraintPart constraint;
192 XwManagerPart manager;
193 } XwManagerRec;
196 #define XtInheritTraversalProc ((XwTraversalProc) _XtInherit)
198 /**************************************
200 * Exported Routines from Manager.c
202 **************************************/
203 extern void _XwManagerEnter(); /* start traversal */
204 extern void _XwManagerLeave(); /* end traversal */
205 extern void _XwManagerFocusIn(); /* focus management */
206 extern void _XwManagerVisibility(); /* more focus management */
207 extern void _XwManagerUnmap(); /* even more focus management */
208 extern Boolean _XwFindTraversablePrim(); /* traversal checking routine */
209 extern void _XwReManageChildren(); /* rebuild Managed Children List */
210 extern void _XwManagerInsertChild(); /* special insert child routine */
211 extern Cardinal _XwInsertOrder(); /* compute position from arglist */
214 /************************************************************************
216 * Externs and defines for traversal handling functions incorporated
217 * into all primitive widgets.
219 ************************************************************************/
221 extern void mgr_traversal();
222 extern void _XwDrawBox();
223 extern void XwSetFocusPath();
224 extern void XwMoveFocus();
225 extern void XwProcessTraversal();
226 extern void XwSetInputFocus();
227 extern void _XwInitCheckList();
230 /* Traversal direction defines */
232 #define XwTRAVERSE_CURRENT 0
233 #define XwTRAVERSE_LEFT 1
234 #define XwTRAVERSE_RIGHT 2
235 #define XwTRAVERSE_UP 3
236 #define XwTRAVERSE_DOWN 4
237 #define XwTRAVERSE_NEXT 5
238 #define XwTRAVERSE_PREV 6
239 #define XwTRAVERSE_HOME 7
240 #define XwTRAVERSE_NEXT_TOP 8
243 /**************************************
245 * Exported Routines from Button.c
247 **************************************/
248 extern void _XwSetTextWidthAndHeight();
249 extern void _XwGetNormalGC();
250 extern void _XwGetSensitiveGC();
251 extern void _XwGetInverseGC();
252 extern void _XwInitializeButton();
253 extern void _XwRealize();
254 extern void _XwResizeButton();
255 extern void _XwRegisterName();
256 extern Boolean _XwRecomputeSize();
257 extern Boolean XwTestTraversability();
259 /************************************************************************
261 * New fields for the Button widget class record
262 * and the full class record.
264 ************************************************************************/
266 typedef struct _XwButtonClassPart
268 int mumble;
269 } XwButtonClassPart;
271 typedef struct _XwButtonClassRec
273 CoreClassPart core_class;
274 XwPrimitiveClassPart primitive_class;
275 XwButtonClassPart button_class;
276 } XwButtonClassRec;
278 extern XwButtonClassRec XwbuttonClassRec;
281 /************************************************************************
283 * New fields for the Button instance record and
284 * the full instance record.
286 ************************************************************************/
288 typedef struct _XwButtonPart
290 XFontStruct * font;
291 char * label;
292 int label_location;
293 Dimension internal_height;
294 Dimension internal_width;
295 int sensitive_tile;
296 GC normal_GC;
297 GC inverse_GC;
298 Position label_x;
299 Position label_y;
300 Dimension label_width;
301 Dimension label_height;
302 unsigned int label_len;
303 Boolean set;
304 Boolean display_set;
305 } XwButtonPart;
307 typedef struct _XwButtonRec
309 CorePart core;
310 XwPrimitivePart primitive;
311 XwButtonPart button;
312 } XwButtonRec;
315 /***********************************************************************
317 * Inherited functions exported by MenuBtn
319 ***********************************************************************/
321 #define XtInheritIdealWidthProc ((XwWidthProc) _XtInherit)
322 #define XtInheritUnhighlightProc ((XtWidgetProc) _XtInherit)
323 #define XtInheritHighlightProc ((XtWidgetProc) _XtInherit)
324 #define XtInheritEnterParentProc ((XtWidgetProc) _XtInherit)
326 /* Corrected by Steve Langasek (was incompatible with the revised Wprintf()) */
328 typedef void (*XwStrProc)(
329 #if NeedFunctionPrototypes
330 char *format, ... /* hint */
331 #endif
334 /***********************************************************************
336 * New Fields for the MenuPane widget class record, and
337 * the full class record.
339 ***********************************************************************/
341 typedef void (*XwWBoolProc)(
342 #if NeedFunctionPrototypes
343 Widget, /* widget */
344 Boolean /* flag */
345 #endif
348 typedef struct {
349 XwWBoolProc setTraversalFlag;
350 } XwMenuPaneClassPart;
352 /* Full class record declaration */
353 typedef struct _XwMenuPaneClassRec {
354 CoreClassPart core_class;
355 CompositeClassPart composite_class;
356 ConstraintClassPart constraint_class;
357 XwManagerClassPart manager_class;
358 XwMenuPaneClassPart menu_pane_class;
359 } XwMenuPaneClassRec;
361 extern XwMenuPaneClassRec XwmenupaneClassRec;
362 extern Boolean _XwAllAttachesAreSensitive();
364 #define XtInheritMenuPaneConstraintInit ((XtInitProc) _XtInherit)
365 #define XtInheritSetTraversalFlagProc ((XwWBoolProc) _XtInherit)
367 /***********************************************************************
369 * New Fields for the MenuPane widget instance record, and
370 * the full class record.
372 ***********************************************************************/
374 typedef struct {
375 /* Internal fields */
376 GC titleGC;
377 Widget attachId;
379 /* User settable fields */
380 XFontStruct * title_font;
381 String title_string;
382 Boolean title_showing;
383 String attach_to;
384 XImage * titleImage;
385 Boolean title_override;
386 int title_type;
387 String mnemonic;
388 XtCallbackList select;
389 } XwMenuPanePart;
392 typedef struct _XwMenuPaneRec {
393 CorePart core;
394 CompositePart composite;
395 ConstraintPart constraint;
396 XwManagerPart manager;
397 XwMenuPanePart menu_pane;
398 } XwMenuPaneRec;
401 /* New Procedures for _XtInherit, with proper function prototypes */
403 typedef void (*XwWidthProc)(
404 #if NeedFunctionPrototypes
405 Widget, /* widget */
406 Dimension* /* width */
407 #endif
410 typedef void (*XwWintProc)(
411 #if NeedFunctionPrototypes
412 Widget, /* widget */
413 int /* type */
414 #endif
417 typedef void (*XwWWProc)(
418 #if NeedFunctionPrototypes
419 Widget, /* manager */
420 Widget /* pane */
421 #endif
424 typedef void (*XwSelectProc)(
425 #if NeedFunctionPrototypes
426 Widget, /* manager */
427 Widget, /* button */
428 String, /* accelerator */
429 unsigned int, /* accelEventType */
430 unsigned int, /* accelDetail */
431 unsigned int /* accelModifiers */
432 #endif
435 typedef void (*XwWWSProc)(
436 #if NeedFunctionPrototypes
437 Widget, /* manager */
438 Widget, /* button */
439 String /* accelerator */
440 #endif
443 typedef void (*XwPostProc)(
444 #if NeedFunctionPrototypes
445 Widget, /* widget */
446 Widget, /* widget */
447 Widget, /* widget */
448 Position, /* x */
449 Position /* y */
450 #endif
453 typedef void (*XwSetSProc)(
454 #if NeedFunctionPrototypes
455 Widget, /* widget */
456 Position, /* left */
457 Position /* right */
458 #endif
461 /***********************************************************************
463 * Global functions exported by MapEvent.c
465 ***********************************************************************/
467 typedef Boolean (*XwBooleanProc)();
469 extern Boolean _XwMatchBtnEvent();
470 extern Boolean _XwMapBtnEvent();
471 extern Boolean _XwMapKeyEvent();
472 extern Boolean _XwMatchKeyEvent();
473 extern Boolean _XwValidModifier();
474 extern String _XwMapToHex();
475 extern unsigned long _XwMapFromHex();
477 extern void _XwSetMappedManagedChildrenList();
479 #define XtInheritAttachPane ((XwWWSProc) _XtInherit)
480 #define XtInheritDetachPane ((XwWWSProc) _XtInherit)
481 #define XtInheritAddPane ((XwWWProc) _XtInherit)
482 #define XtInheritSetSelectAccelerator ((XwSelectProc) _XtInherit)
483 #define XtInheritClearSelectAccelerator ((XwWWProc) _XtInherit)
484 #define XtInheritSetPostMnemonic ((XwWWSProc) _XtInherit)
485 #define XtInheritClearPostMnemonic ((XwWWProc) _XtInherit)
486 #define XtInheritAddButton ((XwWWProc) _XtInherit)
487 #define XtInheritSetSelectMnemonic ((XwWWSProc) _XtInherit)
488 #define XtInheritClearSelectMnemonic ((XwWWProc) _XtInherit)
489 #define XtInheritProcessSelect ((XwBooleanProc) _XtInherit)
490 #define XtInheritValidEvent ((XwBooleanProc) _XtInherit)
491 #define XtInheritDoICascade ((XwBooleanProc) _XtInherit)
492 #define XtInheritSetTitleAttributes ((XwWWProc) _XtInherit)
493 #define XtInheritPaneManagedChildren ((XwWWProc) _XtInherit)
494 #define XtInheritBtnSensitivityChanged ((XwWWProc) _XtInherit)
495 #define XtInheritPaneSensitivityChanged ((XwWWProc) _XtInherit)
497 /***********************************************************************
499 * New Fields for the MenuMgr widget class record, and
500 * the full class record.
502 ***********************************************************************/
504 typedef struct {
505 XwWWSProc attachPane;
506 XwWWSProc detachPane;
507 XwWWProc addPane;
508 XwSelectProc setSelectAccelerator;
509 XwWWProc clearSelectAccelerator;
510 XwWWSProc setPostMnemonic;
511 XwWWProc clearPostMnemonic;
512 XwWWProc addButton;
513 XwBooleanProc processSelect;
514 XwBooleanProc validEvent;
515 XwBooleanProc doICascade;
516 XwWWSProc setSelectMnemonic;
517 XwWWProc clearSelectMnemonic;
518 XwWWProc setTitleAttributes;
519 XwWWProc paneManagedChildren;
520 XwEventProc traverseLeft;
521 XwEventProc traverseRight;
522 XwEventProc traverseNext;
523 XwEventProc traversePrev;
524 XwEventProc traverseHome;
525 XwEventProc traverseUp;
526 XwEventProc traverseDown;
527 XwEventProc traverseNextTop;
528 XwWWProc btnSensitivityChanged;
529 XwWWProc paneSensitivityChanged;
530 } XwMenuMgrClassPart;
532 /* Full class record declaration */
533 typedef struct _XwMenuMgrClassRec {
534 CoreClassPart core_class;
535 CompositeClassPart composite_class;
536 ConstraintClassPart constraint_class;
537 XwManagerClassPart manager_class;
538 XwMenuMgrClassPart menu_mgr_class;
539 } XwMenuMgrClassRec;
541 extern XwMenuMgrClassRec XwmenumgrClassRec;
543 /***********************************************************************
545 * New Fields for the MenuMgr widget instance record, and
546 * the full class record.
548 ***********************************************************************/
550 /* Structure used by menu mgr to store keyboard accelerators */
551 typedef struct {
552 String accelString;
553 unsigned int accelEventType;
554 KeyCode accelKey;
555 unsigned int accelModifiers;
556 Widget menuBtn;
557 } XwKeyAccel;
559 /* Structure used by menu mgr to store pending attach requests */
560 typedef struct {
561 String menuBtnName;
562 Widget menupaneId;
563 } XwAttachList;
565 typedef struct {
566 /* Internal fields */
567 unsigned int postEventType;
568 unsigned int postButton;
569 unsigned int postModifiers;
570 unsigned int selectEventType;
571 unsigned int selectButton;
572 unsigned int selectModifiers;
573 XwKeyAccel * menuBtnAccelTable;
574 int numAccels;
575 int sizeAccelTable;
576 XwAttachList * pendingAttachList;
577 int numAttachReqs;
578 int sizeAttachList;
579 Boolean menuActive;
580 unsigned int unpostEventType;
581 KeyCode unpostKey;
582 unsigned int unpostModifiers;
583 unsigned int kbdSelectEventType;
584 KeyCode kbdSelectKey;
585 unsigned int kbdSelectModifiers;
587 /* User settable fields */
588 Boolean associateChildren;
589 String postString;
590 String selectString;
591 String unpostString;
592 String kbdSelectString;
593 } XwMenuMgrPart;
596 typedef struct _XwMenuMgrRec {
597 CorePart core;
598 CompositePart composite;
599 ConstraintPart constraint;
600 XwManagerPart manager;
601 XwMenuMgrPart menu_mgr;
602 } XwMenuMgrRec;