4
* Declarations for Tk-related things that are visible outside of the Tk
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.138 2010/12/16 09:03:07 nijtmans Exp $
22
#if (TCL_MAJOR_VERSION != 8) || (TCL_MINOR_VERSION < 6)
23
# error Tk 8.6 must be compiled with tcl.h from Tcl 8.6 or better
27
* For C++ compilers, use extern "C"
35
* When version numbers change here, you must also go into the following files
36
* and update the version numbers:
38
* library/tk.tcl (1 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/Tk-Common.xcconfig (not patchlevel) 1 LOC
43
* win/README (not patchlevel)
44
* unix/README (not patchlevel)
45
* unix/tk.spec (1 LOC patch)
46
* win/tcl.m4 (not patchlevel)
48
* You may also need to update some of these files when the numbers change for
49
* the version of Tcl that this release of Tk is compiled against.
52
#define TK_MAJOR_VERSION 8
53
#define TK_MINOR_VERSION 6
54
#define TK_RELEASE_LEVEL TCL_BETA_RELEASE
55
#define TK_RELEASE_SERIAL 1
57
#define TK_VERSION "8.6"
58
#define TK_PATCH_LEVEL "8.6b1.2"
61
* A special definition used to allow this header file to be included from
62
* windows or mac resource files so that they can obtain version information.
63
* RC_INVOKED is defined by default by the windows RC tool and manually set
66
* Resource compilers don't like all the C stuff, like typedefs and procedure
67
* declarations, that occur below, so block them out.
73
# include <X11/Xlib.h>
83
#undef TCL_STORAGE_CLASS
84
#define TCL_STORAGE_CLASS DLLEXPORT
88
*----------------------------------------------------------------------
90
* Decide whether or not to use input methods.
93
#ifdef XNQueryInputStyle
94
#define TK_USE_INPUT_METHODS
98
* Dummy types that are used by clients:
101
typedef struct Tk_BindingTable_ *Tk_BindingTable;
102
typedef struct Tk_Canvas_ *Tk_Canvas;
103
typedef struct Tk_Cursor_ *Tk_Cursor;
104
typedef struct Tk_ErrorHandler_ *Tk_ErrorHandler;
105
typedef struct Tk_Font_ *Tk_Font;
106
typedef struct Tk_Image__ *Tk_Image;
107
typedef struct Tk_ImageMaster_ *Tk_ImageMaster;
108
typedef struct Tk_OptionTable_ *Tk_OptionTable;
109
typedef struct Tk_PostscriptInfo_ *Tk_PostscriptInfo;
110
typedef struct Tk_TextLayout_ *Tk_TextLayout;
111
typedef struct Tk_Window_ *Tk_Window;
112
typedef struct Tk_3DBorder_ *Tk_3DBorder;
113
typedef struct Tk_Style_ *Tk_Style;
114
typedef struct Tk_StyleEngine_ *Tk_StyleEngine;
115
typedef struct Tk_StyledElement_ *Tk_StyledElement;
118
* Additional types exported to clients.
121
typedef const char *Tk_Uid;
124
*----------------------------------------------------------------------
126
* The enum below defines the valid types for Tk configuration options as
127
* implemented by Tk_InitOptions, Tk_SetOptions, etc.
135
TK_OPTION_STRING_TABLE,
153
* Structures of the following type are used by widgets to specify their
154
* configuration options. Typically each widget has a static array of these
155
* structures, where each element of the array describes a single
156
* configuration option. The array is passed to Tk_CreateOptionTable.
159
typedef struct Tk_OptionSpec {
160
Tk_OptionType type; /* Type of option, such as TK_OPTION_COLOR;
161
* see definitions above. Last option in table
162
* must have type TK_OPTION_END. */
163
const char *optionName; /* Name used to specify option in Tcl
165
const char *dbName; /* Name for option in option database. */
166
const char *dbClass; /* Class for option in database. */
167
const char *defValue; /* Default value for option if not specified
168
* in command line, the option database, or
170
int objOffset; /* Where in record to store a Tcl_Obj * that
171
* holds the value of this option, specified
172
* as an offset in bytes from the start of the
173
* record. Use the Tk_Offset macro to generate
174
* values for this. -1 means don't store the
175
* Tcl_Obj in the record. */
176
int internalOffset; /* Where in record to store the internal
177
* representation of the value of this option,
178
* such as an int or XColor *. This field is
179
* specified as an offset in bytes from the
180
* start of the record. Use the Tk_Offset
181
* macro to generate values for it. -1 means
182
* don't store the internal representation in
184
int flags; /* Any combination of the values defined
186
ClientData clientData; /* An alternate place to put option-specific
187
* data. Used for the monochrome default value
188
* for colors, etc. */
189
int typeMask; /* An arbitrary bit mask defined by the class
190
* manager; typically bits correspond to
191
* certain kinds of options such as all those
192
* that require a redisplay when they change.
193
* Tk_SetOptions returns the bit-wise OR of
194
* the typeMasks of all options that were
199
* Flag values for Tk_OptionSpec structures. These flags are shared by
200
* Tk_ConfigSpec structures, so be sure to coordinate any changes carefully.
203
#define TK_OPTION_NULL_OK (1 << 0)
204
#define TK_OPTION_DONT_SET_DEFAULT (1 << 3)
207
* The following structure and function types are used by TK_OPTION_CUSTOM
208
* options; the structure holds pointers to the functions needed by the Tk
209
* option config code to handle a custom option.
212
typedef int (Tk_CustomOptionSetProc) (ClientData clientData,
213
Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj **value, char *widgRec,
214
int offset, char *saveInternalPtr, int flags);
215
typedef Tcl_Obj *(Tk_CustomOptionGetProc) (ClientData clientData,
216
Tk_Window tkwin, char *widgRec, int offset);
217
typedef void (Tk_CustomOptionRestoreProc) (ClientData clientData,
218
Tk_Window tkwin, char *internalPtr, char *saveInternalPtr);
219
typedef void (Tk_CustomOptionFreeProc) (ClientData clientData, Tk_Window tkwin,
222
typedef struct Tk_ObjCustomOption {
223
const char *name; /* Name of the custom option. */
224
Tk_CustomOptionSetProc *setProc;
225
/* Function to use to set a record's option
226
* value from a Tcl_Obj */
227
Tk_CustomOptionGetProc *getProc;
228
/* Function to use to get a Tcl_Obj
229
* representation from an internal
230
* representation of an option. */
231
Tk_CustomOptionRestoreProc *restoreProc;
232
/* Function to use to restore a saved value
233
* for the internal representation. */
234
Tk_CustomOptionFreeProc *freeProc;
235
/* Function to use to free the internal
236
* representation of an option. */
237
ClientData clientData; /* Arbitrary one-word value passed to the
239
} Tk_ObjCustomOption;
242
* Macro to use to fill in "offset" fields of the Tk_OptionSpec structure.
243
* Computes number of bytes from beginning of structure to a given field.
247
#define Tk_Offset(type, field) ((int) offsetof(type, field))
249
#define Tk_Offset(type, field) ((int) ((char *) &((type *) 0)->field))
253
* The following two structures are used for error handling. When config
254
* options are being modified, the old values are saved in a Tk_SavedOptions
255
* structure. If an error occurs, then the contents of the structure can be
256
* used to restore all of the old values. The contents of this structure are
257
* for the private use Tk. No-one outside Tk should ever read or write any of
258
* the fields of these structures.
261
typedef struct Tk_SavedOption {
262
struct TkOption *optionPtr; /* Points to information that describes the
264
Tcl_Obj *valuePtr; /* The old value of the option, in the form of
265
* a Tcl object; may be NULL if the value was
266
* not saved as an object. */
267
double internalForm; /* The old value of the option, in some
268
* internal representation such as an int or
269
* (XColor *). Valid only if the field
270
* optionPtr->specPtr->objOffset is < 0. The
271
* space must be large enough to accommodate a
272
* double, a long, or a pointer; right now it
273
* looks like a double (i.e., 8 bytes) is big
274
* enough. Also, using a double guarantees
275
* that the field is properly aligned for
276
* storing large values. */
280
# define TK_NUM_SAVED_OPTIONS 2
282
# define TK_NUM_SAVED_OPTIONS 20
285
typedef struct Tk_SavedOptions {
286
char *recordPtr; /* The data structure in which to restore
287
* configuration options. */
288
Tk_Window tkwin; /* Window associated with recordPtr; needed to
289
* restore certain options. */
290
int numItems; /* The number of valid items in items field. */
291
Tk_SavedOption items[TK_NUM_SAVED_OPTIONS];
292
/* Items used to hold old values. */
293
struct Tk_SavedOptions *nextPtr;
294
/* Points to next structure in list; needed if
295
* too many options changed to hold all the
296
* old values in a single structure. NULL
297
* means no more structures. */
301
* Structure used to describe application-specific configuration options:
302
* indicates procedures to call to parse an option and to return a text string
303
* describing an option. THESE ARE DEPRECATED; PLEASE USE THE NEW STRUCTURES
308
* This is a temporary flag used while tkObjConfig and new widgets are in
312
#ifndef __NO_OLD_CONFIG
314
typedef int (Tk_OptionParseProc) (ClientData clientData, Tcl_Interp *interp,
315
Tk_Window tkwin, CONST84 char *value, char *widgRec, int offset);
316
typedef CONST86 char *(Tk_OptionPrintProc) (ClientData clientData,
317
Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr);
319
typedef struct Tk_CustomOption {
320
Tk_OptionParseProc *parseProc;
321
/* Procedure to call to parse an option and
322
* store it in converted form. */
323
Tk_OptionPrintProc *printProc;
324
/* Procedure to return a printable string
325
* describing an existing option. */
326
ClientData clientData; /* Arbitrary one-word value used by option
327
* parser: passed to parseProc and
332
* Structure used to specify information for Tk_ConfigureWidget. Each
333
* structure gives complete information for one option, including how the
334
* option is specified on the command line, where it appears in the option
338
typedef struct Tk_ConfigSpec {
339
int type; /* Type of option, such as TK_CONFIG_COLOR;
340
* see definitions below. Last option in table
341
* must have type TK_CONFIG_END. */
342
CONST86 char *argvName; /* Switch used to specify option in argv. NULL
343
* means this spec is part of a group. */
344
Tk_Uid dbName; /* Name for option in option database. */
345
Tk_Uid dbClass; /* Class for option in database. */
346
Tk_Uid defValue; /* Default value for option if not specified
347
* in command line or database. */
348
int offset; /* Where in widget record to store value; use
349
* Tk_Offset macro to generate values for
351
int specFlags; /* Any combination of the values defined
352
* below; other bits are used internally by
354
CONST86 Tk_CustomOption *customPtr;
355
/* 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
362
* Type values for Tk_ConfigSpec structures. See the user documentation for
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,
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.
403
CONST86 char *key; /* The key string that flags the option in the
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
CONST86 char *help; /* Documentation message describing this
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.
448
TK_DEFER_EVENT, TK_PROCESS_EVENT, TK_DISCARD_EVENT
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
488
#define TK_NOTIFY_SHARE 20
491
* Enumerated type for describing a point by which to anchor something:
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,
501
* Enumerated type for describing a style of justification:
505
TK_JUSTIFY_LEFT, TK_JUSTIFY_RIGHT, TK_JUSTIFY_CENTER
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
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
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. */
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
549
typedef Window (Tk_ClassCreateProc) (Tk_Window tkwin, Window parent,
550
ClientData instanceData);
551
typedef void (Tk_ClassWorldChangedProc) (ClientData instanceData);
552
typedef void (Tk_ClassModalProc) (Tk_Window tkwin, XEvent *eventPtr);
554
typedef struct Tk_ClassProcs {
556
Tk_ClassWorldChangedProc *worldChangedProc;
557
/* Procedure to invoke when the widget needs
558
* to respond in some way to a change in the
559
* world (font changes, etc.) */
560
Tk_ClassCreateProc *createProc;
561
/* Procedure to invoke when the platform-
562
* dependent window needs to be created. */
563
Tk_ClassModalProc *modalProc;
564
/* Procedure to invoke after all bindings on a
565
* widget have been triggered in order to
566
* handle a modal loop. */
570
* Simple accessor for Tk_ClassProcs structure. Checks that the structure is
571
* not NULL, then checks the size field and returns either the requested
572
* field, if present, or NULL if the structure is too small to have the field
573
* (or NULL if the structure is NULL).
575
* A more general version of this function may be useful if other
576
* size-versioned structure pop up in the future:
578
* #define Tk_GetField(name, who, which) \
579
* (((who) == NULL) ? NULL :
580
* (((who)->size <= Tk_Offset(name, which)) ? NULL :(name)->which))
583
#define Tk_GetClassProc(procs, which) \
584
(((procs) == NULL) ? NULL : \
585
(((procs)->size <= Tk_Offset(Tk_ClassProcs, which)) ? NULL:(procs)->which))
588
* Each geometry manager (the packer, the placer, etc.) is represented by a
589
* structure of the following form, which indicates procedures to invoke in
590
* the geometry manager to carry out certain functions.
593
typedef void (Tk_GeomRequestProc) (ClientData clientData, Tk_Window tkwin);
594
typedef void (Tk_GeomLostSlaveProc) (ClientData clientData, Tk_Window tkwin);
596
typedef struct Tk_GeomMgr {
597
const char *name; /* Name of the geometry manager (command used
598
* to invoke it, or name of widget class that
599
* allows embedded widgets). */
600
Tk_GeomRequestProc *requestProc;
601
/* Procedure to invoke when a slave's
602
* requested geometry changes. */
603
Tk_GeomLostSlaveProc *lostSlaveProc;
604
/* Procedure to invoke when a slave is taken
605
* away from one geometry manager by another.
606
* NULL means geometry manager doesn't care
607
* when slaves are lost. */
611
* Result values returned by Tk_GetScrollInfo:
614
#define TK_SCROLL_MOVETO 1
615
#define TK_SCROLL_PAGES 2
616
#define TK_SCROLL_UNITS 3
617
#define TK_SCROLL_ERROR 4
620
*----------------------------------------------------------------------
622
* Extensions to the X event set
624
*----------------------------------------------------------------------
627
#define VirtualEvent (MappingNotify + 1)
628
#define ActivateNotify (MappingNotify + 2)
629
#define DeactivateNotify (MappingNotify + 3)
630
#define MouseWheelEvent (MappingNotify + 4)
631
#define TK_LASTEVENT (MappingNotify + 5)
633
#define MouseWheelMask (1L << 28)
634
#define ActivateMask (1L << 29)
635
#define VirtualEventMask (1L << 30)
638
* A virtual event shares most of its fields with the XKeyEvent and
639
* XButtonEvent structures. 99% of the time a virtual event will be an
640
* abstraction of a key or button event, so this structure provides the most
641
* information to the user. The only difference is the changing of the detail
642
* field for a virtual event so that it holds the name of the virtual event
645
* When using this structure, you should ensure that you zero out all the
646
* fields first using memset() or bzero().
651
unsigned long serial; /* # of last request processed by server. */
652
Bool send_event; /* True if this came from a SendEvent
654
Display *display; /* Display the event was read from. */
655
Window event; /* Window on which event was requested. */
656
Window root; /* Root window that the event occured on. */
657
Window subwindow; /* Child window. */
658
Time time; /* Milliseconds. */
659
int x, y; /* Pointer x, y coordinates in event
661
int x_root, y_root; /* Coordinates relative to root. */
662
unsigned int state; /* Key or button mask */
663
Tk_Uid name; /* Name of virtual event. */
664
Bool same_screen; /* Same screen flag. */
665
Tcl_Obj *user_data; /* Application-specific data reference; Tk
666
* will decrement the reference count *once*
667
* when it has finished processing the
673
unsigned long serial; /* # of last request processed by server. */
674
Bool send_event; /* True if this came from a SendEvent
676
Display *display; /* Display the event was read from. */
677
Window window; /* Window in which event occurred. */
678
} XActivateDeactivateEvent;
679
typedef XActivateDeactivateEvent XActivateEvent;
680
typedef XActivateDeactivateEvent XDeactivateEvent;
683
*----------------------------------------------------------------------
685
* Macros for querying Tk_Window structures. See the manual entries for
688
*----------------------------------------------------------------------
691
#define Tk_Display(tkwin) (((Tk_FakeWin *) (tkwin))->display)
692
#define Tk_ScreenNumber(tkwin) (((Tk_FakeWin *) (tkwin))->screenNum)
693
#define Tk_Screen(tkwin) \
694
(ScreenOfDisplay(Tk_Display(tkwin), Tk_ScreenNumber(tkwin)))
695
#define Tk_Depth(tkwin) (((Tk_FakeWin *) (tkwin))->depth)
696
#define Tk_Visual(tkwin) (((Tk_FakeWin *) (tkwin))->visual)
697
#define Tk_WindowId(tkwin) (((Tk_FakeWin *) (tkwin))->window)
698
#define Tk_PathName(tkwin) (((Tk_FakeWin *) (tkwin))->pathName)
699
#define Tk_Name(tkwin) (((Tk_FakeWin *) (tkwin))->nameUid)
700
#define Tk_Class(tkwin) (((Tk_FakeWin *) (tkwin))->classUid)
701
#define Tk_X(tkwin) (((Tk_FakeWin *) (tkwin))->changes.x)
702
#define Tk_Y(tkwin) (((Tk_FakeWin *) (tkwin))->changes.y)
703
#define Tk_Width(tkwin) (((Tk_FakeWin *) (tkwin))->changes.width)
704
#define Tk_Height(tkwin) \
705
(((Tk_FakeWin *) (tkwin))->changes.height)
706
#define Tk_Changes(tkwin) (&((Tk_FakeWin *) (tkwin))->changes)
707
#define Tk_Attributes(tkwin) (&((Tk_FakeWin *) (tkwin))->atts)
708
#define Tk_IsEmbedded(tkwin) \
709
(((Tk_FakeWin *) (tkwin))->flags & TK_EMBEDDED)
710
#define Tk_IsContainer(tkwin) \
711
(((Tk_FakeWin *) (tkwin))->flags & TK_CONTAINER)
712
#define Tk_IsMapped(tkwin) \
713
(((Tk_FakeWin *) (tkwin))->flags & TK_MAPPED)
714
#define Tk_IsTopLevel(tkwin) \
715
(((Tk_FakeWin *) (tkwin))->flags & TK_TOP_LEVEL)
716
#define Tk_HasWrapper(tkwin) \
717
(((Tk_FakeWin *) (tkwin))->flags & TK_HAS_WRAPPER)
718
#define Tk_WinManaged(tkwin) \
719
(((Tk_FakeWin *) (tkwin))->flags & TK_WIN_MANAGED)
720
#define Tk_TopWinHierarchy(tkwin) \
721
(((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY)
722
#define Tk_IsManageable(tkwin) \
723
(((Tk_FakeWin *) (tkwin))->flags & TK_WM_MANAGEABLE)
724
#define Tk_ReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->reqWidth)
725
#define Tk_ReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->reqHeight)
726
/* Tk_InternalBorderWidth is deprecated */
727
#define Tk_InternalBorderWidth(tkwin) \
728
(((Tk_FakeWin *) (tkwin))->internalBorderLeft)
729
#define Tk_InternalBorderLeft(tkwin) \
730
(((Tk_FakeWin *) (tkwin))->internalBorderLeft)
731
#define Tk_InternalBorderRight(tkwin) \
732
(((Tk_FakeWin *) (tkwin))->internalBorderRight)
733
#define Tk_InternalBorderTop(tkwin) \
734
(((Tk_FakeWin *) (tkwin))->internalBorderTop)
735
#define Tk_InternalBorderBottom(tkwin) \
736
(((Tk_FakeWin *) (tkwin))->internalBorderBottom)
737
#define Tk_MinReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->minReqWidth)
738
#define Tk_MinReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->minReqHeight)
739
#define Tk_Parent(tkwin) (((Tk_FakeWin *) (tkwin))->parentPtr)
740
#define Tk_Colormap(tkwin) (((Tk_FakeWin *) (tkwin))->atts.colormap)
743
* The structure below is needed by the macros above so that they can access
744
* the fields of a Tk_Window. The fields not needed by the macros are declared
745
* as "dummyX". The structure has its own type in order to prevent apps from
746
* accessing Tk_Window fields except using official macros. WARNING!! The
747
* structure definition must be kept consistent with the TkWindow structure in
748
* tkInt.h. If you change one, then change the other. See the declaration in
749
* tkInt.h for documentation on what the fields are used for internally.
752
typedef struct Tk_FakeWin {
754
char *dummy1; /* dispPtr */
759
char *dummy2; /* childList */
760
char *dummy3; /* lastChildPtr */
761
Tk_Window parentPtr; /* parentPtr */
762
char *dummy4; /* nextPtr */
763
char *dummy5; /* mainPtr */
767
XWindowChanges changes;
768
unsigned int dummy6; /* dirtyChanges */
769
XSetWindowAttributes atts;
770
unsigned long dummy7; /* dirtyAtts */
772
char *dummy8; /* handlerList */
773
#ifdef TK_USE_INPUT_METHODS
774
XIC dummy9; /* inputContext */
775
#endif /* TK_USE_INPUT_METHODS */
776
ClientData *dummy10; /* tagPtr */
777
int dummy11; /* numTags */
778
int dummy12; /* optionLevel */
779
char *dummy13; /* selHandlerList */
780
char *dummy14; /* geomMgrPtr */
781
ClientData dummy15; /* geomData */
782
int reqWidth, reqHeight;
783
int internalBorderLeft;
784
char *dummy16; /* wmInfoPtr */
785
char *dummy17; /* classProcPtr */
786
ClientData dummy18; /* instanceData */
787
char *dummy19; /* privatePtr */
788
int internalBorderRight;
789
int internalBorderTop;
790
int internalBorderBottom;
793
char *dummy20; /* geometryMaster */
797
* Flag values for TkWindow (and Tk_FakeWin) structures are:
799
* TK_MAPPED: 1 means window is currently mapped,
801
* TK_TOP_LEVEL: 1 means this is a top-level widget.
802
* TK_ALREADY_DEAD: 1 means the window is in the process of
803
* being destroyed already.
804
* TK_NEED_CONFIG_NOTIFY: 1 means that the window has been reconfigured
805
* before it was made to exist. At the time of
806
* making it exist a ConfigureNotify event needs
808
* TK_GRAB_FLAG: Used to manage grabs. See tkGrab.c for details
809
* TK_CHECKED_IC: 1 means we've already tried to get an input
810
* context for this window; if the ic field is
811
* NULL it means that there isn't a context for
813
* TK_DONT_DESTROY_WINDOW: 1 means that Tk_DestroyWindow should not
814
* invoke XDestroyWindow to destroy this widget's
815
* X window. The flag is set when the window has
816
* already been destroyed elsewhere (e.g. by
817
* another application) or when it will be
818
* destroyed later (e.g. by destroying its parent)
819
* TK_WM_COLORMAP_WINDOW: 1 means that this window has at some time
820
* appeared in the WM_COLORMAP_WINDOWS property
821
* for its toplevel, so we have to remove it from
822
* that property if the window is deleted and the
824
* TK_EMBEDDED: 1 means that this window (which must be a
825
* toplevel) is not a free-standing window but
826
* rather is embedded in some other application.
827
* TK_CONTAINER: 1 means that this window is a container, and
828
* that some other application (either in this
829
* process or elsewhere) may be embedding itself
831
* TK_BOTH_HALVES: 1 means that this window is used for
832
* application embedding (either as container or
833
* embedded application), and both the containing
834
* and embedded halves are associated with
835
* windows in this particular process.
836
* TK_WRAPPER: 1 means that this window is the extra wrapper
837
* window created around a toplevel to hold the
838
* menubar under Unix. See tkUnixWm.c for more
840
* TK_REPARENTED: 1 means that this window has been reparented
841
* so that as far as the window system is
842
* concerned it isn't a child of its Tk parent.
843
* Initially this is used only for special Unix
845
* TK_ANONYMOUS_WINDOW: 1 means that this window has no name, and is
846
* thus not accessible from Tk.
847
* TK_HAS_WRAPPER 1 means that this window has a wrapper window
848
* TK_WIN_MANAGED 1 means that this window is a child of the root
849
* window, and is managed by the window manager.
850
* TK_TOP_HIERARCHY 1 means this window is at the top of a physical
851
* window hierarchy within this process, i.e. the
852
* window's parent either doesn't exist or is not
853
* owned by this Tk application.
854
* TK_PROP_PROPCHANGE 1 means that PropertyNotify events in the
855
* window's children should propagate up to this
857
* TK_WM_MANAGEABLE 1 marks a window as capable of being converted
858
* into a toplevel using [wm manage].
862
#define TK_TOP_LEVEL 2
863
#define TK_ALREADY_DEAD 4
864
#define TK_NEED_CONFIG_NOTIFY 8
865
#define TK_GRAB_FLAG 0x10
866
#define TK_CHECKED_IC 0x20
867
#define TK_DONT_DESTROY_WINDOW 0x40
868
#define TK_WM_COLORMAP_WINDOW 0x80
869
#define TK_EMBEDDED 0x100
870
#define TK_CONTAINER 0x200
871
#define TK_BOTH_HALVES 0x400
872
#define TK_WRAPPER 0x1000
873
#define TK_REPARENTED 0x2000
874
#define TK_ANONYMOUS_WINDOW 0x4000
875
#define TK_HAS_WRAPPER 0x8000
876
#define TK_WIN_MANAGED 0x10000
877
#define TK_TOP_HIERARCHY 0x20000
878
#define TK_PROP_PROPCHANGE 0x40000
879
#define TK_WM_MANAGEABLE 0x80000
882
*----------------------------------------------------------------------
884
* Procedure prototypes and structures used for defining new canvas items:
886
*----------------------------------------------------------------------
890
TK_STATE_NULL = -1, TK_STATE_ACTIVE, TK_STATE_DISABLED,
891
TK_STATE_NORMAL, TK_STATE_HIDDEN
894
typedef struct Tk_SmoothMethod {
896
int (*coordProc) (Tk_Canvas canvas, double *pointPtr, int numPoints,
897
int numSteps, XPoint xPoints[], double dblPoints[]);
898
void (*postscriptProc) (Tcl_Interp *interp, Tk_Canvas canvas,
899
double *coordPtr, int numPoints, int numSteps);
903
* For each item in a canvas widget there exists one record with the following
904
* structure. Each actual item is represented by a record with the following
905
* stuff at its beginning, plus additional type-specific stuff after that.
908
#define TK_TAG_SPACE 3
910
typedef struct Tk_Item {
911
int id; /* Unique identifier for this item (also
912
* serves as first tag for item). */
913
struct Tk_Item *nextPtr; /* Next in display list of all items in this
914
* canvas. Later items in list are drawn on
915
* top of earlier ones. */
916
Tk_Uid staticTagSpace[TK_TAG_SPACE];
917
/* Built-in space for limited # of tags. */
918
Tk_Uid *tagPtr; /* Pointer to array of tags. Usually points to
919
* staticTagSpace, but may point to malloc-ed
920
* space if there are lots of tags. */
921
int tagSpace; /* Total amount of tag space available at
923
int numTags; /* Number of tag slots actually used at
925
struct Tk_ItemType *typePtr;/* Table of procedures that implement this
927
int x1, y1, x2, y2; /* Bounding box for item, in integer canvas
928
* units. Set by item-specific code and
929
* guaranteed to contain every pixel drawn in
930
* item. Item area includes x1 and y1 but not
932
struct Tk_Item *prevPtr; /* Previous in display list of all items in
933
* this canvas. Later items in list are drawn
934
* just below earlier ones. */
935
Tk_State state; /* State of item. */
936
char *reserved1; /* reserved for future use */
937
int redraw_flags; /* Some flags used in the canvas */
940
*------------------------------------------------------------------
941
* Starting here is additional type-specific stuff; see the declarations
942
* for individual types to see what is part of each type. The actual space
943
* below is determined by the "itemInfoSize" of the type's Tk_ItemType
945
*------------------------------------------------------------------
950
* Flag bits for canvases (redraw_flags):
952
* TK_ITEM_STATE_DEPENDANT - 1 means that object needs to be redrawn if the
953
* canvas state changes.
954
* TK_ITEM_DONT_REDRAW - 1 means that the object redraw is already been
955
* prepared, so the general canvas code doesn't
956
* need to do that any more.
959
#define TK_ITEM_STATE_DEPENDANT 1
960
#define TK_ITEM_DONT_REDRAW 2
963
* Records of the following type are used to describe a type of item (e.g.
964
* lines, circles, etc.) that can form part of a canvas widget.
967
#ifdef USE_OLD_CANVAS
968
typedef int (Tk_ItemCreateProc)(Tcl_Interp *interp, Tk_Canvas canvas,
969
Tk_Item *itemPtr, int argc, char **argv);
970
typedef int (Tk_ItemConfigureProc)(Tcl_Interp *interp, Tk_Canvas canvas,
971
Tk_Item *itemPtr, int argc, char **argv, int flags);
972
typedef int (Tk_ItemCoordProc)(Tcl_Interp *interp, Tk_Canvas canvas,
973
Tk_Item *itemPtr, int argc, char **argv);
975
typedef int (Tk_ItemCreateProc)(Tcl_Interp *interp, Tk_Canvas canvas,
976
Tk_Item *itemPtr, int argc, Tcl_Obj *const objv[]);
977
typedef int (Tk_ItemConfigureProc)(Tcl_Interp *interp, Tk_Canvas canvas,
978
Tk_Item *itemPtr, int argc, Tcl_Obj *const objv[],
980
typedef int (Tk_ItemCoordProc)(Tcl_Interp *interp, Tk_Canvas canvas,
981
Tk_Item *itemPtr, int argc, Tcl_Obj *const argv[]);
982
#endif /* USE_OLD_CANVAS */
983
typedef void (Tk_ItemDeleteProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
985
typedef void (Tk_ItemDisplayProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
986
Display *display, Drawable dst, int x, int y, int width,
988
typedef double (Tk_ItemPointProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
990
typedef int (Tk_ItemAreaProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
992
typedef int (Tk_ItemPostscriptProc)(Tcl_Interp *interp, Tk_Canvas canvas,
993
Tk_Item *itemPtr, int prepass);
994
typedef void (Tk_ItemScaleProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
995
double originX, double originY, double scaleX,
997
typedef void (Tk_ItemTranslateProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
998
double deltaX, double deltaY);
999
#ifdef USE_OLD_CANVAS
1000
typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas,
1001
Tk_Item *itemPtr, char *indexString, int *indexPtr);
1003
typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas,
1004
Tk_Item *itemPtr, Tcl_Obj *indexString, int *indexPtr);
1005
#endif /* USE_OLD_CANVAS */
1006
typedef void (Tk_ItemCursorProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
1008
typedef int (Tk_ItemSelectionProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
1009
int offset, char *buffer, int maxBytes);
1010
#ifdef USE_OLD_CANVAS
1011
typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
1012
int beforeThis, char *string);
1014
typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
1015
int beforeThis, Tcl_Obj *string);
1016
#endif /* USE_OLD_CANVAS */
1017
typedef void (Tk_ItemDCharsProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
1018
int first, int last);
1020
#ifndef __NO_OLD_CONFIG
1022
typedef struct Tk_ItemType {
1023
CONST86 char *name; /* The name of this type of item, such as
1025
int itemSize; /* Total amount of space needed for item's
1027
Tk_ItemCreateProc *createProc;
1028
/* Procedure to create a new item of this
1030
CONST86 Tk_ConfigSpec *configSpecs; /* Pointer to array of configuration specs for
1031
* this type. Used for returning configuration
1033
Tk_ItemConfigureProc *configProc;
1034
/* Procedure to call to change configuration
1036
Tk_ItemCoordProc *coordProc;/* Procedure to call to get and set the item's
1038
Tk_ItemDeleteProc *deleteProc;
1039
/* Procedure to delete existing item of this
1041
Tk_ItemDisplayProc *displayProc;
1042
/* Procedure to display items of this type. */
1043
int alwaysRedraw; /* Non-zero means displayProc should be called
1044
* even when the item has been moved
1046
Tk_ItemPointProc *pointProc;/* Computes distance from item to a given
1048
Tk_ItemAreaProc *areaProc; /* Computes whether item is inside, outside,
1049
* or overlapping an area. */
1050
Tk_ItemPostscriptProc *postscriptProc;
1051
/* Procedure to write a Postscript description
1052
* for items of this type. */
1053
Tk_ItemScaleProc *scaleProc;/* Procedure to rescale items of this type. */
1054
Tk_ItemTranslateProc *translateProc;
1055
/* Procedure to translate items of this
1057
Tk_ItemIndexProc *indexProc;/* Procedure to determine index of indicated
1058
* character. NULL if item doesn't support
1060
Tk_ItemCursorProc *icursorProc;
1061
/* Procedure to set insert cursor posn to just
1062
* before a given position. */
1063
Tk_ItemSelectionProc *selectionProc;
1064
/* Procedure to return selection (in STRING
1065
* format) when it is in this item. */
1066
Tk_ItemInsertProc *insertProc;
1067
/* Procedure to insert something into an
1069
Tk_ItemDCharsProc *dCharsProc;
1070
/* Procedure to delete characters from an
1072
struct Tk_ItemType *nextPtr;/* Used to link types together into a list. */
1073
char *reserved1; /* Reserved for future extension. */
1074
int reserved2; /* Carefully compatible with */
1075
char *reserved3; /* Jan Nijtmans dash patch */
1080
* Flag (used in the alwaysRedraw field) to say whether an item supports
1081
* point-level manipulation like the line and polygon items.
1084
#define TK_MOVABLE_POINTS 2
1086
#endif /* __NO_OLD_CONFIG */
1089
* The following structure provides information about the selection and the
1090
* insertion cursor. It is needed by only a few items, such as those that
1091
* display text. It is shared by the generic canvas code and the item-specific
1092
* code, but most of the fields should be written only by the canvas generic
1096
typedef struct Tk_CanvasTextInfo {
1097
Tk_3DBorder selBorder; /* Border and background for selected
1098
* characters. Read-only to items.*/
1099
int selBorderWidth; /* Width of border around selection. Read-only
1101
XColor *selFgColorPtr; /* Foreground color for selected text.
1102
* Read-only to items. */
1103
Tk_Item *selItemPtr; /* Pointer to selected item. NULL means
1104
* selection isn't in this canvas. Writable by
1106
int selectFirst; /* Character index of first selected
1107
* character. Writable by items. */
1108
int selectLast; /* Character index of last selected character.
1109
* Writable by items. */
1110
Tk_Item *anchorItemPtr; /* Item corresponding to "selectAnchor": not
1111
* necessarily selItemPtr. Read-only to
1113
int selectAnchor; /* Character index of fixed end of selection
1114
* (i.e. "select to" operation will use this
1115
* as one end of the selection). Writable by
1117
Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion
1118
* cursor. Read-only to items. */
1119
int insertWidth; /* Total width of insertion cursor. Read-only
1121
int insertBorderWidth; /* Width of 3-D border around insert cursor.
1122
* Read-only to items. */
1123
Tk_Item *focusItemPtr; /* Item that currently has the input focus, or
1124
* NULL if no such item. Read-only to items. */
1125
int gotFocus; /* Non-zero means that the canvas widget has
1126
* the input focus. Read-only to items.*/
1127
int cursorOn; /* Non-zero means that an insertion cursor
1128
* should be displayed in focusItemPtr.
1129
* Read-only to items.*/
1130
} Tk_CanvasTextInfo;
1133
* Structures used for Dashing and Outline.
1136
typedef struct Tk_Dash {
1140
char array[sizeof(char *)];
1144
typedef struct Tk_TSOffset {
1145
int flags; /* Flags; see below for possible values */
1146
int xoffset; /* x offset */
1147
int yoffset; /* y offset */
1151
* Bit fields in Tk_Offset->flags:
1154
#define TK_OFFSET_INDEX 1
1155
#define TK_OFFSET_RELATIVE 2
1156
#define TK_OFFSET_LEFT 4
1157
#define TK_OFFSET_CENTER 8
1158
#define TK_OFFSET_RIGHT 16
1159
#define TK_OFFSET_TOP 32
1160
#define TK_OFFSET_MIDDLE 64
1161
#define TK_OFFSET_BOTTOM 128
1163
typedef struct Tk_Outline {
1164
GC gc; /* Graphics context. */
1165
double width; /* Width of outline. */
1166
double activeWidth; /* Width of outline. */
1167
double disabledWidth; /* Width of outline. */
1168
int offset; /* Dash offset. */
1169
Tk_Dash dash; /* Dash pattern. */
1170
Tk_Dash activeDash; /* Dash pattern if state is active. */
1171
Tk_Dash disabledDash; /* Dash pattern if state is disabled. */
1172
void *reserved1; /* Reserved for future expansion. */
1175
Tk_TSOffset tsoffset; /* Stipple offset for outline. */
1176
XColor *color; /* Outline color. */
1177
XColor *activeColor; /* Outline color if state is active. */
1178
XColor *disabledColor; /* Outline color if state is disabled. */
1179
Pixmap stipple; /* Outline Stipple pattern. */
1180
Pixmap activeStipple; /* Outline Stipple pattern if state is
1182
Pixmap disabledStipple; /* Outline Stipple pattern if state is
1187
*----------------------------------------------------------------------
1189
* Procedure prototypes and structures used for managing images:
1191
*----------------------------------------------------------------------
1194
typedef struct Tk_ImageType Tk_ImageType;
1195
#ifdef USE_OLD_IMAGE
1196
typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, char *name, int argc,
1197
char **argv, Tk_ImageType *typePtr, Tk_ImageMaster master,
1198
ClientData *masterDataPtr);
1200
typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, CONST86 char *name, int objc,
1201
Tcl_Obj *const objv[], CONST86 Tk_ImageType *typePtr, Tk_ImageMaster master,
1202
ClientData *masterDataPtr);
1203
#endif /* USE_OLD_IMAGE */
1204
typedef ClientData (Tk_ImageGetProc) (Tk_Window tkwin, ClientData masterData);
1205
typedef void (Tk_ImageDisplayProc) (ClientData instanceData, Display *display,
1206
Drawable drawable, int imageX, int imageY, int width, int height,
1207
int drawableX, int drawableY);
1208
typedef void (Tk_ImageFreeProc) (ClientData instanceData, Display *display);
1209
typedef void (Tk_ImageDeleteProc) (ClientData masterData);
1210
typedef void (Tk_ImageChangedProc) (ClientData clientData, int x, int y,
1211
int width, int height, int imageWidth, int imageHeight);
1212
typedef int (Tk_ImagePostscriptProc) (ClientData clientData,
1213
Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo,
1214
int x, int y, int width, int height, int prepass);
1217
* The following structure represents a particular type of image (bitmap, xpm
1218
* image, etc.). It provides information common to all images of that type,
1219
* such as the type name and a collection of procedures in the image manager
1220
* that respond to various events. Each image manager is represented by one of
1224
struct Tk_ImageType {
1225
CONST86 char *name; /* Name of image type. */
1226
Tk_ImageCreateProc *createProc;
1227
/* Procedure to call to create a new image of
1229
Tk_ImageGetProc *getProc; /* Procedure to call the first time
1230
* Tk_GetImage is called in a new way (new
1231
* visual or screen). */
1232
Tk_ImageDisplayProc *displayProc;
1233
/* Call to draw image, in response to
1234
* Tk_RedrawImage calls. */
1235
Tk_ImageFreeProc *freeProc; /* Procedure to call whenever Tk_FreeImage is
1236
* called to release an instance of an
1238
Tk_ImageDeleteProc *deleteProc;
1239
/* Procedure to call to delete image. It will
1240
* not be called until after freeProc has been
1241
* called for each instance of the image. */
1242
Tk_ImagePostscriptProc *postscriptProc;
1243
/* Procedure to call to produce postscript
1244
* output for the image. */
1245
struct Tk_ImageType *nextPtr;
1246
/* Next in list of all image types currently
1247
* known. Filled in by Tk, not by image
1249
char *reserved; /* reserved for future expansion */
1253
*----------------------------------------------------------------------
1255
* Additional definitions used to manage images of type "photo".
1257
*----------------------------------------------------------------------
1261
* The following type is used to identify a particular photo image to be
1265
typedef void *Tk_PhotoHandle;
1268
* The following structure describes a block of pixels in memory:
1271
typedef struct Tk_PhotoImageBlock {
1272
unsigned char *pixelPtr; /* Pointer to the first pixel. */
1273
int width; /* Width of block, in pixels. */
1274
int height; /* Height of block, in pixels. */
1275
int pitch; /* Address difference between corresponding
1276
* pixels in successive lines. */
1277
int pixelSize; /* Address difference between successive
1278
* pixels in the same line. */
1279
int offset[4]; /* Address differences between the red, green,
1280
* blue and alpha components of the pixel and
1281
* the pixel as a whole. */
1282
} Tk_PhotoImageBlock;
1285
* The following values control how blocks are combined into photo images when
1286
* the alpha component of a pixel is not 255, a.k.a. the compositing rule.
1289
#define TK_PHOTO_COMPOSITE_OVERLAY 0
1290
#define TK_PHOTO_COMPOSITE_SET 1
1293
* Procedure prototypes and structures used in reading and writing photo
1297
typedef struct Tk_PhotoImageFormat Tk_PhotoImageFormat;
1298
#ifdef USE_OLD_IMAGE
1299
typedef int (Tk_ImageFileMatchProc) (Tcl_Channel chan, char *fileName,
1300
char *formatString, int *widthPtr, int *heightPtr);
1301
typedef int (Tk_ImageStringMatchProc) (char *string, char *formatString,
1302
int *widthPtr, int *heightPtr);
1303
typedef int (Tk_ImageFileReadProc) (Tcl_Interp *interp, Tcl_Channel chan,
1304
char *fileName, char *formatString, Tk_PhotoHandle imageHandle,
1305
int destX, int destY, int width, int height, int srcX, int srcY);
1306
typedef int (Tk_ImageStringReadProc) (Tcl_Interp *interp, char *string,
1307
char *formatString, Tk_PhotoHandle imageHandle, int destX, int destY,
1308
int width, int height, int srcX, int srcY);
1309
typedef int (Tk_ImageFileWriteProc) (Tcl_Interp *interp, char *fileName,
1310
char *formatString, Tk_PhotoImageBlock *blockPtr);
1311
typedef int (Tk_ImageStringWriteProc) (Tcl_Interp *interp,
1312
Tcl_DString *dataPtr, char *formatString, Tk_PhotoImageBlock *blockPtr);
1314
typedef int (Tk_ImageFileMatchProc) (Tcl_Channel chan, const char *fileName,
1315
Tcl_Obj *format, int *widthPtr, int *heightPtr, Tcl_Interp *interp);
1316
typedef int (Tk_ImageStringMatchProc) (Tcl_Obj *dataObj, Tcl_Obj *format,
1317
int *widthPtr, int *heightPtr, Tcl_Interp *interp);
1318
typedef int (Tk_ImageFileReadProc) (Tcl_Interp *interp, Tcl_Channel chan,
1319
const char *fileName, Tcl_Obj *format, Tk_PhotoHandle imageHandle,
1320
int destX, int destY, int width, int height, int srcX, int srcY);
1321
typedef int (Tk_ImageStringReadProc) (Tcl_Interp *interp, Tcl_Obj *dataObj,
1322
Tcl_Obj *format, Tk_PhotoHandle imageHandle, int destX, int destY,
1323
int width, int height, int srcX, int srcY);
1324
typedef int (Tk_ImageFileWriteProc) (Tcl_Interp *interp, const char *fileName,
1325
Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr);
1326
typedef int (Tk_ImageStringWriteProc) (Tcl_Interp *interp, Tcl_Obj *format,
1327
Tk_PhotoImageBlock *blockPtr);
1328
#endif /* USE_OLD_IMAGE */
1331
* The following structure represents a particular file format for storing
1332
* images (e.g., PPM, GIF, JPEG, etc.). It provides information to allow image
1333
* files of that format to be recognized and read into a photo image.
1336
struct Tk_PhotoImageFormat {
1337
CONST86 char *name; /* Name of image file format */
1338
Tk_ImageFileMatchProc *fileMatchProc;
1339
/* Procedure to call to determine whether an
1340
* image file matches this format. */
1341
Tk_ImageStringMatchProc *stringMatchProc;
1342
/* Procedure to call to determine whether the
1343
* data in a string matches this format. */
1344
Tk_ImageFileReadProc *fileReadProc;
1345
/* Procedure to call to read data from an
1346
* image file into a photo image. */
1347
Tk_ImageStringReadProc *stringReadProc;
1348
/* Procedure to call to read data from a
1349
* string into a photo image. */
1350
Tk_ImageFileWriteProc *fileWriteProc;
1351
/* Procedure to call to write data from a
1352
* photo image to a file. */
1353
Tk_ImageStringWriteProc *stringWriteProc;
1354
/* Procedure to call to obtain a string
1355
* representation of the data in a photo
1357
struct Tk_PhotoImageFormat *nextPtr;
1358
/* Next in list of all photo image formats
1359
* currently known. Filled in by Tk, not by
1360
* image format handler. */
1364
*----------------------------------------------------------------------
1366
* Procedure prototypes and structures used for managing styles:
1368
*----------------------------------------------------------------------
1372
* Style support version tag.
1375
#define TK_STYLE_VERSION_1 0x1
1376
#define TK_STYLE_VERSION TK_STYLE_VERSION_1
1379
* The following structures and prototypes are used as static templates to
1380
* declare widget elements.
1383
typedef void (Tk_GetElementSizeProc) (ClientData clientData, char *recordPtr,
1384
const Tk_OptionSpec **optionsPtr, Tk_Window tkwin, int width,
1385
int height, int inner, int *widthPtr, int *heightPtr);
1386
typedef void (Tk_GetElementBoxProc) (ClientData clientData, char *recordPtr,
1387
const Tk_OptionSpec **optionsPtr, Tk_Window tkwin, int x, int y,
1388
int width, int height, int inner, int *xPtr, int *yPtr, int *widthPtr,
1390
typedef int (Tk_GetElementBorderWidthProc) (ClientData clientData,
1391
char *recordPtr, const Tk_OptionSpec **optionsPtr, Tk_Window tkwin);
1392
typedef void (Tk_DrawElementProc) (ClientData clientData, char *recordPtr,
1393
const Tk_OptionSpec **optionsPtr, Tk_Window tkwin, Drawable d, int x,
1394
int y, int width, int height, int state);
1396
typedef struct Tk_ElementOptionSpec {
1397
char *name; /* Name of the required option. */
1398
Tk_OptionType type; /* Accepted option type. TK_OPTION_END means
1400
} Tk_ElementOptionSpec;
1402
typedef struct Tk_ElementSpec {
1403
int version; /* Version of the style support. */
1404
char *name; /* Name of element. */
1405
Tk_ElementOptionSpec *options;
1406
/* List of required options. Last one's name
1408
Tk_GetElementSizeProc *getSize;
1409
/* Compute the external (resp. internal) size
1410
* of the element from its desired internal
1411
* (resp. external) size. */
1412
Tk_GetElementBoxProc *getBox;
1413
/* Compute the inscribed or bounding boxes
1414
* within a given area. */
1415
Tk_GetElementBorderWidthProc *getBorderWidth;
1416
/* Return the element's internal border width.
1417
* Mostly useful for widgets. */
1418
Tk_DrawElementProc *draw; /* Draw the element in the given bounding
1423
* Element state flags. Can be OR'ed.
1426
#define TK_ELEMENT_STATE_ACTIVE 1<<0
1427
#define TK_ELEMENT_STATE_DISABLED 1<<1
1428
#define TK_ELEMENT_STATE_FOCUS 1<<2
1429
#define TK_ELEMENT_STATE_PRESSED 1<<3
1432
*----------------------------------------------------------------------
1434
* The definitions below provide backward compatibility for functions and
1435
* types related to event handling that used to be in Tk but have moved to
1438
*----------------------------------------------------------------------
1441
#define TK_READABLE TCL_READABLE
1442
#define TK_WRITABLE TCL_WRITABLE
1443
#define TK_EXCEPTION TCL_EXCEPTION
1445
#define TK_DONT_WAIT TCL_DONT_WAIT
1446
#define TK_X_EVENTS TCL_WINDOW_EVENTS
1447
#define TK_WINDOW_EVENTS TCL_WINDOW_EVENTS
1448
#define TK_FILE_EVENTS TCL_FILE_EVENTS
1449
#define TK_TIMER_EVENTS TCL_TIMER_EVENTS
1450
#define TK_IDLE_EVENTS TCL_IDLE_EVENTS
1451
#define TK_ALL_EVENTS TCL_ALL_EVENTS
1453
#define Tk_IdleProc Tcl_IdleProc
1454
#define Tk_FileProc Tcl_FileProc
1455
#define Tk_TimerProc Tcl_TimerProc
1456
#define Tk_TimerToken Tcl_TimerToken
1458
#define Tk_BackgroundError Tcl_BackgroundError
1459
#define Tk_CancelIdleCall Tcl_CancelIdleCall
1460
#define Tk_CreateFileHandler Tcl_CreateFileHandler
1461
#define Tk_CreateTimerHandler Tcl_CreateTimerHandler
1462
#define Tk_DeleteFileHandler Tcl_DeleteFileHandler
1463
#define Tk_DeleteTimerHandler Tcl_DeleteTimerHandler
1464
#define Tk_DoOneEvent Tcl_DoOneEvent
1465
#define Tk_DoWhenIdle Tcl_DoWhenIdle
1466
#define Tk_Sleep Tcl_Sleep
1468
/* Additional stuff that has moved to Tcl: */
1470
#define Tk_EventuallyFree Tcl_EventuallyFree
1471
#define Tk_FreeProc Tcl_FreeProc
1472
#define Tk_Preserve Tcl_Preserve
1473
#define Tk_Release Tcl_Release
1475
/* Removed Tk_Main, use macro instead */
1477
#define Tk_Main(argc, argv, proc) Tk_MainEx(argc, argv, proc, \
1478
(Tcl_FindExecutable(0), (Tcl_CreateInterp)()))
1480
#define Tk_Main(argc, argv, proc) Tk_MainEx(argc, argv, proc, \
1481
(Tcl_FindExecutable(argv[0]), (Tcl_CreateInterp)()))
1483
const char * Tk_InitStubs(Tcl_Interp *interp, const char *version,
1485
EXTERN const char * Tk_PkgInitStubsCheck(Tcl_Interp *interp,
1486
const char *version, int exact);
1488
#ifndef USE_TK_STUBS
1489
#define Tk_InitStubs(interp, version, exact) \
1490
Tk_PkgInitStubsCheck(interp, version, exact)
1491
#endif /* USE_TK_STUBS */
1493
#define Tk_InitImageArgs(interp, argc, argv) /**/
1496
*----------------------------------------------------------------------
1498
* Additional procedure types defined by Tk.
1500
*----------------------------------------------------------------------
1503
typedef int (Tk_ErrorProc) (ClientData clientData, XErrorEvent *errEventPtr);
1504
typedef void (Tk_EventProc) (ClientData clientData, XEvent *eventPtr);
1505
typedef int (Tk_GenericProc) (ClientData clientData, XEvent *eventPtr);
1506
typedef int (Tk_ClientMessageProc) (Tk_Window tkwin, XEvent *eventPtr);
1507
typedef int (Tk_GetSelProc) (ClientData clientData, Tcl_Interp *interp,
1508
CONST86 char *portion);
1509
typedef void (Tk_LostSelProc) (ClientData clientData);
1510
typedef Tk_RestrictAction (Tk_RestrictProc) (ClientData clientData,
1512
typedef int (Tk_SelectionProc) (ClientData clientData, int offset,
1513
char *buffer, int maxBytes);
1516
*----------------------------------------------------------------------
1518
* Platform independent exported procedures and variables.
1520
*----------------------------------------------------------------------
1523
#include "tkDecls.h"
1525
#ifdef USE_OLD_IMAGE
1526
#undef Tk_CreateImageType
1527
#define Tk_CreateImageType Tk_CreateOldImageType
1528
#undef Tk_CreatePhotoImageFormat
1529
#define Tk_CreatePhotoImageFormat Tk_CreateOldPhotoImageFormat
1530
#endif /* USE_OLD_IMAGE */
1533
*----------------------------------------------------------------------
1535
* Allow users to say that they don't want to alter their source to add extra
1536
* arguments to Tk_PhotoPutBlock() et al; DO NOT DEFINE THIS WHEN BUILDING TK.
1538
* This goes after the inclusion of the stubbed-decls so that the declarations
1539
* of what is actually there can be correct.
1542
#ifdef USE_COMPOSITELESS_PHOTO_PUT_BLOCK
1543
# ifdef Tk_PhotoPutBlock
1544
# undef Tk_PhotoPutBlock
1546
# define Tk_PhotoPutBlock Tk_PhotoPutBlock_NoComposite
1547
# ifdef Tk_PhotoPutZoomedBlock
1548
# undef Tk_PhotoPutZoomedBlock
1550
# define Tk_PhotoPutZoomedBlock Tk_PhotoPutZoomedBlock_NoComposite
1551
# define USE_PANIC_ON_PHOTO_ALLOC_FAILURE
1552
#else /* !USE_COMPOSITELESS_PHOTO_PUT_BLOCK */
1553
# ifdef USE_PANIC_ON_PHOTO_ALLOC_FAILURE
1554
# ifdef Tk_PhotoPutBlock
1555
# undef Tk_PhotoPutBlock
1557
# define Tk_PhotoPutBlock Tk_PhotoPutBlock_Panic
1558
# ifdef Tk_PhotoPutZoomedBlock
1559
# undef Tk_PhotoPutZoomedBlock
1561
# define Tk_PhotoPutZoomedBlock Tk_PhotoPutZoomedBlock_Panic
1562
# endif /* USE_PANIC_ON_PHOTO_ALLOC_FAILURE */
1563
#endif /* USE_COMPOSITELESS_PHOTO_PUT_BLOCK */
1564
#ifdef USE_PANIC_ON_PHOTO_ALLOC_FAILURE
1565
# ifdef Tk_PhotoExpand
1566
# undef Tk_PhotoExpand
1568
# define Tk_PhotoExpand Tk_PhotoExpand_Panic
1569
# ifdef Tk_PhotoSetSize
1570
# undef Tk_PhotoSetSize
1572
# define Tk_PhotoSetSize Tk_PhotoSetSize_Panic
1573
#endif /* USE_PANIC_ON_PHOTO_ALLOC_FAILURE */
1575
#undef TCL_STORAGE_CLASS
1576
#define TCL_STORAGE_CLASS DLLIMPORT
1578
#endif /* RC_INVOKED */