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