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. 12 ** 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 *************************************<+>*************************************/ 29 30 31 /*********************************************************************** 32 * 33 * Miscellaneous Private Defines 34 * 35 ***********************************************************************/ 36 37 #define XwStrlen(s) ((s) ? strlen(s) : 0) 38 #define XwBLOCK 10 39 #define XwMANAGER 1 40 #define XwPRIMITIVE 2 41 42 43 /************************************************************************ 44 * 45 * The Primitive Widget Class and instance records. 46 * 47 ************************************************************************/ 48 49 typedef void (*XwEventProc)( 50 #if NeedFunctionPrototypes 51 Widget, /* widget */ 52 XEvent* /* event */ 53 #endif 54 ); 55 56 typedef struct _XwPrimitiveClassPart 57 { 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; 65 66 typedef struct _XwPrimitiveClassRec 67 { 68 CoreClassPart core_class; 69 XwPrimitiveClassPart primitive_class; 70 } XwPrimitiveClassRec; 71 72 extern XwPrimitiveClassRec XwprimitiveClassRec; 73 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) 79 80 extern void _XwHighlightBorder(); 81 extern void _XwUnhighlightBorder(); 82 83 extern void _XwPrimitiveEnter(); 84 extern void _XwPrimitiveLeave(); 85 extern void _XwPrimitiveFocusIn(); 86 extern void _XwPrimitiveFocusOut(); 87 extern void _XwPrimitiveVisibility(); 88 extern void _XwPrimitiveUnmap(); 89 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(); 98 99 100 typedef struct _XwPrimitivePart 101 { 102 Pixel foreground; 103 int background_tile; 104 105 Cursor cursor; 106 107 int traversal_type; 108 Boolean I_have_traversal; 109 110 int highlight_thickness; 111 int highlight_style; 112 Pixel highlight_color; 113 int highlight_tile; 114 115 116 Boolean recompute_size; 117 118 GC highlight_GC; 119 120 Boolean display_sensitive; 121 Boolean highlighted; 122 Boolean display_highlighted; 123 124 XtCallbackList select; 125 XtCallbackList release; 126 XtCallbackList toggle; 127 } XwPrimitivePart; 128 129 typedef struct _XwPrimitiveRec 130 { 131 CorePart core; 132 XwPrimitivePart primitive; 133 } XwPrimitiveRec; 134 135 136 137 /************************************************************************ 138 * 139 * The Manager Widget Class and instance records. 140 * 141 ************************************************************************/ 142 143 typedef void (*XwTraversalProc)( 144 #if NeedFunctionPrototypes 145 Widget, /* widget */ 146 XPoint, /* ul */ 147 XPoint, /* lr */ 148 int /* dir */ 149 #endif 150 ); 151 152 typedef struct _XwManagerClassPart 153 { 154 XwTraversalProc traversal_handler; 155 XtTranslations translations; 156 } XwManagerClassPart; 157 158 typedef struct _XwManagerClassRec 159 { 160 CoreClassPart core_class; 161 CompositeClassPart composite_class; 162 ConstraintClassPart constraint_class; 163 XwManagerClassPart manager_class; 164 } XwManagerClassRec; 165 166 extern XwManagerClassRec XwmanagerClassRec; 167 168 typedef struct _XwManagerPart 169 { 170 Pixel foreground; 171 int background_tile; 172 173 Boolean traversal_on; 174 175 int highlight_thickness; 176 177 GC highlight_GC; 178 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; 186 187 typedef struct _XwManagerRec 188 { 189 CorePart core; 190 CompositePart composite; 191 ConstraintPart constraint; 192 XwManagerPart manager; 193 } XwManagerRec; 194 195 196 #define XtInheritTraversalProc ((XwTraversalProc) _XtInherit) 197 198 /************************************** 199 * 200 * Exported Routines from Manager.c 201 * 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 */ 212 213 214 /************************************************************************ 215 * 216 * Externs and defines for traversal handling functions incorporated 217 * into all primitive widgets. 218 * 219 ************************************************************************/ 220 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(); 228 229 230 /* Traversal direction defines */ 231 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 241 242 243 /************************************** 244 * 245 * Exported Routines from Button.c 246 * 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(); 258 259 /************************************************************************ 260 * 261 * New fields for the Button widget class record 262 * and the full class record. 263 * 264 ************************************************************************/ 265 266 typedef struct _XwButtonClassPart 267 { 268 int mumble; 269 } XwButtonClassPart; 270 271 typedef struct _XwButtonClassRec 272 { 273 CoreClassPart core_class; 274 XwPrimitiveClassPart primitive_class; 275 XwButtonClassPart button_class; 276 } XwButtonClassRec; 277 278 extern XwButtonClassRec XwbuttonClassRec; 279 280 281 /************************************************************************ 282 * 283 * New fields for the Button instance record and 284 * the full instance record. 285 * 286 ************************************************************************/ 287 288 typedef struct _XwButtonPart 289 { 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; 306 307 typedef struct _XwButtonRec 308 { 309 CorePart core; 310 XwPrimitivePart primitive; 311 XwButtonPart button; 312 } XwButtonRec; 313 314 315 /*********************************************************************** 316 * 317 * Inherited functions exported by MenuBtn 318 * 319 ***********************************************************************/ 320 321 #define XtInheritIdealWidthProc ((XwWidthProc) _XtInherit) 322 #define XtInheritUnhighlightProc ((XtWidgetProc) _XtInherit) 323 #define XtInheritHighlightProc ((XtWidgetProc) _XtInherit) 324 #define XtInheritEnterParentProc ((XtWidgetProc) _XtInherit) 325 326 /* Corrected by Steve Langasek (was incompatible with the revised Wprintf()) */ 327 328 typedef void (*XwStrProc)( 329 #if NeedFunctionPrototypes 330 char *format, ... /* hint */ 331 #endif 332 ); 333 334 /*********************************************************************** 335 * 336 * New Fields for the MenuPane widget class record, and 337 * the full class record. 338 * 339 ***********************************************************************/ 340 341 typedef void (*XwWBoolProc)( 342 #if NeedFunctionPrototypes 343 Widget, /* widget */ 344 Boolean /* flag */ 345 #endif 346 ); 347 348 typedef struct { 349 XwWBoolProc setTraversalFlag; 350 } XwMenuPaneClassPart; 351 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; 360 361 extern XwMenuPaneClassRec XwmenupaneClassRec; 362 extern Boolean _XwAllAttachesAreSensitive(); 363 364 #define XtInheritMenuPaneConstraintInit ((XtInitProc) _XtInherit) 365 #define XtInheritSetTraversalFlagProc ((XwWBoolProc) _XtInherit) 366 367 /*********************************************************************** 368 * 369 * New Fields for the MenuPane widget instance record, and 370 * the full class record. 371 * 372 ***********************************************************************/ 373 374 typedef struct { 375 /* Internal fields */ 376 GC titleGC; 377 Widget attachId; 378 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; 390 391 392 typedef struct _XwMenuPaneRec { 393 CorePart core; 394 CompositePart composite; 395 ConstraintPart constraint; 396 XwManagerPart manager; 397 XwMenuPanePart menu_pane; 398 } XwMenuPaneRec; 399 400 401 /* New Procedures for _XtInherit, with proper function prototypes */ 402 403 typedef void (*XwWidthProc)( 404 #if NeedFunctionPrototypes 405 Widget, /* widget */ 406 Dimension* /* width */ 407 #endif 408 ); 409 410 typedef void (*XwWintProc)( 411 #if NeedFunctionPrototypes 412 Widget, /* widget */ 413 int /* type */ 414 #endif 415 ); 416 417 typedef void (*XwWWProc)( 418 #if NeedFunctionPrototypes 419 Widget, /* manager */ 420 Widget /* pane */ 421 #endif 422 ); 423 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 433 ); 434 435 typedef void (*XwWWSProc)( 436 #if NeedFunctionPrototypes 437 Widget, /* manager */ 438 Widget, /* button */ 439 String /* accelerator */ 440 #endif 441 ); 442 443 typedef void (*XwPostProc)( 444 #if NeedFunctionPrototypes 445 Widget, /* widget */ 446 Widget, /* widget */ 447 Widget, /* widget */ 448 Position, /* x */ 449 Position /* y */ 450 #endif 451 ); 452 453 typedef void (*XwSetSProc)( 454 #if NeedFunctionPrototypes 455 Widget, /* widget */ 456 Position, /* left */ 457 Position /* right */ 458 #endif 459 ); 460 461 /*********************************************************************** 462 * 463 * Global functions exported by MapEvent.c 464 * 465 ***********************************************************************/ 466 467 typedef Boolean (*XwBooleanProc)(); 468 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(); 476 477 extern void _XwSetMappedManagedChildrenList(); 478 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) 496 497 /*********************************************************************** 498 * 499 * New Fields for the MenuMgr widget class record, and 500 * the full class record. 501 * 502 ***********************************************************************/ 503 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; 531 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; 540 541 extern XwMenuMgrClassRec XwmenumgrClassRec; 542 543 /*********************************************************************** 544 * 545 * New Fields for the MenuMgr widget instance record, and 546 * the full class record. 547 * 548 ***********************************************************************/ 549 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; 558 559 /* Structure used by menu mgr to store pending attach requests */ 560 typedef struct { 561 String menuBtnName; 562 Widget menupaneId; 563 } XwAttachList; 564 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; 586 587 /* User settable fields */ 588 Boolean associateChildren; 589 String postString; 590 String selectString; 591 String unpostString; 592 String kbdSelectString; 593 } XwMenuMgrPart; 594 595 596 typedef struct _XwMenuMgrRec { 597 CorePart core; 598 CompositePart composite; 599 ConstraintPart constraint; 600 XwManagerPart manager; 601 XwMenuMgrPart menu_mgr; 602 } XwMenuMgrRec; 603 604 605 606