home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / perl / tkTable.h < prev    next >
Encoding:
C/C++ Source or Header  |  2003-09-16  |  25.5 KB  |  670 lines

  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.2 2003/09/16 18:18:17 joker 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. /*
  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. } TableTag;
  236.  
  237. /*  The widget structure for the table Widget */
  238.  
  239. typedef struct {
  240.     /* basic information about the window and the interpreter */
  241.     Tk_Window tkwin;
  242.     Display *display;
  243.     Tcl_Interp *interp;
  244.     Tcl_Command widgetCmd;    /* Token for entry's widget command. */
  245.  
  246.     /*
  247.      * Configurable Options
  248.      */
  249.     int autoClear;
  250.     char *selectMode;        /* single, browse, multiple, or extended */
  251.     int selectType;        /* row, col, both, or cell */
  252.     int selectTitles;        /* whether to do automatic title selection */
  253.     int rows, cols;        /* number of rows and columns */
  254.     int defRowHeight;        /* default row height in chars (positive)
  255.                  * or pixels (negative) */
  256.     int defColWidth;        /* default column width in chars (positive)
  257.                  * or pixels (negative) */
  258.     int maxReqCols;        /* the requested # cols to display */
  259.     int maxReqRows;        /* the requested # rows to display */
  260.     int maxReqWidth;        /* the maximum requested width in pixels */
  261.     int maxReqHeight;        /* the maximum requested height in pixels */
  262.   Var arrayVar;            /* name of traced array variable */
  263.     char *rowSep;        /* separator string to place between
  264.                  * rows when getting selection */
  265.     char *colSep;        /* separator string to place between
  266.                  * cols when getting selection */
  267.     TableTag defaultTag;    /* the default tag colors/fonts etc */
  268.     LangCallback *yScrollCmd;    /* the y-scroll command */
  269.     LangCallback *xScrollCmd;    /* the x-scroll command */
  270.     LangCallback *browseCmd;     /* the command that is called when the
  271.                  * active cell changes */
  272.     int caching;        /* whether to cache values of table */
  273.     LangCallback *command;    /* A command to eval when get/set occurs
  274.                  * for table values */
  275.     int useCmd;            /* Signals whether to use command or the
  276.                  * array variable, will be 0 if command errs */
  277.     LangCallback *selCmd;    /* the command that is called to when a
  278.                  * [selection get] call occurs for a table */
  279.     LangCallback *valCmd;    /* Command prefix to use when invoking
  280.                  * validate command.  NULL means don't
  281.                  * invoke commands.  Malloc'ed. */
  282.     int validate;        /* Non-zero means try to validate */
  283.     Tk_3DBorder insertBg;    /* the cursor color */
  284.     Tk_Cursor cursor;        /* the regular mouse pointer */
  285.     Tk_Cursor bdcursor;        /* the mouse pointer when over borders */
  286. #ifdef TITLE_CURSOR
  287.     Tk_Cursor titleCursor;    /* the mouse pointer when over titles */
  288. #endif
  289.     int exportSelection;    /* Non-zero means tie internal table
  290.                  * to X selection. */
  291.     TableState state;        /* Normal or disabled.    Table is read-only
  292.                  * when disabled. */
  293.     int insertWidth;        /* Total width of insert cursor. */
  294.     int insertBorderWidth;    /* Width of 3-D border around insert cursor. */
  295.     int insertOnTime;        /* Number of milliseconds cursor should spend
  296.                  * in "on" state for each blink. */
  297.     int insertOffTime;        /* Number of milliseconds cursor should spend
  298.                  * in "off" state for each blink. */
  299.     int invertSelected;        /* Whether to draw selected cells swapping
  300.                  * foreground and background */
  301.     int colStretch;        /* The way to stretch columns if the window
  302.                  * is too large */
  303.     int rowStretch;        /* The way to stretch rows if the window is
  304.                  * too large */
  305.     int colOffset;        /* X index of leftmost col in the display */
  306.     int rowOffset;        /* Y index of topmost row in the display */
  307.     int drawMode;        /* The mode to use when redrawing */
  308.     int flashMode;        /* Specifies whether flashing is enabled */
  309.     int flashTime;        /* The number of ms to flash a cell for */
  310.     int resize;            /* -resizeborders option for interactive
  311.                  * resizing of borders */
  312.     int sparse;            /* Whether to use "sparse" arrays by
  313.                  * deleting empty array elements (default) */
  314.     LangCallback *rowTagCmd,
  315.              *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.     LangCallback *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 _ANSI_ARGS_((Table *tablePtr, Drawable window,
  441.             TableEmbWindow *ewPtr, TableTag *tagPtr,
  442.             int x, int y, int width, int height));
  443. extern void    EmbWinUnmap _ANSI_ARGS_((register Table *tablePtr,
  444.             int rlo, int rhi, int clo, int chi));
  445. extern void    EmbWinDelete _ANSI_ARGS_((register Table *tablePtr,
  446.             TableEmbWindow *ewPtr));
  447. extern int    Table_WinMove _ANSI_ARGS_((register Table *tablePtr,
  448.             char *CONST srcPtr, char *CONST destPtr, int flags));
  449. extern int    Table_WinDelete _ANSI_ARGS_((register Table *tablePtr,
  450.             char *CONST idxPtr));
  451. extern int    Table_WindowCmd _ANSI_ARGS_((ClientData clientData,
  452.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  453. extern int    TableValidateChange _ANSI_ARGS_((Table *tablePtr, int r,
  454.             int c, char *oldVal, char *newVal, int idx));
  455. extern void    TableLostSelection _ANSI_ARGS_((ClientData clientData));
  456. extern void    TableSetActiveIndex _ANSI_ARGS_((register Table *tablePtr));
  457.  
  458. /*
  459.  * HEADERS IN tkTableCmds.c
  460.  */
  461.  
  462. extern int    Table_ActivateCmd _ANSI_ARGS_((ClientData clientData,
  463.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  464. extern int    Table_AdjustCmd _ANSI_ARGS_((ClientData clientData,
  465.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int widthType));
  466. extern int    Table_BboxCmd _ANSI_ARGS_((ClientData clientData,
  467.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  468. extern int    Table_BorderCmd _ANSI_ARGS_((ClientData clientData,
  469.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  470. extern int    Table_ClearCmd _ANSI_ARGS_((ClientData clientData,
  471.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  472. extern int    Table_CurselectionCmd _ANSI_ARGS_((ClientData clientData,
  473.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  474. extern int    Table_CurvalueCmd _ANSI_ARGS_((ClientData clientData,
  475.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  476. extern int    Table_GetCmd _ANSI_ARGS_((ClientData clientData,
  477.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  478. extern int    Table_ScanCmd _ANSI_ARGS_((ClientData clientData,
  479.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  480. extern int    Table_SeeCmd _ANSI_ARGS_((ClientData clientData,
  481.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  482. extern int    Table_SelAnchorCmd _ANSI_ARGS_((ClientData clientData,
  483.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  484. extern int    Table_SelClearCmd _ANSI_ARGS_((ClientData clientData,
  485.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  486. extern int    Table_SelIncludesCmd _ANSI_ARGS_((ClientData clientData,
  487.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  488. extern int    Table_SelSetCmd _ANSI_ARGS_((ClientData clientData,
  489.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  490. extern int    Table_ViewCmd _ANSI_ARGS_((ClientData clientData,
  491.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  492.  
  493. /*
  494.  * HEADERS IN tkTableEdit.c
  495.  */
  496.  
  497. extern int    Table_EditCmd _ANSI_ARGS_((ClientData clientData,
  498.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  499. extern void    TableDeleteChars _ANSI_ARGS_((register Table *tablePtr,
  500.             int idx, int count));
  501. extern void    TableInsertChars _ANSI_ARGS_((register Table *tablePtr,
  502.             int idx, char *string));
  503.  
  504. /*
  505.  * HEADERS IN tkTableTag.c
  506.  */
  507.  
  508. extern TableTag *TableNewTag _ANSI_ARGS_((Table *tablePtr));
  509. extern void    TableResetTag _ANSI_ARGS_((Table *tablePtr, TableTag *tagPtr));
  510. extern void    TableMergeTag _ANSI_ARGS_((Table *tablePtr, TableTag *baseTag,
  511.             TableTag *addTag));
  512. extern void    TableInvertTag _ANSI_ARGS_((TableTag *baseTag));
  513. extern int    TableGetTagBorders _ANSI_ARGS_((TableTag *tagPtr,
  514.             int *left, int *right, int *top, int *bottom));
  515. extern void    TableInitTags _ANSI_ARGS_((Table *tablePtr));
  516. extern TableTag *FindRowColTag _ANSI_ARGS_((Table *tablePtr,
  517.             int cell, int type));
  518. extern void    TableCleanupTag _ANSI_ARGS_((Table *tablePtr,
  519.             TableTag *tagPtr));
  520. extern int    Table_TagCmd _ANSI_ARGS_((ClientData clientData,
  521.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  522.  
  523. /*
  524.  * HEADERS IN tkTableUtil.c
  525.  */
  526.  
  527. extern void    Table_ClearHashTable _ANSI_ARGS_((Tcl_HashTable *hashTblPtr));
  528. extern int    TableOptionBdSet _ANSI_ARGS_((ClientData clientData,
  529.             Tcl_Interp *interp, Tk_Window tkwin,
  530.             Arg value, char *widgRec, int offset));
  531. extern Arg    TableOptionBdGet _ANSI_ARGS_((ClientData clientData,
  532.             Tk_Window tkwin, char *widgRec, int offset,
  533.             Tcl_FreeProc **freeProcPtr));
  534. extern int    TableTagConfigureBd _ANSI_ARGS_((Table *tablePtr,
  535.             TableTag *tagPtr, Arg oldValue, int nullOK));
  536. extern int    Cmd_OptionSet _ANSI_ARGS_((ClientData clientData,
  537.             Tcl_Interp *interp,
  538.             Tk_Window unused, Arg value,
  539.             char *widgRec, int offset));
  540. extern Arg    Cmd_OptionGet _ANSI_ARGS_((ClientData clientData,
  541.             Tk_Window unused, char *widgRec,
  542.             int offset, Tcl_FreeProc **freeProcPtr));
  543.  
  544. /*
  545.  * HEADERS IN tkTableCell.c
  546.  */
  547.  
  548. extern int    TableTrueCell _ANSI_ARGS_((Table *tablePtr, int row, int col,
  549.                        int *trow, int *tcol));
  550. extern int    TableCellCoords _ANSI_ARGS_((Table *tablePtr, int row,
  551.             int col, int *rx, int *ry, int *rw, int *rh));
  552. extern int    TableCellVCoords _ANSI_ARGS_((Table *tablePtr, int row,
  553.             int col, int *rx, int *ry,
  554.             int *rw, int *rh, int full));
  555. extern void    TableWhatCell _ANSI_ARGS_((register Table *tablePtr,
  556.             int x, int y, int *row, int *col));
  557. extern int    TableAtBorder _ANSI_ARGS_((Table *tablePtr, int x, int y,
  558.             int *row, int *col));
  559. extern char *    TableGetCellValue _ANSI_ARGS_((Table *tablePtr, int r, int c));
  560. extern int    TableSetCellValue _ANSI_ARGS_((Table *tablePtr, int r, int c,
  561.             char *value));
  562. extern int    TableMoveCellValue _ANSI_ARGS_((Table *tablePtr,
  563.             int fromr, int fromc, char *frombuf,
  564.             int tor, int toc, char *tobuf, int outOfBounds));
  565.  
  566. extern int    TableGetIcursor _ANSI_ARGS_((Table *tablePtr, char *arg,
  567.             int *posn));
  568. #define TableGetIcursorObj(tablePtr, objPtr, posnPtr) \
  569.     TableGetIcursor(tablePtr, Tcl_GetString(objPtr), posnPtr)
  570. extern int    TableGetIndex _ANSI_ARGS_((register Table *tablePtr,
  571.             char *str, int *row_p, int *col_p));
  572. #define TableGetIndexObj(tablePtr, objPtr, rowPtr, colPtr) \
  573.     TableGetIndex(tablePtr, Tcl_GetString(objPtr), rowPtr, colPtr)
  574. extern int    Table_SetCmd _ANSI_ARGS_((ClientData clientData,
  575.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  576. extern int    Table_HiddenCmd _ANSI_ARGS_((ClientData clientData,
  577.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  578. extern int    Table_SpanCmd _ANSI_ARGS_((ClientData clientData,
  579.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  580. extern void    TableSpanSanCheck _ANSI_ARGS_((register Table *tablePtr));
  581.  
  582. /*
  583.  * HEADERS IN TKTABLECELLSORT
  584.  */
  585. /*
  586.  * We keep the old CellSort true because it is used for grabbing
  587.  * the selection, so we really want them ordered
  588.  */
  589. extern Arg    TableCellSort _ANSI_ARGS_((Table *tablePtr, char *str));
  590. #ifdef NO_SORT_CELLS
  591. #  define TableCellSortObj(interp, objPtr) (objPtr)
  592. #else
  593. extern Tcl_Obj*    TableCellSortObj _ANSI_ARGS_((Tcl_Interp *interp,
  594.             Tcl_Obj *listObjPtr));
  595. #endif
  596.  
  597. /*
  598.  * HEADERS IN TKTABLEPS
  599.  */
  600.  
  601. #ifdef POSTSCRIPT
  602. extern int    Table_PostscriptCmd _ANSI_ARGS_((ClientData clientData,
  603.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  604. extern void    Tcl_DStringAppendAll _ANSI_ARGS_(TCL_VARARGS(Tcl_DString *, arg1));
  605. #endif
  606.  
  607. /*
  608.  * HEADERS IN TKTABLE
  609.  */
  610.  
  611. EXTERN int Tktable_Init        _ANSI_ARGS_((Tcl_Interp *interp));
  612. EXTERN int Tktable_SafeInit    _ANSI_ARGS_((Tcl_Interp *interp));
  613.  
  614. extern void    TableGetActiveBuf _ANSI_ARGS_((register Table *tablePtr));
  615. extern void    ExpandPercents _ANSI_ARGS_((Table *tablePtr, char *before,
  616.             int r, int c, char *oldVal, char *newVal, int idx,
  617.             Tcl_DString *dsPtr, int cmdType));
  618. extern void    TableInvalidate _ANSI_ARGS_((Table *tablePtr, int x, int y,
  619.             int width, int height, int force));
  620. extern void    TableRefresh _ANSI_ARGS_((register Table *tablePtr,
  621.             int arg1, int arg2, int mode));
  622. extern void    TableGeometryRequest _ANSI_ARGS_((Table *tablePtr));
  623. extern void    TableAdjustActive _ANSI_ARGS_((register Table *tablePtr));
  624. extern void    TableAdjustParams _ANSI_ARGS_((register Table *tablePtr));
  625. extern void    TableConfigCursor _ANSI_ARGS_((register Table *tablePtr));
  626. extern void    TableAddFlash _ANSI_ARGS_((Table *tablePtr, int row, int col));
  627.  
  628.  
  629. #define TableInvalidateAll(tablePtr, flags) \
  630.     TableInvalidate((tablePtr), 0, 0, Tk_Width((tablePtr)->tkwin),\
  631.         Tk_Height((tablePtr)->tkwin), (flags))
  632.  
  633.      /*
  634.       * Turn row/col into an index into the table
  635.       */
  636. #define TableMakeArrayIndex(r, c, i)    sprintf((i), "%d,%d", (r), (c))
  637.  
  638.      /*
  639.       * Turn array index back into row/col
  640.       * return the number of args parsed (should be two)
  641.       */
  642. #define TableParseArrayIndex(r, c, i)    sscanf((i), "%d,%d", (r), (c))
  643.  
  644.      /*
  645.       * Macro for finding the last cell of the table
  646.       */
  647. #define TableGetLastCell(tablePtr, rowPtr, colPtr) \
  648.     TableWhatCell((tablePtr),\
  649.         Tk_Width((tablePtr)->tkwin)-(tablePtr)->highlightWidth-1,\
  650.         Tk_Height((tablePtr)->tkwin)-(tablePtr)->highlightWidth-1,\
  651.         (rowPtr), (colPtr))
  652.  
  653. EXTERN int    Tk_TableObjCmd _ANSI_ARGS_((ClientData clientData,
  654.             Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));
  655.  
  656.  
  657. /*
  658.  * end of header
  659.  * reset TCL_STORAGE_CLASS to DLLIMPORT.
  660.  */
  661. #undef TCL_STORAGE_CLASS
  662. #define TCL_STORAGE_CLASS DLLIMPORT
  663.  
  664. /* perltk tkTables replacement for TCL_unsetVar. deletes an element in a hash */
  665. EXTERN void    tkTableUnsetElement _ANSI_ARGS_((Var hashEntry, char * key));
  666.  
  667.  
  668. #endif /* _TKTABLE_H_ */
  669.  
  670.