1 /*************************************<+>*************************************
2 *****************************************************************************
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
13 *****************************************************************************
15 ** Copyright (c) 1988 by Hewlett-Packard Company
16 ** Copyright (c) 1988 by the Massachusetts Institute of Technology
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
27 *****************************************************************************
28 *************************************<+>*************************************/
31 /***********************************************************************
33 * Miscellaneous Private Defines
35 ***********************************************************************/
37 #define XwStrlen(s) ((s) ? strlen(s) : 0)
43 /************************************************************************
45 * The Primitive Widget Class and instance records.
47 ************************************************************************/
49 typedef void (*XwEventProc
)(
50 #if NeedFunctionPrototypes
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
108 Boolean I_have_traversal
;
110 int highlight_thickness
;
112 Pixel highlight_color
;
116 Boolean recompute_size
;
120 Boolean display_sensitive
;
122 Boolean display_highlighted
;
124 XtCallbackList select
;
125 XtCallbackList release
;
126 XtCallbackList toggle
;
129 typedef struct _XwPrimitiveRec
132 XwPrimitivePart primitive
;
137 /************************************************************************
139 * The Manager Widget Class and instance records.
141 ************************************************************************/
143 typedef void (*XwTraversalProc
)(
144 #if NeedFunctionPrototypes
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
;
166 extern XwManagerClassRec XwmanagerClassRec
;
168 typedef struct _XwManagerPart
173 Boolean traversal_on
;
175 int highlight_thickness
;
180 WidgetList managed_children
;
182 Cardinal num_managed_children
;
184 XtCallbackList next_top
;
187 typedef struct _XwManagerRec
190 CompositePart composite
;
191 ConstraintPart constraint
;
192 XwManagerPart manager
;
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
271 typedef struct _XwButtonClassRec
273 CoreClassPart core_class
;
274 XwPrimitiveClassPart primitive_class
;
275 XwButtonClassPart button_class
;
278 extern XwButtonClassRec XwbuttonClassRec
;
281 /************************************************************************
283 * New fields for the Button instance record and
284 * the full instance record.
286 ************************************************************************/
288 typedef struct _XwButtonPart
293 Dimension internal_height
;
294 Dimension internal_width
;
300 Dimension label_width
;
301 Dimension label_height
;
302 unsigned int label_len
;
307 typedef struct _XwButtonRec
310 XwPrimitivePart primitive
;
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 */
334 /***********************************************************************
336 * New Fields for the MenuPane widget class record, and
337 * the full class record.
339 ***********************************************************************/
341 typedef void (*XwWBoolProc
)(
342 #if NeedFunctionPrototypes
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 ***********************************************************************/
375 /* Internal fields */
379 /* User settable fields */
380 XFontStruct
* title_font
;
382 Boolean title_showing
;
385 Boolean title_override
;
388 XtCallbackList select
;
392 typedef struct _XwMenuPaneRec
{
394 CompositePart composite
;
395 ConstraintPart constraint
;
396 XwManagerPart manager
;
397 XwMenuPanePart menu_pane
;
401 /* New Procedures for _XtInherit, with proper function prototypes */
403 typedef void (*XwWidthProc
)(
404 #if NeedFunctionPrototypes
406 Dimension
* /* width */
410 typedef void (*XwWintProc
)(
411 #if NeedFunctionPrototypes
417 typedef void (*XwWWProc
)(
418 #if NeedFunctionPrototypes
419 Widget
, /* manager */
424 typedef void (*XwSelectProc
)(
425 #if NeedFunctionPrototypes
426 Widget
, /* manager */
428 String
, /* accelerator */
429 unsigned int, /* accelEventType */
430 unsigned int, /* accelDetail */
431 unsigned int /* accelModifiers */
435 typedef void (*XwWWSProc
)(
436 #if NeedFunctionPrototypes
437 Widget
, /* manager */
439 String
/* accelerator */
443 typedef void (*XwPostProc
)(
444 #if NeedFunctionPrototypes
453 typedef void (*XwSetSProc
)(
454 #if NeedFunctionPrototypes
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 ***********************************************************************/
505 XwWWSProc attachPane
;
506 XwWWSProc detachPane
;
508 XwSelectProc setSelectAccelerator
;
509 XwWWProc clearSelectAccelerator
;
510 XwWWSProc setPostMnemonic
;
511 XwWWProc clearPostMnemonic
;
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
;
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 */
553 unsigned int accelEventType
;
555 unsigned int accelModifiers
;
559 /* Structure used by menu mgr to store pending attach requests */
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
;
576 XwAttachList
* pendingAttachList
;
580 unsigned int unpostEventType
;
582 unsigned int unpostModifiers
;
583 unsigned int kbdSelectEventType
;
584 KeyCode kbdSelectKey
;
585 unsigned int kbdSelectModifiers
;
587 /* User settable fields */
588 Boolean associateChildren
;
592 String kbdSelectString
;
596 typedef struct _XwMenuMgrRec
{
598 CompositePart composite
;
599 ConstraintPart constraint
;
600 XwManagerPart manager
;
601 XwMenuMgrPart menu_mgr
;