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