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