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