1 /* 2 * tkTable.h -- 3 * 4 * This is the header file for the module that implements 5 * table widgets for the Tk toolkit. 6 * 7 * Copyright (c) 1997-2002 Jeffrey Hobbs 8 * 9 * See the file "license.txt" for information on usage and redistribution 10 * of this file, and for a DISCLAIMER OF ALL WARRANTIES. 11 * 12 * RCS: @(#) $Id: tkTable.h,v 1.18 2004/02/08 03:09:45 cerney Exp $ 13 */ 14 15 #ifndef _TKTABLE_H_ 16 #define _TKTABLE_H_ 17 18 19 20 #include <string.h> 21 #include <stdlib.h> 22 #include <tk.h> 23 #include "tkVMacro.h" 24 #include "tkTableversion.h" 25 26 #ifdef MAC_TCL 27 # include <Xatom.h> 28 #else 29 # include <X11/Xatom.h> 30 #endif /* MAC_TCL */ 31 32 #if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION == 0) /* Tcl8.0 stuff */ 33 #define Tcl_GetString(objPtr) Tcl_GetStringFromObj(objPtr, (int *)NULL) 34 #endif 35 36 #define Arg Tcl_Obj* 37 38 /* 39 * Tcl/Tk 8.4 introduced better CONST-ness in the APIs, but we use CONST84 in 40 * some cases for compatibility with earlier Tcl headers to prevent warnings. 41 */ 42 #ifndef CONST84 43 # define CONST84 44 #endif 45 46 /* This EXTERN declaration is needed for Tcl < 8.0.3 */ 47 #ifndef EXTERN 48 # ifdef __cplusplus 49 # define EXTERN extern "C" 50 # else 51 # define EXTERN extern 52 # endif 53 #endif 54 55 #ifdef TCL_STORAGE_CLASS 56 # undef TCL_STORAGE_CLASS 57 #endif 58 #ifdef BUILD_Tktable 59 # define TCL_STORAGE_CLASS DLLEXPORT 60 #else 61 # define TCL_STORAGE_CLASS DLLIMPORT 62 #endif 63 64 #ifdef WIN32 65 # define WIN32_LEAN_AND_MEAN 66 # include <windows.h> 67 # undef WIN32_LEAN_AND_MEAN 68 /* VC++ has an entry point called DllMain instead of DllEntryPoint */ 69 # if defined(_MSC_VER) 70 # define DllEntryPoint DllMain 71 # endif 72 #endif 73 74 #if defined(WIN32) || defined(MAC_TCL) || defined(MAC_OSX_TK) 75 /* XSync call defined in the internals for some reason */ 76 # ifndef XSync 77 # define XSync(display, bool) {display->request++;} 78 # endif 79 #endif /* defn of XSync */ 80 81 #ifndef NORMAL_BG 82 # ifdef WIN32 83 # define NORMAL_BG "SystemButtonFace" 84 # define ACTIVE_BG NORMAL_BG 85 # define SELECT_BG "SystemHighlight" 86 # define SELECT_FG "SystemHighlightText" 87 # define DISABLED "SystemDisabledText" 88 # define HIGHLIGHT "SystemWindowFrame" 89 # define DEF_TABLE_FONT "{MS Sans Serif} 8" 90 # elif defined(MAC_TCL) || defined(MAC_OSX_TK) 91 # define NORMAL_BG "systemWindowBody" 92 # define ACTIVE_BG "#ececec" 93 # define SELECT_BG "systemHighlight" 94 # define SELECT_FG "systemHighlightText" 95 # define DISABLED "#a3a3a3" 96 # define HIGHLIGHT "Black" 97 # define DEF_TABLE_FONT "Helvetica 12" 98 # else 99 # define NORMAL_BG "#d9d9d9" 100 # define ACTIVE_BG "#fcfcfc" 101 # define SELECT_BG "#c3c3c3" 102 # define SELECT_FG "Black" 103 # define DISABLED "#a3a3a3" 104 # define HIGHLIGHT "Black" 105 # define DEF_TABLE_FONT "Helvetica -12" 106 # endif 107 #endif /* NORMAL_BG */ 108 109 #define MAX(A,B) (((A)>(B))?(A):(B)) 110 #define MIN(A,B) (((A)>(B))?(B):(A)) 111 #define BETWEEN(val,min,max) ( ((val)<(min)) ? (min) : \ 112 ( ((val)>(max)) ? (max) : (val) ) ) 113 #define CONSTRAIN(val,min,max) if ((val) < (min)) { (val) = (min); } \ 114 else if ((val) > (max)) { (val) = (max); } 115 #define STREQ(s1, s2) (strcmp((s1), (s2)) == 0) 116 #define ARSIZE(A) (sizeof(A)/sizeof(*A)) 117 #define INDEX_BUFSIZE 32 /* max size of buffer for indices */ 118 #define TEST_KEY "#TEST KEY#" /* index for testing array existence */ 119 120 /* 121 * Assigned bits of "flags" fields of Table structures, and what those 122 * bits mean: 123 * 124 * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has 125 * already been queued to redisplay the table. 126 * REDRAW_BORDER: Non-zero means 3-D border must be redrawn 127 * around window during redisplay. Normally 128 * only text portion needs to be redrawn. 129 * CURSOR_ON: Non-zero means insert cursor is displayed at 130 * present. 0 means it isn't displayed. 131 * TEXT_CHANGED: Non-zero means the active cell text is being edited. 132 * HAS_FOCUS: Non-zero means this window has the input focus. 133 * HAS_ACTIVE: Non-zero means the active cell is set. 134 * HAS_ANCHOR: Non-zero means the anchor cell is set. 135 * BROWSE_CMD: Non-zero means we're evaluating the -browsecommand. 136 * VALIDATING: Non-zero means we are in a valCmd 137 * SET_ACTIVE: About to set the active array element internally 138 * ACTIVE_DISABLED: Non-zero means the active cell is -state disabled 139 * OVER_BORDER: Non-zero means we are over a table cell border 140 * REDRAW_ON_MAP: Forces a redraw on the unmap 141 * AVOID_SPANS: prevent cell spans from being used 142 * 143 * FIX - consider adding UPDATE_SCROLLBAR a la entry 144 */ 145 #define REDRAW_PENDING (1L<<0) 146 #define CURSOR_ON (1L<<1) 147 #define HAS_FOCUS (1L<<2) 148 #define TEXT_CHANGED (1L<<3) 149 #define HAS_ACTIVE (1L<<4) 150 #define HAS_ANCHOR (1L<<5) 151 #define BROWSE_CMD (1L<<6) 152 #define REDRAW_BORDER (1L<<7) 153 #define VALIDATING (1L<<8) 154 #define SET_ACTIVE (1L<<9) 155 #define ACTIVE_DISABLED (1L<<10) 156 #define OVER_BORDER (1L<<11) 157 #define REDRAW_ON_MAP (1L<<12) 158 #define AVOID_SPANS (1L<<13) 159 160 /* Flags for TableInvalidate && TableRedraw */ 161 #define ROW (1L<<0) 162 #define COL (1L<<1) 163 #define CELL (1L<<2) 164 165 #define CELL_BAD (1<<0) 166 #define CELL_OK (1<<1) 167 #define CELL_SPAN (1<<2) 168 #define CELL_HIDDEN (1<<3) 169 #define CELL_VIEWABLE (CELL_OK|CELL_SPAN) 170 171 #define INV_FILL (1L<<3) /* use for Redraw when the affected 172 * row/col will affect neighbors */ 173 #define INV_FORCE (1L<<4) 174 #define INV_HIGHLIGHT (1L<<5) 175 #define INV_NO_ERR_MSG (1L<<5) /* Don't leave an error message */ 176 177 /* These alter how the selection set/clear commands behave */ 178 #define SEL_ROW (1<<0) 179 #define SEL_COL (1<<1) 180 #define SEL_BOTH (1<<2) 181 #define SEL_CELL (1<<3) 182 #define SEL_NONE (1<<4) 183 184 /* 185 * Definitions for tablePtr->dataSource, by bit 186 */ 187 #define DATA_NONE 0 188 #define DATA_CACHE (1<<1) 189 #define DATA_ARRAY (1<<2) 190 #define DATA_COMMAND (1<<3) 191 192 /* 193 * Definitions for configuring -borderwidth 194 */ 195 #define BD_TABLE 0 196 #define BD_TABLE_TAG (1<<1) 197 #define BD_TABLE_WIN (1<<2) 198 199 /* 200 * Possible state values for tags 201 */ 202 typedef enum { 203 STATE_UNUSED, STATE_UNKNOWN, STATE_HIDDEN, 204 STATE_NORMAL, STATE_DISABLED, STATE_ACTIVE, STATE_LAST 205 } TableState; 206 207 /* 208 * Structure for use in parsing table commands/values. 209 * Accessor functions defined in tkTableUtil.c 210 */ 211 typedef struct { 212 char *name; /* name of the command/value */ 213 int value; /* >0 because 0 represents an error or proc */ 214 } Cmd_Struct; 215 216 /* 217 * The tag structure 218 */ 219 typedef struct { 220 Tk_3DBorder bg; /* background color */ 221 Tk_3DBorder fg; /* foreground color */ 222 223 char * borderStr; /* border style */ 224 int borders; /* number of borders specified (1, 2 or 4) */ 225 int bd[4]; /* cell border width */ 226 227 int relief; /* relief type */ 228 Tk_Font tkfont; /* Information about text font, or NULL. */ 229 Tk_Anchor anchor; /* default anchor point */ 230 char * imageStr; /* name of image */ 231 Tk_Image image; /* actual pointer to image, if any */ 232 TableState state; /* state of the cell */ 233 Tk_Justify justify; /* justification of text in the cell */ 234 int multiline; /* wrapping style of multiline text */ 235 int wrap; /* wrapping style of multiline text */ 236 int showtext; /* whether to display text over image */ 237 } TableTag; 238 239 /* The widget structure for the table Widget */ 240 241 typedef struct { 242 /* basic information about the window and the interpreter */ 243 Tk_Window tkwin; 244 Display *display; 245 Tcl_Interp *interp; 246 Tcl_Command widgetCmd; /* Token for entry's widget command. */ 247 248 /* 249 * Configurable Options 250 */ 251 int autoClear; 252 char *selectMode; /* single, browse, multiple, or extended */ 253 int selectType; /* row, col, both, or cell */ 254 int selectTitles; /* whether to do automatic title selection */ 255 int rows, cols; /* number of rows and columns */ 256 int defRowHeight; /* default row height in chars (positive) 257 * or pixels (negative) */ 258 int defColWidth; /* default column width in chars (positive) 259 * or pixels (negative) */ 260 int maxReqCols; /* the requested # cols to display */ 261 int maxReqRows; /* the requested # rows to display */ 262 int maxReqWidth; /* the maximum requested width in pixels */ 263 int maxReqHeight; /* the maximum requested height in pixels */ 264 Var arrayVar; /* name of traced array variable */ 265 char *rowSep; /* separator string to place between 266 * rows when getting selection */ 267 char *colSep; /* separator string to place between 268 * cols when getting selection */ 269 TableTag defaultTag; /* the default tag colors/fonts etc */ 270 LangCallback *yScrollCmd; /* the y-scroll command */ 271 LangCallback *xScrollCmd; /* the x-scroll command */ 272 LangCallback *browseCmd; /* the command that is called when the 273 * active cell changes */ 274 int caching; /* whether to cache values of table */ 275 LangCallback *command; /* A command to eval when get/set occurs 276 * for table values */ 277 int useCmd; /* Signals whether to use command or the 278 * array variable, will be 0 if command errs */ 279 LangCallback *selCmd; /* the command that is called to when a 280 * [selection get] call occurs for a table */ 281 LangCallback *valCmd; /* Command prefix to use when invoking 282 * validate command. NULL means don't 283 * invoke commands. Malloc'ed. */ 284 int validate; /* Non-zero means try to validate */ 285 Tk_3DBorder insertBg; /* the cursor color */ 286 Tk_Cursor cursor; /* the regular mouse pointer */ 287 Tk_Cursor bdcursor; /* the mouse pointer when over borders */ 288 #ifdef TITLE_CURSOR 289 Tk_Cursor titleCursor; /* the mouse pointer when over titles */ 290 #endif 291 int exportSelection; /* Non-zero means tie internal table 292 * to X selection. */ 293 TableState state; /* Normal or disabled. Table is read-only 294 * when disabled. */ 295 int insertWidth; /* Total width of insert cursor. */ 296 int insertBorderWidth; /* Width of 3-D border around insert cursor. */ 297 int insertOnTime; /* Number of milliseconds cursor should spend 298 * in "on" state for each blink. */ 299 int insertOffTime; /* Number of milliseconds cursor should spend 300 * in "off" state for each blink. */ 301 int invertSelected; /* Whether to draw selected cells swapping 302 * foreground and background */ 303 int colStretch; /* The way to stretch columns if the window 304 * is too large */ 305 int rowStretch; /* The way to stretch rows if the window is 306 * too large */ 307 int colOffset; /* X index of leftmost col in the display */ 308 int rowOffset; /* Y index of topmost row in the display */ 309 int drawMode; /* The mode to use when redrawing */ 310 int flashMode; /* Specifies whether flashing is enabled */ 311 int flashTime; /* The number of ms to flash a cell for */ 312 int resize; /* -resizeborders option for interactive 313 * resizing of borders */ 314 int sparse; /* Whether to use "sparse" arrays by 315 * deleting empty array elements (default) */ 316 LangCallback *rowTagCmd, 317 *colTagCmd; /* script to eval for getting row/tag cmd */ 318 int highlightWidth; /* Width in pixels of highlight to draw 319 * around widget when it has the focus. 320 * <= 0 means don't draw a highlight. */ 321 XColor *highlightBgColorPtr;/* Color for drawing traversal highlight 322 * area when highlight is off. */ 323 XColor *highlightColorPtr; /* Color for drawing traversal highlight. */ 324 char *takeFocus; /* Used only in Tcl to check if this 325 * widget will accept focus */ 326 int padX, padY; /* Extra space around text (pixels to leave 327 * on each side). Ignored for bitmaps and 328 * images. */ 329 int ipadX, ipadY; /* Space to leave empty around cell borders. 330 * This differs from pad* in that it is always 331 * present for the cell (except windows). */ 332 333 /* 334 * Cached Information 335 */ 336 #ifdef TITLE_CURSOR 337 Tk_Cursor *lastCursorPtr; /* pointer to last cursor defined. */ 338 #endif 339 int titleRows, titleCols; /* the number of rows|cols to use as a title */ 340 /* these are kept in real coords */ 341 int topRow, leftCol; /* The topleft cell to display excluding the 342 * fixed title rows. This is just the 343 * config request. The actual cell used may 344 * be different to keep the screen full */ 345 int anchorRow, anchorCol; /* the row,col of the anchor cell */ 346 int activeRow, activeCol; /* the row,col of the active cell */ 347 int oldTopRow, oldLeftCol; /* cached by TableAdjustParams */ 348 int oldActRow, oldActCol; /* cached by TableAdjustParams */ 349 int icursor; /* The index of the insertion cursor in the 350 * active cell */ 351 int flags; /* An or'ed combination of flags concerning 352 * redraw/cursor etc. */ 353 int dataSource; /* where our data comes from: 354 * DATA_{NONE,CACHE,ARRAY,COMMAND} */ 355 int maxWidth, maxHeight; /* max width|height required in pixels */ 356 int charWidth, charHeight; /* size of a character in the default font */ 357 int *colPixels, *rowPixels; /* Array of the pixel widths/heights */ 358 int *colStarts, *rowStarts; /* Array of start pixels for rows|columns */ 359 int scanMarkX, scanMarkY; /* Used by "scan" and "border" to mark */ 360 int scanMarkRow, scanMarkCol;/* necessary information for dragto */ 361 /* values in these are kept in user coords */ 362 Tcl_HashTable *cache; /* value cache */ 363 364 /* 365 * colWidths and rowHeights are indexed from 0, so always adjust numbers 366 * by the appropriate *Offset factor 367 */ 368 Tcl_HashTable *colWidths; /* hash table of non default column widths */ 369 Tcl_HashTable *rowHeights; /* hash table of non default row heights */ 370 Tcl_HashTable *spanTbl; /* table for spans */ 371 Tcl_HashTable *spanAffTbl; /* table for cells affected by spans */ 372 Tcl_HashTable *tagTable; /* table for style tags */ 373 Tcl_HashTable *winTable; /* table for embedded windows */ 374 Tcl_HashTable *rowStyles; /* table for row styles */ 375 Tcl_HashTable *colStyles; /* table for col styles */ 376 Tcl_HashTable *cellStyles; /* table for cell styles */ 377 Tcl_HashTable *flashCells; /* table of flashing cells */ 378 Tcl_HashTable *selCells; /* table of selected cells */ 379 Tcl_TimerToken cursorTimer; /* timer token for the cursor blinking */ 380 Tcl_TimerToken flashTimer; /* timer token for the cell flashing */ 381 char *activeBuf; /* buffer where the selection is kept 382 * for editing the active cell */ 383 char **tagPrioNames; /* list of tag names in priority order */ 384 TableTag **tagPrios; /* list of tag pointers in priority order */ 385 TableTag *activeTagPtr; /* cache of active composite tag */ 386 int activeX, activeY; /* cache offset of active layout in cell */ 387 int tagPrioSize; /* size of tagPrios list */ 388 int tagPrioMax; /* max allocated size of tagPrios list */ 389 390 /* The invalid rectangle if there is an update pending */ 391 int invalidX, invalidY, invalidWidth, invalidHeight; 392 int seen[4]; /* see TableUndisplay */ 393 394 #ifdef POSTSCRIPT 395 /* Pointer to information used for generating Postscript for the canvas. 396 * NULL means no Postscript is currently being generated. */ 397 struct TkPostscriptInfo *psInfoPtr; 398 #endif 399 400 #ifdef PROCS 401 Tcl_HashTable *inProc; /* cells where proc is being evaled */ 402 int showProcs; /* whether to show embedded proc (1) or 403 * its calculated value (0) */ 404 int hasProcs; /* whether table has embedded procs or not */ 405 #endif 406 } Table; 407 408 /* 409 * HEADERS FOR EMBEDDED WINDOWS 410 */ 411 412 /* 413 * A structure of the following type holds information for each window 414 * embedded in a table widget. 415 */ 416 417 typedef struct TableEmbWindow { 418 Table *tablePtr; /* Information about the overall table 419 * widget. */ 420 Tk_Window tkwin; /* Window for this segment. NULL means that 421 * the window hasn't been created yet. */ 422 Tcl_HashEntry *hPtr; /* entry into winTable */ 423 LangCallback *create; /* Script to create window on-demand. 424 * NULL means no such script. 425 * Malloc-ed. */ 426 Tk_3DBorder bg; /* background color */ 427 428 char *borderStr; /* border style */ 429 int borders; /* number of borders specified (1, 2 or 4) */ 430 int bd[4]; /* border width for cell around window */ 431 432 int relief; /* relief type */ 433 int sticky; /* How to align window in space */ 434 int padX, padY; /* Padding to leave around each side 435 * of window, in pixels. */ 436 int displayed; /* Non-zero means that the window has been 437 * displayed on the screen recently. */ 438 } TableEmbWindow; 439 440 extern Tk_ConfigSpec tableSpecs[]; 441 442 extern void EmbWinDisplay _ANSI_ARGS_((Table *tablePtr, Drawable window, 443 TableEmbWindow *ewPtr, TableTag *tagPtr, 444 int x, int y, int width, int height)); 445 extern void EmbWinUnmap _ANSI_ARGS_((register Table *tablePtr, 446 int rlo, int rhi, int clo, int chi)); 447 extern void EmbWinDelete _ANSI_ARGS_((register Table *tablePtr, 448 TableEmbWindow *ewPtr)); 449 extern int Table_WinMove _ANSI_ARGS_((register Table *tablePtr, 450 char *CONST srcPtr, char *CONST destPtr, int flags)); 451 extern int Table_WinDelete _ANSI_ARGS_((register Table *tablePtr, 452 char *CONST idxPtr)); 453 extern int Table_WindowCmd _ANSI_ARGS_((ClientData clientData, 454 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 455 extern int TableValidateChange _ANSI_ARGS_((Table *tablePtr, int r, 456 int c, char *oldVal, char *newVal, int idx)); 457 extern void TableLostSelection _ANSI_ARGS_((ClientData clientData)); 458 extern void TableSetActiveIndex _ANSI_ARGS_((register Table *tablePtr)); 459 460 /* 461 * HEADERS IN tkTableCmds.c 462 */ 463 464 extern int Table_ActivateCmd _ANSI_ARGS_((ClientData clientData, 465 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 466 extern int Table_AdjustCmd _ANSI_ARGS_((ClientData clientData, 467 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int widthType)); 468 extern int Table_BboxCmd _ANSI_ARGS_((ClientData clientData, 469 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 470 extern int Table_BorderCmd _ANSI_ARGS_((ClientData clientData, 471 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 472 extern int Table_ClearCmd _ANSI_ARGS_((ClientData clientData, 473 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 474 extern int Table_CurselectionCmd _ANSI_ARGS_((ClientData clientData, 475 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 476 extern int Table_CurvalueCmd _ANSI_ARGS_((ClientData clientData, 477 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 478 extern int Table_GetCmd _ANSI_ARGS_((ClientData clientData, 479 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 480 extern int Table_ScanCmd _ANSI_ARGS_((ClientData clientData, 481 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 482 extern int Table_SeeCmd _ANSI_ARGS_((ClientData clientData, 483 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 484 extern int Table_SelAnchorCmd _ANSI_ARGS_((ClientData clientData, 485 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 486 extern int Table_SelClearCmd _ANSI_ARGS_((ClientData clientData, 487 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 488 extern int Table_SelIncludesCmd _ANSI_ARGS_((ClientData clientData, 489 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 490 extern int Table_SelSetCmd _ANSI_ARGS_((ClientData clientData, 491 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 492 extern int Table_ViewCmd _ANSI_ARGS_((ClientData clientData, 493 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 494 495 /* 496 * HEADERS IN tkTableEdit.c 497 */ 498 499 extern int Table_EditCmd _ANSI_ARGS_((ClientData clientData, 500 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 501 extern void TableDeleteChars _ANSI_ARGS_((register Table *tablePtr, 502 int idx, int count)); 503 extern void TableInsertChars _ANSI_ARGS_((register Table *tablePtr, 504 int idx, char *string)); 505 506 /* 507 * HEADERS IN tkTableTag.c 508 */ 509 510 extern TableTag *TableNewTag _ANSI_ARGS_((Table *tablePtr)); 511 extern void TableResetTag _ANSI_ARGS_((Table *tablePtr, TableTag *tagPtr)); 512 extern void TableMergeTag _ANSI_ARGS_((Table *tablePtr, TableTag *baseTag, 513 TableTag *addTag)); 514 extern void TableInvertTag _ANSI_ARGS_((TableTag *baseTag)); 515 extern int TableGetTagBorders _ANSI_ARGS_((TableTag *tagPtr, 516 int *left, int *right, int *top, int *bottom)); 517 extern void TableInitTags _ANSI_ARGS_((Table *tablePtr)); 518 extern TableTag *FindRowColTag _ANSI_ARGS_((Table *tablePtr, 519 int cell, int type)); 520 extern void TableCleanupTag _ANSI_ARGS_((Table *tablePtr, 521 TableTag *tagPtr)); 522 extern int Table_TagCmd _ANSI_ARGS_((ClientData clientData, 523 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 524 525 /* 526 * HEADERS IN tkTableUtil.c 527 */ 528 529 extern void Table_ClearHashTable _ANSI_ARGS_((Tcl_HashTable *hashTblPtr)); 530 extern int TableOptionBdSet _ANSI_ARGS_((ClientData clientData, 531 Tcl_Interp *interp, Tk_Window tkwin, 532 Arg value, char *widgRec, int offset)); 533 extern Arg TableOptionBdGet _ANSI_ARGS_((ClientData clientData, 534 Tk_Window tkwin, char *widgRec, int offset, 535 Tcl_FreeProc **freeProcPtr)); 536 extern int TableTagConfigureBd _ANSI_ARGS_((Table *tablePtr, 537 TableTag *tagPtr, Arg oldValue, int nullOK)); 538 extern int Cmd_OptionSet _ANSI_ARGS_((ClientData clientData, 539 Tcl_Interp *interp, 540 Tk_Window unused, Arg value, 541 char *widgRec, int offset)); 542 extern Arg Cmd_OptionGet _ANSI_ARGS_((ClientData clientData, 543 Tk_Window unused, char *widgRec, 544 int offset, Tcl_FreeProc **freeProcPtr)); 545 546 /* 547 * HEADERS IN tkTableCell.c 548 */ 549 550 extern int TableTrueCell _ANSI_ARGS_((Table *tablePtr, int row, int col, 551 int *trow, int *tcol)); 552 extern int TableCellCoords _ANSI_ARGS_((Table *tablePtr, int row, 553 int col, int *rx, int *ry, int *rw, int *rh)); 554 extern int TableCellVCoords _ANSI_ARGS_((Table *tablePtr, int row, 555 int col, int *rx, int *ry, 556 int *rw, int *rh, int full)); 557 extern void TableWhatCell _ANSI_ARGS_((register Table *tablePtr, 558 int x, int y, int *row, int *col)); 559 extern int TableAtBorder _ANSI_ARGS_((Table *tablePtr, int x, int y, 560 int *row, int *col)); 561 extern char * TableGetCellValue _ANSI_ARGS_((Table *tablePtr, int r, int c)); 562 extern int TableSetCellValue _ANSI_ARGS_((Table *tablePtr, int r, int c, 563 char *value)); 564 extern int TableMoveCellValue _ANSI_ARGS_((Table *tablePtr, 565 int fromr, int fromc, char *frombuf, 566 int tor, int toc, char *tobuf, int outOfBounds)); 567 568 extern int TableGetIcursor _ANSI_ARGS_((Table *tablePtr, char *arg, 569 int *posn)); 570 #define TableGetIcursorObj(tablePtr, objPtr, posnPtr) \ 571 TableGetIcursor(tablePtr, Tcl_GetString(objPtr), posnPtr) 572 extern int TableGetIndex _ANSI_ARGS_((register Table *tablePtr, 573 char *str, int *row_p, int *col_p)); 574 #define TableGetIndexObj(tablePtr, objPtr, rowPtr, colPtr) \ 575 TableGetIndex(tablePtr, Tcl_GetString(objPtr), rowPtr, colPtr) 576 extern int Table_SetCmd _ANSI_ARGS_((ClientData clientData, 577 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 578 extern int Table_HiddenCmd _ANSI_ARGS_((ClientData clientData, 579 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 580 extern int Table_SpanCmd _ANSI_ARGS_((ClientData clientData, 581 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 582 extern void TableSpanSanCheck _ANSI_ARGS_((register Table *tablePtr)); 583 584 /* 585 * HEADERS IN TKTABLECELLSORT 586 */ 587 /* 588 * We keep the old CellSort true because it is used for grabbing 589 * the selection, so we really want them ordered 590 */ 591 extern Arg TableCellSort _ANSI_ARGS_((Table *tablePtr, char *str)); 592 #ifdef NO_SORT_CELLS 593 # define TableCellSortObj(interp, objPtr) (objPtr) 594 #else 595 extern Tcl_Obj* TableCellSortObj _ANSI_ARGS_((Tcl_Interp *interp, 596 Tcl_Obj *listObjPtr)); 597 #endif 598 599 /* 600 * HEADERS IN TKTABLEPS 601 */ 602 603 #ifdef POSTSCRIPT 604 extern int Table_PostscriptCmd _ANSI_ARGS_((ClientData clientData, 605 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 606 extern void Tcl_DStringAppendAll _ANSI_ARGS_(TCL_VARARGS(Tcl_DString *, arg1)); 607 #endif 608 609 /* 610 * HEADERS IN TKTABLE 611 */ 612 613 EXTERN int Tktable_Init _ANSI_ARGS_((Tcl_Interp *interp)); 614 EXTERN int Tktable_SafeInit _ANSI_ARGS_((Tcl_Interp *interp)); 615 616 extern void TableGetActiveBuf _ANSI_ARGS_((register Table *tablePtr)); 617 extern void ExpandPercents _ANSI_ARGS_((Table *tablePtr, char *before, 618 int r, int c, char *oldVal, char *newVal, int idx, 619 Tcl_DString *dsPtr, int cmdType)); 620 extern void TableInvalidate _ANSI_ARGS_((Table *tablePtr, int x, int y, 621 int width, int height, int force)); 622 extern void TableRefresh _ANSI_ARGS_((register Table *tablePtr, 623 int arg1, int arg2, int mode)); 624 extern void TableGeometryRequest _ANSI_ARGS_((Table *tablePtr)); 625 extern void TableAdjustActive _ANSI_ARGS_((register Table *tablePtr)); 626 extern void TableAdjustParams _ANSI_ARGS_((register Table *tablePtr)); 627 extern void TableConfigCursor _ANSI_ARGS_((register Table *tablePtr)); 628 extern void TableAddFlash _ANSI_ARGS_((Table *tablePtr, int row, int col)); 629 630 631 #define TableInvalidateAll(tablePtr, flags) \ 632 TableInvalidate((tablePtr), 0, 0, Tk_Width((tablePtr)->tkwin),\ 633 Tk_Height((tablePtr)->tkwin), (flags)) 634 635 /* 636 * Turn row/col into an index into the table 637 */ 638 #define TableMakeArrayIndex(r, c, i) sprintf((i), "%d,%d", (r), (c)) 639 640 /* 641 * Turn array index back into row/col 642 * return the number of args parsed (should be two) 643 */ 644 #define TableParseArrayIndex(r, c, i) sscanf((i), "%d,%d", (r), (c)) 645 646 /* 647 * Macro for finding the last cell of the table 648 */ 649 #define TableGetLastCell(tablePtr, rowPtr, colPtr) \ 650 TableWhatCell((tablePtr),\ 651 Tk_Width((tablePtr)->tkwin)-(tablePtr)->highlightWidth-1,\ 652 Tk_Height((tablePtr)->tkwin)-(tablePtr)->highlightWidth-1,\ 653 (rowPtr), (colPtr)) 654 655 EXTERN int Tk_TableObjCmd _ANSI_ARGS_((ClientData clientData, 656 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])); 657 658 659 /* 660 * end of header 661 * reset TCL_STORAGE_CLASS to DLLIMPORT. 662 */ 663 #undef TCL_STORAGE_CLASS 664 #define TCL_STORAGE_CLASS DLLIMPORT 665 666 /* perltk tkTables replacement for TCL_unsetVar. deletes an element in a hash */ 667 EXTERN void tkTableUnsetElement _ANSI_ARGS_((Var hashEntry, char * key)); 668 669 670 #endif /* _TKTABLE_H_ */ 671 672