| 1 | /* |
| 2 | * tixInt.h -- |
| 3 | * |
| 4 | * Defines internal data types and functions used by the Tix library. |
| 5 | * |
| 6 | * Copyright (c) 1996, Expert Interface Technologies |
| 7 | * |
| 8 | * See the file "license.terms" for information on usage and redistribution |
| 9 | * of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 10 | * |
| 11 | */ |
| 12 | #ifndef _TIX |
| 13 | #include "tix.h" |
| 14 | #endif |
| 15 | #ifndef _TIXINT |
| 16 | #define _TIXINT |
| 17 | #define _TIX_INT_H_ |
| 18 | |
| 19 | /*---------------------------------------------------------------------- |
| 20 | * |
| 21 | * Tix Display Item Types |
| 22 | * |
| 23 | *---------------------------------------------------------------------- |
| 24 | */ |
| 25 | |
| 26 | #define TIX_DITEM_NONE 0 |
| 27 | #define TIX_DITEM_TEXT 1 |
| 28 | #define TIX_DITEM_IMAGETEXT 2 |
| 29 | #define TIX_DITEM_WINDOW 3 |
| 30 | #define TIX_DITEM_IMAGE 4 |
| 31 | |
| 32 | /* |
| 33 | * The flags for drawing DItems |
| 34 | */ |
| 35 | |
| 36 | #define TIX_DITEM_NORMAL_BG (0x1 << 0) |
| 37 | #define TIX_DITEM_ACTIVE_BG (0x1 << 1) |
| 38 | #define TIX_DITEM_SELECTED_BG (0x1 << 2) |
| 39 | #define TIX_DITEM_DISABLED_BG (0x1 << 3) |
| 40 | #define TIX_DITEM_NORMAL_FG (0x1 << 4) |
| 41 | #define TIX_DITEM_ACTIVE_FG (0x1 << 5) |
| 42 | #define TIX_DITEM_SELECTED_FG (0x1 << 6) |
| 43 | #define TIX_DITEM_DISABLED_FG (0x1 << 7) |
| 44 | #define TIX_DITEM_FONT (0x1 << 8) |
| 45 | #define TIX_DITEM_PADX (0x1 << 9) |
| 46 | #define TIX_DITEM_PADY (0x1 << 10) |
| 47 | |
| 48 | #define TIX_DONT_CALL_CONFIG TK_CONFIG_USER_BIT |
| 49 | |
| 50 | /* |
| 51 | * These values are used ONLY for indexing the color array in |
| 52 | * Tix_StyleTemplate |
| 53 | */ |
| 54 | |
| 55 | #define TIX_DITEM_NORMAL 0 |
| 56 | #define TIX_DITEM_ACTIVE 1 |
| 57 | #define TIX_DITEM_SELECTED 2 |
| 58 | #define TIX_DITEM_DISABLED 3 |
| 59 | |
| 60 | /* |
| 61 | * Flags for MultiInfo |
| 62 | */ |
| 63 | #define TIX_CONFIG_INFO 1 |
| 64 | #define TIX_CONFIG_VALUE 2 |
| 65 | |
| 66 | typedef union Tix_DItem Tix_DItem; |
| 67 | typedef union Tix_DItemStyle Tix_DItemStyle; |
| 68 | typedef struct Tix_DItemInfo Tix_DItemInfo; |
| 69 | typedef struct Tix_DispData Tix_DispData; |
| 70 | typedef struct Tix_StyleTemplate Tix_StyleTemplate; |
| 71 | |
| 72 | typedef void Tix_DItemCalculateSizeProc _ANSI_ARGS_(( |
| 73 | Tix_DItem * iPtr)); |
| 74 | typedef char * Tix_DItemComponentProc _ANSI_ARGS_(( |
| 75 | Tix_DItem * iPtr, int x, int y)); |
| 76 | typedef int Tix_DItemConfigureProc _ANSI_ARGS_(( |
| 77 | Tix_DItem * iPtr, int argc, Tcl_Obj **objv, |
| 78 | int flags)); |
| 79 | typedef Tix_DItem * Tix_DItemCreateProc _ANSI_ARGS_(( |
| 80 | Tix_DispData * ddPtr, |
| 81 | Tix_DItemInfo * diTypePtr)); |
| 82 | typedef void Tix_DItemDisplayProc _ANSI_ARGS_(( |
| 83 | Pixmap pixmap, GC gc, Tix_DItem * iPtr, |
| 84 | int x, int y, int width, int height, int flag)); |
| 85 | typedef void Tix_DItemFreeProc _ANSI_ARGS_((Tix_DItem * diPtr)); |
| 86 | typedef void Tix_DItemSizeChangedProc _ANSI_ARGS_(( |
| 87 | Tix_DItem * iPtr)); |
| 88 | |
| 89 | typedef void Tix_DItemStyleChangedProc _ANSI_ARGS_(( |
| 90 | Tix_DItem * iPtr)); |
| 91 | typedef void Tix_DItemLostStyleProc _ANSI_ARGS_(( |
| 92 | Tix_DItem * iPtr)); |
| 93 | typedef int Tix_DItemStyleConfigureProc _ANSI_ARGS_(( |
| 94 | Tix_DItemStyle* style, int argc, Tcl_Obj **objv, |
| 95 | int flags)); |
| 96 | typedef Tix_DItemStyle* Tix_DItemStyleCreateProc _ANSI_ARGS_(( |
| 97 | Tcl_Interp * interp, Tk_Window tkwin, |
| 98 | Tix_DItemInfo * diTypePtr, char * name)); |
| 99 | typedef void Tix_DItemStyleFreeProc _ANSI_ARGS_(( |
| 100 | Tix_DItemStyle* style)); |
| 101 | typedef void Tix_DItemStyleSetTemplateProc _ANSI_ARGS_(( |
| 102 | Tix_DItemStyle* style, |
| 103 | Tix_StyleTemplate * tmplPtr)); |
| 104 | |
| 105 | /* |
| 106 | * These are debugging routines |
| 107 | */ |
| 108 | |
| 109 | typedef int Tix_DItemRefCountProc _ANSI_ARGS_(()); |
| 110 | typedef int Tix_DItemStyleRefCountProc _ANSI_ARGS_(()); |
| 111 | |
| 112 | /*---------------------------------------------------------------------- |
| 113 | * Tix_DItemInfo -- |
| 114 | * |
| 115 | * This structure is used to register a new display item (call |
| 116 | * Tix_AddDItemType). |
| 117 | *---------------------------------------------------------------------- |
| 118 | */ |
| 119 | struct Tix_DItemInfo { |
| 120 | char * name; |
| 121 | int type; |
| 122 | |
| 123 | /* |
| 124 | * These procedures communicate with the items |
| 125 | */ |
| 126 | Tix_DItemCreateProc * createProc; |
| 127 | Tix_DItemConfigureProc * configureProc; |
| 128 | Tix_DItemCalculateSizeProc * calculateSizeProc; |
| 129 | Tix_DItemComponentProc * componentProc; |
| 130 | Tix_DItemDisplayProc * displayProc; |
| 131 | Tix_DItemFreeProc * freeProc; |
| 132 | Tix_DItemStyleChangedProc *styleChangedProc; |
| 133 | Tix_DItemLostStyleProc * lostStyleProc; |
| 134 | |
| 135 | /* |
| 136 | * These procedures communicate with the styles |
| 137 | */ |
| 138 | Tix_DItemStyleCreateProc * styleCreateProc; |
| 139 | Tix_DItemStyleConfigureProc * styleConfigureProc; |
| 140 | Tix_DItemStyleFreeProc * styleFreeProc; |
| 141 | Tix_DItemStyleSetTemplateProc * styleSetTemplateProc; |
| 142 | |
| 143 | Tk_ConfigSpec * itemConfigSpecs; |
| 144 | Tk_ConfigSpec * styleConfigSpecs; |
| 145 | struct Tix_DItemInfo * next; |
| 146 | }; |
| 147 | |
| 148 | /*---------------------------------------------------------------------- |
| 149 | * Tix_DispData -- |
| 150 | * |
| 151 | * Information needed by the display types to display the item in |
| 152 | * an X drawable. |
| 153 | *---------------------------------------------------------------------- |
| 154 | */ |
| 155 | struct Tix_DispData { |
| 156 | Display * display; |
| 157 | Tcl_Interp * interp; |
| 158 | Tk_Window tkwin; |
| 159 | Tix_DItemSizeChangedProc * sizeChangedProc; |
| 160 | }; |
| 161 | |
| 162 | /*---------------------------------------------------------------------- |
| 163 | * Tix_StyleTemplate -- |
| 164 | * |
| 165 | * A StyleTemplate is used to set the values of the default styles |
| 166 | * associated with a widget |
| 167 | *---------------------------------------------------------------------- |
| 168 | */ |
| 169 | struct Tix_StyleTemplate { |
| 170 | int flags; /* determines which field is valid */ |
| 171 | |
| 172 | struct { |
| 173 | XColor * bg; |
| 174 | XColor * fg; |
| 175 | } colors[4]; /* colors for the four basic modes*/ |
| 176 | |
| 177 | int pad[2]; |
| 178 | #if 0 |
| 179 | /* %bordercolor not used */ |
| 180 | XColor * borderColor; |
| 181 | Tix_Relief relief; |
| 182 | int borderWidth; |
| 183 | #endif |
| 184 | TixFont font; |
| 185 | }; |
| 186 | |
| 187 | /*---------------------------------------------------------------------- |
| 188 | * |
| 189 | * |
| 190 | * Display Item Types |
| 191 | * |
| 192 | * |
| 193 | *---------------------------------------------------------------------- |
| 194 | */ |
| 195 | |
| 196 | /* |
| 197 | * Display Styles |
| 198 | */ |
| 199 | typedef struct TixBaseStyle TixBaseStyle; |
| 200 | typedef struct TixImageTextStyle TixImageTextStyle; |
| 201 | typedef struct TixImageStyle TixImageStyle; |
| 202 | typedef struct TixTextStyle TixTextStyle; |
| 203 | typedef struct TixWindowStyle TixWindowStyle; |
| 204 | |
| 205 | typedef struct TixBaseItem TixBaseItem; |
| 206 | typedef struct TixColorStyle TixColorStyle; |
| 207 | typedef struct TixImageTextItem TixImageTextItem; |
| 208 | typedef struct TixImageItem TixImageItem; |
| 209 | typedef struct TixTextItem TixTextItem; |
| 210 | typedef struct TixWindowItem TixWindowItem; |
| 211 | |
| 212 | /*---------------------------------------------------------------------- |
| 213 | * TixBaseItem -- |
| 214 | * |
| 215 | * This is the abstract base class for all display items. All |
| 216 | * display items should have the data members defined in the |
| 217 | * BaseItem structure |
| 218 | *---------------------------------------------------------------------- |
| 219 | */ |
| 220 | #define ITEM_COMMON_MEMBERS \ |
| 221 | Tix_DItemInfo * diTypePtr; \ |
| 222 | Tix_DispData * ddPtr; \ |
| 223 | ClientData clientData; \ |
| 224 | int size[2] /* Size of this element */ \ |
| 225 | |
| 226 | struct TixBaseItem { |
| 227 | ITEM_COMMON_MEMBERS; |
| 228 | TixBaseStyle * stylePtr; |
| 229 | }; |
| 230 | |
| 231 | /*---------------------------------------------------------------------- |
| 232 | * TixBaseStyle -- |
| 233 | * |
| 234 | * This is the abstract base class for all display styles. All |
| 235 | * display items should have the data members defined in the |
| 236 | * BaseStyle structure. The common members are initialized by |
| 237 | * tixDiStyle.c |
| 238 | * |
| 239 | *---------------------------------------------------------------------- |
| 240 | */ |
| 241 | |
| 242 | #define STYLE_COMMON_MEMBERS \ |
| 243 | Tcl_Command styleCmd; /* Token for style's command. */ \ |
| 244 | Tcl_HashTable items; /* Ditems affected by this style */ \ |
| 245 | int refCount; /* Number of ditems affected by this style */\ |
| 246 | int flags; /* Various attributes */ \ |
| 247 | Tcl_Interp *interp; /* Interpreter associated with style. */ \ |
| 248 | Tk_Window tkwin; /* Window associated with this style */ \ |
| 249 | Tix_DItemInfo * diTypePtr; \ |
| 250 | Tk_Anchor anchor; /* Anchor information */ \ |
| 251 | char * name; /* Name of this style */ \ |
| 252 | int pad[2] /* paddings */ |
| 253 | |
| 254 | |
| 255 | #if 0 |
| 256 | Tix_Relief relief |
| 257 | /* %bordercolor not used */ |
| 258 | int borderWidth; |
| 259 | XColor * borderColor; /* color of the border when it is displayed |
| 260 | * in "flat border" mode |
| 261 | */ |
| 262 | GC borderGC |
| 263 | #endif |
| 264 | |
| 265 | #define STYLE_COLOR_MEMBERS \ |
| 266 | struct { \ |
| 267 | XColor * bg; \ |
| 268 | XColor * fg; \ |
| 269 | GC foreGC; \ |
| 270 | GC backGC; \ |
| 271 | } colors[4] /* colors and GC's for the four basic modes*/ |
| 272 | |
| 273 | struct TixBaseStyle { |
| 274 | STYLE_COMMON_MEMBERS; |
| 275 | }; |
| 276 | |
| 277 | #define TIX_STYLE_DELETED 1 |
| 278 | #define TIX_STYLE_DEFAULT 2 |
| 279 | |
| 280 | /* |
| 281 | * Abstract type for all styles that have a color element |
| 282 | */ |
| 283 | struct TixColorStyle { |
| 284 | STYLE_COMMON_MEMBERS; |
| 285 | STYLE_COLOR_MEMBERS; |
| 286 | }; |
| 287 | |
| 288 | /*---------------------------------------------------------------------- |
| 289 | * ImageTextItem -- |
| 290 | * |
| 291 | * Display an image together with a text string |
| 292 | *---------------------------------------------------------------------- |
| 293 | */ |
| 294 | struct TixImageTextItem { |
| 295 | ITEM_COMMON_MEMBERS; |
| 296 | |
| 297 | TixImageTextStyle *stylePtr; |
| 298 | /*-------------------------*/ |
| 299 | /* Bitmap */ |
| 300 | /*-------------------------*/ |
| 301 | Pixmap bitmap; |
| 302 | int bitmapW, bitmapH; /* Size of bitmap */ |
| 303 | |
| 304 | /*-------------------------*/ |
| 305 | /* Image */ |
| 306 | /*-------------------------*/ |
| 307 | char *imageString; /* Name of image to display (malloc'ed), or |
| 308 | * NULL. If non-NULL, bitmap, text, and |
| 309 | * textVarName are ignored. */ |
| 310 | Tk_Image image; |
| 311 | int imageW, imageH; /* Size of image */ |
| 312 | |
| 313 | /*-------------------------*/ |
| 314 | /* Text */ |
| 315 | /*-------------------------*/ |
| 316 | |
| 317 | Arg text; /* Show descriptive text */ |
| 318 | size_t numChars; /* Size of text */ |
| 319 | int textW, textH; |
| 320 | int wrapLength; |
| 321 | Tk_Justify justify; /* Justification to use for multi-line text. */ |
| 322 | int underline; /* Index of character to underline. < 0 means |
| 323 | * don't underline anything. */ |
| 324 | |
| 325 | int showImage, showText; |
| 326 | }; |
| 327 | |
| 328 | struct TixImageTextStyle { |
| 329 | STYLE_COMMON_MEMBERS; |
| 330 | STYLE_COLOR_MEMBERS; |
| 331 | int wrapLength; |
| 332 | Tk_Justify justify; /* Justification to use for multi-line text. */ |
| 333 | TixFont font; |
| 334 | int gap; /* Gap between text and image */ |
| 335 | Tk_Anchor textanchor; /* Text anchor information */ |
| 336 | }; |
| 337 | |
| 338 | /*---------------------------------------------------------------------- |
| 339 | * ImageItem -- |
| 340 | * |
| 341 | * Displays an image |
| 342 | *---------------------------------------------------------------------- |
| 343 | */ |
| 344 | struct TixImageItem { |
| 345 | ITEM_COMMON_MEMBERS; |
| 346 | |
| 347 | TixImageStyle *stylePtr; |
| 348 | |
| 349 | /*-------------------------*/ |
| 350 | /* Image */ |
| 351 | /*-------------------------*/ |
| 352 | char *imageString; /* Name of image to display (malloc'ed), or |
| 353 | * NULL. If non-NULL, bitmap, text, and |
| 354 | * textVarName are ignored. */ |
| 355 | Tk_Image image; |
| 356 | int imageW, imageH; /* Size of image */ |
| 357 | }; |
| 358 | |
| 359 | struct TixImageStyle { |
| 360 | STYLE_COMMON_MEMBERS; |
| 361 | STYLE_COLOR_MEMBERS; |
| 362 | }; |
| 363 | /*---------------------------------------------------------------------- |
| 364 | * TextItem -- |
| 365 | * |
| 366 | * Displays a text string. |
| 367 | *---------------------------------------------------------------------- |
| 368 | */ |
| 369 | struct TixTextItem { |
| 370 | ITEM_COMMON_MEMBERS; |
| 371 | |
| 372 | TixTextStyle *stylePtr; |
| 373 | /*-------------------------*/ |
| 374 | /* Text */ |
| 375 | /*-------------------------*/ |
| 376 | |
| 377 | Arg text; /* Show descriptive text */ |
| 378 | size_t numChars; /* Size of text */ |
| 379 | int textW, textH; |
| 380 | int underline; /* Index of character to underline. < 0 means |
| 381 | * don't underline anything. */ |
| 382 | }; |
| 383 | |
| 384 | struct TixTextStyle { |
| 385 | STYLE_COMMON_MEMBERS; |
| 386 | STYLE_COLOR_MEMBERS; |
| 387 | int wrapLength; |
| 388 | Tk_Justify justify; /* Justification to use for multi-line text. */ |
| 389 | TixFont font; |
| 390 | }; |
| 391 | |
| 392 | /*---------------------------------------------------------------------- |
| 393 | * WindowItem -- |
| 394 | * |
| 395 | * Displays a window. |
| 396 | *---------------------------------------------------------------------- |
| 397 | */ |
| 398 | struct TixWindowItem { |
| 399 | ITEM_COMMON_MEMBERS; |
| 400 | TixWindowStyle *stylePtr; |
| 401 | Tk_Window tkwin; |
| 402 | struct TixWindowItem * next; |
| 403 | int serial; |
| 404 | }; |
| 405 | |
| 406 | struct TixWindowStyle { |
| 407 | STYLE_COMMON_MEMBERS; |
| 408 | }; |
| 409 | |
| 410 | /*---------------------------------------------------------------------- |
| 411 | * Tix_DItem and Tix_DItemStyle -- |
| 412 | * |
| 413 | * These unions just make it easy to address the internals of the |
| 414 | * structures of the display items and styles. If you create a new |
| 415 | * display item, you will need to do you type casting yourself. |
| 416 | *---------------------------------------------------------------------- |
| 417 | */ |
| 418 | union Tix_DItem { |
| 419 | TixBaseItem base; |
| 420 | TixImageTextItem imagetext; |
| 421 | TixTextItem text; |
| 422 | TixWindowItem window; |
| 423 | TixImageItem image; |
| 424 | }; |
| 425 | |
| 426 | union Tix_DItemStyle { |
| 427 | TixBaseStyle base; |
| 428 | TixColorStyle color; |
| 429 | TixImageTextStyle imagetext; |
| 430 | TixTextStyle text; |
| 431 | TixWindowStyle window; |
| 432 | TixImageStyle image; |
| 433 | }; |
| 434 | |
| 435 | #define Tix_DItemType(x) ((x)->base.diTypePtr->type) |
| 436 | #define Tix_DItemTypeName(x) ((x)->base.diTypePtr->name) |
| 437 | #define Tix_DItemWidth(x) ((x)->base.size[0]) |
| 438 | #define Tix_DItemHeight(x) ((x)->base.size[1]) |
| 439 | #define Tix_DItemConfigSpecs(x) ((x)->base.diTypePtr->itemConfigSpecs) |
| 440 | #define Tix_DItemPadX(x) ((x)->base.stylePtr->pad[0]) |
| 441 | #define Tix_DItemPadY(x) ((x)->base.stylePtr->pad[1]) |
| 442 | |
| 443 | #define TIX_WIDTH 0 |
| 444 | #define TIX_HEIGHT 1 |
| 445 | |
| 446 | /*---------------------------------------------------------------------- |
| 447 | * Tix_ArgumentList -- |
| 448 | * |
| 449 | * This data structure is used to split command arguments for |
| 450 | * the display item types |
| 451 | *---------------------------------------------------------------------- |
| 452 | */ |
| 453 | #define FIXED_SIZE 4 |
| 454 | typedef struct { |
| 455 | int argc; |
| 456 | Tcl_Obj **objv; |
| 457 | } Tix_Argument; |
| 458 | |
| 459 | typedef struct { |
| 460 | Tix_Argument * arg; |
| 461 | int numLists; |
| 462 | Tix_Argument preAlloc[FIXED_SIZE]; |
| 463 | } Tix_ArgumentList; |
| 464 | |
| 465 | /*---------------------------------------------------------------------- |
| 466 | * Tix_ScrollInfo -- |
| 467 | * |
| 468 | * This data structure encapsulates all the necessary operations |
| 469 | * for scrolling widgets |
| 470 | *---------------------------------------------------------------------- |
| 471 | */ |
| 472 | #define TIX_SCROLL_INT 1 |
| 473 | #define TIX_SCROLL_DOUBLE 2 |
| 474 | |
| 475 | /* abstract type */ |
| 476 | typedef struct Tix_ScrollInfo { |
| 477 | int type; /* TIX_SCROLL_INT or TIX_SCROLL_DOUBLE */ |
| 478 | LangCallback *command; |
| 479 | /* place holder for actual space - double must be mentioned |
| 480 | to force alignment for too-clever-by-half compilers |
| 481 | */ |
| 482 | union { |
| 483 | int iscroll[4]; |
| 484 | double dscroll[4]; |
| 485 | } info; |
| 486 | } Tix_ScrollInfo; |
| 487 | |
| 488 | typedef struct Tix_IntScrollInfo { |
| 489 | int type; /* TIX_SCROLL_INT */ |
| 490 | LangCallback *command; |
| 491 | |
| 492 | int total; /* total size (width or height) of the widget*/ |
| 493 | int window; /* visible size */ |
| 494 | int offset; /* The top/left side of the scrolled widget */ |
| 495 | int unit; /* How much should we scroll when the user |
| 496 | * press the arrow on a scrollbar? */ |
| 497 | |
| 498 | } Tix_IntScrollInfo; |
| 499 | |
| 500 | typedef struct Tix_DoubleScrollInfo { |
| 501 | int type; /* TIX_SCROLL_DOUBLE */ |
| 502 | LangCallback *command; |
| 503 | |
| 504 | double total; /* total size (width or height) of the widget*/ |
| 505 | double window; /* visible size */ |
| 506 | double offset; /* The top/left side of the scrolled widget */ |
| 507 | double unit; /* How much should we scroll when the user |
| 508 | * press the arrow on a scrollbar? */ |
| 509 | } Tix_DoubleScrollInfo; |
| 510 | |
| 511 | /*---------------------------------------------------------------------- |
| 512 | * |
| 513 | * Global variables |
| 514 | * |
| 515 | * Should be used only in the Tix library. Some systems don't support |
| 516 | * exporting of global variables from shared libraries. |
| 517 | * |
| 518 | *---------------------------------------------------------------------- |
| 519 | */ |
| 520 | EXTERN Tk_Uid tixNormalUid; |
| 521 | EXTERN Tk_Uid tixDisabledUid; |
| 522 | EXTERN Tk_Uid tixCellUid; |
| 523 | EXTERN Tk_Uid tixRowUid; |
| 524 | EXTERN Tk_Uid tixColumnUid; |
| 525 | |
| 526 | #define FLAG_READONLY 0 |
| 527 | #define FLAG_STATIC 1 |
| 528 | #define FLAG_FORCECALL 2 |
| 529 | |
| 530 | /*---------------------------------------------------------------------- |
| 531 | * |
| 532 | * |
| 533 | * MEGA-WIDGET CONFIG HANDLING |
| 534 | * |
| 535 | * |
| 536 | *---------------------------------------------------------------------- |
| 537 | */ |
| 538 | typedef struct _TixConfigSpec TixConfigSpec; |
| 539 | typedef struct _TixConfigAlias TixConfigAlias; |
| 540 | typedef struct _TixClassRecord TixClassRecord; |
| 541 | |
| 542 | struct _TixConfigSpec { |
| 543 | unsigned int isAlias : 1; |
| 544 | unsigned int readOnly : 1; |
| 545 | unsigned int isStatic : 1; |
| 546 | unsigned int forceCall : 1; |
| 547 | |
| 548 | char * argvName; |
| 549 | char * defValue; |
| 550 | |
| 551 | char * dbName; /* The additional parts of a */ |
| 552 | char * dbClass; /* TixWidgetConfigSpec structure */ |
| 553 | |
| 554 | char *verifyCmd; |
| 555 | |
| 556 | TixConfigSpec * realPtr; /* valid only if this option is an alias */ |
| 557 | }; |
| 558 | |
| 559 | /* |
| 560 | * Controls the access of root widget and subwidget commands and options |
| 561 | */ |
| 562 | typedef struct _Tix_ExportSpec { |
| 563 | Tix_LinkList exportCmds; |
| 564 | Tix_LinkList restrictCmds; |
| 565 | Tix_LinkList exportOpts; |
| 566 | Tix_LinkList restrictOpts; |
| 567 | } Tix_ExportSpec; |
| 568 | |
| 569 | typedef struct _Tix_SubWidgetSpec { |
| 570 | struct _Tix_SubWidgetSpec * next; |
| 571 | char * name; |
| 572 | Tix_ExportSpec export; |
| 573 | } Tix_SubWidgetSpec; |
| 574 | |
| 575 | typedef struct _Tix_StringLink { |
| 576 | struct _Tix_StringLink *next; |
| 577 | char * string; |
| 578 | } Tix_StringLink; |
| 579 | |
| 580 | typedef struct _Tix_SubwidgetDef { |
| 581 | struct _TixSubwidgetDef * next; |
| 582 | char * spec; |
| 583 | char * value; |
| 584 | } Tix_SubwidgetDef; |
| 585 | |
| 586 | typedef struct _TixClassParseStruct { |
| 587 | char * alias; |
| 588 | char * ClassName; |
| 589 | char * configSpec; |
| 590 | char * def; |
| 591 | char * flag; |
| 592 | char * forceCall; |
| 593 | char * method; |
| 594 | char * readOnly; |
| 595 | char * isStatic; |
| 596 | char * superClass; |
| 597 | char * subWidget; |
| 598 | char * isVirtual; |
| 599 | |
| 600 | int optArgc; |
| 601 | char ** optArgv; |
| 602 | } TixClassParseStruct; |
| 603 | |
| 604 | struct _TixClassRecord { |
| 605 | TixClassRecord * next; /* Chains to the next class record in |
| 606 | * a superClass's unInitSubCls list */ |
| 607 | TixClassRecord * superClass; /* The superclass of this class. Is |
| 608 | * NULL if this class does not have |
| 609 | * a superclass. */ |
| 610 | unsigned int isWidget; /* TRUE iff this class is created by |
| 611 | * the "tixWidgetClass" command */ |
| 612 | char * className; /* Instiantiation command */ |
| 613 | char * ClassName; /* used in TK option database */ |
| 614 | |
| 615 | int nSpecs; |
| 616 | TixConfigSpec ** specs; |
| 617 | int nMethods; |
| 618 | char ** methods; |
| 619 | Tk_Window mainWindow; /* This variable is essentially |
| 620 | * a cached variable so that |
| 621 | * we can advoid calling |
| 622 | * Tk_MainWindow() */ |
| 623 | int isVirtual; /* is this a virtual base class |
| 624 | * (shouldn't be instantiated)*/ |
| 625 | TixClassParseStruct*parsePtr; /* Information supplied by the |
| 626 | * tixClass or tixWidgetClass |
| 627 | * commands */ |
| 628 | Tix_LinkList unInitSubCls; /* The subclasses that have not been |
| 629 | * initialized. */ |
| 630 | int initialized; /* Is this class initialized? A class |
| 631 | * is not initialized if it has been |
| 632 | * defined but some its superclass |
| 633 | * is not initialized. |
| 634 | */ |
| 635 | Tix_LinkList subWDefs; /* the -defaults option */ |
| 636 | #if USE_ACCESS_CONTROL |
| 637 | Tix_LinkList subWidgets; |
| 638 | Tix_ExportSpec exportSpec; /* controls the export status |
| 639 | * of the commands and options |
| 640 | * of the root widget */ |
| 641 | #endif |
| 642 | }; |
| 643 | |
| 644 | typedef struct _TixInterpState { |
| 645 | char * result; |
| 646 | char * errorInfo; |
| 647 | char * errorCode; |
| 648 | } TixInterpState; |
| 649 | |
| 650 | /*---------------------------------------------------------------------- |
| 651 | * |
| 652 | * Internal procedures |
| 653 | * |
| 654 | *---------------------------------------------------------------------- |
| 655 | */ |
| 656 | |
| 657 | EXTERN int Tix_CallConfigMethod _ANSI_ARGS_(( |
| 658 | Tcl_Interp *interp, TixClassRecord *cPtr, |
| 659 | char * widRec, TixConfigSpec *spec, char * value)); |
| 660 | EXTERN int Tix_CallMethod _ANSI_ARGS_((Tcl_Interp *interp, |
| 661 | char *context, char *widRec, char *method, |
| 662 | int argc, Tcl_Obj **objv)); |
| 663 | EXTERN int Tix_ChangeOneOption _ANSI_ARGS_(( |
| 664 | Tcl_Interp *interp, TixClassRecord *cPtr, |
| 665 | char * widRec, TixConfigSpec *spec, char * value, |
| 666 | int isDefault, int isInit)); |
| 667 | EXTERN int Tix_ChangeOptions _ANSI_ARGS_(( |
| 668 | Tcl_Interp *interp, TixClassRecord *cPtr, |
| 669 | char * widRec, int argc, Tcl_Obj **objv)); |
| 670 | EXTERN TixConfigSpec * Tix_FindConfigSpecByName _ANSI_ARGS_(( |
| 671 | Tcl_Interp * interp, |
| 672 | TixClassRecord * cPtr, char * name)); |
| 673 | EXTERN char * Tix_FindMethod _ANSI_ARGS_((Tcl_Interp *interp, |
| 674 | char *context, char *method)); |
| 675 | EXTERN char * Tix_FindPublicMethod _ANSI_ARGS_(( |
| 676 | Tcl_Interp *interp, TixClassRecord * cPtr, |
| 677 | char * method)); |
| 678 | EXTERN int Tix_GetChars _ANSI_ARGS_((Tcl_Interp *interp, |
| 679 | char *string, double *doublePtr)); |
| 680 | EXTERN char * Tix_GetConfigSpecFullName _ANSI_ARGS_((char *clasRec, |
| 681 | char *flag)); |
| 682 | EXTERN char * Tix_GetContext _ANSI_ARGS_(( |
| 683 | Tcl_Interp * interp, char * widRec)); |
| 684 | EXTERN char * Tix_GetMethodFullName _ANSI_ARGS_((char *context, |
| 685 | char *method)); |
| 686 | EXTERN void Tix_GetPublicMethods _ANSI_ARGS_((Tcl_Interp *interp, |
| 687 | char *widRec, int *numMethods, |
| 688 | char *** validMethods)); |
| 689 | EXTERN int Tix_GetWidgetOption _ANSI_ARGS_(( |
| 690 | Tcl_Interp *interp, Tk_Window tkwin, |
| 691 | char *argvName, char *dbName, char *dbClass, |
| 692 | char *defValue, int argc, Tcl_Obj **objv, |
| 693 | int type, char *ptr)); |
| 694 | EXTERN int Tix_GetVar _ANSI_ARGS_(( |
| 695 | Tcl_Interp *interp, TixClassRecord *cPtr, |
| 696 | char * widRec, char * flag)); |
| 697 | EXTERN int Tix_QueryAllOptions _ANSI_ARGS_(( |
| 698 | Tcl_Interp *interp, TixClassRecord * cPtr, |
| 699 | char *widRec)); |
| 700 | EXTERN int Tix_QueryOneOption _ANSI_ARGS_(( |
| 701 | Tcl_Interp *interp, TixClassRecord *cPtr, |
| 702 | char *widRec, char *flag)); |
| 703 | EXTERN int Tix_SuperClass _ANSI_ARGS_((Tcl_Interp *interp, |
| 704 | char *widClass, char ** superClass_ret)); |
| 705 | EXTERN int Tix_UnknownPublicMethodError _ANSI_ARGS_(( |
| 706 | Tcl_Interp *interp, TixClassRecord * cPtr, |
| 707 | char * widRec, char * method)); |
| 708 | EXTERN int Tix_ValueMissingError _ANSI_ARGS_((Tcl_Interp *interp, |
| 709 | char *spec)); |
| 710 | EXTERN void Tix_AddDItemType _ANSI_ARGS_(( |
| 711 | Tix_DItemInfo * diTypePtr)); |
| 712 | EXTERN int Tix_ConfigureInfo2 _ANSI_ARGS_(( |
| 713 | Tcl_Interp *interp, Tk_Window tkwin, |
| 714 | char *entRec, Tk_ConfigSpec *entConfigSpecs, |
| 715 | Tix_DItem * iPtr, char *argvName, int flags)); |
| 716 | EXTERN int Tix_ConfigureValue2 _ANSI_ARGS_((Tcl_Interp *interp, |
| 717 | Tk_Window tkwin, char * entRec, |
| 718 | Tk_ConfigSpec *entConfigSpecs, Tix_DItem * iPtr, |
| 719 | char *argvName, int flags)); |
| 720 | EXTERN void Tix_DItemCalculateSize _ANSI_ARGS_(( |
| 721 | Tix_DItem * iPtr)); |
| 722 | EXTERN char * Tix_DItemComponent _ANSI_ARGS_((Tix_DItem * diPtr, |
| 723 | int x, int y)); |
| 724 | EXTERN int Tix_DItemConfigure _ANSI_ARGS_(( |
| 725 | Tix_DItem * diPtr, int argc, |
| 726 | Tcl_Obj **objv, int flags)); |
| 727 | EXTERN Tix_DItem * Tix_DItemCreate _ANSI_ARGS_((Tix_DispData * ddPtr, |
| 728 | char * type)); |
| 729 | EXTERN void Tix_DItemDrawBackground _ANSI_ARGS_(( |
| 730 | Pixmap pixmap, GC gc, Tix_DItem * iPtr, |
| 731 | int x, int y, int width, int height, int flags)); |
| 732 | EXTERN void Tix_DItemDisplay _ANSI_ARGS_(( |
| 733 | Pixmap pixmap, GC gc, Tix_DItem * iPtr, |
| 734 | int x, int y, int width, int height, int flag)); |
| 735 | EXTERN void Tix_DItemFree _ANSI_ARGS_(( |
| 736 | Tix_DItem * iPtr)); |
| 737 | EXTERN void TixDItemStyleChanged _ANSI_ARGS_(( |
| 738 | Tix_DItemInfo * diTypePtr, |
| 739 | Tix_DItemStyle * stylePtr)); |
| 740 | EXTERN void TixDItemStyleFree _ANSI_ARGS_((Tix_DItem *iPtr, |
| 741 | Tix_DItemStyle * stylePtr)); |
| 742 | EXTERN void TixDItemGetAnchor _ANSI_ARGS_((Tk_Anchor anchor, |
| 743 | int x, int y, int cav_w, int cav_h, |
| 744 | int width, int height, int * x_ret, int * y_ret)); |
| 745 | EXTERN void Tix_FreeArgumentList _ANSI_ARGS_(( |
| 746 | Tix_ArgumentList *argListPtr)); |
| 747 | EXTERN void TixGetColorDItemGC _ANSI_ARGS_(( |
| 748 | Tix_DItem * iPtr, GC * backGC_ret, |
| 749 | GC * foreGC_ret, int flags)); |
| 750 | EXTERN Tix_DItemStyle* TixGetDefaultDItemStyle _ANSI_ARGS_(( |
| 751 | Tix_DispData * ddPtr, Tix_DItemInfo * diTypePtr, |
| 752 | Tix_DItem *iPtr, Tix_DItemStyle* oldStylePtr)); |
| 753 | EXTERN Tix_DItemInfo * Tix_GetDItemType _ANSI_ARGS_(( |
| 754 | Tcl_Interp * interp, char *type)); |
| 755 | EXTERN void Tix_GetScrollFractions _ANSI_ARGS_(( |
| 756 | Tix_ScrollInfo * siPtr, |
| 757 | double * first_ret, double * last_ret)); |
| 758 | EXTERN void Tix_InitScrollInfo _ANSI_ARGS_(( |
| 759 | Tix_ScrollInfo * siPtr, int type)); |
| 760 | EXTERN int Tix_MultiConfigureInfo _ANSI_ARGS_(( |
| 761 | Tcl_Interp * interp, |
| 762 | Tk_Window tkwin, Tk_ConfigSpec **specsList, |
| 763 | int numLists, char **widgRecList, char *argvName, |
| 764 | int flags, int request)); |
| 765 | EXTERN void Tix_SetDefaultStyleTemplate _ANSI_ARGS_(( |
| 766 | Tk_Window tkwin, Tix_StyleTemplate * tmplPtr)); |
| 767 | EXTERN int Tix_SetScrollBarView _ANSI_ARGS_(( |
| 768 | Tcl_Interp *interp, Tix_ScrollInfo * siPtr, |
| 769 | int argc, Tcl_Obj **objv, int compat)); |
| 770 | EXTERN void Tix_SetWindowItemSerial _ANSI_ARGS_(( |
| 771 | Tix_LinkList * lPtr, Tix_DItem * iPtr, |
| 772 | int serial)); |
| 773 | EXTERN int Tix_SplitConfig _ANSI_ARGS_((Tcl_Interp * interp, |
| 774 | Tk_Window tkwin, Tk_ConfigSpec ** specsList, |
| 775 | int numLists, int argc, Tcl_Obj **objv, |
| 776 | Tix_ArgumentList * argListPtr)); |
| 777 | EXTERN void Tix_UnmapInvisibleWindowItems _ANSI_ARGS_(( |
| 778 | Tix_LinkList * lPtr, int serial)); |
| 779 | EXTERN void Tix_UpdateScrollBar _ANSI_ARGS_(( |
| 780 | Tcl_Interp *interp, Tix_ScrollInfo * siPtr)); |
| 781 | EXTERN int Tix_WidgetConfigure2 _ANSI_ARGS_(( |
| 782 | Tcl_Interp *interp, Tk_Window tkwin, char * entRec, |
| 783 | Tk_ConfigSpec *entConfigSpecs, |
| 784 | Tix_DItem * iPtr, int argc, Tcl_Obj **objv, |
| 785 | int flags, int forced, int * sizeChanged_ret)); |
| 786 | EXTERN void Tix_WindowItemListRemove _ANSI_ARGS_(( |
| 787 | Tix_LinkList * lPtr, Tix_DItem * iPtr)); |
| 788 | |
| 789 | typedef struct _TixpSubRegion TixpSubRegion; |
| 790 | |
| 791 | /* |
| 792 | * Functions that should be used by Tix only. Functions prefixed by "Tix" |
| 793 | * are generic functions that has one implementation for all platforms. |
| 794 | * Functions prefixed with "Tixp" requires one implementation on each |
| 795 | * platform. |
| 796 | */ |
| 797 | |
| 798 | extern int TixInitSam _ANSI_ARGS_((Tcl_Interp * interp)); |
| 799 | extern int TixLoadLibrary _ANSI_ARGS_((Tcl_Interp * interp)); |
| 800 | extern void TixRestoreInterpState _ANSI_ARGS_(( |
| 801 | Tcl_Interp * interp, TixInterpState * statePtr)); |
| 802 | extern void TixSaveInterpState _ANSI_ARGS_((Tcl_Interp * interp, |
| 803 | TixInterpState * statePtr)); |
| 804 | |
| 805 | extern void TixpDrawAnchorLines _ANSI_ARGS_((Display *display, |
| 806 | Drawable drawable, GC gc, int x, int y, |
| 807 | int w, int h)); |
| 808 | extern void TixpDrawTmpLine _ANSI_ARGS_((int x1, int y1, |
| 809 | int x2, int y2, Tk_Window tkwin)); |
| 810 | extern void TixpEndSubRegionDraw _ANSI_ARGS_((Display *display, |
| 811 | Drawable drawable, GC gc, |
| 812 | TixpSubRegion * subRegPtr)); |
| 813 | extern int TixpSetWindowParent _ANSI_ARGS_((Tcl_Interp * interp, |
| 814 | Tk_Window tkwin, Tk_Window newParent, |
| 815 | int parentId)); |
| 816 | extern void TixpStartSubRegionDraw _ANSI_ARGS_((Display *display, |
| 817 | Drawable drawable, GC gc, |
| 818 | TixpSubRegion * subRegPtr, int origX, |
| 819 | int origY, int x, int y, int width, int height, |
| 820 | int needWidth, int needHeight)); |
| 821 | extern void TixpSubRegDisplayText _ANSI_ARGS_((Display *display, |
| 822 | Drawable drawable, GC gc, |
| 823 | TixpSubRegion * subRegPtr, |
| 824 | TixFont font, char *string, |
| 825 | int numChars, int x, int y, int length, |
| 826 | Tk_Justify justify, int underline)); |
| 827 | extern void TixpSubRegDrawBitmap _ANSI_ARGS_((Display *display, |
| 828 | Drawable drawable, GC gc, |
| 829 | TixpSubRegion * subRegPtr, Pixmap bitmap, |
| 830 | int src_x, int src_y, int width, int height, |
| 831 | int dest_x, int dest_y, unsigned long plane)); |
| 832 | extern void TixpSubRegDrawImage _ANSI_ARGS_(( |
| 833 | TixpSubRegion * subRegPtr, Tk_Image image, |
| 834 | int imageX, int imageY, int width, int height, |
| 835 | Drawable drawable, int drawableX, int drawableY)); |
| 836 | extern void TixpSubRegFillRectangle _ANSI_ARGS_((Display *display, |
| 837 | Drawable drawable, GC gc, |
| 838 | TixpSubRegion * subRegPtr, int x, int y, |
| 839 | int width, int height)); |
| 840 | |
| 841 | /* These functions are also, and originaly declared in tixPort.h but |
| 842 | * that would mean even more Vtables |
| 843 | */ |
| 844 | |
| 845 | EXTERN void TixComputeTextGeometry _ANSI_ARGS_(( |
| 846 | TixFont fontStructPtr, char *string, |
| 847 | int numChars, int wrapLength, int *widthPtr, |
| 848 | int *heightPtr)); |
| 849 | EXTERN void TixDisplayText _ANSI_ARGS_((Display *display, |
| 850 | Drawable drawable, TixFont font, |
| 851 | char *string, int numChars, int x, int y, |
| 852 | int length, Tk_Justify justify, int underline, |
| 853 | GC gc)); |
| 854 | EXTERN Tcl_HashTable * TixGetHashTable _ANSI_ARGS_((Tcl_Interp * interp, |
| 855 | char * name, Tcl_InterpDeleteProc *deleteProc)); |
| 856 | |
| 857 | /* |
| 858 | * built-in strdup is not compatible with the tcl memory allocator. We |
| 859 | * replace all strdup calls with tixStrDup. |
| 860 | */ |
| 861 | #define NO_STRDUP 1 |
| 862 | extern char *tixStrDup _ANSI_ARGS_(( CONST char * s)); |
| 863 | |
| 864 | /* |
| 865 | * Console Stuff |
| 866 | * (these are declared with the EXTERN in win/winMain.c but without it |
| 867 | * in generic/tkConsole.c) |
| 868 | */ |
| 869 | EXTERN void TkConsoleCreate _ANSI_ARGS_((void)); |
| 870 | EXTERN int TkConsoleInit _ANSI_ARGS_((Tcl_Interp *interp)); |
| 871 | |
| 872 | #define TixConsoleCreate(x) TkConsoleCreate() |
| 873 | #define TixConsoleInit(x) TkConsoleInit(x) |
| 874 | |
| 875 | #endif /* _TIXINT */ |
| 876 | |