jpayne@69: /* jpayne@69: * tk.h -- jpayne@69: * jpayne@69: * Declarations for Tk-related things that are visible outside of the Tk jpayne@69: * module itself. jpayne@69: * jpayne@69: * Copyright (c) 1989-1994 The Regents of the University of California. jpayne@69: * Copyright (c) 1994 The Australian National University. jpayne@69: * Copyright (c) 1994-1998 Sun Microsystems, Inc. jpayne@69: * Copyright (c) 1998-2000 Ajuba Solutions. jpayne@69: * jpayne@69: * See the file "license.terms" for information on usage and redistribution of jpayne@69: * this file, and for a DISCLAIMER OF ALL WARRANTIES. jpayne@69: */ jpayne@69: jpayne@69: #ifndef _TK jpayne@69: #define _TK jpayne@69: jpayne@69: #include jpayne@69: #if (TCL_MAJOR_VERSION != 8) || (TCL_MINOR_VERSION < 6) jpayne@69: # error Tk 8.6 must be compiled with tcl.h from Tcl 8.6 or better jpayne@69: #endif jpayne@69: jpayne@69: #ifndef CONST84 jpayne@69: # define CONST84 const jpayne@69: # define CONST84_RETURN const jpayne@69: #endif jpayne@69: #ifndef CONST86 jpayne@69: # define CONST86 CONST84 jpayne@69: #endif jpayne@69: #ifndef EXTERN jpayne@69: # define EXTERN extern TCL_STORAGE_CLASS jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Utility macros: STRINGIFY takes an argument and wraps it in "" (double jpayne@69: * quotation marks), JOIN joins two arguments. jpayne@69: */ jpayne@69: jpayne@69: #ifndef STRINGIFY jpayne@69: # define STRINGIFY(x) STRINGIFY1(x) jpayne@69: # define STRINGIFY1(x) #x jpayne@69: #endif jpayne@69: #ifndef JOIN jpayne@69: # define JOIN(a,b) JOIN1(a,b) jpayne@69: # define JOIN1(a,b) a##b jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * For C++ compilers, use extern "C" jpayne@69: */ jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: extern "C" { jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * When version numbers change here, you must also go into the following files jpayne@69: * and update the version numbers: jpayne@69: * jpayne@69: * library/tk.tcl (1 LOC patch) jpayne@69: * unix/configure.in (2 LOC Major, 2 LOC minor, 1 LOC patch) jpayne@69: * win/configure.in (as above) jpayne@69: * README (sections 0 and 1) jpayne@69: * macosx/Tk-Common.xcconfig (not patchlevel) 1 LOC jpayne@69: * win/README (not patchlevel) jpayne@69: * unix/README (not patchlevel) jpayne@69: * unix/tk.spec (1 LOC patch) jpayne@69: * win/tcl.m4 (not patchlevel) jpayne@69: * jpayne@69: * You may also need to update some of these files when the numbers change for jpayne@69: * the version of Tcl that this release of Tk is compiled against. jpayne@69: */ jpayne@69: jpayne@69: #define TK_MAJOR_VERSION 8 jpayne@69: #define TK_MINOR_VERSION 6 jpayne@69: #define TK_RELEASE_LEVEL TCL_FINAL_RELEASE jpayne@69: #define TK_RELEASE_SERIAL 13 jpayne@69: jpayne@69: #define TK_VERSION "8.6" jpayne@69: #define TK_PATCH_LEVEL "8.6.13" jpayne@69: jpayne@69: /* jpayne@69: * A special definition used to allow this header file to be included from jpayne@69: * windows or mac resource files so that they can obtain version information. jpayne@69: * RC_INVOKED is defined by default by the windows RC tool and manually set jpayne@69: * for macintosh. jpayne@69: * jpayne@69: * Resource compilers don't like all the C stuff, like typedefs and procedure jpayne@69: * declarations, that occur below, so block them out. jpayne@69: */ jpayne@69: jpayne@69: #ifndef RC_INVOKED jpayne@69: jpayne@69: #if !defined(_XLIB_H) && !defined(_X11_XLIB_H_) jpayne@69: #if defined(__GNUC__) && !defined(__cplusplus) jpayne@69: # pragma GCC diagnostic ignored "-Wc++-compat" jpayne@69: #endif jpayne@69: # include jpayne@69: # ifdef MAC_OSX_TK jpayne@69: # include jpayne@69: # endif jpayne@69: #endif jpayne@69: #if defined(STDC_HEADERS) || defined(__STDC__) || defined(__C99__FUNC__) \ jpayne@69: || defined(__cplusplus) || defined(_MSC_VER) || defined(__ICC) jpayne@69: # include jpayne@69: #endif jpayne@69: jpayne@69: #ifdef BUILD_tk jpayne@69: #undef TCL_STORAGE_CLASS jpayne@69: #define TCL_STORAGE_CLASS DLLEXPORT jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------- jpayne@69: * jpayne@69: * Decide whether or not to use input methods. jpayne@69: */ jpayne@69: jpayne@69: #ifdef XNQueryInputStyle jpayne@69: #define TK_USE_INPUT_METHODS jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Dummy types that are used by clients: jpayne@69: */ jpayne@69: jpayne@69: #define Tk_ImageModel Tk_ImageMaster jpayne@69: typedef struct Tk_BindingTable_ *Tk_BindingTable; jpayne@69: typedef struct Tk_Canvas_ *Tk_Canvas; jpayne@69: typedef struct Tk_Cursor_ *Tk_Cursor; jpayne@69: typedef struct Tk_ErrorHandler_ *Tk_ErrorHandler; jpayne@69: typedef struct Tk_Font_ *Tk_Font; jpayne@69: typedef struct Tk_Image__ *Tk_Image; jpayne@69: typedef struct Tk_ImageMaster_ *Tk_ImageMaster; jpayne@69: typedef struct Tk_OptionTable_ *Tk_OptionTable; jpayne@69: typedef struct Tk_PostscriptInfo_ *Tk_PostscriptInfo; jpayne@69: typedef struct Tk_TextLayout_ *Tk_TextLayout; jpayne@69: typedef struct Tk_Window_ *Tk_Window; jpayne@69: typedef struct Tk_3DBorder_ *Tk_3DBorder; jpayne@69: typedef struct Tk_Style_ *Tk_Style; jpayne@69: typedef struct Tk_StyleEngine_ *Tk_StyleEngine; jpayne@69: typedef struct Tk_StyledElement_ *Tk_StyledElement; jpayne@69: jpayne@69: /* jpayne@69: * Additional types exported to clients. jpayne@69: */ jpayne@69: jpayne@69: typedef const char *Tk_Uid; jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------- jpayne@69: * jpayne@69: * The enum below defines the valid types for Tk configuration options as jpayne@69: * implemented by Tk_InitOptions, Tk_SetOptions, etc. jpayne@69: */ jpayne@69: jpayne@69: typedef enum { jpayne@69: TK_OPTION_BOOLEAN, jpayne@69: TK_OPTION_INT, jpayne@69: TK_OPTION_DOUBLE, jpayne@69: TK_OPTION_STRING, jpayne@69: TK_OPTION_STRING_TABLE, jpayne@69: TK_OPTION_COLOR, jpayne@69: TK_OPTION_FONT, jpayne@69: TK_OPTION_BITMAP, jpayne@69: TK_OPTION_BORDER, jpayne@69: TK_OPTION_RELIEF, jpayne@69: TK_OPTION_CURSOR, jpayne@69: TK_OPTION_JUSTIFY, jpayne@69: TK_OPTION_ANCHOR, jpayne@69: TK_OPTION_SYNONYM, jpayne@69: TK_OPTION_PIXELS, jpayne@69: TK_OPTION_WINDOW, jpayne@69: TK_OPTION_END, jpayne@69: TK_OPTION_CUSTOM, jpayne@69: TK_OPTION_STYLE jpayne@69: } Tk_OptionType; jpayne@69: jpayne@69: /* jpayne@69: * Structures of the following type are used by widgets to specify their jpayne@69: * configuration options. Typically each widget has a static array of these jpayne@69: * structures, where each element of the array describes a single jpayne@69: * configuration option. The array is passed to Tk_CreateOptionTable. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tk_OptionSpec { jpayne@69: Tk_OptionType type; /* Type of option, such as TK_OPTION_COLOR; jpayne@69: * see definitions above. Last option in table jpayne@69: * must have type TK_OPTION_END. */ jpayne@69: const char *optionName; /* Name used to specify option in Tcl jpayne@69: * commands. */ jpayne@69: const char *dbName; /* Name for option in option database. */ jpayne@69: const char *dbClass; /* Class for option in database. */ jpayne@69: const char *defValue; /* Default value for option if not specified jpayne@69: * in command line, the option database, or jpayne@69: * the system. */ jpayne@69: int objOffset; /* Where in record to store a Tcl_Obj * that jpayne@69: * holds the value of this option, specified jpayne@69: * as an offset in bytes from the start of the jpayne@69: * record. Use the Tk_Offset macro to generate jpayne@69: * values for this. -1 means don't store the jpayne@69: * Tcl_Obj in the record. */ jpayne@69: int internalOffset; /* Where in record to store the internal jpayne@69: * representation of the value of this option, jpayne@69: * such as an int or XColor *. This field is jpayne@69: * specified as an offset in bytes from the jpayne@69: * start of the record. Use the Tk_Offset jpayne@69: * macro to generate values for it. -1 means jpayne@69: * don't store the internal representation in jpayne@69: * the record. */ jpayne@69: int flags; /* Any combination of the values defined jpayne@69: * below. */ jpayne@69: const void *clientData; /* An alternate place to put option-specific jpayne@69: * data. Used for the monochrome default value jpayne@69: * for colors, etc. */ jpayne@69: int typeMask; /* An arbitrary bit mask defined by the class jpayne@69: * manager; typically bits correspond to jpayne@69: * certain kinds of options such as all those jpayne@69: * that require a redisplay when they change. jpayne@69: * Tk_SetOptions returns the bit-wise OR of jpayne@69: * the typeMasks of all options that were jpayne@69: * changed. */ jpayne@69: } Tk_OptionSpec; jpayne@69: jpayne@69: /* jpayne@69: * Flag values for Tk_OptionSpec structures. These flags are shared by jpayne@69: * Tk_ConfigSpec structures, so be sure to coordinate any changes carefully. jpayne@69: */ jpayne@69: jpayne@69: #define TK_OPTION_NULL_OK (1 << 0) jpayne@69: #define TK_OPTION_DONT_SET_DEFAULT (1 << 3) jpayne@69: jpayne@69: /* jpayne@69: * The following structure and function types are used by TK_OPTION_CUSTOM jpayne@69: * options; the structure holds pointers to the functions needed by the Tk jpayne@69: * option config code to handle a custom option. jpayne@69: */ jpayne@69: jpayne@69: typedef int (Tk_CustomOptionSetProc) (ClientData clientData, jpayne@69: Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj **value, char *widgRec, jpayne@69: int offset, char *saveInternalPtr, int flags); jpayne@69: typedef Tcl_Obj *(Tk_CustomOptionGetProc) (ClientData clientData, jpayne@69: Tk_Window tkwin, char *widgRec, int offset); jpayne@69: typedef void (Tk_CustomOptionRestoreProc) (ClientData clientData, jpayne@69: Tk_Window tkwin, char *internalPtr, char *saveInternalPtr); jpayne@69: typedef void (Tk_CustomOptionFreeProc) (ClientData clientData, Tk_Window tkwin, jpayne@69: char *internalPtr); jpayne@69: jpayne@69: typedef struct Tk_ObjCustomOption { jpayne@69: const char *name; /* Name of the custom option. */ jpayne@69: Tk_CustomOptionSetProc *setProc; jpayne@69: /* Function to use to set a record's option jpayne@69: * value from a Tcl_Obj */ jpayne@69: Tk_CustomOptionGetProc *getProc; jpayne@69: /* Function to use to get a Tcl_Obj jpayne@69: * representation from an internal jpayne@69: * representation of an option. */ jpayne@69: Tk_CustomOptionRestoreProc *restoreProc; jpayne@69: /* Function to use to restore a saved value jpayne@69: * for the internal representation. */ jpayne@69: Tk_CustomOptionFreeProc *freeProc; jpayne@69: /* Function to use to free the internal jpayne@69: * representation of an option. */ jpayne@69: ClientData clientData; /* Arbitrary one-word value passed to the jpayne@69: * handling procs. */ jpayne@69: } Tk_ObjCustomOption; jpayne@69: jpayne@69: /* jpayne@69: * Macro to use to fill in "offset" fields of the Tk_OptionSpec structure. jpayne@69: * Computes number of bytes from beginning of structure to a given field. jpayne@69: */ jpayne@69: jpayne@69: #define Tk_Offset(type, field) ((int) offsetof(type, field)) jpayne@69: /* Workaround for platforms missing offsetof(), e.g. VC++ 6.0 */ jpayne@69: #ifndef offsetof jpayne@69: # define offsetof(type, field) ((size_t) ((char *) &((type *) 0)->field)) jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * The following two structures are used for error handling. When config jpayne@69: * options are being modified, the old values are saved in a Tk_SavedOptions jpayne@69: * structure. If an error occurs, then the contents of the structure can be jpayne@69: * used to restore all of the old values. The contents of this structure are jpayne@69: * for the private use Tk. No-one outside Tk should ever read or write any of jpayne@69: * the fields of these structures. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tk_SavedOption { jpayne@69: struct TkOption *optionPtr; /* Points to information that describes the jpayne@69: * option. */ jpayne@69: Tcl_Obj *valuePtr; /* The old value of the option, in the form of jpayne@69: * a Tcl object; may be NULL if the value was jpayne@69: * not saved as an object. */ jpayne@69: double internalForm; /* The old value of the option, in some jpayne@69: * internal representation such as an int or jpayne@69: * (XColor *). Valid only if the field jpayne@69: * optionPtr->specPtr->objOffset is < 0. The jpayne@69: * space must be large enough to accommodate a jpayne@69: * double, a long, or a pointer; right now it jpayne@69: * looks like a double (i.e., 8 bytes) is big jpayne@69: * enough. Also, using a double guarantees jpayne@69: * that the field is properly aligned for jpayne@69: * storing large values. */ jpayne@69: } Tk_SavedOption; jpayne@69: jpayne@69: #ifdef TCL_MEM_DEBUG jpayne@69: # define TK_NUM_SAVED_OPTIONS 2 jpayne@69: #else jpayne@69: # define TK_NUM_SAVED_OPTIONS 20 jpayne@69: #endif jpayne@69: jpayne@69: typedef struct Tk_SavedOptions { jpayne@69: char *recordPtr; /* The data structure in which to restore jpayne@69: * configuration options. */ jpayne@69: Tk_Window tkwin; /* Window associated with recordPtr; needed to jpayne@69: * restore certain options. */ jpayne@69: int numItems; /* The number of valid items in items field. */ jpayne@69: Tk_SavedOption items[TK_NUM_SAVED_OPTIONS]; jpayne@69: /* Items used to hold old values. */ jpayne@69: struct Tk_SavedOptions *nextPtr; jpayne@69: /* Points to next structure in list; needed if jpayne@69: * too many options changed to hold all the jpayne@69: * old values in a single structure. NULL jpayne@69: * means no more structures. */ jpayne@69: } Tk_SavedOptions; jpayne@69: jpayne@69: /* jpayne@69: * Structure used to describe application-specific configuration options: jpayne@69: * indicates procedures to call to parse an option and to return a text string jpayne@69: * describing an option. THESE ARE DEPRECATED; PLEASE USE THE NEW STRUCTURES jpayne@69: * LISTED ABOVE. jpayne@69: */ jpayne@69: jpayne@69: /* jpayne@69: * This is a temporary flag used while tkObjConfig and new widgets are in jpayne@69: * development. jpayne@69: */ jpayne@69: jpayne@69: #ifndef __NO_OLD_CONFIG jpayne@69: jpayne@69: typedef int (Tk_OptionParseProc) (ClientData clientData, Tcl_Interp *interp, jpayne@69: Tk_Window tkwin, CONST84 char *value, char *widgRec, int offset); jpayne@69: typedef CONST86 char *(Tk_OptionPrintProc) (ClientData clientData, jpayne@69: Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); jpayne@69: jpayne@69: typedef struct Tk_CustomOption { jpayne@69: Tk_OptionParseProc *parseProc; jpayne@69: /* Procedure to call to parse an option and jpayne@69: * store it in converted form. */ jpayne@69: Tk_OptionPrintProc *printProc; jpayne@69: /* Procedure to return a printable string jpayne@69: * describing an existing option. */ jpayne@69: ClientData clientData; /* Arbitrary one-word value used by option jpayne@69: * parser: passed to parseProc and jpayne@69: * printProc. */ jpayne@69: } Tk_CustomOption; jpayne@69: jpayne@69: /* jpayne@69: * Structure used to specify information for Tk_ConfigureWidget. Each jpayne@69: * structure gives complete information for one option, including how the jpayne@69: * option is specified on the command line, where it appears in the option jpayne@69: * database, etc. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tk_ConfigSpec { jpayne@69: int type; /* Type of option, such as TK_CONFIG_COLOR; jpayne@69: * see definitions below. Last option in table jpayne@69: * must have type TK_CONFIG_END. */ jpayne@69: CONST86 char *argvName; /* Switch used to specify option in argv. NULL jpayne@69: * means this spec is part of a group. */ jpayne@69: Tk_Uid dbName; /* Name for option in option database. */ jpayne@69: Tk_Uid dbClass; /* Class for option in database. */ jpayne@69: Tk_Uid defValue; /* Default value for option if not specified jpayne@69: * in command line or database. */ jpayne@69: int offset; /* Where in widget record to store value; use jpayne@69: * Tk_Offset macro to generate values for jpayne@69: * this. */ jpayne@69: int specFlags; /* Any combination of the values defined jpayne@69: * below; other bits are used internally by jpayne@69: * tkConfig.c. */ jpayne@69: CONST86 Tk_CustomOption *customPtr; jpayne@69: /* If type is TK_CONFIG_CUSTOM then this is a jpayne@69: * pointer to info about how to parse and jpayne@69: * print the option. Otherwise it is jpayne@69: * irrelevant. */ jpayne@69: } Tk_ConfigSpec; jpayne@69: jpayne@69: /* jpayne@69: * Type values for Tk_ConfigSpec structures. See the user documentation for jpayne@69: * details. jpayne@69: */ jpayne@69: jpayne@69: typedef enum { jpayne@69: TK_CONFIG_BOOLEAN, TK_CONFIG_INT, TK_CONFIG_DOUBLE, TK_CONFIG_STRING, jpayne@69: TK_CONFIG_UID, TK_CONFIG_COLOR, TK_CONFIG_FONT, TK_CONFIG_BITMAP, jpayne@69: TK_CONFIG_BORDER, TK_CONFIG_RELIEF, TK_CONFIG_CURSOR, jpayne@69: TK_CONFIG_ACTIVE_CURSOR, TK_CONFIG_JUSTIFY, TK_CONFIG_ANCHOR, jpayne@69: TK_CONFIG_SYNONYM, TK_CONFIG_CAP_STYLE, TK_CONFIG_JOIN_STYLE, jpayne@69: TK_CONFIG_PIXELS, TK_CONFIG_MM, TK_CONFIG_WINDOW, TK_CONFIG_CUSTOM, jpayne@69: TK_CONFIG_END jpayne@69: } Tk_ConfigTypes; jpayne@69: jpayne@69: /* jpayne@69: * Possible values for flags argument to Tk_ConfigureWidget: jpayne@69: */ jpayne@69: jpayne@69: #define TK_CONFIG_ARGV_ONLY 1 jpayne@69: #define TK_CONFIG_OBJS 0x80 jpayne@69: jpayne@69: /* jpayne@69: * Possible flag values for Tk_ConfigSpec structures. Any bits at or above jpayne@69: * TK_CONFIG_USER_BIT may be used by clients for selecting certain entries. jpayne@69: * Before changing any values here, coordinate with tkOldConfig.c jpayne@69: * (internal-use-only flags are defined there). jpayne@69: */ jpayne@69: jpayne@69: #define TK_CONFIG_NULL_OK (1 << 0) jpayne@69: #define TK_CONFIG_COLOR_ONLY (1 << 1) jpayne@69: #define TK_CONFIG_MONO_ONLY (1 << 2) jpayne@69: #define TK_CONFIG_DONT_SET_DEFAULT (1 << 3) jpayne@69: #define TK_CONFIG_OPTION_SPECIFIED (1 << 4) jpayne@69: #define TK_CONFIG_USER_BIT 0x100 jpayne@69: #endif /* __NO_OLD_CONFIG */ jpayne@69: jpayne@69: /* jpayne@69: * Structure used to specify how to handle argv options. jpayne@69: */ jpayne@69: jpayne@69: typedef struct { jpayne@69: CONST86 char *key; /* The key string that flags the option in the jpayne@69: * argv array. */ jpayne@69: int type; /* Indicates option type; see below. */ jpayne@69: char *src; /* Value to be used in setting dst; usage jpayne@69: * depends on type. */ jpayne@69: char *dst; /* Address of value to be modified; usage jpayne@69: * depends on type. */ jpayne@69: CONST86 char *help; /* Documentation message describing this jpayne@69: * option. */ jpayne@69: } Tk_ArgvInfo; jpayne@69: jpayne@69: /* jpayne@69: * Legal values for the type field of a Tk_ArgvInfo: see the user jpayne@69: * documentation for details. jpayne@69: */ jpayne@69: jpayne@69: #define TK_ARGV_CONSTANT 15 jpayne@69: #define TK_ARGV_INT 16 jpayne@69: #define TK_ARGV_STRING 17 jpayne@69: #define TK_ARGV_UID 18 jpayne@69: #define TK_ARGV_REST 19 jpayne@69: #define TK_ARGV_FLOAT 20 jpayne@69: #define TK_ARGV_FUNC 21 jpayne@69: #define TK_ARGV_GENFUNC 22 jpayne@69: #define TK_ARGV_HELP 23 jpayne@69: #define TK_ARGV_CONST_OPTION 24 jpayne@69: #define TK_ARGV_OPTION_VALUE 25 jpayne@69: #define TK_ARGV_OPTION_NAME_VALUE 26 jpayne@69: #define TK_ARGV_END 27 jpayne@69: jpayne@69: /* jpayne@69: * Flag bits for passing to Tk_ParseArgv: jpayne@69: */ jpayne@69: jpayne@69: #define TK_ARGV_NO_DEFAULTS 0x1 jpayne@69: #define TK_ARGV_NO_LEFTOVERS 0x2 jpayne@69: #define TK_ARGV_NO_ABBREV 0x4 jpayne@69: #define TK_ARGV_DONT_SKIP_FIRST_ARG 0x8 jpayne@69: jpayne@69: /* jpayne@69: * Enumerated type for describing actions to be taken in response to a jpayne@69: * restrictProc established by Tk_RestrictEvents. jpayne@69: */ jpayne@69: jpayne@69: typedef enum { jpayne@69: TK_DEFER_EVENT, TK_PROCESS_EVENT, TK_DISCARD_EVENT jpayne@69: } Tk_RestrictAction; jpayne@69: jpayne@69: /* jpayne@69: * Priority levels to pass to Tk_AddOption: jpayne@69: */ jpayne@69: jpayne@69: #define TK_WIDGET_DEFAULT_PRIO 20 jpayne@69: #define TK_STARTUP_FILE_PRIO 40 jpayne@69: #define TK_USER_DEFAULT_PRIO 60 jpayne@69: #define TK_INTERACTIVE_PRIO 80 jpayne@69: #define TK_MAX_PRIO 100 jpayne@69: jpayne@69: /* jpayne@69: * Relief values returned by Tk_GetRelief: jpayne@69: */ jpayne@69: jpayne@69: #define TK_RELIEF_NULL -1 jpayne@69: #define TK_RELIEF_FLAT 0 jpayne@69: #define TK_RELIEF_GROOVE 1 jpayne@69: #define TK_RELIEF_RAISED 2 jpayne@69: #define TK_RELIEF_RIDGE 3 jpayne@69: #define TK_RELIEF_SOLID 4 jpayne@69: #define TK_RELIEF_SUNKEN 5 jpayne@69: jpayne@69: /* jpayne@69: * "Which" argument values for Tk_3DBorderGC: jpayne@69: */ jpayne@69: jpayne@69: #define TK_3D_FLAT_GC 1 jpayne@69: #define TK_3D_LIGHT_GC 2 jpayne@69: #define TK_3D_DARK_GC 3 jpayne@69: jpayne@69: /* jpayne@69: * Special EnterNotify/LeaveNotify "mode" for use in events generated by jpayne@69: * tkShare.c. Pick a high enough value that it's unlikely to conflict with jpayne@69: * existing values (like NotifyNormal) or any new values defined in the jpayne@69: * future. jpayne@69: */ jpayne@69: jpayne@69: #define TK_NOTIFY_SHARE 20 jpayne@69: jpayne@69: /* jpayne@69: * Enumerated type for describing a point by which to anchor something: jpayne@69: */ jpayne@69: jpayne@69: typedef enum { jpayne@69: TK_ANCHOR_N, TK_ANCHOR_NE, TK_ANCHOR_E, TK_ANCHOR_SE, jpayne@69: TK_ANCHOR_S, TK_ANCHOR_SW, TK_ANCHOR_W, TK_ANCHOR_NW, jpayne@69: TK_ANCHOR_CENTER jpayne@69: } Tk_Anchor; jpayne@69: jpayne@69: /* jpayne@69: * Enumerated type for describing a style of justification: jpayne@69: */ jpayne@69: jpayne@69: typedef enum { jpayne@69: TK_JUSTIFY_LEFT, TK_JUSTIFY_RIGHT, TK_JUSTIFY_CENTER jpayne@69: } Tk_Justify; jpayne@69: jpayne@69: /* jpayne@69: * The following structure is used by Tk_GetFontMetrics() to return jpayne@69: * information about the properties of a Tk_Font. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tk_FontMetrics { jpayne@69: int ascent; /* The amount in pixels that the tallest jpayne@69: * letter sticks up above the baseline, plus jpayne@69: * any extra blank space added by the designer jpayne@69: * of the font. */ jpayne@69: int descent; /* The largest amount in pixels that any jpayne@69: * letter sticks below the baseline, plus any jpayne@69: * extra blank space added by the designer of jpayne@69: * the font. */ jpayne@69: int linespace; /* The sum of the ascent and descent. How far jpayne@69: * apart two lines of text in the same font jpayne@69: * should be placed so that none of the jpayne@69: * characters in one line overlap any of the jpayne@69: * characters in the other line. */ jpayne@69: } Tk_FontMetrics; jpayne@69: jpayne@69: /* jpayne@69: * Flags passed to Tk_MeasureChars: jpayne@69: */ jpayne@69: jpayne@69: #define TK_WHOLE_WORDS 1 jpayne@69: #define TK_AT_LEAST_ONE 2 jpayne@69: #define TK_PARTIAL_OK 4 jpayne@69: jpayne@69: /* jpayne@69: * Flags passed to Tk_ComputeTextLayout: jpayne@69: */ jpayne@69: jpayne@69: #define TK_IGNORE_TABS 8 jpayne@69: #define TK_IGNORE_NEWLINES 16 jpayne@69: jpayne@69: /* jpayne@69: * Widget class procedures used to implement platform specific widget jpayne@69: * behavior. jpayne@69: */ jpayne@69: jpayne@69: typedef Window (Tk_ClassCreateProc) (Tk_Window tkwin, Window parent, jpayne@69: ClientData instanceData); jpayne@69: typedef void (Tk_ClassWorldChangedProc) (ClientData instanceData); jpayne@69: typedef void (Tk_ClassModalProc) (Tk_Window tkwin, XEvent *eventPtr); jpayne@69: jpayne@69: typedef struct Tk_ClassProcs { jpayne@69: unsigned int size; jpayne@69: Tk_ClassWorldChangedProc *worldChangedProc; jpayne@69: /* Procedure to invoke when the widget needs jpayne@69: * to respond in some way to a change in the jpayne@69: * world (font changes, etc.) */ jpayne@69: Tk_ClassCreateProc *createProc; jpayne@69: /* Procedure to invoke when the platform- jpayne@69: * dependent window needs to be created. */ jpayne@69: Tk_ClassModalProc *modalProc; jpayne@69: /* Procedure to invoke after all bindings on a jpayne@69: * widget have been triggered in order to jpayne@69: * handle a modal loop. */ jpayne@69: } Tk_ClassProcs; jpayne@69: jpayne@69: /* jpayne@69: * Simple accessor for Tk_ClassProcs structure. Checks that the structure is jpayne@69: * not NULL, then checks the size field and returns either the requested jpayne@69: * field, if present, or NULL if the structure is too small to have the field jpayne@69: * (or NULL if the structure is NULL). jpayne@69: * jpayne@69: * A more general version of this function may be useful if other jpayne@69: * size-versioned structure pop up in the future: jpayne@69: * jpayne@69: * #define Tk_GetField(name, who, which) \ jpayne@69: * (((who) == NULL) ? NULL : jpayne@69: * (((who)->size <= Tk_Offset(name, which)) ? NULL :(name)->which)) jpayne@69: */ jpayne@69: jpayne@69: #define Tk_GetClassProc(procs, which) \ jpayne@69: (((procs) == NULL) ? NULL : \ jpayne@69: (((procs)->size <= Tk_Offset(Tk_ClassProcs, which)) ? NULL:(procs)->which)) jpayne@69: jpayne@69: /* jpayne@69: * Each geometry manager (the packer, the placer, etc.) is represented by a jpayne@69: * structure of the following form, which indicates procedures to invoke in jpayne@69: * the geometry manager to carry out certain functions. jpayne@69: */ jpayne@69: jpayne@69: #define Tk_GeomLostContentProc Tk_GeomLostSlaveProc jpayne@69: typedef void (Tk_GeomRequestProc) (ClientData clientData, Tk_Window tkwin); jpayne@69: typedef void (Tk_GeomLostContentProc) (ClientData clientData, Tk_Window tkwin); jpayne@69: jpayne@69: typedef struct Tk_GeomMgr { jpayne@69: const char *name; /* Name of the geometry manager (command used jpayne@69: * to invoke it, or name of widget class that jpayne@69: * allows embedded widgets). */ jpayne@69: Tk_GeomRequestProc *requestProc; jpayne@69: /* Procedure to invoke when a content's jpayne@69: * requested geometry changes. */ jpayne@69: Tk_GeomLostContentProc *lostSlaveProc; jpayne@69: /* Procedure to invoke when content is taken jpayne@69: * away from one geometry manager by another. jpayne@69: * NULL means geometry manager doesn't care jpayne@69: * when content lost. */ jpayne@69: } Tk_GeomMgr; jpayne@69: jpayne@69: /* jpayne@69: * Result values returned by Tk_GetScrollInfo: jpayne@69: */ jpayne@69: jpayne@69: #define TK_SCROLL_MOVETO 1 jpayne@69: #define TK_SCROLL_PAGES 2 jpayne@69: #define TK_SCROLL_UNITS 3 jpayne@69: #define TK_SCROLL_ERROR 4 jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------- jpayne@69: * jpayne@69: * Extensions to the X event set jpayne@69: * jpayne@69: *---------------------------------------------------------------------- jpayne@69: */ jpayne@69: jpayne@69: #define VirtualEvent (MappingNotify + 1) jpayne@69: #define ActivateNotify (MappingNotify + 2) jpayne@69: #define DeactivateNotify (MappingNotify + 3) jpayne@69: #define MouseWheelEvent (MappingNotify + 4) jpayne@69: #define TK_LASTEVENT (MappingNotify + 5) jpayne@69: jpayne@69: #define MouseWheelMask (1L << 28) jpayne@69: #define ActivateMask (1L << 29) jpayne@69: #define VirtualEventMask (1L << 30) jpayne@69: jpayne@69: /* jpayne@69: * A virtual event shares most of its fields with the XKeyEvent and jpayne@69: * XButtonEvent structures. 99% of the time a virtual event will be an jpayne@69: * abstraction of a key or button event, so this structure provides the most jpayne@69: * information to the user. The only difference is the changing of the detail jpayne@69: * field for a virtual event so that it holds the name of the virtual event jpayne@69: * being triggered. jpayne@69: * jpayne@69: * When using this structure, you should ensure that you zero out all the jpayne@69: * fields first using memset() or bzero(). jpayne@69: */ jpayne@69: jpayne@69: typedef struct { jpayne@69: int type; jpayne@69: unsigned long serial; /* # of last request processed by server. */ jpayne@69: Bool send_event; /* True if this came from a SendEvent jpayne@69: * request. */ jpayne@69: Display *display; /* Display the event was read from. */ jpayne@69: Window event; /* Window on which event was requested. */ jpayne@69: Window root; /* Root window that the event occurred on. */ jpayne@69: Window subwindow; /* Child window. */ jpayne@69: Time time; /* Milliseconds. */ jpayne@69: int x, y; /* Pointer x, y coordinates in event jpayne@69: * window. */ jpayne@69: int x_root, y_root; /* Coordinates relative to root. */ jpayne@69: unsigned int state; /* Key or button mask */ jpayne@69: Tk_Uid name; /* Name of virtual event. */ jpayne@69: Bool same_screen; /* Same screen flag. */ jpayne@69: Tcl_Obj *user_data; /* Application-specific data reference; Tk jpayne@69: * will decrement the reference count *once* jpayne@69: * when it has finished processing the jpayne@69: * event. */ jpayne@69: } XVirtualEvent; jpayne@69: jpayne@69: typedef struct { jpayne@69: int type; jpayne@69: unsigned long serial; /* # of last request processed by server. */ jpayne@69: Bool send_event; /* True if this came from a SendEvent jpayne@69: * request. */ jpayne@69: Display *display; /* Display the event was read from. */ jpayne@69: Window window; /* Window in which event occurred. */ jpayne@69: } XActivateDeactivateEvent; jpayne@69: typedef XActivateDeactivateEvent XActivateEvent; jpayne@69: typedef XActivateDeactivateEvent XDeactivateEvent; jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------- jpayne@69: * jpayne@69: * Macros for querying Tk_Window structures. See the manual entries for jpayne@69: * documentation. jpayne@69: * jpayne@69: *---------------------------------------------------------------------- jpayne@69: */ jpayne@69: jpayne@69: #define Tk_Display(tkwin) (((Tk_FakeWin *) (tkwin))->display) jpayne@69: #define Tk_ScreenNumber(tkwin) (((Tk_FakeWin *) (tkwin))->screenNum) jpayne@69: #define Tk_Screen(tkwin) \ jpayne@69: (ScreenOfDisplay(Tk_Display(tkwin), Tk_ScreenNumber(tkwin))) jpayne@69: #define Tk_Depth(tkwin) (((Tk_FakeWin *) (tkwin))->depth) jpayne@69: #define Tk_Visual(tkwin) (((Tk_FakeWin *) (tkwin))->visual) jpayne@69: #define Tk_WindowId(tkwin) (((Tk_FakeWin *) (tkwin))->window) jpayne@69: #define Tk_PathName(tkwin) (((Tk_FakeWin *) (tkwin))->pathName) jpayne@69: #define Tk_Name(tkwin) (((Tk_FakeWin *) (tkwin))->nameUid) jpayne@69: #define Tk_Class(tkwin) (((Tk_FakeWin *) (tkwin))->classUid) jpayne@69: #define Tk_X(tkwin) (((Tk_FakeWin *) (tkwin))->changes.x) jpayne@69: #define Tk_Y(tkwin) (((Tk_FakeWin *) (tkwin))->changes.y) jpayne@69: #define Tk_Width(tkwin) (((Tk_FakeWin *) (tkwin))->changes.width) jpayne@69: #define Tk_Height(tkwin) \ jpayne@69: (((Tk_FakeWin *) (tkwin))->changes.height) jpayne@69: #define Tk_Changes(tkwin) (&((Tk_FakeWin *) (tkwin))->changes) jpayne@69: #define Tk_Attributes(tkwin) (&((Tk_FakeWin *) (tkwin))->atts) jpayne@69: #define Tk_IsEmbedded(tkwin) \ jpayne@69: (((Tk_FakeWin *) (tkwin))->flags & TK_EMBEDDED) jpayne@69: #define Tk_IsContainer(tkwin) \ jpayne@69: (((Tk_FakeWin *) (tkwin))->flags & TK_CONTAINER) jpayne@69: #define Tk_IsMapped(tkwin) \ jpayne@69: (((Tk_FakeWin *) (tkwin))->flags & TK_MAPPED) jpayne@69: #define Tk_IsTopLevel(tkwin) \ jpayne@69: (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_LEVEL) jpayne@69: #define Tk_HasWrapper(tkwin) \ jpayne@69: (((Tk_FakeWin *) (tkwin))->flags & TK_HAS_WRAPPER) jpayne@69: #define Tk_WinManaged(tkwin) \ jpayne@69: (((Tk_FakeWin *) (tkwin))->flags & TK_WIN_MANAGED) jpayne@69: #define Tk_TopWinHierarchy(tkwin) \ jpayne@69: (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY) jpayne@69: #define Tk_IsManageable(tkwin) \ jpayne@69: (((Tk_FakeWin *) (tkwin))->flags & TK_WM_MANAGEABLE) jpayne@69: #define Tk_ReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->reqWidth) jpayne@69: #define Tk_ReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->reqHeight) jpayne@69: /* Tk_InternalBorderWidth is deprecated */ jpayne@69: #define Tk_InternalBorderWidth(tkwin) \ jpayne@69: (((Tk_FakeWin *) (tkwin))->internalBorderLeft) jpayne@69: #define Tk_InternalBorderLeft(tkwin) \ jpayne@69: (((Tk_FakeWin *) (tkwin))->internalBorderLeft) jpayne@69: #define Tk_InternalBorderRight(tkwin) \ jpayne@69: (((Tk_FakeWin *) (tkwin))->internalBorderRight) jpayne@69: #define Tk_InternalBorderTop(tkwin) \ jpayne@69: (((Tk_FakeWin *) (tkwin))->internalBorderTop) jpayne@69: #define Tk_InternalBorderBottom(tkwin) \ jpayne@69: (((Tk_FakeWin *) (tkwin))->internalBorderBottom) jpayne@69: #define Tk_MinReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->minReqWidth) jpayne@69: #define Tk_MinReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->minReqHeight) jpayne@69: #define Tk_Parent(tkwin) (((Tk_FakeWin *) (tkwin))->parentPtr) jpayne@69: #define Tk_Colormap(tkwin) (((Tk_FakeWin *) (tkwin))->atts.colormap) jpayne@69: jpayne@69: /* jpayne@69: * The structure below is needed by the macros above so that they can access jpayne@69: * the fields of a Tk_Window. The fields not needed by the macros are declared jpayne@69: * as "dummyX". The structure has its own type in order to prevent apps from jpayne@69: * accessing Tk_Window fields except using official macros. WARNING!! The jpayne@69: * structure definition must be kept consistent with the TkWindow structure in jpayne@69: * tkInt.h. If you change one, then change the other. See the declaration in jpayne@69: * tkInt.h for documentation on what the fields are used for internally. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tk_FakeWin { jpayne@69: Display *display; jpayne@69: char *dummy1; /* dispPtr */ jpayne@69: int screenNum; jpayne@69: Visual *visual; jpayne@69: int depth; jpayne@69: Window window; jpayne@69: char *dummy2; /* childList */ jpayne@69: char *dummy3; /* lastChildPtr */ jpayne@69: Tk_Window parentPtr; /* parentPtr */ jpayne@69: char *dummy4; /* nextPtr */ jpayne@69: char *dummy5; /* mainPtr */ jpayne@69: char *pathName; jpayne@69: Tk_Uid nameUid; jpayne@69: Tk_Uid classUid; jpayne@69: XWindowChanges changes; jpayne@69: unsigned int dummy6; /* dirtyChanges */ jpayne@69: XSetWindowAttributes atts; jpayne@69: unsigned long dummy7; /* dirtyAtts */ jpayne@69: unsigned int flags; jpayne@69: char *dummy8; /* handlerList */ jpayne@69: #ifdef TK_USE_INPUT_METHODS jpayne@69: XIC dummy9; /* inputContext */ jpayne@69: #endif /* TK_USE_INPUT_METHODS */ jpayne@69: ClientData *dummy10; /* tagPtr */ jpayne@69: int dummy11; /* numTags */ jpayne@69: int dummy12; /* optionLevel */ jpayne@69: char *dummy13; /* selHandlerList */ jpayne@69: char *dummy14; /* geomMgrPtr */ jpayne@69: ClientData dummy15; /* geomData */ jpayne@69: int reqWidth, reqHeight; jpayne@69: int internalBorderLeft; jpayne@69: char *dummy16; /* wmInfoPtr */ jpayne@69: char *dummy17; /* classProcPtr */ jpayne@69: ClientData dummy18; /* instanceData */ jpayne@69: char *dummy19; /* privatePtr */ jpayne@69: int internalBorderRight; jpayne@69: int internalBorderTop; jpayne@69: int internalBorderBottom; jpayne@69: int minReqWidth; jpayne@69: int minReqHeight; jpayne@69: #ifdef TK_USE_INPUT_METHODS jpayne@69: int dummy20; jpayne@69: #endif /* TK_USE_INPUT_METHODS */ jpayne@69: char *dummy21; /* geomMgrName */ jpayne@69: Tk_Window dummy22; /* maintainerPtr */ jpayne@69: } Tk_FakeWin; jpayne@69: jpayne@69: /* jpayne@69: * Flag values for TkWindow (and Tk_FakeWin) structures are: jpayne@69: * jpayne@69: * TK_MAPPED: 1 means window is currently mapped, jpayne@69: * 0 means unmapped. jpayne@69: * TK_TOP_LEVEL: 1 means this is a top-level widget. jpayne@69: * TK_ALREADY_DEAD: 1 means the window is in the process of jpayne@69: * being destroyed already. jpayne@69: * TK_NEED_CONFIG_NOTIFY: 1 means that the window has been reconfigured jpayne@69: * before it was made to exist. At the time of jpayne@69: * making it exist a ConfigureNotify event needs jpayne@69: * to be generated. jpayne@69: * TK_GRAB_FLAG: Used to manage grabs. See tkGrab.c for details jpayne@69: * TK_CHECKED_IC: 1 means we've already tried to get an input jpayne@69: * context for this window; if the ic field is jpayne@69: * NULL it means that there isn't a context for jpayne@69: * the field. jpayne@69: * TK_DONT_DESTROY_WINDOW: 1 means that Tk_DestroyWindow should not jpayne@69: * invoke XDestroyWindow to destroy this widget's jpayne@69: * X window. The flag is set when the window has jpayne@69: * already been destroyed elsewhere (e.g. by jpayne@69: * another application) or when it will be jpayne@69: * destroyed later (e.g. by destroying its parent) jpayne@69: * TK_WM_COLORMAP_WINDOW: 1 means that this window has at some time jpayne@69: * appeared in the WM_COLORMAP_WINDOWS property jpayne@69: * for its toplevel, so we have to remove it from jpayne@69: * that property if the window is deleted and the jpayne@69: * toplevel isn't. jpayne@69: * TK_EMBEDDED: 1 means that this window (which must be a jpayne@69: * toplevel) is not a free-standing window but jpayne@69: * rather is embedded in some other application. jpayne@69: * TK_CONTAINER: 1 means that this window is a container, and jpayne@69: * that some other application (either in this jpayne@69: * process or elsewhere) may be embedding itself jpayne@69: * inside the window. jpayne@69: * TK_BOTH_HALVES: 1 means that this window is used for jpayne@69: * application embedding (either as container or jpayne@69: * embedded application), and both the containing jpayne@69: * and embedded halves are associated with jpayne@69: * windows in this particular process. jpayne@69: * TK_WRAPPER: 1 means that this window is the extra wrapper jpayne@69: * window created around a toplevel to hold the jpayne@69: * menubar under Unix. See tkUnixWm.c for more jpayne@69: * information. jpayne@69: * TK_REPARENTED: 1 means that this window has been reparented jpayne@69: * so that as far as the window system is jpayne@69: * concerned it isn't a child of its Tk parent. jpayne@69: * Initially this is used only for special Unix jpayne@69: * menubar windows. jpayne@69: * TK_ANONYMOUS_WINDOW: 1 means that this window has no name, and is jpayne@69: * thus not accessible from Tk. jpayne@69: * TK_HAS_WRAPPER 1 means that this window has a wrapper window jpayne@69: * TK_WIN_MANAGED 1 means that this window is a child of the root jpayne@69: * window, and is managed by the window manager. jpayne@69: * TK_TOP_HIERARCHY 1 means this window is at the top of a physical jpayne@69: * window hierarchy within this process, i.e. the jpayne@69: * window's parent either doesn't exist or is not jpayne@69: * owned by this Tk application. jpayne@69: * TK_PROP_PROPCHANGE 1 means that PropertyNotify events in the jpayne@69: * window's children should propagate up to this jpayne@69: * window. jpayne@69: * TK_WM_MANAGEABLE 1 marks a window as capable of being converted jpayne@69: * into a toplevel using [wm manage]. jpayne@69: * TK_CAN_INPUT_TEXT 1 means that this window accepts text input. jpayne@69: * Used on macOS to indicate that key events can be jpayne@69: * processed with the NSTextInputClient protocol. jpayne@69: * Not currently accessible through the public API. jpayne@69: */ jpayne@69: jpayne@69: #define TK_MAPPED 1 jpayne@69: #define TK_TOP_LEVEL 2 jpayne@69: #define TK_ALREADY_DEAD 4 jpayne@69: #define TK_NEED_CONFIG_NOTIFY 8 jpayne@69: #define TK_GRAB_FLAG 0x10 jpayne@69: #define TK_CHECKED_IC 0x20 jpayne@69: #define TK_DONT_DESTROY_WINDOW 0x40 jpayne@69: #define TK_WM_COLORMAP_WINDOW 0x80 jpayne@69: #define TK_EMBEDDED 0x100 jpayne@69: #define TK_CONTAINER 0x200 jpayne@69: #define TK_BOTH_HALVES 0x400 jpayne@69: jpayne@69: #define TK_WRAPPER 0x1000 jpayne@69: #define TK_REPARENTED 0x2000 jpayne@69: #define TK_ANONYMOUS_WINDOW 0x4000 jpayne@69: #define TK_HAS_WRAPPER 0x8000 jpayne@69: #define TK_WIN_MANAGED 0x10000 jpayne@69: #define TK_TOP_HIERARCHY 0x20000 jpayne@69: #define TK_PROP_PROPCHANGE 0x40000 jpayne@69: #define TK_WM_MANAGEABLE 0x80000 jpayne@69: #define TK_CAN_INPUT_TEXT 0x100000 jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------- jpayne@69: * jpayne@69: * Procedure prototypes and structures used for defining new canvas items: jpayne@69: * jpayne@69: *---------------------------------------------------------------------- jpayne@69: */ jpayne@69: jpayne@69: typedef enum { jpayne@69: TK_STATE_NULL = -1, TK_STATE_ACTIVE, TK_STATE_DISABLED, jpayne@69: TK_STATE_NORMAL, TK_STATE_HIDDEN jpayne@69: } Tk_State; jpayne@69: jpayne@69: typedef struct Tk_SmoothMethod { jpayne@69: CONST86 char *name; jpayne@69: int (*coordProc) (Tk_Canvas canvas, double *pointPtr, int numPoints, jpayne@69: int numSteps, XPoint xPoints[], double dblPoints[]); jpayne@69: void (*postscriptProc) (Tcl_Interp *interp, Tk_Canvas canvas, jpayne@69: double *coordPtr, int numPoints, int numSteps); jpayne@69: } Tk_SmoothMethod; jpayne@69: jpayne@69: /* jpayne@69: * For each item in a canvas widget there exists one record with the following jpayne@69: * structure. Each actual item is represented by a record with the following jpayne@69: * stuff at its beginning, plus additional type-specific stuff after that. jpayne@69: */ jpayne@69: jpayne@69: #define TK_TAG_SPACE 3 jpayne@69: jpayne@69: typedef struct Tk_Item { jpayne@69: int id; /* Unique identifier for this item (also jpayne@69: * serves as first tag for item). */ jpayne@69: struct Tk_Item *nextPtr; /* Next in display list of all items in this jpayne@69: * canvas. Later items in list are drawn on jpayne@69: * top of earlier ones. */ jpayne@69: Tk_Uid staticTagSpace[TK_TAG_SPACE]; jpayne@69: /* Built-in space for limited # of tags. */ jpayne@69: Tk_Uid *tagPtr; /* Pointer to array of tags. Usually points to jpayne@69: * staticTagSpace, but may point to malloc-ed jpayne@69: * space if there are lots of tags. */ jpayne@69: int tagSpace; /* Total amount of tag space available at jpayne@69: * tagPtr. */ jpayne@69: int numTags; /* Number of tag slots actually used at jpayne@69: * *tagPtr. */ jpayne@69: struct Tk_ItemType *typePtr;/* Table of procedures that implement this jpayne@69: * type of item. */ jpayne@69: int x1, y1, x2, y2; /* Bounding box for item, in integer canvas jpayne@69: * units. Set by item-specific code and jpayne@69: * guaranteed to contain every pixel drawn in jpayne@69: * item. Item area includes x1 and y1 but not jpayne@69: * x2 and y2. */ jpayne@69: struct Tk_Item *prevPtr; /* Previous in display list of all items in jpayne@69: * this canvas. Later items in list are drawn jpayne@69: * just below earlier ones. */ jpayne@69: Tk_State state; /* State of item. */ jpayne@69: char *reserved1; /* reserved for future use */ jpayne@69: int redraw_flags; /* Some flags used in the canvas */ jpayne@69: jpayne@69: /* jpayne@69: *------------------------------------------------------------------ jpayne@69: * Starting here is additional type-specific stuff; see the declarations jpayne@69: * for individual types to see what is part of each type. The actual space jpayne@69: * below is determined by the "itemInfoSize" of the type's Tk_ItemType jpayne@69: * record. jpayne@69: *------------------------------------------------------------------ jpayne@69: */ jpayne@69: } Tk_Item; jpayne@69: jpayne@69: /* jpayne@69: * Flag bits for canvases (redraw_flags): jpayne@69: * jpayne@69: * TK_ITEM_STATE_DEPENDANT - 1 means that object needs to be redrawn if the jpayne@69: * canvas state changes. jpayne@69: * TK_ITEM_DONT_REDRAW - 1 means that the object redraw is already been jpayne@69: * prepared, so the general canvas code doesn't jpayne@69: * need to do that any more. jpayne@69: */ jpayne@69: jpayne@69: #define TK_ITEM_STATE_DEPENDANT 1 jpayne@69: #define TK_ITEM_DONT_REDRAW 2 jpayne@69: jpayne@69: /* jpayne@69: * Records of the following type are used to describe a type of item (e.g. jpayne@69: * lines, circles, etc.) that can form part of a canvas widget. jpayne@69: */ jpayne@69: jpayne@69: #ifdef USE_OLD_CANVAS jpayne@69: typedef int (Tk_ItemCreateProc)(Tcl_Interp *interp, Tk_Canvas canvas, jpayne@69: Tk_Item *itemPtr, int argc, char **argv); jpayne@69: typedef int (Tk_ItemConfigureProc)(Tcl_Interp *interp, Tk_Canvas canvas, jpayne@69: Tk_Item *itemPtr, int argc, char **argv, int flags); jpayne@69: typedef int (Tk_ItemCoordProc)(Tcl_Interp *interp, Tk_Canvas canvas, jpayne@69: Tk_Item *itemPtr, int argc, char **argv); jpayne@69: #else jpayne@69: typedef int (Tk_ItemCreateProc)(Tcl_Interp *interp, Tk_Canvas canvas, jpayne@69: Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); jpayne@69: typedef int (Tk_ItemConfigureProc)(Tcl_Interp *interp, Tk_Canvas canvas, jpayne@69: Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[], jpayne@69: int flags); jpayne@69: typedef int (Tk_ItemCoordProc)(Tcl_Interp *interp, Tk_Canvas canvas, jpayne@69: Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); jpayne@69: #endif /* USE_OLD_CANVAS */ jpayne@69: typedef void (Tk_ItemDeleteProc)(Tk_Canvas canvas, Tk_Item *itemPtr, jpayne@69: Display *display); jpayne@69: typedef void (Tk_ItemDisplayProc)(Tk_Canvas canvas, Tk_Item *itemPtr, jpayne@69: Display *display, Drawable dst, int x, int y, int width, jpayne@69: int height); jpayne@69: typedef double (Tk_ItemPointProc)(Tk_Canvas canvas, Tk_Item *itemPtr, jpayne@69: double *pointPtr); jpayne@69: typedef int (Tk_ItemAreaProc)(Tk_Canvas canvas, Tk_Item *itemPtr, jpayne@69: double *rectPtr); jpayne@69: typedef int (Tk_ItemPostscriptProc)(Tcl_Interp *interp, Tk_Canvas canvas, jpayne@69: Tk_Item *itemPtr, int prepass); jpayne@69: typedef void (Tk_ItemScaleProc)(Tk_Canvas canvas, Tk_Item *itemPtr, jpayne@69: double originX, double originY, double scaleX, jpayne@69: double scaleY); jpayne@69: typedef void (Tk_ItemTranslateProc)(Tk_Canvas canvas, Tk_Item *itemPtr, jpayne@69: double deltaX, double deltaY); jpayne@69: #ifdef USE_OLD_CANVAS jpayne@69: typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas, jpayne@69: Tk_Item *itemPtr, char *indexString, int *indexPtr); jpayne@69: #else jpayne@69: typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas, jpayne@69: Tk_Item *itemPtr, Tcl_Obj *indexString, int *indexPtr); jpayne@69: #endif /* USE_OLD_CANVAS */ jpayne@69: typedef void (Tk_ItemCursorProc)(Tk_Canvas canvas, Tk_Item *itemPtr, jpayne@69: int index); jpayne@69: typedef int (Tk_ItemSelectionProc)(Tk_Canvas canvas, Tk_Item *itemPtr, jpayne@69: int offset, char *buffer, int maxBytes); jpayne@69: #ifdef USE_OLD_CANVAS jpayne@69: typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr, jpayne@69: int beforeThis, char *string); jpayne@69: #else jpayne@69: typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr, jpayne@69: int beforeThis, Tcl_Obj *string); jpayne@69: #endif /* USE_OLD_CANVAS */ jpayne@69: typedef void (Tk_ItemDCharsProc)(Tk_Canvas canvas, Tk_Item *itemPtr, jpayne@69: int first, int last); jpayne@69: jpayne@69: #ifndef __NO_OLD_CONFIG jpayne@69: jpayne@69: typedef struct Tk_ItemType { jpayne@69: CONST86 char *name; /* The name of this type of item, such as jpayne@69: * "line". */ jpayne@69: int itemSize; /* Total amount of space needed for item's jpayne@69: * record. */ jpayne@69: Tk_ItemCreateProc *createProc; jpayne@69: /* Procedure to create a new item of this jpayne@69: * type. */ jpayne@69: CONST86 Tk_ConfigSpec *configSpecs; /* Pointer to array of configuration specs for jpayne@69: * this type. Used for returning configuration jpayne@69: * info. */ jpayne@69: Tk_ItemConfigureProc *configProc; jpayne@69: /* Procedure to call to change configuration jpayne@69: * options. */ jpayne@69: Tk_ItemCoordProc *coordProc;/* Procedure to call to get and set the item's jpayne@69: * coordinates. */ jpayne@69: Tk_ItemDeleteProc *deleteProc; jpayne@69: /* Procedure to delete existing item of this jpayne@69: * type. */ jpayne@69: Tk_ItemDisplayProc *displayProc; jpayne@69: /* Procedure to display items of this type. */ jpayne@69: int alwaysRedraw; /* Non-zero means displayProc should be called jpayne@69: * even when the item has been moved jpayne@69: * off-screen. */ jpayne@69: Tk_ItemPointProc *pointProc;/* Computes distance from item to a given jpayne@69: * point. */ jpayne@69: Tk_ItemAreaProc *areaProc; /* Computes whether item is inside, outside, jpayne@69: * or overlapping an area. */ jpayne@69: Tk_ItemPostscriptProc *postscriptProc; jpayne@69: /* Procedure to write a Postscript description jpayne@69: * for items of this type. */ jpayne@69: Tk_ItemScaleProc *scaleProc;/* Procedure to rescale items of this type. */ jpayne@69: Tk_ItemTranslateProc *translateProc; jpayne@69: /* Procedure to translate items of this jpayne@69: * type. */ jpayne@69: Tk_ItemIndexProc *indexProc;/* Procedure to determine index of indicated jpayne@69: * character. NULL if item doesn't support jpayne@69: * indexing. */ jpayne@69: Tk_ItemCursorProc *icursorProc; jpayne@69: /* Procedure to set insert cursor posn to just jpayne@69: * before a given position. */ jpayne@69: Tk_ItemSelectionProc *selectionProc; jpayne@69: /* Procedure to return selection (in STRING jpayne@69: * format) when it is in this item. */ jpayne@69: Tk_ItemInsertProc *insertProc; jpayne@69: /* Procedure to insert something into an jpayne@69: * item. */ jpayne@69: Tk_ItemDCharsProc *dCharsProc; jpayne@69: /* Procedure to delete characters from an jpayne@69: * item. */ jpayne@69: struct Tk_ItemType *nextPtr;/* Used to link types together into a list. */ jpayne@69: char *reserved1; /* Reserved for future extension. */ jpayne@69: int reserved2; /* Carefully compatible with */ jpayne@69: char *reserved3; /* Jan Nijtmans dash patch */ jpayne@69: char *reserved4; jpayne@69: } Tk_ItemType; jpayne@69: jpayne@69: /* jpayne@69: * Flag (used in the alwaysRedraw field) to say whether an item supports jpayne@69: * point-level manipulation like the line and polygon items. jpayne@69: */ jpayne@69: jpayne@69: #define TK_MOVABLE_POINTS 2 jpayne@69: jpayne@69: #endif /* __NO_OLD_CONFIG */ jpayne@69: jpayne@69: /* jpayne@69: * The following structure provides information about the selection and the jpayne@69: * insertion cursor. It is needed by only a few items, such as those that jpayne@69: * display text. It is shared by the generic canvas code and the item-specific jpayne@69: * code, but most of the fields should be written only by the canvas generic jpayne@69: * code. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tk_CanvasTextInfo { jpayne@69: Tk_3DBorder selBorder; /* Border and background for selected jpayne@69: * characters. Read-only to items.*/ jpayne@69: int selBorderWidth; /* Width of border around selection. Read-only jpayne@69: * to items. */ jpayne@69: XColor *selFgColorPtr; /* Foreground color for selected text. jpayne@69: * Read-only to items. */ jpayne@69: Tk_Item *selItemPtr; /* Pointer to selected item. NULL means jpayne@69: * selection isn't in this canvas. Writable by jpayne@69: * items. */ jpayne@69: int selectFirst; /* Character index of first selected jpayne@69: * character. Writable by items. */ jpayne@69: int selectLast; /* Character index of last selected character. jpayne@69: * Writable by items. */ jpayne@69: Tk_Item *anchorItemPtr; /* Item corresponding to "selectAnchor": not jpayne@69: * necessarily selItemPtr. Read-only to jpayne@69: * items. */ jpayne@69: int selectAnchor; /* Character index of fixed end of selection jpayne@69: * (i.e. "select to" operation will use this jpayne@69: * as one end of the selection). Writable by jpayne@69: * items. */ jpayne@69: Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion jpayne@69: * cursor. Read-only to items. */ jpayne@69: int insertWidth; /* Total width of insertion cursor. Read-only jpayne@69: * to items. */ jpayne@69: int insertBorderWidth; /* Width of 3-D border around insert cursor. jpayne@69: * Read-only to items. */ jpayne@69: Tk_Item *focusItemPtr; /* Item that currently has the input focus, or jpayne@69: * NULL if no such item. Read-only to items. */ jpayne@69: int gotFocus; /* Non-zero means that the canvas widget has jpayne@69: * the input focus. Read-only to items.*/ jpayne@69: int cursorOn; /* Non-zero means that an insertion cursor jpayne@69: * should be displayed in focusItemPtr. jpayne@69: * Read-only to items.*/ jpayne@69: } Tk_CanvasTextInfo; jpayne@69: jpayne@69: /* jpayne@69: * Structures used for Dashing and Outline. jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tk_Dash { jpayne@69: int number; jpayne@69: union { jpayne@69: char *pt; jpayne@69: char array[sizeof(char *)]; jpayne@69: } pattern; jpayne@69: } Tk_Dash; jpayne@69: jpayne@69: typedef struct Tk_TSOffset { jpayne@69: int flags; /* Flags; see below for possible values */ jpayne@69: int xoffset; /* x offset */ jpayne@69: int yoffset; /* y offset */ jpayne@69: } Tk_TSOffset; jpayne@69: jpayne@69: /* jpayne@69: * Bit fields in Tk_TSOffset->flags: jpayne@69: */ jpayne@69: jpayne@69: #define TK_OFFSET_INDEX 1 jpayne@69: #define TK_OFFSET_RELATIVE 2 jpayne@69: #define TK_OFFSET_LEFT 4 jpayne@69: #define TK_OFFSET_CENTER 8 jpayne@69: #define TK_OFFSET_RIGHT 16 jpayne@69: #define TK_OFFSET_TOP 32 jpayne@69: #define TK_OFFSET_MIDDLE 64 jpayne@69: #define TK_OFFSET_BOTTOM 128 jpayne@69: jpayne@69: typedef struct Tk_Outline { jpayne@69: GC gc; /* Graphics context. */ jpayne@69: double width; /* Width of outline. */ jpayne@69: double activeWidth; /* Width of outline. */ jpayne@69: double disabledWidth; /* Width of outline. */ jpayne@69: int offset; /* Dash offset. */ jpayne@69: Tk_Dash dash; /* Dash pattern. */ jpayne@69: Tk_Dash activeDash; /* Dash pattern if state is active. */ jpayne@69: Tk_Dash disabledDash; /* Dash pattern if state is disabled. */ jpayne@69: void *reserved1; /* Reserved for future expansion. */ jpayne@69: void *reserved2; jpayne@69: void *reserved3; jpayne@69: Tk_TSOffset tsoffset; /* Stipple offset for outline. */ jpayne@69: XColor *color; /* Outline color. */ jpayne@69: XColor *activeColor; /* Outline color if state is active. */ jpayne@69: XColor *disabledColor; /* Outline color if state is disabled. */ jpayne@69: Pixmap stipple; /* Outline Stipple pattern. */ jpayne@69: Pixmap activeStipple; /* Outline Stipple pattern if state is jpayne@69: * active. */ jpayne@69: Pixmap disabledStipple; /* Outline Stipple pattern if state is jpayne@69: * disabled. */ jpayne@69: } Tk_Outline; jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------- jpayne@69: * jpayne@69: * Procedure prototypes and structures used for managing images: jpayne@69: * jpayne@69: *---------------------------------------------------------------------- jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tk_ImageType Tk_ImageType; jpayne@69: #ifdef USE_OLD_IMAGE jpayne@69: typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, char *name, int argc, jpayne@69: char **argv, Tk_ImageType *typePtr, Tk_ImageMaster model, jpayne@69: ClientData *clientDataPtr); jpayne@69: #else jpayne@69: typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, CONST86 char *name, int objc, jpayne@69: Tcl_Obj *const objv[], CONST86 Tk_ImageType *typePtr, Tk_ImageMaster model, jpayne@69: ClientData *clientDataPtr); jpayne@69: #endif /* USE_OLD_IMAGE */ jpayne@69: typedef ClientData (Tk_ImageGetProc) (Tk_Window tkwin, ClientData clientData); jpayne@69: typedef void (Tk_ImageDisplayProc) (ClientData clientData, Display *display, jpayne@69: Drawable drawable, int imageX, int imageY, int width, int height, jpayne@69: int drawableX, int drawableY); jpayne@69: typedef void (Tk_ImageFreeProc) (ClientData clientData, Display *display); jpayne@69: typedef void (Tk_ImageDeleteProc) (ClientData clientData); jpayne@69: typedef void (Tk_ImageChangedProc) (ClientData clientData, int x, int y, jpayne@69: int width, int height, int imageWidth, int imageHeight); jpayne@69: typedef int (Tk_ImagePostscriptProc) (ClientData clientData, jpayne@69: Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo, jpayne@69: int x, int y, int width, int height, int prepass); jpayne@69: jpayne@69: /* jpayne@69: * The following structure represents a particular type of image (bitmap, xpm jpayne@69: * image, etc.). It provides information common to all images of that type, jpayne@69: * such as the type name and a collection of procedures in the image manager jpayne@69: * that respond to various events. Each image manager is represented by one of jpayne@69: * these structures. jpayne@69: */ jpayne@69: jpayne@69: struct Tk_ImageType { jpayne@69: CONST86 char *name; /* Name of image type. */ jpayne@69: Tk_ImageCreateProc *createProc; jpayne@69: /* Procedure to call to create a new image of jpayne@69: * this type. */ jpayne@69: Tk_ImageGetProc *getProc; /* Procedure to call the first time jpayne@69: * Tk_GetImage is called in a new way (new jpayne@69: * visual or screen). */ jpayne@69: Tk_ImageDisplayProc *displayProc; jpayne@69: /* Call to draw image, in response to jpayne@69: * Tk_RedrawImage calls. */ jpayne@69: Tk_ImageFreeProc *freeProc; /* Procedure to call whenever Tk_FreeImage is jpayne@69: * called to release an instance of an jpayne@69: * image. */ jpayne@69: Tk_ImageDeleteProc *deleteProc; jpayne@69: /* Procedure to call to delete image. It will jpayne@69: * not be called until after freeProc has been jpayne@69: * called for each instance of the image. */ jpayne@69: Tk_ImagePostscriptProc *postscriptProc; jpayne@69: /* Procedure to call to produce postscript jpayne@69: * output for the image. */ jpayne@69: struct Tk_ImageType *nextPtr; jpayne@69: /* Next in list of all image types currently jpayne@69: * known. Filled in by Tk, not by image jpayne@69: * manager. */ jpayne@69: char *reserved; /* reserved for future expansion */ jpayne@69: }; jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------- jpayne@69: * jpayne@69: * Additional definitions used to manage images of type "photo". jpayne@69: * jpayne@69: *---------------------------------------------------------------------- jpayne@69: */ jpayne@69: jpayne@69: /* jpayne@69: * The following type is used to identify a particular photo image to be jpayne@69: * manipulated: jpayne@69: */ jpayne@69: jpayne@69: typedef void *Tk_PhotoHandle; jpayne@69: jpayne@69: /* jpayne@69: * The following structure describes a block of pixels in memory: jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tk_PhotoImageBlock { jpayne@69: unsigned char *pixelPtr; /* Pointer to the first pixel. */ jpayne@69: int width; /* Width of block, in pixels. */ jpayne@69: int height; /* Height of block, in pixels. */ jpayne@69: int pitch; /* Address difference between corresponding jpayne@69: * pixels in successive lines. */ jpayne@69: int pixelSize; /* Address difference between successive jpayne@69: * pixels in the same line. */ jpayne@69: int offset[4]; /* Address differences between the red, green, jpayne@69: * blue and alpha components of the pixel and jpayne@69: * the pixel as a whole. */ jpayne@69: } Tk_PhotoImageBlock; jpayne@69: jpayne@69: /* jpayne@69: * The following values control how blocks are combined into photo images when jpayne@69: * the alpha component of a pixel is not 255, a.k.a. the compositing rule. jpayne@69: */ jpayne@69: jpayne@69: #define TK_PHOTO_COMPOSITE_OVERLAY 0 jpayne@69: #define TK_PHOTO_COMPOSITE_SET 1 jpayne@69: jpayne@69: /* jpayne@69: * Procedure prototypes and structures used in reading and writing photo jpayne@69: * images: jpayne@69: */ jpayne@69: jpayne@69: typedef struct Tk_PhotoImageFormat Tk_PhotoImageFormat; jpayne@69: #ifdef USE_OLD_IMAGE jpayne@69: typedef int (Tk_ImageFileMatchProc) (Tcl_Channel chan, char *fileName, jpayne@69: char *formatString, int *widthPtr, int *heightPtr); jpayne@69: typedef int (Tk_ImageStringMatchProc) (char *string, char *formatString, jpayne@69: int *widthPtr, int *heightPtr); jpayne@69: typedef int (Tk_ImageFileReadProc) (Tcl_Interp *interp, Tcl_Channel chan, jpayne@69: char *fileName, char *formatString, Tk_PhotoHandle imageHandle, jpayne@69: int destX, int destY, int width, int height, int srcX, int srcY); jpayne@69: typedef int (Tk_ImageStringReadProc) (Tcl_Interp *interp, char *string, jpayne@69: char *formatString, Tk_PhotoHandle imageHandle, int destX, int destY, jpayne@69: int width, int height, int srcX, int srcY); jpayne@69: typedef int (Tk_ImageFileWriteProc) (Tcl_Interp *interp, char *fileName, jpayne@69: char *formatString, Tk_PhotoImageBlock *blockPtr); jpayne@69: typedef int (Tk_ImageStringWriteProc) (Tcl_Interp *interp, jpayne@69: Tcl_DString *dataPtr, char *formatString, Tk_PhotoImageBlock *blockPtr); jpayne@69: #else jpayne@69: typedef int (Tk_ImageFileMatchProc) (Tcl_Channel chan, const char *fileName, jpayne@69: Tcl_Obj *format, int *widthPtr, int *heightPtr, Tcl_Interp *interp); jpayne@69: typedef int (Tk_ImageStringMatchProc) (Tcl_Obj *dataObj, Tcl_Obj *format, jpayne@69: int *widthPtr, int *heightPtr, Tcl_Interp *interp); jpayne@69: typedef int (Tk_ImageFileReadProc) (Tcl_Interp *interp, Tcl_Channel chan, jpayne@69: const char *fileName, Tcl_Obj *format, Tk_PhotoHandle imageHandle, jpayne@69: int destX, int destY, int width, int height, int srcX, int srcY); jpayne@69: typedef int (Tk_ImageStringReadProc) (Tcl_Interp *interp, Tcl_Obj *dataObj, jpayne@69: Tcl_Obj *format, Tk_PhotoHandle imageHandle, int destX, int destY, jpayne@69: int width, int height, int srcX, int srcY); jpayne@69: typedef int (Tk_ImageFileWriteProc) (Tcl_Interp *interp, const char *fileName, jpayne@69: Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr); jpayne@69: typedef int (Tk_ImageStringWriteProc) (Tcl_Interp *interp, Tcl_Obj *format, jpayne@69: Tk_PhotoImageBlock *blockPtr); jpayne@69: #endif /* USE_OLD_IMAGE */ jpayne@69: jpayne@69: /* jpayne@69: * The following structure represents a particular file format for storing jpayne@69: * images (e.g., PPM, GIF, JPEG, etc.). It provides information to allow image jpayne@69: * files of that format to be recognized and read into a photo image. jpayne@69: */ jpayne@69: jpayne@69: struct Tk_PhotoImageFormat { jpayne@69: CONST86 char *name; /* Name of image file format */ jpayne@69: Tk_ImageFileMatchProc *fileMatchProc; jpayne@69: /* Procedure to call to determine whether an jpayne@69: * image file matches this format. */ jpayne@69: Tk_ImageStringMatchProc *stringMatchProc; jpayne@69: /* Procedure to call to determine whether the jpayne@69: * data in a string matches this format. */ jpayne@69: Tk_ImageFileReadProc *fileReadProc; jpayne@69: /* Procedure to call to read data from an jpayne@69: * image file into a photo image. */ jpayne@69: Tk_ImageStringReadProc *stringReadProc; jpayne@69: /* Procedure to call to read data from a jpayne@69: * string into a photo image. */ jpayne@69: Tk_ImageFileWriteProc *fileWriteProc; jpayne@69: /* Procedure to call to write data from a jpayne@69: * photo image to a file. */ jpayne@69: Tk_ImageStringWriteProc *stringWriteProc; jpayne@69: /* Procedure to call to obtain a string jpayne@69: * representation of the data in a photo jpayne@69: * image.*/ jpayne@69: struct Tk_PhotoImageFormat *nextPtr; jpayne@69: /* Next in list of all photo image formats jpayne@69: * currently known. Filled in by Tk, not by jpayne@69: * image format handler. */ jpayne@69: }; jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------- jpayne@69: * jpayne@69: * Procedure prototypes and structures used for managing styles: jpayne@69: * jpayne@69: *---------------------------------------------------------------------- jpayne@69: */ jpayne@69: jpayne@69: /* jpayne@69: * Style support version tag. jpayne@69: */ jpayne@69: jpayne@69: #define TK_STYLE_VERSION_1 0x1 jpayne@69: #define TK_STYLE_VERSION TK_STYLE_VERSION_1 jpayne@69: jpayne@69: /* jpayne@69: * The following structures and prototypes are used as static templates to jpayne@69: * declare widget elements. jpayne@69: */ jpayne@69: jpayne@69: typedef void (Tk_GetElementSizeProc) (ClientData clientData, char *recordPtr, jpayne@69: const Tk_OptionSpec **optionsPtr, Tk_Window tkwin, int width, jpayne@69: int height, int inner, int *widthPtr, int *heightPtr); jpayne@69: typedef void (Tk_GetElementBoxProc) (ClientData clientData, char *recordPtr, jpayne@69: const Tk_OptionSpec **optionsPtr, Tk_Window tkwin, int x, int y, jpayne@69: int width, int height, int inner, int *xPtr, int *yPtr, int *widthPtr, jpayne@69: int *heightPtr); jpayne@69: typedef int (Tk_GetElementBorderWidthProc) (ClientData clientData, jpayne@69: char *recordPtr, const Tk_OptionSpec **optionsPtr, Tk_Window tkwin); jpayne@69: typedef void (Tk_DrawElementProc) (ClientData clientData, char *recordPtr, jpayne@69: const Tk_OptionSpec **optionsPtr, Tk_Window tkwin, Drawable d, int x, jpayne@69: int y, int width, int height, int state); jpayne@69: jpayne@69: typedef struct Tk_ElementOptionSpec { jpayne@69: char *name; /* Name of the required option. */ jpayne@69: Tk_OptionType type; /* Accepted option type. TK_OPTION_END means jpayne@69: * any. */ jpayne@69: } Tk_ElementOptionSpec; jpayne@69: jpayne@69: typedef struct Tk_ElementSpec { jpayne@69: int version; /* Version of the style support. */ jpayne@69: char *name; /* Name of element. */ jpayne@69: Tk_ElementOptionSpec *options; jpayne@69: /* List of required options. Last one's name jpayne@69: * must be NULL. */ jpayne@69: Tk_GetElementSizeProc *getSize; jpayne@69: /* Compute the external (resp. internal) size jpayne@69: * of the element from its desired internal jpayne@69: * (resp. external) size. */ jpayne@69: Tk_GetElementBoxProc *getBox; jpayne@69: /* Compute the inscribed or bounding boxes jpayne@69: * within a given area. */ jpayne@69: Tk_GetElementBorderWidthProc *getBorderWidth; jpayne@69: /* Return the element's internal border width. jpayne@69: * Mostly useful for widgets. */ jpayne@69: Tk_DrawElementProc *draw; /* Draw the element in the given bounding jpayne@69: * box. */ jpayne@69: } Tk_ElementSpec; jpayne@69: jpayne@69: /* jpayne@69: * Element state flags. Can be OR'ed. jpayne@69: */ jpayne@69: jpayne@69: #define TK_ELEMENT_STATE_ACTIVE 1<<0 jpayne@69: #define TK_ELEMENT_STATE_DISABLED 1<<1 jpayne@69: #define TK_ELEMENT_STATE_FOCUS 1<<2 jpayne@69: #define TK_ELEMENT_STATE_PRESSED 1<<3 jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------- jpayne@69: * jpayne@69: * The definitions below provide backward compatibility for functions and jpayne@69: * types related to event handling that used to be in Tk but have moved to jpayne@69: * Tcl. jpayne@69: * jpayne@69: *---------------------------------------------------------------------- jpayne@69: */ jpayne@69: jpayne@69: #define TK_READABLE TCL_READABLE jpayne@69: #define TK_WRITABLE TCL_WRITABLE jpayne@69: #define TK_EXCEPTION TCL_EXCEPTION jpayne@69: jpayne@69: #define TK_DONT_WAIT TCL_DONT_WAIT jpayne@69: #define TK_X_EVENTS TCL_WINDOW_EVENTS jpayne@69: #define TK_WINDOW_EVENTS TCL_WINDOW_EVENTS jpayne@69: #define TK_FILE_EVENTS TCL_FILE_EVENTS jpayne@69: #define TK_TIMER_EVENTS TCL_TIMER_EVENTS jpayne@69: #define TK_IDLE_EVENTS TCL_IDLE_EVENTS jpayne@69: #define TK_ALL_EVENTS TCL_ALL_EVENTS jpayne@69: jpayne@69: #define Tk_IdleProc Tcl_IdleProc jpayne@69: #define Tk_FileProc Tcl_FileProc jpayne@69: #define Tk_TimerProc Tcl_TimerProc jpayne@69: #define Tk_TimerToken Tcl_TimerToken jpayne@69: jpayne@69: #define Tk_BackgroundError Tcl_BackgroundError jpayne@69: #define Tk_CancelIdleCall Tcl_CancelIdleCall jpayne@69: #define Tk_CreateFileHandler Tcl_CreateFileHandler jpayne@69: #define Tk_CreateTimerHandler Tcl_CreateTimerHandler jpayne@69: #define Tk_DeleteFileHandler Tcl_DeleteFileHandler jpayne@69: #define Tk_DeleteTimerHandler Tcl_DeleteTimerHandler jpayne@69: #define Tk_DoOneEvent Tcl_DoOneEvent jpayne@69: #define Tk_DoWhenIdle Tcl_DoWhenIdle jpayne@69: #define Tk_Sleep Tcl_Sleep jpayne@69: jpayne@69: /* Additional stuff that has moved to Tcl: */ jpayne@69: jpayne@69: #define Tk_EventuallyFree Tcl_EventuallyFree jpayne@69: #define Tk_FreeProc Tcl_FreeProc jpayne@69: #define Tk_Preserve Tcl_Preserve jpayne@69: #define Tk_Release Tcl_Release jpayne@69: jpayne@69: /* Removed Tk_Main, use macro instead */ jpayne@69: #if defined(_WIN32) || defined(__CYGWIN__) jpayne@69: #define Tk_Main(argc, argv, proc) Tk_MainEx(argc, argv, proc, \ jpayne@69: (Tcl_FindExecutable(0), (Tcl_CreateInterp)())) jpayne@69: #else jpayne@69: #define Tk_Main(argc, argv, proc) Tk_MainEx(argc, argv, proc, \ jpayne@69: (Tcl_FindExecutable(argv[0]), (Tcl_CreateInterp)())) jpayne@69: #endif jpayne@69: const char * Tk_InitStubs(Tcl_Interp *interp, const char *version, jpayne@69: int exact); jpayne@69: EXTERN const char * Tk_PkgInitStubsCheck(Tcl_Interp *interp, jpayne@69: const char *version, int exact); jpayne@69: jpayne@69: #ifndef USE_TK_STUBS jpayne@69: #define Tk_InitStubs(interp, version, exact) \ jpayne@69: Tk_PkgInitStubsCheck(interp, version, exact) jpayne@69: #endif /* USE_TK_STUBS */ jpayne@69: jpayne@69: #define Tk_InitImageArgs(interp, argc, argv) /**/ jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------- jpayne@69: * jpayne@69: * Additional procedure types defined by Tk. jpayne@69: * jpayne@69: *---------------------------------------------------------------------- jpayne@69: */ jpayne@69: jpayne@69: typedef int (Tk_ErrorProc) (ClientData clientData, XErrorEvent *errEventPtr); jpayne@69: typedef void (Tk_EventProc) (ClientData clientData, XEvent *eventPtr); jpayne@69: typedef int (Tk_GenericProc) (ClientData clientData, XEvent *eventPtr); jpayne@69: typedef int (Tk_ClientMessageProc) (Tk_Window tkwin, XEvent *eventPtr); jpayne@69: typedef int (Tk_GetSelProc) (ClientData clientData, Tcl_Interp *interp, jpayne@69: CONST86 char *portion); jpayne@69: typedef void (Tk_LostSelProc) (ClientData clientData); jpayne@69: typedef Tk_RestrictAction (Tk_RestrictProc) (ClientData clientData, jpayne@69: XEvent *eventPtr); jpayne@69: typedef int (Tk_SelectionProc) (ClientData clientData, int offset, jpayne@69: char *buffer, int maxBytes); jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------- jpayne@69: * jpayne@69: * Platform independent exported procedures and variables. jpayne@69: * jpayne@69: *---------------------------------------------------------------------- jpayne@69: */ jpayne@69: jpayne@69: #include "tkDecls.h" jpayne@69: jpayne@69: #ifdef USE_OLD_IMAGE jpayne@69: #undef Tk_CreateImageType jpayne@69: #define Tk_CreateImageType Tk_CreateOldImageType jpayne@69: #undef Tk_CreatePhotoImageFormat jpayne@69: #define Tk_CreatePhotoImageFormat Tk_CreateOldPhotoImageFormat jpayne@69: #endif /* USE_OLD_IMAGE */ jpayne@69: jpayne@69: /* jpayne@69: *---------------------------------------------------------------------- jpayne@69: * jpayne@69: * Allow users to say that they don't want to alter their source to add extra jpayne@69: * arguments to Tk_PhotoPutBlock() et al; DO NOT DEFINE THIS WHEN BUILDING TK. jpayne@69: * jpayne@69: * This goes after the inclusion of the stubbed-decls so that the declarations jpayne@69: * of what is actually there can be correct. jpayne@69: */ jpayne@69: jpayne@69: #ifdef USE_COMPOSITELESS_PHOTO_PUT_BLOCK jpayne@69: # ifdef Tk_PhotoPutBlock jpayne@69: # undef Tk_PhotoPutBlock jpayne@69: # endif jpayne@69: # define Tk_PhotoPutBlock Tk_PhotoPutBlock_NoComposite jpayne@69: # ifdef Tk_PhotoPutZoomedBlock jpayne@69: # undef Tk_PhotoPutZoomedBlock jpayne@69: # endif jpayne@69: # define Tk_PhotoPutZoomedBlock Tk_PhotoPutZoomedBlock_NoComposite jpayne@69: # define USE_PANIC_ON_PHOTO_ALLOC_FAILURE jpayne@69: #else /* !USE_COMPOSITELESS_PHOTO_PUT_BLOCK */ jpayne@69: # ifdef USE_PANIC_ON_PHOTO_ALLOC_FAILURE jpayne@69: # ifdef Tk_PhotoPutBlock jpayne@69: # undef Tk_PhotoPutBlock jpayne@69: # endif jpayne@69: # define Tk_PhotoPutBlock Tk_PhotoPutBlock_Panic jpayne@69: # ifdef Tk_PhotoPutZoomedBlock jpayne@69: # undef Tk_PhotoPutZoomedBlock jpayne@69: # endif jpayne@69: # define Tk_PhotoPutZoomedBlock Tk_PhotoPutZoomedBlock_Panic jpayne@69: # endif /* USE_PANIC_ON_PHOTO_ALLOC_FAILURE */ jpayne@69: #endif /* USE_COMPOSITELESS_PHOTO_PUT_BLOCK */ jpayne@69: #ifdef USE_PANIC_ON_PHOTO_ALLOC_FAILURE jpayne@69: # ifdef Tk_PhotoExpand jpayne@69: # undef Tk_PhotoExpand jpayne@69: # endif jpayne@69: # define Tk_PhotoExpand Tk_PhotoExpand_Panic jpayne@69: # ifdef Tk_PhotoSetSize jpayne@69: # undef Tk_PhotoSetSize jpayne@69: # endif jpayne@69: # define Tk_PhotoSetSize Tk_PhotoSetSize_Panic jpayne@69: #endif /* USE_PANIC_ON_PHOTO_ALLOC_FAILURE */ jpayne@69: jpayne@69: #undef TCL_STORAGE_CLASS jpayne@69: #define TCL_STORAGE_CLASS DLLIMPORT jpayne@69: jpayne@69: #endif /* RC_INVOKED */ jpayne@69: jpayne@69: /* jpayne@69: * end block for C++ jpayne@69: */ jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: } jpayne@69: #endif jpayne@69: jpayne@69: #endif /* _TK */ jpayne@69: jpayne@69: /* jpayne@69: * Local Variables: jpayne@69: * mode: c jpayne@69: * c-basic-offset: 4 jpayne@69: * fill-column: 78 jpayne@69: * End: jpayne@69: */