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