home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _4ef209e1445a16fe2502df74da4200be < prev    next >
Encoding:
Text File  |  2004-06-01  |  71.0 KB  |  1,860 lines

  1. /*
  2.  * tk.h --
  3.  *
  4.  *      Declarations for Tk-related things that are visible
  5.  *      outside of the Tk module itself.
  6.  *
  7.  * Copyright (c) 1989-1994 The Regents of the University of California.
  8.  * Copyright (c) 1994 The Australian National University.
  9.  * Copyright (c) 1994-1998 Sun Microsystems, Inc.
  10.  * Copyright (c) 1998-2000 Ajuba Solutions.
  11.  *
  12.  * See the file "license.terms" for information on usage and redistribution
  13.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  14.  *
  15.  * RCS: @(#) $Id: tk.h,v 1.74.2.3 2003/10/03 16:32:39 dgp Exp $
  16.  */
  17.  
  18. #ifndef _TK
  19. #define _TK
  20.  
  21. /*
  22.  * For C++ compilers, use extern "C"
  23.  */
  24.  
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28.  
  29. /*
  30.  * When version numbers change here, you must also go into the following files
  31.  * and update the version numbers:
  32.  *
  33.  * library/tk.tcl       (only if Major.minor changes, not patchlevel)
  34.  * unix/configure.in    (2 LOC Major, 2 LOC minor, 1 LOC patch)
  35.  * win/configure.in     (as above)
  36.  * win/makefile.vc      (not patchlevel)
  37.  * README               (sections 0 and 1)
  38.  * mac/README           (not patchlevel)
  39.  * macosx/Wish.pbproj/project.pbxproj
  40.  *                      (14 LOC total, 4 LOC patch)
  41.  * win/README           (not patchlevel)
  42.  * unix/README          (not patchlevel)
  43.  * unix/tk.spec         (3 LOC Major/Minor, 2 LOC patch)
  44.  * win/tcl.m4           (not patchlevel)
  45.  *
  46.  * You may also need to update some of these files when the numbers change
  47.  * for the version of Tcl that this release of Tk is compiled against.
  48.  */
  49.  
  50. #define TK_MAJOR_VERSION   8
  51. #define TK_MINOR_VERSION   4
  52. #define TK_RELEASE_LEVEL   TCL_FINAL_RELEASE
  53. #define TK_RELEASE_SERIAL  5
  54.  
  55. #define TK_VERSION    "8.4"
  56. #define TK_PATCH_LEVEL    "8.4.5"
  57.  
  58. /*
  59.  * The following definitions set up the proper options for Macintosh
  60.  * compilers.  We use this method because there is no autoconf equivalent.
  61.  */
  62.  
  63. #if defined(MAC_TCL) || defined(MAC_OSX_TK)
  64. #   ifndef REDO_KEYSYM_LOOKUP
  65. #       define REDO_KEYSYM_LOOKUP
  66. #   endif
  67. #endif
  68.  
  69.  
  70. /*
  71.  * A special definition used to allow this header file to be included
  72.  * from windows or mac resource files so that they can obtain version
  73.  * information.  RC_INVOKED is defined by default by the windows RC tool
  74.  * and manually set for macintosh.
  75.  *
  76.  * Resource compilers don't like all the C stuff, like typedefs and
  77.  * procedure declarations, that occur below, so block them out.
  78.  */
  79.  
  80. #ifdef RC_INVOKED
  81. #include "Lang.h"
  82. #endif
  83.  
  84. #ifndef RC_INVOKED
  85.  
  86. #ifndef _TKPORT
  87. #include "tkPort.h"
  88. #endif
  89.  
  90. #ifndef _XLIB_H
  91. #   if defined (MAC_TCL)
  92. #       include <Xlib.h>
  93. #       include <X.h>
  94. #   elif defined(MAC_OSX_TK)
  95. #       include <X11/Xlib.h>
  96. #       include <X11/X.h>
  97. #   else
  98. #       include <X11/Xlib.h>
  99. #   endif
  100. #if !defined(_XLIB_H)
  101. #define _XLIB_H
  102. #endif
  103. #endif
  104.  
  105.  
  106. #ifdef __STDC__
  107. #   include <stddef.h>
  108. #endif
  109.  
  110. #ifdef BUILD_tk
  111. # undef TCL_STORAGE_CLASS
  112. # define TCL_STORAGE_CLASS DLLEXPORT
  113. #endif
  114.  
  115. /*
  116.  * Decide whether or not to use input methods.
  117.  */
  118.  
  119. #ifdef XNQueryInputStyle
  120. #define TK_USE_INPUT_METHODS
  121. #endif
  122.  
  123. /*
  124.  * Dummy types that are used by clients:
  125.  */
  126.  
  127. typedef struct Tk_BindingTable_ *Tk_BindingTable;
  128. typedef struct Tk_Canvas_ *Tk_Canvas;
  129. typedef struct Tk_Cursor_ *Tk_Cursor;
  130. typedef struct Tk_ErrorHandler_ *Tk_ErrorHandler;
  131. typedef struct Tk_Font_ *Tk_Font;
  132. typedef struct Tk_Image__ *Tk_Image;
  133. typedef struct Tk_ImageMaster_ *Tk_ImageMaster;
  134. typedef struct Tk_OptionTable_ *Tk_OptionTable;
  135. typedef struct Tk_PostscriptInfo_ *Tk_PostscriptInfo;
  136. typedef struct Tk_TextLayout_ *Tk_TextLayout;
  137. typedef struct Tk_Window_ *Tk_Window;
  138. typedef struct Tk_3DBorder_ *Tk_3DBorder;
  139. typedef struct Tk_Style_ *Tk_Style;
  140. typedef struct Tk_StyleEngine_ *Tk_StyleEngine;
  141. typedef struct Tk_StyledElement_ *Tk_StyledElement;
  142.  
  143. /*
  144.  * Additional types exported to clients.
  145.  */
  146.  
  147. typedef CONST char *Tk_Uid;
  148.  
  149. /*
  150.  * The enum below defines the valid types for Tk configuration options
  151.  * as implemented by Tk_InitOptions, Tk_SetOptions, etc.
  152.  */
  153.  
  154. typedef enum {
  155.     TK_OPTION_BOOLEAN,
  156.     TK_OPTION_INT,
  157.     TK_OPTION_DOUBLE,
  158.     TK_OPTION_STRING,
  159.     TK_OPTION_STRING_TABLE,
  160.     TK_OPTION_COLOR,
  161.     TK_OPTION_FONT,
  162.     TK_OPTION_BITMAP,
  163.     TK_OPTION_BORDER,
  164.     TK_OPTION_RELIEF,
  165.     TK_OPTION_CURSOR,
  166.     TK_OPTION_JUSTIFY,
  167.     TK_OPTION_ANCHOR,
  168.     TK_OPTION_SYNONYM,
  169.     TK_OPTION_PIXELS,
  170.     TK_OPTION_WINDOW,
  171.     TK_OPTION_END,
  172.     TK_OPTION_CUSTOM,
  173.     TK_OPTION_STYLE,
  174.     TK_OPTION_OBJ,
  175.     TK_OPTION_CALLBACK,
  176.     TK_OPTION_SCALARVAR,
  177.     TK_OPTION_HASHVAR,
  178.     TK_OPTION_ARRAYVAR
  179. } Tk_OptionType;
  180.  
  181. /*
  182.  * Structures of the following type are used by widgets to specify
  183.  * their configuration options.  Typically each widget has a static
  184.  * array of these structures, where each element of the array describes
  185.  * a single configuration option.  The array is passed to
  186.  * Tk_CreateOptionTable.
  187.  */
  188.  
  189. typedef struct Tk_OptionSpec {
  190.     Tk_OptionType type;         /* Type of option, such as TK_OPTION_COLOR;
  191.                  * see definitions above. Last option in
  192.                  * table must have type TK_OPTION_END. */
  193.     char *optionName;           /* Name used to specify option in Tcl
  194.                  * commands. */
  195.     char *dbName;               /* Name for option in option database. */
  196.     char *dbClass;              /* Class for option in database. */
  197.     char *defValue;             /* Default value for option if not specified
  198.                  * in command line, the option database,
  199.                  * or the system. */
  200.     int objOffset;              /* Where in record to store a Tcl_Obj * that
  201.                  * holds the value of this option, specified
  202.                  * as an offset in bytes from the start of
  203.                  * the record. Use the Tk_Offset macro to
  204.                  * generate values for this.  -1 means don't
  205.                  * store the Tcl_Obj in the record. */
  206.     int internalOffset;         /* Where in record to store the internal
  207.                  * representation of the value of this option,
  208.                  * such as an int or XColor *.  This field
  209.                  * is specified as an offset in bytes
  210.                  * from the start of the record. Use the
  211.                  * Tk_Offset macro to generate values for it.
  212.                  * -1 means don't store the internal
  213.                  * representation in the record. */
  214.     int flags;                  /* Any combination of the values defined
  215.                  * below. */
  216.     ClientData clientData;      /* An alternate place to put option-specific
  217.                  * data. Used for the monochrome default value
  218.                  * for colors, etc. */
  219.     int typeMask;               /* An arbitrary bit mask defined by the
  220.                  * class manager; typically bits correspond
  221.                  * to certain kinds of options such as all
  222.                  * those that require a redisplay when they
  223.                  * change.  Tk_SetOptions returns the bit-wise
  224.                  * OR of the typeMasks of all options that
  225.                  * were changed. */
  226. } Tk_OptionSpec;
  227.  
  228. /*
  229.  * Flag values for Tk_OptionSpec structures.  These flags are shared by
  230.  * Tk_ConfigSpec structures, so be sure to coordinate any changes
  231.  * carefully.
  232.  */
  233.  
  234. #define TK_OPTION_NULL_OK               (1 << 0)
  235. #define TK_OPTION_DONT_SET_DEFAULT      (1 << 3)
  236.  
  237. /*
  238.  * The following structure and function types are used by TK_OPTION_CUSTOM
  239.  * options; the structure holds pointers to the functions needed by the Tk
  240.  * option config code to handle a custom option.
  241.  */
  242.  
  243. typedef int (Tk_CustomOptionSetProc) _ANSI_ARGS_((ClientData clientData,
  244.     Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj **value, char *widgRec,
  245.     int offset, char *saveInternalPtr, int flags));
  246. typedef Tcl_Obj *(Tk_CustomOptionGetProc) _ANSI_ARGS_((ClientData clientData,
  247.     Tk_Window tkwin, char *widgRec, int offset));
  248. typedef void (Tk_CustomOptionRestoreProc) _ANSI_ARGS_((ClientData clientData,
  249.     Tk_Window tkwin, char *internalPtr, char *saveInternalPtr));
  250. typedef void (Tk_CustomOptionFreeProc) _ANSI_ARGS_((ClientData clientData,
  251.     Tk_Window tkwin, char *internalPtr));
  252.  
  253. typedef struct Tk_ObjCustomOption {
  254.     char *name;                         /* Name of the custom option. */
  255.     Tk_CustomOptionSetProc *setProc;    /* Function to use to set a record's
  256.                      * option value from a Tcl_Obj */
  257.     Tk_CustomOptionGetProc *getProc;    /* Function to use to get a Tcl_Obj
  258.                      * representation from an internal
  259.                      * representation of an option. */
  260.     Tk_CustomOptionRestoreProc *restoreProc;    /* Function to use to restore a
  261.                          * saved value for the internal
  262.                          * representation. */
  263.     Tk_CustomOptionFreeProc *freeProc;  /* Function to use to free the internal
  264.                      * representation of an option. */
  265.     ClientData clientData;              /* Arbitrary one-word value passed to
  266.                      * the handling procs. */
  267. } Tk_ObjCustomOption;
  268.  
  269.  
  270. /*
  271.  * Macro to use to fill in "offset" fields of the Tk_OptionSpec.
  272.  * struct.  Computes number of bytes from beginning of structure
  273.  * to a given field.
  274.  */
  275.  
  276. #ifdef offsetof
  277. #define Tk_Offset(type, field) ((int) offsetof(type, field))
  278. #else
  279. #define Tk_Offset(type, field) ((int) ((char *) &((type *) 0)->field))
  280. #endif
  281.  
  282. /*
  283.  * The following two structures are used for error handling.  When
  284.  * configuration options are being modified, the old values are
  285.  * saved in a Tk_SavedOptions structure.  If an error occurs, then the
  286.  * contents of the structure can be used to restore all of the old
  287.  * values.  The contents of this structure are for the private use
  288.  * Tk.  No-one outside Tk should ever read or write any of the fields
  289.  * of these structures.
  290.  */
  291.  
  292. typedef struct Tk_SavedOption {
  293.     struct TkOption *optionPtr;         /* Points to information that describes
  294.                      * the option. */
  295.     Tcl_Obj *valuePtr;                  /* The old value of the option, in
  296.                      * the form of a Tcl object; may be
  297.                      * NULL if the value wasn't saved as
  298.                      * an object. */
  299.     double internalForm;                /* The old value of the option, in
  300.                      * some internal representation such
  301.                      * as an int or (XColor *).  Valid
  302.                      * only if optionPtr->specPtr->objOffset
  303.                      * is < 0.  The space must be large
  304.                      * enough to accommodate a double, a
  305.                      * long, or a pointer; right now it
  306.                      * looks like a double is big
  307.                      * enough.  Also, using a double
  308.                      * guarantees that the field is
  309.                      * properly aligned for storing large
  310.                      * values. */
  311. } Tk_SavedOption;
  312.  
  313. #ifdef TCL_MEM_DEBUG
  314. #   define TK_NUM_SAVED_OPTIONS 2
  315. #else
  316. #   define TK_NUM_SAVED_OPTIONS 20
  317. #endif
  318.  
  319. typedef struct Tk_SavedOptions {
  320.     char *recordPtr;                    /* The data structure in which to
  321.                      * restore configuration options. */
  322.     Tk_Window tkwin;                    /* Window associated with recordPtr;
  323.                      * needed to restore certain options. */
  324.     int numItems;                       /* The number of valid items in
  325.                      * items field. */
  326.     Tk_SavedOption items[TK_NUM_SAVED_OPTIONS];
  327.                     /* Items used to hold old values. */
  328.     struct Tk_SavedOptions *nextPtr;    /* Points to next structure in list;
  329.                      * needed if too many options changed
  330.                      * to hold all the old values in a
  331.                      * single structure.  NULL means no
  332.                      * more structures. */
  333. } Tk_SavedOptions;
  334.  
  335. /*
  336.  * Structure used to describe application-specific configuration
  337.  * options:  indicates procedures to call to parse an option and
  338.  * to return a text string describing an option. THESE ARE
  339.  * DEPRECATED; PLEASE USE THE NEW STRUCTURES LISTED ABOVE.
  340.  */
  341.  
  342. /*
  343.  * This is a temporary flag used while tkObjConfig and new widgets
  344.  * are in development.
  345.  */
  346.  
  347. #ifndef __NO_OLD_CONFIG
  348.  
  349. typedef int (Tk_OptionParseProc) _ANSI_ARGS_((ClientData clientData,
  350.     Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *value, char *widgRec,
  351.     int offset));
  352. typedef Tcl_Obj *(Tk_OptionPrintProc) _ANSI_ARGS_((ClientData clientData,
  353.     Tk_Window tkwin, char *widgRec, int offset,
  354.     Tcl_FreeProc **freeProcPtr));
  355.  
  356. typedef struct Tk_CustomOption {
  357.     Tk_OptionParseProc *parseProc;      /* Procedure to call to parse an
  358.                      * option and store it in converted
  359.                      * form. */
  360.     Tk_OptionPrintProc *printProc;      /* Procedure to return a printable
  361.                      * string describing an existing
  362.                      * option. */
  363.     ClientData clientData;              /* Arbitrary one-word value used by
  364.                      * option parser:  passed to
  365.                      * parseProc and printProc. */
  366. } Tk_CustomOption;
  367.  
  368. /*
  369.  * Structure used to specify information for Tk_ConfigureWidget.  Each
  370.  * structure gives complete information for one option, including
  371.  * how the option is specified on the command line, where it appears
  372.  * in the option database, etc.
  373.  */
  374.  
  375. typedef struct Tk_ConfigSpec {
  376.     int type;                   /* Type of option, such as TK_CONFIG_COLOR;
  377.                  * see definitions below.  Last option in
  378.                  * table must have type TK_CONFIG_END. */
  379.     char *argvName;             /* Switch used to specify option in objv.
  380.                  * NULL means this spec is part of a group. */
  381.     Tk_Uid dbName;              /* Name for option in option database. */
  382.     Tk_Uid dbClass;             /* Class for option in database. */
  383.     Tk_Uid defValue;            /* Default value for option if not
  384.                  * specified in command line or database. */
  385.     int offset;                 /* Where in widget record to store value;
  386.                  * use Tk_Offset macro to generate values
  387.                  * for this. */
  388.     int specFlags;              /* Any combination of the values defined
  389.                  * below;  other bits are used internally
  390.                  * by tkConfig.c. */
  391.     Tk_CustomOption *customPtr; /* If type is TK_CONFIG_CUSTOM then this is
  392.                  * a pointer to info about how to parse and
  393.                  * print the option.  Otherwise it is
  394.                  * irrelevant. */
  395. } Tk_ConfigSpec;
  396.  
  397. /*
  398.  * Type values for Tk_ConfigSpec structures.  See the user
  399.  * documentation for details.
  400.  */
  401.  
  402.  
  403. /*
  404.  * Macro to use to fill in "offset" fields of Tk_ConfigInfos.
  405.  * Computes number of bytes from beginning of structure to a
  406.  * given field.
  407.  */
  408.  
  409. #ifdef offsetof
  410. #define Tk_Offset(type, field) ((int) offsetof(type, field))
  411. #else
  412. #define Tk_Offset(type, field) ((int) ((char *) &((type *) 0)->field))
  413. #endif
  414.  
  415. typedef enum {
  416.     TK_CONFIG_BOOLEAN, TK_CONFIG_INT, TK_CONFIG_DOUBLE, TK_CONFIG_STRING,
  417.     TK_CONFIG_UID, TK_CONFIG_COLOR, TK_CONFIG_FONT, TK_CONFIG_BITMAP,
  418.     TK_CONFIG_BORDER, TK_CONFIG_RELIEF, TK_CONFIG_CURSOR,
  419.     TK_CONFIG_ACTIVE_CURSOR, TK_CONFIG_JUSTIFY, TK_CONFIG_ANCHOR,
  420.     TK_CONFIG_SYNONYM, TK_CONFIG_CAP_STYLE, TK_CONFIG_JOIN_STYLE,
  421.     TK_CONFIG_PIXELS, TK_CONFIG_MM, TK_CONFIG_WINDOW, TK_CONFIG_CUSTOM,
  422.     TK_CONFIG_CALLBACK, TK_CONFIG_LANGARG, TK_CONFIG_SCALARVAR,
  423.     TK_CONFIG_HASHVAR,  TK_CONFIG_ARRAYVAR, TK_CONFIG_OBJECT,
  424.     TK_CONFIG_END
  425. } Tk_ConfigTypes;
  426.  
  427. /*
  428.  * Possible values for flags argument to Tk_ConfigureWidget:
  429.  */
  430.  
  431. #define TK_CONFIG_ARGV_ONLY     1
  432. #define TK_CONFIG_OBJS          0x80
  433.  
  434. /*
  435.  * Possible flag values for Tk_ConfigSpec structures.  Any bits at
  436.  * or above TK_CONFIG_USER_BIT may be used by clients for selecting
  437.  * certain entries.  Before changing any values here, coordinate with
  438.  * tkOldConfig.c (internal-use-only flags are defined there).
  439.  */
  440.  
  441. #define TK_CONFIG_NULL_OK               (1 << 0)
  442. #define TK_CONFIG_COLOR_ONLY            (1 << 1)
  443. #define TK_CONFIG_MONO_ONLY             (1 << 2)
  444. #define TK_CONFIG_DONT_SET_DEFAULT      (1 << 3)
  445. #define TK_CONFIG_OPTION_SPECIFIED      (1 << 4)
  446. #define TK_CONFIG_USER_BIT              0x100
  447. #endif /* __NO_OLD_CONFIG */
  448.  
  449. /*
  450.  * Structure used to specify how to handle argv options.
  451.  */
  452.  
  453. typedef struct {
  454.     char *key;          /* The key string that flags the option in the
  455.              * objv array. */
  456.     int type;           /* Indicates option type;  see below. */
  457.     char *src;          /* Value to be used in setting dst;  usage
  458.              * depends on type. */
  459.     char *dst;          /* Address of value to be modified;  usage
  460.              * depends on type. */
  461.     char *help;         /* Documentation message describing this option. */
  462. } Tk_ArgvInfo;
  463.  
  464. /*
  465.  * Legal values for the type field of a Tk_ArgvInfo: see the user
  466.  * documentation for details.
  467.  */
  468.  
  469. #define TK_ARGV_CONSTANT                15
  470. #define TK_ARGV_INT                     16
  471. #define TK_ARGV_STRING                  17
  472. #define TK_ARGV_UID                     18
  473. #define TK_ARGV_REST                    19
  474. #define TK_ARGV_FLOAT                   20
  475. #define TK_ARGV_FUNC                    21
  476. #define TK_ARGV_GENFUNC                 22
  477. #define TK_ARGV_HELP                    23
  478. #define TK_ARGV_CONST_OPTION            24
  479. #define TK_ARGV_OPTION_VALUE            25
  480. #define TK_ARGV_OPTION_NAME_VALUE       26
  481. #define TK_ARGV_END                     27
  482.  
  483. /*
  484.  * Flag bits for passing to Tk_ParseArgv:
  485.  */
  486.  
  487. #define TK_ARGV_NO_DEFAULTS             0x1
  488. #define TK_ARGV_NO_LEFTOVERS            0x2
  489. #define TK_ARGV_NO_ABBREV               0x4
  490. #define TK_ARGV_DONT_SKIP_FIRST_ARG     0x8
  491.  
  492. /*
  493.  * Enumerated type for describing actions to be taken in response
  494.  * to a restrictProc established by Tk_RestrictEvents.
  495.  */
  496.  
  497. typedef enum {
  498.     TK_DEFER_EVENT, TK_PROCESS_EVENT, TK_DISCARD_EVENT
  499. } Tk_RestrictAction;
  500.  
  501. /*
  502.  * Priority levels to pass to Tk_AddOption:
  503.  */
  504.  
  505. #define TK_WIDGET_DEFAULT_PRIO  20
  506. #define TK_STARTUP_FILE_PRIO    40
  507. #define TK_USER_DEFAULT_PRIO    60
  508. #define TK_INTERACTIVE_PRIO     80
  509. #define TK_MAX_PRIO             100
  510.  
  511. /*
  512.  * Relief values returned by Tk_GetRelief:
  513.  */
  514.  
  515. #define TK_RELIEF_NULL          -1
  516. #define TK_RELIEF_FLAT          0
  517. #define TK_RELIEF_GROOVE        1
  518. #define TK_RELIEF_RAISED        2
  519. #define TK_RELIEF_RIDGE         3
  520. #define TK_RELIEF_SOLID         4
  521. #define TK_RELIEF_SUNKEN        5
  522.  
  523. /*
  524.  * "Which" argument values for Tk_3DBorderGC:
  525.  */
  526.  
  527. #define TK_3D_FLAT_GC           1
  528. #define TK_3D_LIGHT_GC          2
  529. #define TK_3D_DARK_GC           3
  530.  
  531. /*
  532.  * Special EnterNotify/LeaveNotify "mode" for use in events
  533.  * generated by tkShare.c.  Pick a high enough value that it's
  534.  * unlikely to conflict with existing values (like NotifyNormal)
  535.  * or any new values defined in the future.
  536.  */
  537.  
  538. #define TK_NOTIFY_SHARE         20
  539.  
  540. /*
  541.  * Enumerated type for describing a point by which to anchor something:
  542.  */
  543.  
  544. typedef enum {
  545.     TK_ANCHOR_N, TK_ANCHOR_NE, TK_ANCHOR_E, TK_ANCHOR_SE,
  546.     TK_ANCHOR_S, TK_ANCHOR_SW, TK_ANCHOR_W, TK_ANCHOR_NW,
  547.     TK_ANCHOR_CENTER
  548. } Tk_Anchor;
  549.  
  550. /*
  551.  * Enumerated type for describing a style of justification:
  552.  */
  553.  
  554. typedef enum {
  555.     TK_JUSTIFY_LEFT, TK_JUSTIFY_RIGHT, TK_JUSTIFY_CENTER
  556. } Tk_Justify;
  557.  
  558. /*
  559.  * The following structure is used by Tk_GetFontMetrics() to return
  560.  * information about the properties of a Tk_Font.
  561.  */
  562.  
  563. typedef struct Tk_FontMetrics {
  564.     int ascent;                 /* The amount in pixels that the tallest
  565.                  * letter sticks up above the baseline, plus
  566.                  * any extra blank space added by the designer
  567.                  * of the font. */
  568.     int descent;                /* The largest amount in pixels that any
  569.                  * letter sticks below the baseline, plus any
  570.                  * extra blank space added by the designer of
  571.                  * the font. */
  572.     int linespace;              /* The sum of the ascent and descent.  How
  573.                  * far apart two lines of text in the same
  574.                  * font should be placed so that none of the
  575.                  * characters in one line overlap any of the
  576.                  * characters in the other line. */
  577. } Tk_FontMetrics;
  578.  
  579. /*
  580.  * Flags passed to Tk_MeasureChars:
  581.  */
  582.  
  583. #define TK_WHOLE_WORDS          1
  584. #define TK_AT_LEAST_ONE         2
  585. #define TK_PARTIAL_OK           4
  586.  
  587. /*
  588.  * Flags passed to Tk_ComputeTextLayout:
  589.  */
  590.  
  591. #define TK_IGNORE_TABS          8
  592. #define TK_IGNORE_NEWLINES      16
  593.  
  594. /*
  595.  * Widget class procedures used to implement platform specific widget
  596.  * behavior.
  597.  */
  598.  
  599. typedef Window (Tk_ClassCreateProc) _ANSI_ARGS_((Tk_Window tkwin,
  600.     Window parent, ClientData instanceData));
  601. typedef void (Tk_ClassWorldChangedProc) _ANSI_ARGS_((ClientData instanceData));
  602. typedef void (Tk_ClassModalProc) _ANSI_ARGS_((Tk_Window tkwin,
  603.     XEvent *eventPtr));
  604.  
  605. typedef struct Tk_ClassProcs {
  606.     unsigned int size;
  607.     Tk_ClassWorldChangedProc *worldChangedProc;
  608.                 /* Procedure to invoke when the widget needs to
  609.                  * respond in some way to a change in the
  610.                  * world (font changes, etc.) */
  611.     Tk_ClassCreateProc *createProc;
  612.                 /* Procedure to invoke when the
  613.                  * platform-dependent window needs to be
  614.                  * created. */
  615.     Tk_ClassModalProc *modalProc;
  616.                 /* Procedure to invoke after all bindings on a
  617.                  * widget have been triggered in order to
  618.                  * handle a modal loop. */
  619. } Tk_ClassProcs;
  620.  
  621. /*
  622.  * Simple accessor for Tk_ClassProcs structure.  Checks that the structure
  623.  * is not NULL, then checks the size field and returns either the requested
  624.  * field, if present, or NULL if the structure is too small to have the field
  625.  * (or NULL if the structure is NULL).
  626.  *
  627.  * A more general version of this function may be useful if other
  628.  * size-versioned structure pop up in the future:
  629.  *
  630.  *      #define Tk_GetField(name, who, which) \
  631.  *          (((who) == NULL) ? NULL :
  632.  *          (((who)->size <= Tk_Offset(name, which)) ? NULL :(name)->which))
  633.  */
  634.  
  635. #define Tk_GetClassProc(procs, which) \
  636.     (((procs) == NULL) ? NULL : \
  637.     (((procs)->size <= Tk_Offset(Tk_ClassProcs, which)) ? NULL:(procs)->which))
  638.  
  639. /*
  640.  * Each geometry manager (the packer, the placer, etc.) is represented
  641.  * by a structure of the following form, which indicates procedures
  642.  * to invoke in the geometry manager to carry out certain functions.
  643.  */
  644.  
  645. typedef void (Tk_GeomRequestProc) _ANSI_ARGS_((ClientData clientData,
  646.     Tk_Window tkwin));
  647. typedef void (Tk_GeomLostSlaveProc) _ANSI_ARGS_((ClientData clientData,
  648.     Tk_Window tkwin));
  649.  
  650. typedef struct Tk_GeomMgr {
  651.     char *name;                 /* Name of the geometry manager (command
  652.                  * used to invoke it, or name of widget
  653.                  * class that allows embedded widgets). */
  654.     Tk_GeomRequestProc *requestProc;
  655.                 /* Procedure to invoke when a slave's
  656.                  * requested geometry changes. */
  657.     Tk_GeomLostSlaveProc *lostSlaveProc;
  658.                 /* Procedure to invoke when a slave is
  659.                  * taken away from one geometry manager
  660.                  * by another.  NULL means geometry manager
  661.                  * doesn't care when slaves are lost. */
  662. } Tk_GeomMgr;
  663.  
  664. /*
  665.  * Result values returned by Tk_GetScrollInfo:
  666.  */
  667.  
  668. #define TK_SCROLL_MOVETO        1
  669. #define TK_SCROLL_PAGES         2
  670. #define TK_SCROLL_UNITS         3
  671. #define TK_SCROLL_ERROR         4
  672.  
  673. /*
  674.  *---------------------------------------------------------------------------
  675.  *
  676.  * Extensions to the X event set
  677.  *
  678.  *---------------------------------------------------------------------------
  679.  */
  680. #define VirtualEvent        (LASTEvent)
  681. #define ActivateNotify      (LASTEvent + 1)
  682. #define DeactivateNotify    (LASTEvent + 2)
  683. #define MouseWheelEvent     (LASTEvent + 3)
  684. #define TK_LASTEVENT        (LASTEvent + 4)
  685.  
  686. #define MouseWheelMask      (1L << 28)
  687.  
  688. #define ActivateMask        (1L << 29)
  689. #define VirtualEventMask    (1L << 30)
  690. #define TK_LASTEVENT        (LASTEvent + 4)
  691.  
  692.  
  693. /*
  694.  * A virtual event shares most of its fields with the XKeyEvent and
  695.  * XButtonEvent structures.  99% of the time a virtual event will be
  696.  * an abstraction of a key or button event, so this structure provides
  697.  * the most information to the user.  The only difference is the changing
  698.  * of the detail field for a virtual event so that it holds the name of the
  699.  * virtual event being triggered.
  700.  */
  701.  
  702. typedef struct {
  703.     int type;
  704.     unsigned long serial;   /* # of last request processed by server */
  705.     Bool send_event;        /* True if this came from a SendEvent request */
  706.     Display *display;       /* Display the event was read from */
  707.     Window event;           /* Window on which event was requested. */
  708.     Window root;            /* root window that the event occured on */
  709.     Window subwindow;       /* child window */
  710.     Time time;              /* milliseconds */
  711.     int x, y;               /* pointer x, y coordinates in event window */
  712.     int x_root, y_root;     /* coordinates relative to root */
  713.     unsigned int state;     /* key or button mask */
  714.     Tk_Uid name;            /* Name of virtual event. */
  715.     Bool same_screen;       /* same screen flag */
  716. } XVirtualEvent;
  717.  
  718. typedef struct {
  719.     int type;
  720.     unsigned long serial;   /* # of last request processed by server */
  721.     Bool send_event;        /* True if this came from a SendEvent request */
  722.     Display *display;       /* Display the event was read from */
  723.     Window window;          /* Window in which event occurred. */
  724. } XActivateDeactivateEvent;
  725. typedef XActivateDeactivateEvent XActivateEvent;
  726. typedef XActivateDeactivateEvent XDeactivateEvent;
  727.  
  728. /*
  729.  *--------------------------------------------------------------
  730.  *
  731.  * Macros for querying Tk_Window structures.  See the
  732.  * manual entries for documentation.
  733.  *
  734.  *--------------------------------------------------------------
  735.  */
  736.  
  737. #define Tk_Display(tkwin)               (((Tk_FakeWin *) (tkwin))->display)
  738. #define Tk_ScreenNumber(tkwin)          (((Tk_FakeWin *) (tkwin))->screenNum)
  739. #define Tk_Screen(tkwin)                (ScreenOfDisplay(Tk_Display(tkwin), \
  740.     Tk_ScreenNumber(tkwin)))
  741. #define Tk_Depth(tkwin)                 (((Tk_FakeWin *) (tkwin))->depth)
  742. #define Tk_Visual(tkwin)                (((Tk_FakeWin *) (tkwin))->visual)
  743. #define Tk_WindowId(tkwin)              (((Tk_FakeWin *) (tkwin))->window)
  744. #define Tk_PathName(tkwin)              (((Tk_FakeWin *) (tkwin))->pathName)
  745. #define Tk_Name(tkwin)                  (((Tk_FakeWin *) (tkwin))->nameUid)
  746. #define Tk_Class(tkwin)                 (((Tk_FakeWin *) (tkwin))->classUid)
  747. #define Tk_X(tkwin)                     (((Tk_FakeWin *) (tkwin))->changes.x)
  748. #define Tk_Y(tkwin)                     (((Tk_FakeWin *) (tkwin))->changes.y)
  749. #define Tk_Width(tkwin)                 (((Tk_FakeWin *) (tkwin))->changes.width)
  750. #define Tk_Height(tkwin) \
  751.     (((Tk_FakeWin *) (tkwin))->changes.height)
  752. #define Tk_Changes(tkwin)               (&((Tk_FakeWin *) (tkwin))->changes)
  753. #define Tk_Attributes(tkwin)            (&((Tk_FakeWin *) (tkwin))->atts)
  754. #define Tk_IsEmbedded(tkwin) \
  755.     (((Tk_FakeWin *) (tkwin))->flags & TK_EMBEDDED)
  756. #define Tk_IsContainer(tkwin) \
  757.     (((Tk_FakeWin *) (tkwin))->flags & TK_CONTAINER)
  758. #define Tk_IsMapped(tkwin) \
  759.     (((Tk_FakeWin *) (tkwin))->flags & TK_MAPPED)
  760. #define Tk_IsTopLevel(tkwin) \
  761.     (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_LEVEL)
  762. #define Tk_HasWrapper(tkwin) \
  763.     (((Tk_FakeWin *) (tkwin))->flags & TK_HAS_WRAPPER)
  764. #define Tk_WinManaged(tkwin) \
  765.     (((Tk_FakeWin *) (tkwin))->flags & TK_WIN_MANAGED)
  766. #define Tk_TopWinHierarchy(tkwin) \
  767.     (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY)
  768. #define Tk_ReqWidth(tkwin)              (((Tk_FakeWin *) (tkwin))->reqWidth)
  769. #define Tk_ReqHeight(tkwin)             (((Tk_FakeWin *) (tkwin))->reqHeight)
  770. /* Tk_InternalBorderWidth is deprecated */
  771. #define Tk_InternalBorderWidth(tkwin) \
  772.     (((Tk_FakeWin *) (tkwin))->internalBorderLeft)
  773. #define Tk_InternalBorderLeft(tkwin) \
  774.     (((Tk_FakeWin *) (tkwin))->internalBorderLeft)
  775. #define Tk_InternalBorderRight(tkwin) \
  776.     (((Tk_FakeWin *) (tkwin))->internalBorderRight)
  777. #define Tk_InternalBorderTop(tkwin) \
  778.     (((Tk_FakeWin *) (tkwin))->internalBorderTop)
  779. #define Tk_InternalBorderBottom(tkwin) \
  780.     (((Tk_FakeWin *) (tkwin))->internalBorderBottom)
  781. #define Tk_MinReqWidth(tkwin)           (((Tk_FakeWin *) (tkwin))->minReqWidth)
  782. #define Tk_MinReqHeight(tkwin)          (((Tk_FakeWin *) (tkwin))->minReqHeight)
  783. #define Tk_Parent(tkwin)                (((Tk_FakeWin *) (tkwin))->parentPtr)
  784. #define Tk_Colormap(tkwin)              (((Tk_FakeWin *) (tkwin))->atts.colormap)
  785.  
  786. /*
  787.  * The structure below is needed by the macros above so that they can
  788.  * access the fields of a Tk_Window.  The fields not needed by the macros
  789.  * are declared as "dummyX".  The structure has its own type in order to
  790.  * prevent applications from accessing Tk_Window fields except using
  791.  * official macros.  WARNING!! The structure definition must be kept
  792.  * consistent with the TkWindow structure in tkInt.h.  If you change one,
  793.  * then change the other.  See the declaration in tkInt.h for
  794.  * documentation on what the fields are used for internally.
  795.  */
  796.  
  797. typedef struct Tk_FakeWin {
  798.     Display *display;
  799.     char *dummy1;               /* dispPtr */
  800.     int screenNum;
  801.     Visual *visual;
  802.     int depth;
  803.     Window window;
  804.     char *dummy2;               /* childList */
  805.     char *dummy3;               /* lastChildPtr */
  806.     Tk_Window parentPtr;        /* parentPtr */
  807.     char *dummy4;               /* nextPtr */
  808.     char *dummy5;               /* mainPtr */
  809.     char *pathName;
  810.     Tk_Uid nameUid;
  811.     Tk_Uid classUid;
  812.     XWindowChanges changes;
  813.     unsigned int dummy6;        /* dirtyChanges */
  814.     XSetWindowAttributes atts;
  815.     unsigned long dummy7;       /* dirtyAtts */
  816.     unsigned int flags;
  817.     char *dummy8;               /* handlerList */
  818. #ifdef TK_USE_INPUT_METHODS
  819.     XIC dummy9;                 /* inputContext */
  820. #endif /* TK_USE_INPUT_METHODS */
  821.     ClientData *dummy10;        /* tagPtr */
  822.     int dummy11;                /* numTags */
  823.     int dummy12;                /* optionLevel */
  824.     char *dummy13;              /* selHandlerList */
  825.     char *dummy14;              /* geomMgrPtr */
  826.     ClientData dummy15;         /* geomData */
  827.     int reqWidth, reqHeight;
  828.     int internalBorderLeft;
  829.     char *dummy16;              /* wmInfoPtr */
  830.     char *dummy17;              /* classProcPtr */
  831.     ClientData dummy18;         /* instanceData */
  832.     char *dummy19;              /* privatePtr */
  833.     int internalBorderRight;
  834.     int internalBorderTop;
  835.     int internalBorderBottom;
  836.     int minReqWidth;
  837.     int minReqHeight;
  838. } Tk_FakeWin;
  839.  
  840. /*
  841.  * Flag values for TkWindow (and Tk_FakeWin) structures are:
  842.  *
  843.  * TK_MAPPED:                   1 means window is currently mapped,
  844.  *                              0 means unmapped.
  845.  * TK_TOP_LEVEL:                1 means this is a top-level widget.
  846.  * TK_ALREADY_DEAD:             1 means the window is in the process of
  847.  *                              being destroyed already.
  848.  * TK_NEED_CONFIG_NOTIFY:       1 means that the window has been reconfigured
  849.  *                              before it was made to exist.  At the time of
  850.  *                              making it exist a ConfigureNotify event needs
  851.  *                              to be generated.
  852.  * TK_GRAB_FLAG:                Used to manage grabs.  See tkGrab.c for
  853.  *                              details.
  854.  * TK_CHECKED_IC:               1 means we've already tried to get an input
  855.  *                              context for this window;  if the ic field
  856.  *                              is NULL it means that there isn't a context
  857.  *                              for the field.
  858.  * TK_DONT_DESTROY_WINDOW:      1 means that Tk_DestroyWindow should not
  859.  *                              invoke XDestroyWindow to destroy this widget's
  860.  *                              X window.  The flag is set when the window
  861.  *                              has already been destroyed elsewhere (e.g.
  862.  *                              by another application) or when it will be
  863.  *                              destroyed later (e.g. by destroying its
  864.  *                              parent).
  865.  * TK_WM_COLORMAP_WINDOW:       1 means that this window has at some time
  866.  *                              appeared in the WM_COLORMAP_WINDOWS property
  867.  *                              for its toplevel, so we have to remove it
  868.  *                              from that property if the window is
  869.  *                              deleted and the toplevel isn't.
  870.  * TK_EMBEDDED:                 1 means that this window (which must be a
  871.  *                              toplevel) is not a free-standing window but
  872.  *                              rather is embedded in some other application.
  873.  * TK_CONTAINER:                1 means that this window is a container, and
  874.  *                              that some other application (either in
  875.  *                              this process or elsewhere) may be
  876.  *                              embedding itself inside the window.
  877.  * TK_BOTH_HALVES:              1 means that this window is used for
  878.  *                              application embedding (either as
  879.  *                              container or embedded application), and
  880.  *                              both the containing and embedded halves
  881.  *                              are associated with windows in this
  882.  *                              particular process.
  883.  * TK_DEFER_MODAL:              1 means that this window has deferred a modal
  884.  *                              loop until all of the bindings for the current
  885.  *                              event have been invoked.
  886.  * TK_WRAPPER:                  1 means that this window is the extra
  887.  *                              wrapper window created around a toplevel
  888.  *                              to hold the menubar under Unix.  See
  889.  *                              tkUnixWm.c for more information.
  890.  * TK_REPARENTED:               1 means that this window has been reparented
  891.  *                              so that as far as the window system is
  892.  *                              concerned it isn't a child of its Tk
  893.  *                              parent.  Initially this is used only for
  894.  *                              special Unix menubar windows.
  895.  * TK_ANONYMOUS_WINDOW:         1 means that this window has no name, and is
  896.  *                              thus not accessible from Tk.
  897.  * TK_HAS_WRAPPER               1 means that this window has a wrapper window
  898.  * TK_WIN_MANAGED               1 means that this window is a child of the
  899.  *                              root window, and is managed by the window
  900.  *                              manager.
  901.  * TK_TOP_HIERARCHY             1 means this window is at the top of a
  902.  *                              physical window hierarchy within this
  903.  *                              process, i.e. the window's parent
  904.  *                              either doesn't exist or is not owned by
  905.  *                              this Tk application.
  906.  * TK_PROP_PROPCHANGE           1 means that PropertyNotify events in
  907.  *                              this window's children should propagate
  908.  *                              up to this window.
  909.  */
  910.  
  911.  
  912. #define TK_MAPPED               1
  913. #define TK_TOP_LEVEL            2
  914. #define TK_ALREADY_DEAD         4
  915. #define TK_NEED_CONFIG_NOTIFY   8
  916. #define TK_GRAB_FLAG            0x10
  917. #define TK_CHECKED_IC           0x20
  918. #define TK_DONT_DESTROY_WINDOW  0x40
  919. #define TK_WM_COLORMAP_WINDOW   0x80
  920. #define TK_EMBEDDED             0x100
  921. #define TK_CONTAINER            0x200
  922. #define TK_BOTH_HALVES          0x400
  923. #define TK_DEFER_MODAL          0x800
  924. #define TK_WRAPPER              0x1000
  925. #define TK_REPARENTED           0x2000
  926. #define TK_ANONYMOUS_WINDOW     0x4000
  927. #define TK_HAS_WRAPPER          0x8000
  928. #define TK_WIN_MANAGED          0x10000
  929. #define TK_TOP_HIERARCHY        0x20000
  930. #define TK_PROP_PROPCHANGE      0x40000
  931.  
  932. /*
  933.  *--------------------------------------------------------------
  934.  *
  935.  * Procedure prototypes and structures used for defining new canvas
  936.  * items:
  937.  *
  938.  *--------------------------------------------------------------
  939.  */
  940.  
  941. typedef enum {
  942.     TK_STATE_NULL = -1, TK_STATE_ACTIVE, TK_STATE_DISABLED,
  943.     TK_STATE_NORMAL, TK_STATE_HIDDEN
  944. } Tk_State;
  945.  
  946. typedef struct Tk_SmoothMethod {
  947.     char *name;
  948.     int (*coordProc) _ANSI_ARGS_((Tk_Canvas canvas,
  949.         double *pointPtr, int numPoints, int numSteps,
  950.         XPoint xPoints[], double dblPoints[]));
  951.     void (*postscriptProc) _ANSI_ARGS_((Tcl_Interp *interp,
  952.         Tk_Canvas canvas, double *coordPtr,
  953.         int numPoints, int numSteps));
  954. } Tk_SmoothMethod;
  955.  
  956. /*
  957.  * For each item in a canvas widget there exists one record with
  958.  * the following structure.  Each actual item is represented by
  959.  * a record with the following stuff at its beginning, plus additional
  960.  * type-specific stuff after that.
  961.  */
  962.  
  963. #define TK_TAG_SPACE 3
  964.  
  965. typedef struct Tk_Item  {
  966.     int id;                             /* Unique identifier for this item
  967.                      * (also serves as first tag for
  968.                      * item). */
  969.     struct Tk_Item *nextPtr;            /* Next in display list of all
  970.                      * items in this canvas.  Later items
  971.                      * in list are drawn on top of earlier
  972.                      * ones. */
  973.     Tk_Uid staticTagSpace[TK_TAG_SPACE];/* Built-in space for limited # of
  974.                      * tags. */
  975.     Tk_Uid *tagPtr;                     /* Pointer to array of tags.  Usually
  976.                      * points to staticTagSpace, but
  977.                      * may point to malloc-ed space if
  978.                      * there are lots of tags. */
  979.     int tagSpace;                       /* Total amount of tag space available
  980.                      * at tagPtr. */
  981.     int numTags;                        /* Number of tag slots actually used
  982.                      * at *tagPtr. */
  983.     struct Tk_ItemType *typePtr;        /* Table of procedures that implement
  984.                      * this type of item. */
  985.     int x1, y1, x2, y2;                 /* Bounding box for item, in integer
  986.                      * canvas units. Set by item-specific
  987.                      * code and guaranteed to contain every
  988.                      * pixel drawn in item.  Item area
  989.                      * includes x1 and y1 but not x2
  990.                      * and y2. */
  991.     struct Tk_Item *prevPtr;            /* Previous in display list of all
  992.                      * items in this canvas. Later items
  993.                      * in list are drawn just below earlier
  994.                      * ones. */
  995.     Tk_State state;                     /* state of item */
  996.     LangCallback *updateCmd;            /* for "-updatecommand" option */
  997.     int redraw_flags;                   /* some flags used in the canvas */
  998.     struct Tk_Item *group;              /* group item managing this one */
  999.  
  1000.     /*
  1001.      *------------------------------------------------------------------
  1002.      * Starting here is additional type-specific stuff;  see the
  1003.      * declarations for individual types to see what is part of
  1004.      * each type.  The actual space below is determined by the
  1005.      * "itemInfoSize" of the type's Tk_ItemType record.
  1006.      *------------------------------------------------------------------
  1007.      */
  1008. } Tk_Item;
  1009.  
  1010. /*
  1011.  * Flag bits for canvases (redraw_flags):
  1012.  *
  1013.  * TK_ITEM_STATE_DEPENDANT -    1 means that object needs to be
  1014.  *                              redrawn if the canvas state changes.
  1015.  * TK_ITEM_DONT_REDRAW -        1 means that the object redraw is already
  1016.  *                              been prepared, so the general canvas code
  1017.  *                              doesn't need to do that any more.
  1018.  */
  1019.  
  1020. #define TK_ITEM_STATE_DEPENDANT         1
  1021. #define TK_ITEM_DONT_REDRAW             2
  1022.  
  1023. /*
  1024.  * Structures used for implementing visitors.
  1025.  */
  1026.  
  1027. typedef ClientData Tk_VisitorStartProc _ANSI_ARGS_((Tcl_Interp *interp,
  1028.            Tk_Canvas canvas, int argc, Tcl_Obj *CONST *objv));
  1029. typedef int     Tk_VisitorItemProc _ANSI_ARGS_((Tcl_Interp *interp,
  1030.            Tk_Canvas canvas, ClientData clientData,
  1031.            Tk_Item *itemPtr));
  1032. typedef int     Tk_VisitorEndProc _ANSI_ARGS_((Tcl_Interp *interp,
  1033.            Tk_Canvas canvas, ClientData clientData));
  1034.  
  1035. typedef struct Tk_VisitorType {
  1036.     char *name;
  1037.     int typeSize;                       /* should be sizeof(Tk_VisitorType) */
  1038.     int flags;                          /* If this flag is non-zero then
  1039.                      * the item needs to be redrawn. */
  1040.     Tk_VisitorStartProc *startProc;
  1041.     Tk_VisitorEndProc  *endProc;
  1042.     Tk_VisitorItemProc *visitArc;       /* The Arc visitor procedure. */
  1043.     Tk_VisitorItemProc *visitBitmap;    /* The Bitmap visitor procedure. */
  1044.     Tk_VisitorItemProc *visitImage;     /* The Image visitor procedure. */
  1045.     Tk_VisitorItemProc *visitLine;      /* The Line visitor procedure. */
  1046.     Tk_VisitorItemProc *visitOval;      /* The Oval visitor procedure. */
  1047.     Tk_VisitorItemProc *visitPolygon;   /* The Polygon visitor procedure. */
  1048.     Tk_VisitorItemProc *visitRectangle; /* The Rectangle visitor procedure. */
  1049.     Tk_VisitorItemProc *visitText;      /* The Text visitor procedure. */
  1050.     Tk_VisitorItemProc *visitWindow;    /* The Window visitor procedure. */
  1051.     Tk_VisitorItemProc *visitSticker;   /* The Sticker visitor procedure.
  1052.                      * from tkSticker*/
  1053.     Tk_VisitorItemProc *visitViewport;  /* The Viewport visitor procedure.
  1054.                      * from TkSM */
  1055.     Tk_VisitorItemProc *visitBarchart;  /* The Barchart visitor procedure.
  1056.                      * from Scotty */
  1057.     Tk_VisitorItemProc *visitStripchart;/* The Stripchart visitor procedure.
  1058.                      * from Scotty */
  1059.  
  1060.     /* ptk extensions */
  1061.     Tk_VisitorItemProc *visitGroup;     /* The Group visitor procedure. */
  1062.     Tk_VisitorItemProc *visitGrid;      /* The Grid visitor procedure. */
  1063.  
  1064.     /*
  1065.      *------------------------------------------------------------------
  1066.      * Starting here is additional item-extension stuff;
  1067.      * you can add extra item types after this plus other information.
  1068.      *------------------------------------------------------------------
  1069.      */
  1070. } Tk_VisitorType;
  1071.  
  1072. /*
  1073.  * Records of the following type are used to describe a type of
  1074.  * item (e.g.  lines, circles, etc.) that can form part of a
  1075.  * canvas widget.
  1076.  */
  1077.  
  1078. #ifdef USE_OLD_CANVAS
  1079. typedef int     Tk_ItemCreateProc _ANSI_ARGS_((Tcl_Interp *interp,
  1080.             Tk_Canvas canvas, Tk_Item *itemPtr, int argc,
  1081.             Tcl_Obj *CONST *objv));
  1082. typedef int     Tk_ItemConfigureProc _ANSI_ARGS_((Tcl_Interp *interp,
  1083.             Tk_Canvas canvas, Tk_Item *itemPtr, int argc,
  1084.             Tcl_Obj *CONST *objv, int flags));
  1085. typedef int     Tk_ItemCoordProc _ANSI_ARGS_((Tcl_Interp *interp,
  1086.             Tk_Canvas canvas, Tk_Item *itemPtr, int argc,
  1087.             Tcl_Obj *CONST *objv));
  1088. #else
  1089. typedef int     Tk_ItemCreateProc _ANSI_ARGS_((Tcl_Interp *interp,
  1090.             Tk_Canvas canvas, Tk_Item *itemPtr, int argc,
  1091.             Tcl_Obj *CONST objv[]));
  1092. typedef int     Tk_ItemConfigureProc _ANSI_ARGS_((Tcl_Interp *interp,
  1093.             Tk_Canvas canvas, Tk_Item *itemPtr, int argc,
  1094.             CONST84 Tcl_Obj *CONST objv[], int flags));
  1095. typedef int     Tk_ItemCoordProc _ANSI_ARGS_((Tcl_Interp *interp,
  1096.             Tk_Canvas canvas, Tk_Item *itemPtr, int argc,
  1097.             Tcl_Obj *CONST objv[]));
  1098. #endif
  1099. typedef void    Tk_ItemDeleteProc _ANSI_ARGS_((Tk_Canvas canvas,
  1100.             Tk_Item *itemPtr, Display *display));
  1101. typedef void    Tk_ItemDisplayProc _ANSI_ARGS_((Tk_Canvas canvas,
  1102.             Tk_Item *itemPtr, Display *display, Drawable dst,
  1103.             int x, int y, int width, int height));
  1104. typedef double  Tk_ItemPointProc _ANSI_ARGS_((Tk_Canvas canvas,
  1105.             Tk_Item *itemPtr, double *pointPtr));
  1106. typedef int     Tk_ItemAreaProc _ANSI_ARGS_((Tk_Canvas canvas,
  1107.             Tk_Item *itemPtr, double *rectPtr));
  1108. typedef int     Tk_ItemPostscriptProc _ANSI_ARGS_((Tcl_Interp *interp,
  1109.             Tk_Canvas canvas, Tk_Item *itemPtr, int prepass));
  1110. typedef void    Tk_ItemScaleProc _ANSI_ARGS_((Tk_Canvas canvas,
  1111.             Tk_Item *itemPtr, double originX, double originY,
  1112.             double scaleX, double scaleY));
  1113. typedef void    Tk_ItemTranslateProc _ANSI_ARGS_((Tk_Canvas canvas,
  1114.             Tk_Item *itemPtr, double deltaX, double deltaY));
  1115. typedef int     Tk_ItemIndexProc _ANSI_ARGS_((Tcl_Interp *interp,
  1116.             Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Obj *indexString,
  1117.             int *indexPtr));
  1118. typedef void    Tk_ItemCursorProc _ANSI_ARGS_((Tk_Canvas canvas,
  1119.             Tk_Item *itemPtr, int index));
  1120. typedef int     Tk_ItemSelectionProc _ANSI_ARGS_((Tk_Canvas canvas,
  1121.             Tk_Item *itemPtr, int offset, char *buffer,
  1122.             int maxBytes));
  1123. typedef void    Tk_ItemInsertProc _ANSI_ARGS_((Tk_Canvas canvas,
  1124.             Tk_Item *itemPtr, int beforeThis, Tcl_Obj *string));
  1125. typedef void    Tk_ItemDCharsProc _ANSI_ARGS_((Tk_Canvas canvas,
  1126.             Tk_Item *itemPtr, int first, int last));
  1127. typedef void    Tk_ItemBboxProc _ANSI_ARGS_((Tk_Canvas canvas,
  1128.             Tk_Item *itemPtr));
  1129. typedef int     Tk_ItemGetCoordProc _ANSI_ARGS_((Tk_Item *itemPtr,
  1130.             double **coordsPtr, Tcl_FreeProc *freeProc));
  1131. typedef int     Tk_ItemSetCoordProc _ANSI_ARGS_((Tk_Canvas canvas,
  1132.             Tk_Item *itemPtr, int num, double *coords));
  1133.  
  1134. /*
  1135.  * Some flag values that can be used in the "flags" field in Tk_ItemType.
  1136.  */
  1137.  
  1138. #define TK_ITEM_ALWAYS_REDRAW 1
  1139. #define TK_ITEM_VISITOR_SUPPORT 2
  1140.  
  1141. /*
  1142.  * Structures used for implementing visitors.
  1143.  */
  1144. #ifndef __NO_OLD_CONFIG
  1145.  
  1146. typedef struct Tk_ItemType {
  1147.     char *name;                         /* The name of this type of item, such
  1148.                      * as "line". */
  1149.     int itemSize;                       /* Total amount of space needed for
  1150.                      * item's record. */
  1151.     Tk_ItemCreateProc *createProc;      /* Procedure to create a new item of
  1152.                      * this type. */
  1153.     Tk_ConfigSpec *configSpecs;         /* Pointer to array of configuration
  1154.                      * specs for this type.  Used for
  1155.                      * returning configuration info. */
  1156.     Tk_ItemConfigureProc *configProc;   /* Procedure to call to change
  1157.                      * configuration options. */
  1158.     Tk_ItemCoordProc *coordProc;        /* Procedure to call to get and set
  1159.                      * the item's coordinates. */
  1160.     Tk_ItemDeleteProc *deleteProc;      /* Procedure to delete existing item of
  1161.                      * this type. */
  1162.     Tk_ItemDisplayProc *displayProc;    /* Procedure to display items of
  1163.                      * this type. */
  1164.     int alwaysRedraw;                   /* Non-zero means displayProc should
  1165.                      * be called even when the item has
  1166.                      * been moved off-screen. */
  1167.     Tk_ItemPointProc *pointProc;        /* Computes distance from item to
  1168.                      * a given point. */
  1169.     Tk_ItemAreaProc *areaProc;          /* Computes whether item is inside,
  1170.                      * outside, or overlapping an area. */
  1171.     Tk_ItemPostscriptProc *postscriptProc;
  1172.                     /* Procedure to write a Postscript
  1173.                      * description for items of this
  1174.                      * type. */
  1175.     Tk_ItemScaleProc *scaleProc;        /* Procedure to rescale items of
  1176.                      * this type. */
  1177.     Tk_ItemTranslateProc *translateProc;/* Procedure to translate items of
  1178.                      * this type. */
  1179.     Tk_ItemIndexProc *indexProc;        /* Procedure to determine index of
  1180.                      * indicated character.  NULL if
  1181.                      * item doesn't support indexing. */
  1182.     Tk_ItemCursorProc *icursorProc;     /* Procedure to set insert cursor pos.
  1183.                      * to just before a given position. */
  1184.     Tk_ItemSelectionProc *selectionProc;/* Procedure to return selection (in
  1185.                      * STRING format) when it is in this
  1186.                      * item. */
  1187.     Tk_ItemInsertProc *insertProc;      /* Procedure to insert something into
  1188.                      * an item. */
  1189.     Tk_ItemDCharsProc *dCharsProc;      /* Procedure to delete characters
  1190.                      * from an item. */
  1191.     struct Tk_ItemType *nextPtr;        /* Used to link types together into
  1192.                      * a list. */
  1193.     Tk_ItemBboxProc *bboxProc;          /* Reserved for future extension. */
  1194.     int   reserved2;                    /* Carefully compatible with */
  1195.     char *reserved3;                    /* Jan Nijtmans dash patch */
  1196.     char *reserved4;
  1197. } Tk_ItemType;
  1198.  
  1199. #endif
  1200.  
  1201. /*
  1202.  * The following structure provides information about the selection and
  1203.  * the insertion cursor.  It is needed by only a few items, such as
  1204.  * those that display text.  It is shared by the generic canvas code
  1205.  * and the item-specific code, but most of the fields should be written
  1206.  * only by the canvas generic code.
  1207.  */
  1208.  
  1209. typedef struct Tk_CanvasTextInfo {
  1210.     Tk_3DBorder selBorder;      /* Border and background for selected
  1211.                  * characters.  Read-only to items.*/
  1212.     int selBorderWidth;         /* Width of border around selection.
  1213.                  * Read-only to items. */
  1214.     XColor *selFgColorPtr;      /* Foreground color for selected text.
  1215.                  * Read-only to items. */
  1216.     Tk_Item *selItemPtr;        /* Pointer to selected item.  NULL means
  1217.                  * selection isn't in this canvas.
  1218.                  * Writable by items. */
  1219.     int selectFirst;            /* Character index of first selected
  1220.                  * character.  Writable by items. */
  1221.     int selectLast;             /* Character index of last selected
  1222.                  * character.  Writable by items. */
  1223.     Tk_Item *anchorItemPtr;     /* Item corresponding to "selectAnchor":
  1224.                  * not necessarily selItemPtr.   Read-only
  1225.                  * to items. */
  1226.     int selectAnchor;           /* Character index of fixed end of
  1227.                  * selection (i.e. "select to" operation will
  1228.                  * use this as one end of the selection).
  1229.                  * Writable by items. */
  1230.     Tk_3DBorder insertBorder;   /* Used to draw vertical bar for insertion
  1231.                  * cursor.  Read-only to items. */
  1232.     int insertWidth;            /* Total width of insertion cursor.  Read-only
  1233.                  * to items. */
  1234.     int insertBorderWidth;      /* Width of 3-D border around insert cursor.
  1235.                  * Read-only to items. */
  1236.     Tk_Item *focusItemPtr;      /* Item that currently has the input focus,
  1237.                  * or NULL if no such item.  Read-only to
  1238.                  * items.  */
  1239.     int gotFocus;               /* Non-zero means that the canvas widget has
  1240.                  * the input focus.  Read-only to items.*/
  1241.     int cursorOn;               /* Non-zero means that an insertion cursor
  1242.                  * should be displayed in focusItemPtr.
  1243.                  * Read-only to items.*/
  1244. } Tk_CanvasTextInfo;
  1245.  
  1246. /*
  1247.  * Structures used for Dashing and Outline.
  1248.  */
  1249.  
  1250. typedef struct Tk_Dash {
  1251.     int number;
  1252.     union {
  1253.     char *pt;
  1254.     char array[sizeof(char *)];
  1255.     } pattern;
  1256. } Tk_Dash;
  1257.  
  1258. typedef struct Tk_TSOffset {
  1259.     int flags;                  /* flags; see below for possible values */
  1260.     int xoffset;                /* x offset */
  1261.     int yoffset;                /* y offset */
  1262. } Tk_TSOffset;
  1263.  
  1264. /*
  1265.  * Bit fields in Tk_Offset->flags:
  1266.  */
  1267.  
  1268. #define TK_OFFSET_INDEX         1
  1269. #define TK_OFFSET_RELATIVE      2
  1270. #define TK_OFFSET_LEFT          4
  1271. #define TK_OFFSET_CENTER        8
  1272. #define TK_OFFSET_RIGHT         16
  1273. #define TK_OFFSET_TOP           32
  1274. #define TK_OFFSET_MIDDLE        64
  1275. #define TK_OFFSET_BOTTOM        128
  1276.  
  1277. typedef struct Tk_Tile_ *Tk_Tile;       /* Opaque type for tiles */
  1278.  
  1279. typedef struct Tk_Outline {
  1280.     GC gc;                      /* Graphics context. */
  1281.     double width;               /* Width of outline. */
  1282.     double activeWidth;         /* Width of outline. */
  1283.     double disabledWidth;       /* Width of outline. */
  1284.     int offset;                 /* Dash offset */
  1285.     Tk_Dash dash;               /* Dash pattern */
  1286.     Tk_Dash activeDash;         /* Dash pattern if state is active*/
  1287.     Tk_Dash disabledDash;       /* Dash pattern if state is disabled*/
  1288.     VOID *reserved1;            /* reserved for future expansion */
  1289.     VOID *reserved2;
  1290.     VOID *reserved3;
  1291.     Tk_TSOffset tsoffset;       /* stipple offset for outline*/
  1292.     XColor *color;              /* Outline color. */
  1293.     XColor *activeColor;        /* Outline color if state is active. */
  1294.     XColor *disabledColor;      /* Outline color if state is disabled. */
  1295.     Pixmap stipple;             /* Outline Stipple pattern. */
  1296.     Pixmap activeStipple;       /* Outline Stipple pattern if state is active. */
  1297.     Pixmap disabledStipple;     /* Outline Stipple pattern if state is disabled. */
  1298.     Tk_Tile tile;
  1299. } Tk_Outline;
  1300.  
  1301.  
  1302. /*
  1303.  * Some functions handy for Dashing and Outlines (in tkCanvUtil.c).
  1304.  */
  1305.  
  1306. EXTERN void     Tk_CreateOutline _ANSI_ARGS_((Tk_Outline *outline));
  1307. EXTERN void     Tk_DeleteOutline _ANSI_ARGS_((Display *display,
  1308.             Tk_Outline *outline));
  1309. EXTERN int      Tk_ConfigOutlineGC _ANSI_ARGS_((XGCValues *gcValues,
  1310.             Tk_Canvas canvas ,Tk_Item *item,
  1311.             Tk_Outline *outline));
  1312. EXTERN int      Tk_ChangeOutlineGC _ANSI_ARGS_((Tk_Canvas canvas,
  1313.             Tk_Item *item, Tk_Outline *outline));
  1314. EXTERN int      Tk_ResetOutlineGC _ANSI_ARGS_((Tk_Canvas canvas,
  1315.             Tk_Item *item, Tk_Outline *outline));
  1316. EXTERN int      Tk_CanvasPsOutline _ANSI_ARGS_((Tk_Canvas canvas,
  1317.             Tk_Item *item, Tk_Outline *outline));
  1318.  
  1319. /*
  1320.  * Some functions handy for Tiling and Stipple/Tile offset.
  1321.  */
  1322.  
  1323. typedef void    (Tk_TileChangedProc) _ANSI_ARGS_((ClientData clientData,
  1324.             Tk_Tile tile));
  1325. EXTERN Tk_Tile  Tk_GetTile _ANSI_ARGS_((Tcl_Interp *interp, Tk_Window tkwin,
  1326.             CONST char *imageName));
  1327. EXTERN void     Tk_FreeTile _ANSI_ARGS_((Tk_Tile tile));
  1328. EXTERN CONST char *     Tk_NameOfTile _ANSI_ARGS_((Tk_Tile tile));
  1329. EXTERN void     Tk_SetTileChangedProc _ANSI_ARGS_((Tk_Tile tile,
  1330.             Tk_TileChangedProc * changeProc, ClientData clientData));
  1331. EXTERN Pixmap   Tk_PixmapOfTile _ANSI_ARGS_((Tk_Tile tile));
  1332. EXTERN int      Tk_PixelParseProc _ANSI_ARGS_((
  1333.             ClientData clientData, Tcl_Interp *interp,
  1334.             Tk_Window tkwin, Tcl_Obj *value, char *widgRec,
  1335.             int offset));
  1336. EXTERN Tcl_Obj *Tk_PixelPrintProc _ANSI_ARGS_((
  1337.             ClientData clientData, Tk_Window tkwin,
  1338.             char *widgRec, int offset,
  1339.             Tcl_FreeProc **freeProcPtr));
  1340. EXTERN void     Tk_SizeOfTile _ANSI_ARGS_((Tk_Tile tile, int *widthPtr,
  1341.             int *heightPtr));
  1342. EXTERN int      Tk_TileParseProc _ANSI_ARGS_((
  1343.             ClientData clientData, Tcl_Interp *interp,
  1344.             Tk_Window tkwin, Tcl_Obj *value, char *widgRec,
  1345.             int offset));
  1346. EXTERN Tcl_Obj *Tk_TilePrintProc _ANSI_ARGS_((
  1347.             ClientData clientData, Tk_Window tkwin,
  1348.             char *widgRec, int offset,
  1349.             Tcl_FreeProc **freeProcPtr));
  1350. EXTERN int      Tk_OffsetParseProc _ANSI_ARGS_((
  1351.             ClientData clientData, Tcl_Interp *interp,
  1352.             Tk_Window tkwin, Tcl_Obj *value, char *widgRec,
  1353.             int offset));
  1354. EXTERN Tcl_Obj *Tk_OffsetPrintProc _ANSI_ARGS_((
  1355.             ClientData clientData, Tk_Window tkwin,
  1356.             char *widgRec, int offset,
  1357.             Tcl_FreeProc **freeProcPtr));
  1358. EXTERN int      Tk_OrientParseProc _ANSI_ARGS_((
  1359.             ClientData clientData, Tcl_Interp *interp,
  1360.             Tk_Window tkwin, Tcl_Obj *value, char *widgRec,
  1361.             int offset));
  1362. EXTERN Tcl_Obj *Tk_OrientPrintProc _ANSI_ARGS_((
  1363.             ClientData clientData, Tk_Window tkwin,
  1364.             char *widgRec, int offset,
  1365.             Tcl_FreeProc **freeProcPtr));
  1366.  
  1367.  
  1368. /*
  1369.  *--------------------------------------------------------------
  1370.  *
  1371.  * Procedure prototypes and structures used for managing images:
  1372.  *
  1373.  *--------------------------------------------------------------
  1374.  */
  1375.  
  1376. typedef struct Tk_ImageType Tk_ImageType;
  1377. #ifdef USE_OLD_IMAGE
  1378. typedef int (Tk_ImageCreateProc) _ANSI_ARGS_((Tcl_Interp *interp,
  1379.     char *name, int argc, Tcl_Obj *CONST *objv, Tk_ImageType *typePtr,
  1380.     Tk_ImageMaster master, ClientData *masterDataPtr));
  1381. #else
  1382. typedef int (Tk_ImageCreateProc) _ANSI_ARGS_((Tcl_Interp *interp,
  1383.     char *name, int objc, Tcl_Obj *CONST objv[], Tk_ImageType *typePtr,
  1384.     Tk_ImageMaster master, ClientData *masterDataPtr));
  1385. #endif
  1386. typedef ClientData (Tk_ImageGetProc) _ANSI_ARGS_((Tk_Window tkwin,
  1387.     ClientData masterData));
  1388. typedef void (Tk_ImageDisplayProc) _ANSI_ARGS_((ClientData instanceData,
  1389.     Display *display, Drawable drawable, int imageX, int imageY,
  1390.     int width, int height, int drawableX, int drawableY));
  1391. typedef void (Tk_ImageFreeProc) _ANSI_ARGS_((ClientData instanceData,
  1392.     Display *display));
  1393. typedef void (Tk_ImageDeleteProc) _ANSI_ARGS_((ClientData masterData));
  1394. typedef void (Tk_ImageChangedProc) _ANSI_ARGS_((ClientData clientData,
  1395.     int x, int y, int width, int height, int imageWidth,
  1396.     int imageHeight));
  1397. typedef int (Tk_ImagePostscriptProc) _ANSI_ARGS_((ClientData clientData,
  1398.     Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo,
  1399.     int x, int y, int width, int height, int prepass));
  1400.  
  1401. /*
  1402.  * The following structure represents a particular type of image
  1403.  * (bitmap, xpm image, etc.).  It provides information common to
  1404.  * all images of that type, such as the type name and a collection
  1405.  * of procedures in the image manager that respond to various
  1406.  * events.  Each image manager is represented by one of these
  1407.  * structures.
  1408.  */
  1409.  
  1410. struct Tk_ImageType {
  1411.     char *name;                 /* Name of image type. */
  1412.     Tk_ImageCreateProc *createProc;
  1413.                 /* Procedure to call to create a new image
  1414.                  * of this type. */
  1415.     Tk_ImageGetProc *getProc;   /* Procedure to call the first time
  1416.                  * Tk_GetImage is called in a new way
  1417.                  * (new visual or screen). */
  1418.     Tk_ImageDisplayProc *displayProc;
  1419.                 /* Call to draw image, in response to
  1420.                  * Tk_RedrawImage calls. */
  1421.     Tk_ImageFreeProc *freeProc; /* Procedure to call whenever Tk_FreeImage
  1422.                  * is called to release an instance of an
  1423.                  * image. */
  1424.     Tk_ImageDeleteProc *deleteProc;
  1425.                 /* Procedure to call to delete image.  It
  1426.                  * will not be called until after freeProc
  1427.                  * has been called for each instance of the
  1428.                  * image. */
  1429.     Tk_ImagePostscriptProc *postscriptProc;
  1430.                 /* Procedure to call to produce postscript
  1431.                  * output for the image. */
  1432.     struct Tk_ImageType *nextPtr;
  1433.                 /* Next in list of all image types currently
  1434.                  * known.  Filled in by Tk, not by image
  1435.                  * manager. */
  1436.     char *reserved;             /* reserved for future expansion */
  1437. };
  1438.  
  1439. /*
  1440.  *--------------------------------------------------------------
  1441.  *
  1442.  * Additional definitions used to manage images of type "photo".
  1443.  *
  1444.  *--------------------------------------------------------------
  1445.  */
  1446.  
  1447. /*
  1448.  * The following type is used to identify a particular photo image
  1449.  * to be manipulated:
  1450.  */
  1451.  
  1452. typedef void *Tk_PhotoHandle;
  1453.  
  1454. /*
  1455.  * The following structure describes a block of pixels in memory:
  1456.  */
  1457.  
  1458. typedef struct Tk_PhotoImageBlock {
  1459.     unsigned char *pixelPtr;    /* Pointer to the first pixel. */
  1460.     int         width;          /* Width of block, in pixels. */
  1461.     int         height;         /* Height of block, in pixels. */
  1462.     int         pitch;          /* Address difference between corresponding
  1463.                  * pixels in successive lines. */
  1464.     int         pixelSize;      /* Address difference between successive
  1465.                  * pixels in the same line. */
  1466.     int         offset[4];      /* Address differences between the red, green
  1467.                  * and blue components of the pixel and the
  1468.                  * pixel as a whole. */
  1469.     int         reserved;       /* Reserved for extensions (dash patch) */
  1470. } Tk_PhotoImageBlock;
  1471.  
  1472. /*
  1473.  * The following values control how blocks are combined into photo
  1474.  * images when the alpha component of a pixel is not 255, a.k.a. the
  1475.  * compositing rule.
  1476.  */
  1477.  
  1478. #define TK_PHOTO_COMPOSITE_OVERLAY      0
  1479. #define TK_PHOTO_COMPOSITE_SET          1
  1480.  
  1481. /*
  1482.  * Procedure prototypes and structures used in reading and
  1483.  * writing photo images:
  1484.  */
  1485.  
  1486. typedef struct Tk_PhotoImageFormat Tk_PhotoImageFormat;
  1487. #ifdef USE_OLD_IMAGE
  1488. typedef int (Tk_ImageFileMatchProc) _ANSI_ARGS_((Tcl_Channel chan,
  1489.     char *fileName, char *formatString, int *widthPtr, int *heightPtr));
  1490. typedef int (Tk_ImageStringMatchProc) _ANSI_ARGS_((char *string,
  1491.     char *formatString, int *widthPtr, int *heightPtr));
  1492. typedef int (Tk_ImageFileReadProc) _ANSI_ARGS_((Tcl_Interp *interp,
  1493.     Tcl_Channel chan, char *fileName, char *formatString,
  1494.     Tk_PhotoHandle imageHandle, int destX, int destY,
  1495.     int width, int height, int srcX, int srcY));
  1496. typedef int (Tk_ImageStringReadProc) _ANSI_ARGS_((Tcl_Interp *interp,
  1497.     char *string, char *formatString, Tk_PhotoHandle imageHandle,
  1498.     int destX, int destY, int width, int height, int srcX, int srcY));
  1499. typedef int (Tk_ImageFileWriteProc) _ANSI_ARGS_((Tcl_Interp *interp,
  1500.     char *fileName, char *formatString, Tk_PhotoImageBlock *blockPtr));
  1501. typedef int (Tk_ImageStringWriteProc) _ANSI_ARGS_((Tcl_Interp *interp,
  1502.     Tcl_DString *dataPtr, char *formatString,
  1503.     Tk_PhotoImageBlock *blockPtr));
  1504. #else
  1505. typedef int (Tk_ImageFileMatchProc) _ANSI_ARGS_((Tcl_Channel chan,
  1506.     Tcl_Obj *fileName, Tcl_Obj *format, int *widthPtr,
  1507.     int *heightPtr,Tcl_Interp *interp));
  1508. typedef int (Tk_ImageStringMatchProc) _ANSI_ARGS_((Tcl_Obj *dataObj,
  1509.     Tcl_Obj *format, int *widthPtr, int *heightPt, Tcl_Interp *interp));
  1510. typedef int (Tk_ImageFileReadProc) _ANSI_ARGS_((Tcl_Interp *interp,
  1511.     Tcl_Channel chan, Tcl_Obj *fileName, Tcl_Obj *format,
  1512.     Tk_PhotoHandle imageHandle, int destX, int destY,
  1513.     int width, int height, int srcX, int srcY));
  1514. typedef int (Tk_ImageStringReadProc) _ANSI_ARGS_((Tcl_Interp *interp,
  1515.     Tcl_Obj *dataObj, Tcl_Obj *format, Tk_PhotoHandle imageHandle,
  1516.     int destX, int destY, int width, int height, int srcX, int srcY));
  1517. typedef int (Tk_ImageFileWriteProc) _ANSI_ARGS_((Tcl_Interp *interp,
  1518.     char *fileName, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr));
  1519. typedef int (Tk_ImageStringWriteProc) _ANSI_ARGS_((Tcl_Interp *interp,
  1520.     Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr));
  1521. #endif
  1522.  
  1523. /*
  1524.  * The following structure represents a particular file format for
  1525.  * storing images (e.g., PPM, GIF, JPEG, etc.).  It provides information
  1526.  * to allow image files of that format to be recognized and read into
  1527.  * a photo image.
  1528.  */
  1529.  
  1530. struct Tk_PhotoImageFormat {
  1531.     char *name;                 /* Name of image file format */
  1532.     Tk_ImageFileMatchProc *fileMatchProc;
  1533.                 /* Procedure to call to determine whether
  1534.                  * an image file matches this format. */
  1535.     Tk_ImageStringMatchProc *stringMatchProc;
  1536.                 /* Procedure to call to determine whether
  1537.                  * the data in a string matches this format. */
  1538.     Tk_ImageFileReadProc *fileReadProc;
  1539.                 /* Procedure to call to read data from
  1540.                  * an image file into a photo image. */
  1541.     Tk_ImageStringReadProc *stringReadProc;
  1542.                 /* Procedure to call to read data from
  1543.                  * a string into a photo image. */
  1544.     Tk_ImageFileWriteProc *fileWriteProc;
  1545.                 /* Procedure to call to write data from
  1546.                  * a photo image to a file. */
  1547.     Tk_ImageStringWriteProc *stringWriteProc;
  1548.                 /* Procedure to call to obtain a string
  1549.                  * representation of the data in a photo
  1550.                  * image.*/
  1551.     struct Tk_PhotoImageFormat *nextPtr;
  1552.                 /* Next in list of all photo image formats
  1553.                  * currently known.  Filled in by Tk, not
  1554.                  * by image format handler. */
  1555. };
  1556.  
  1557. EXTERN void             Tk_CreateOldImageType _ANSI_ARGS_((
  1558.                 Tk_ImageType *typePtr));
  1559. EXTERN void             Tk_CreateOldPhotoImageFormat _ANSI_ARGS_((
  1560.                 Tk_PhotoImageFormat *formatPtr));
  1561.  
  1562. #if !defined(USE_TK_STUBS) && defined(USE_OLD_IMAGE)
  1563. #define Tk_CreateImageType Tk_CreateOldImageType
  1564. #define Tk_CreatePhotoImageFormat Tk_CreateOldPhotoImageFormat
  1565. #endif
  1566.  
  1567.  
  1568. /*
  1569.  *--------------------------------------------------------------
  1570.  *
  1571.  * Procedure prototypes and structures used for managing styles:
  1572.  *
  1573.  *--------------------------------------------------------------
  1574.  */
  1575.  
  1576. /*
  1577.  * Style support version tag.
  1578.  */
  1579. #define TK_STYLE_VERSION_1      0x1
  1580. #define TK_STYLE_VERSION        TK_STYLE_VERSION_1
  1581.  
  1582. /*
  1583.  * The following structures and prototypes are used as static templates to
  1584.  * declare widget elements.
  1585.  */
  1586.  
  1587. typedef void (Tk_GetElementSizeProc) _ANSI_ARGS_((ClientData clientData,
  1588.     char *recordPtr, CONST Tk_OptionSpec **optionsPtr, Tk_Window tkwin,
  1589.     int width, int height, int inner, int *widthPtr, int *heightPtr));
  1590. typedef void (Tk_GetElementBoxProc) _ANSI_ARGS_((ClientData clientData,
  1591.     char *recordPtr, CONST Tk_OptionSpec **optionsPtr, Tk_Window tkwin,
  1592.     int x, int y, int width, int height, int inner, int *xPtr, int *yPtr,
  1593.     int *widthPtr, int *heightPtr));
  1594. typedef int (Tk_GetElementBorderWidthProc) _ANSI_ARGS_((ClientData clientData,
  1595.     char *recordPtr, CONST Tk_OptionSpec **optionsPtr, Tk_Window tkwin));
  1596. typedef void (Tk_DrawElementProc) _ANSI_ARGS_((ClientData clientData,
  1597.     char *recordPtr, CONST Tk_OptionSpec **optionsPtr, Tk_Window tkwin,
  1598.     Drawable d, int x, int y, int width, int height, int state));
  1599.  
  1600. typedef struct Tk_ElementOptionSpec {
  1601.     char *name;                 /* Name of the required option. */
  1602.     Tk_OptionType type;         /* Accepted option type. TK_OPTION_END means
  1603.                  * any. */
  1604. } Tk_ElementOptionSpec;
  1605.  
  1606. typedef struct Tk_ElementSpec {
  1607.     int version;                /* Version of the style support. */
  1608.     char *name;                 /* Name of element. */
  1609.     Tk_ElementOptionSpec *options;
  1610.                 /* List of required options. Last one's name
  1611.                  * must be NULL. */
  1612.  
  1613.     /*
  1614.      * Hooks
  1615.      */
  1616.  
  1617.     Tk_GetElementSizeProc *getSize;
  1618.                 /* Compute the external (resp. internal) size of
  1619.                  * the element from its desired internal (resp.
  1620.                  * external) size. */
  1621.     Tk_GetElementBoxProc *getBox;
  1622.                 /* Compute the inscribed or bounding boxes
  1623.                  * within a given area. */
  1624.     Tk_GetElementBorderWidthProc *getBorderWidth;
  1625.                 /* Return the element's internal border width.
  1626.                  * Mostly useful for widgets. */
  1627.     Tk_DrawElementProc *draw;   /* Draw the element in the given bounding box.*/
  1628. } Tk_ElementSpec;
  1629.  
  1630. /*
  1631.  * Element state flags. Can be OR'ed.
  1632.  */
  1633.  
  1634. #define TK_ELEMENT_STATE_ACTIVE         1<<0
  1635. #define TK_ELEMENT_STATE_DISABLED       1<<1
  1636. #define TK_ELEMENT_STATE_FOCUS          1<<2
  1637. #define TK_ELEMENT_STATE_PRESSED        1<<3
  1638.  
  1639. /*
  1640.  *--------------------------------------------------------------
  1641.  *
  1642.  * The definitions below provide backward compatibility for
  1643.  * functions and types related to event handling that used to
  1644.  * be in Tk but have moved to Tcl.
  1645.  *
  1646.  *--------------------------------------------------------------
  1647.  */
  1648.  
  1649. #if 0
  1650.  
  1651. #define TK_READABLE             TCL_READABLE
  1652. #define TK_WRITABLE             TCL_WRITABLE
  1653. #define TK_EXCEPTION            TCL_EXCEPTION
  1654.  
  1655. #define TK_DONT_WAIT            TCL_DONT_WAIT
  1656. #define TK_X_EVENTS             TCL_WINDOW_EVENTS
  1657. #define TK_WINDOW_EVENTS        TCL_WINDOW_EVENTS
  1658. #define TK_FILE_EVENTS          TCL_FILE_EVENTS
  1659. #define TK_TIMER_EVENTS         TCL_TIMER_EVENTS
  1660. #define TK_IDLE_EVENTS          TCL_IDLE_EVENTS
  1661. #define TK_ALL_EVENTS           TCL_ALL_EVENTS
  1662.  
  1663. #define Tk_IdleProc             Tcl_IdleProc
  1664. #define Tk_FileProc             Tcl_FileProc
  1665. #define Tk_TimerProc            Tcl_TimerProc
  1666. #define Tk_TimerToken           Tcl_TimerToken
  1667.  
  1668. #define Tk_BackgroundError      Tcl_BackgroundError
  1669. #define Tk_CancelIdleCall       Tcl_CancelIdleCall
  1670. #define Tk_CreateFileHandler    Tcl_CreateFileHandler
  1671. #define Tk_CreateTimerHandler   Tcl_CreateTimerHandler
  1672. #define Tk_DeleteFileHandler    Tcl_DeleteFileHandler
  1673. #define Tk_DeleteTimerHandler   Tcl_DeleteTimerHandler
  1674. #define Tk_DoOneEvent           Tcl_DoOneEvent
  1675. #define Tk_DoWhenIdle           Tcl_DoWhenIdle
  1676. #define Tk_Sleep                Tcl_Sleep
  1677.  
  1678. /* Additional stuff that has moved to Tcl: */
  1679.  
  1680. #define Tk_EventuallyFree       Tcl_EventuallyFree
  1681. #define Tk_FreeProc             Tcl_FreeProc
  1682. #define Tk_Preserve             Tcl_Preserve
  1683. #define Tk_Release              Tcl_Release
  1684. #define Tk_FileeventCmd         Tcl_FileEventCmd
  1685.  
  1686. #endif
  1687.  
  1688.  
  1689. /* Removed Tk_Main, use macro instead */
  1690. #define Tk_Main(argc, argv, proc) \
  1691.     Tk_MainEx(argc, argv, proc, Tcl_CreateInterp())
  1692.  
  1693. extern CONST char *Tk_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, char *version, int exact));
  1694.  
  1695. #ifndef USE_TK_STUBS
  1696.  
  1697. #define Tk_InitStubs(interp, version, exact) \
  1698.     Tcl_PkgRequire(interp, "Tk", version, exact)
  1699.  
  1700. #endif
  1701.  
  1702. extern void Tk_InitImageArgs _ANSI_ARGS_((Tcl_Interp *interp, int argc, char ***objv));
  1703.  
  1704. #if !defined(USE_TK_STUBS) || !defined(USE_OLD_IMAGE)
  1705.  
  1706. #define Tk_InitImageArgs(interp, argc, argv) /**/
  1707.  
  1708. #endif
  1709.  
  1710.  
  1711. /*
  1712.  *--------------------------------------------------------------
  1713.  *
  1714.  * Additional procedure types defined by Tk.
  1715.  *
  1716.  *--------------------------------------------------------------
  1717.  */
  1718.  
  1719. #define TK_EVENTTYPE_NONE    0
  1720. #define TK_EVENTTYPE_STRING  1
  1721. #define TK_EVENTTYPE_NUMBER  2
  1722. #define TK_EVENTTYPE_WINDOW  3
  1723. #define TK_EVENTTYPE_ATOM    4
  1724. #define TK_EVENTTYPE_DISPLAY 5
  1725. #define TK_EVENTTYPE_DATA    6
  1726.  
  1727. typedef int (Tk_ErrorProc) _ANSI_ARGS_((ClientData clientData,
  1728.     XErrorEvent *errEventPtr));
  1729. typedef void (Tk_EventProc) _ANSI_ARGS_((ClientData clientData,
  1730.     XEvent *eventPtr));
  1731. typedef int (Tk_GenericProc) _ANSI_ARGS_((ClientData clientData,
  1732.     XEvent *eventPtr));
  1733. typedef int (Tk_ClientMessageProc) _ANSI_ARGS_((Tk_Window tkwin,
  1734.     XEvent *eventPtr));
  1735. typedef int (Tk_GetSelProc) _ANSI_ARGS_((ClientData clientData,
  1736.     Tcl_Interp *interp, char *portion));
  1737. typedef int (Tk_GetXSelProc) _ANSI_ARGS_((ClientData clientData,
  1738.     Tcl_Interp *interp, long *portion, int numValues,
  1739.     int format, Atom type, Tk_Window tkwin));
  1740. typedef void (Tk_LostSelProc) _ANSI_ARGS_((ClientData clientData));
  1741. typedef Tk_RestrictAction (Tk_RestrictProc) _ANSI_ARGS_((
  1742.     ClientData clientData, XEvent *eventPtr));
  1743. typedef int (Tk_SelectionProc) _ANSI_ARGS_((ClientData clientData,
  1744.     int offset, char *buffer, int maxBytes));
  1745.  
  1746. typedef int (Tk_XSelectionProc) _ANSI_ARGS_((ClientData clientData,
  1747.     int offset, long *buffer, int maxBytes,
  1748.     Atom type, Tk_Window tkwin));
  1749.  
  1750.  
  1751. typedef struct {
  1752.     char *name;                 /* Name of command. */
  1753.     int (*cmdProc) _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp,
  1754.         int argc, Tcl_Obj *CONST *objv));
  1755.                 /* Command procedure. */
  1756. } Tk_Cmd;
  1757.  
  1758. /*
  1759.  *--------------------------------------------------------------
  1760.  *
  1761.  * Platform independant exported procedures and variables.
  1762.  *
  1763.  *--------------------------------------------------------------
  1764.  */
  1765.  
  1766. #include "tkDecls.h"
  1767.  
  1768. /*
  1769.  * Allow users to say that they don't want to alter their source to
  1770.  * add the extra argument to Tk_PhotoPutBlock(); DO NOT DEFINE THIS
  1771.  * WHEN BUILDING TK.
  1772.  *
  1773.  * This goes after the inclusion of the stubbed-decls so that the
  1774.  * declarations of what is actually there can be correct.
  1775.  */
  1776.  
  1777. #ifdef USE_COMPOSITELESS_PHOTO_PUT_BLOCK
  1778. #   ifdef Tk_PhotoPutBlock
  1779. #       undef Tk_PhotoPutBlock
  1780. #   endif
  1781. #   define Tk_PhotoPutBlock             Tk_PhotoPutBlock_NoComposite
  1782. #   ifdef Tk_PhotoPutZoomedBlock
  1783. #       undef Tk_PhotoPutZoomedBlock
  1784. #   endif
  1785. #   define Tk_PhotoPutZoomedBlock       Tk_PhotoPutZoomedBlock_NoComposite
  1786. #endif /* USE_COMPOSITELESS_PHOTO_PUT_BLOCK */
  1787.  
  1788. /*
  1789.  * Tcl commands exported by Tk:
  1790.  */
  1791.  
  1792. EXTERN Tcl_Command      Lang_CreateWidget _ANSI_ARGS_((Tcl_Interp *interp,
  1793.                 Tk_Window, Tcl_ObjCmdProc *proc,
  1794.                 ClientData clientData,
  1795.                 Tcl_CmdDeleteProc *deleteProc));
  1796.  
  1797. EXTERN Tcl_Command      Lang_CreateImage _ANSI_ARGS_((Tcl_Interp *interp,
  1798.                 char *cmdName, Tcl_ObjCmdProc *proc,
  1799.                 ClientData clientData,
  1800.                 Tcl_CmdDeleteProc *deleteProc,
  1801.                 Tk_ImageType *typePtr));
  1802.  
  1803. EXTERN void             Lang_DeleteWidget _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Command cmd));
  1804.  
  1805. EXTERN void             Tk_ChangeScreen _ANSI_ARGS_((Tcl_Interp *interp,
  1806.                 char *dispName, int screenIndex));
  1807.  
  1808. EXTERN Var              LangFindVar _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window, CONST char *name));
  1809.  
  1810. EXTERN Tcl_Obj *        LangWidgetObj _ANSI_ARGS_((Tcl_Interp *interp, Tk_Window));
  1811. EXTERN Tcl_Obj *        LangFontObj _ANSI_ARGS_((Tcl_Interp *interp, Tk_Font font, char *name));
  1812. EXTERN Tcl_Obj *        LangObjectObj _ANSI_ARGS_((Tcl_Interp *interp, char *));
  1813.  
  1814. #define LangWidgetArg(interp,win) LangObjArg(LangWidgetObj(interp,win),__FILE__,__LINE__)
  1815. #define LangFontArg(interp,font,name) LangObjArg(LangFontObj(interp,font,name),__FILE__,__LINE__)
  1816. #define LangObjectArg(interp,name) LangObjArg(LangObjectObj(interp,name),__FILE__,__LINE__)
  1817.  
  1818.  
  1819. #ifndef NO_EXTERN
  1820. EXTERN void             Lang_DeadMainWindow _ANSI_ARGS_((Tcl_Interp *, Tk_Window));
  1821. EXTERN void             Lang_NewMainWindow  _ANSI_ARGS_((Tcl_Interp *, Tk_Window));
  1822. EXTERN void             LangDeadWindow _ANSI_ARGS_((Tcl_Interp *interp, Tk_Window));
  1823. EXTERN void             LangClientMessage _ANSI_ARGS_((Tcl_Interp *interp,Tk_Window, XEvent *));
  1824. EXTERN void             LangSelectHook _ANSI_ARGS_((CONST char *what, Tk_Window tkwin,
  1825.                                                    Atom selection, Atom target, Atom type));
  1826. #endif
  1827.  
  1828. EXTERN int LangEventCallback _ANSI_ARGS_((ClientData, Tcl_Interp *,XEvent *,Tk_Window,KeySym));
  1829. EXTERN int              Tk_GetXSelection _ANSI_ARGS_((Tcl_Interp *interp,
  1830.                 Tk_Window tkwin, Atom selection, Atom target,
  1831.                 Tk_GetXSelProc *proc, ClientData clientData));
  1832. EXTERN Tk_Window        Tk_EventWindow _ANSI_ARGS_((XEvent *eventPtr));
  1833. EXTERN char *           Tk_EventInfo _ANSI_ARGS_((int letter, Tk_Window tkwin, XEvent *eventPtr,
  1834.                 KeySym keySym, int *numPtr, int *isNum, int *type,
  1835.                 int num_size, char *numStorage));
  1836.  
  1837. extern void LangCheckDC _ANSI_ARGS_((const char *file, int line));
  1838.  
  1839.  
  1840. #undef TCL_STORAGE_CLASS
  1841. #define TCL_STORAGE_CLASS DLLIMPORT
  1842.  
  1843. #endif /* RC_INVOKED */
  1844.  
  1845. /*
  1846.  * end block for C++
  1847.  */
  1848.  
  1849. #ifdef __cplusplus
  1850. }
  1851. #endif
  1852.  
  1853. #endif /* _TK */
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.