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