~ubuntu-branches/ubuntu/utopic/critcl/utopic

« back to all changes in this revision

Viewing changes to lib/critcl/critcl_c/tcl8.6/X11/tk.h

  • Committer: Package Import Robot
  • Author(s): Andrew Shadura
  • Date: 2013-05-11 00:08:06 UTC
  • Revision ID: package-import@ubuntu.com-20130511000806-7hq1zc3fnn0gat79
Tags: upstream-3.1.9
ImportĀ upstreamĀ versionĀ 3.1.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * tk.h --
 
3
 *
 
4
 *      Declarations for Tk-related things that are visible outside of the Tk
 
5
 *      module itself.
 
6
 *
 
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.
 
11
 *
 
12
 * See the file "license.terms" for information on usage and redistribution of
 
13
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 
14
 *
 
15
 * RCS: @(#) $Id: tk.h,v 1.138 2010/12/16 09:03:07 nijtmans Exp $
 
16
 */
 
17
 
 
18
#ifndef _TK
 
19
#define _TK
 
20
 
 
21
#include <tcl.h>
 
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
 
24
#endif
 
25
 
 
26
/*
 
27
 * For C++ compilers, use extern "C"
 
28
 */
 
29
 
 
30
#ifdef __cplusplus
 
31
extern "C" {
 
32
#endif
 
33
 
 
34
/*
 
35
 * When version numbers change here, you must also go into the following files
 
36
 * and update the version numbers:
 
37
 *
 
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)
 
47
 *
 
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.
 
50
 */
 
51
 
 
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
 
56
 
 
57
#define TK_VERSION              "8.6"
 
58
#define TK_PATCH_LEVEL          "8.6b1.2"
 
59
 
 
60
/*
 
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
 
64
 * for macintosh.
 
65
 *
 
66
 * Resource compilers don't like all the C stuff, like typedefs and procedure
 
67
 * declarations, that occur below, so block them out.
 
68
 */
 
69
 
 
70
#ifndef RC_INVOKED
 
71
 
 
72
#ifndef _XLIB_H
 
73
#   include <X11/Xlib.h>
 
74
#   ifdef MAC_OSX_TK
 
75
#       include <X11/X.h>
 
76
#   endif
 
77
#endif
 
78
#ifdef __STDC__
 
79
#   include <stddef.h>
 
80
#endif
 
81
 
 
82
#ifdef BUILD_tk
 
83
#undef TCL_STORAGE_CLASS
 
84
#define TCL_STORAGE_CLASS       DLLEXPORT
 
85
#endif
 
86
 
 
87
/*
 
88
 *----------------------------------------------------------------------
 
89
 *
 
90
 * Decide whether or not to use input methods.
 
91
 */
 
92
 
 
93
#ifdef XNQueryInputStyle
 
94
#define TK_USE_INPUT_METHODS
 
95
#endif
 
96
 
 
97
/*
 
98
 * Dummy types that are used by clients:
 
99
 */
 
100
 
 
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;
 
116
 
 
117
/*
 
118
 * Additional types exported to clients.
 
119
 */
 
120
 
 
121
typedef const char *Tk_Uid;
 
122
 
 
123
/*
 
124
 *----------------------------------------------------------------------
 
125
 *
 
126
 * The enum below defines the valid types for Tk configuration options as
 
127
 * implemented by Tk_InitOptions, Tk_SetOptions, etc.
 
128
 */
 
129
 
 
130
typedef enum {
 
131
    TK_OPTION_BOOLEAN,
 
132
    TK_OPTION_INT,
 
133
    TK_OPTION_DOUBLE,
 
134
    TK_OPTION_STRING,
 
135
    TK_OPTION_STRING_TABLE,
 
136
    TK_OPTION_COLOR,
 
137
    TK_OPTION_FONT,
 
138
    TK_OPTION_BITMAP,
 
139
    TK_OPTION_BORDER,
 
140
    TK_OPTION_RELIEF,
 
141
    TK_OPTION_CURSOR,
 
142
    TK_OPTION_JUSTIFY,
 
143
    TK_OPTION_ANCHOR,
 
144
    TK_OPTION_SYNONYM,
 
145
    TK_OPTION_PIXELS,
 
146
    TK_OPTION_WINDOW,
 
147
    TK_OPTION_END,
 
148
    TK_OPTION_CUSTOM,
 
149
    TK_OPTION_STYLE
 
150
} Tk_OptionType;
 
151
 
 
152
/*
 
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.
 
157
 */
 
158
 
 
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
 
164
                                 * commands. */
 
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
 
169
                                 * the system. */
 
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
 
183
                                 * the record. */
 
184
    int flags;                  /* Any combination of the values defined
 
185
                                 * below. */
 
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
 
195
                                 * changed. */
 
196
} Tk_OptionSpec;
 
197
 
 
198
/*
 
199
 * Flag values for Tk_OptionSpec structures. These flags are shared by
 
200
 * Tk_ConfigSpec structures, so be sure to coordinate any changes carefully.
 
201
 */
 
202
 
 
203
#define TK_OPTION_NULL_OK               (1 << 0)
 
204
#define TK_OPTION_DONT_SET_DEFAULT      (1 << 3)
 
205
 
 
206
/*
 
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.
 
210
 */
 
211
 
 
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,
 
220
        char *internalPtr);
 
221
 
 
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
 
238
                                 * handling procs. */
 
239
} Tk_ObjCustomOption;
 
240
 
 
241
/*
 
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.
 
244
 */
 
245
 
 
246
#ifdef offsetof
 
247
#define Tk_Offset(type, field) ((int) offsetof(type, field))
 
248
#else
 
249
#define Tk_Offset(type, field) ((int) ((char *) &((type *) 0)->field))
 
250
#endif
 
251
 
 
252
/*
 
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.
 
259
 */
 
260
 
 
261
typedef struct Tk_SavedOption {
 
262
    struct TkOption *optionPtr; /* Points to information that describes the
 
263
                                 * option. */
 
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. */
 
277
} Tk_SavedOption;
 
278
 
 
279
#ifdef TCL_MEM_DEBUG
 
280
#   define TK_NUM_SAVED_OPTIONS 2
 
281
#else
 
282
#   define TK_NUM_SAVED_OPTIONS 20
 
283
#endif
 
284
 
 
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. */
 
298
} Tk_SavedOptions;
 
299
 
 
300
/*
 
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
 
304
 * LISTED ABOVE.
 
305
 */
 
306
 
 
307
/*
 
308
 * This is a temporary flag used while tkObjConfig and new widgets are in
 
309
 * development.
 
310
 */
 
311
 
 
312
#ifndef __NO_OLD_CONFIG
 
313
 
 
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);
 
318
 
 
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
 
328
                                 * printProc. */
 
329
} Tk_CustomOption;
 
330
 
 
331
/*
 
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
 
335
 * database, etc.
 
336
 */
 
337
 
 
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
 
350
                                 * this. */
 
351
    int specFlags;              /* Any combination of the values defined
 
352
                                 * below; other bits are used internally by
 
353
                                 * tkConfig.c. */
 
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
 
358
                                 * irrelevant. */
 
359
} Tk_ConfigSpec;
 
360
 
 
361
/*
 
362
 * Type values for Tk_ConfigSpec structures. See the user documentation for
 
363
 * details.
 
364
 */
 
365
 
 
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;
 
375
 
 
376
/*
 
377
 * Possible values for flags argument to Tk_ConfigureWidget:
 
378
 */
 
379
 
 
380
#define TK_CONFIG_ARGV_ONLY     1
 
381
#define TK_CONFIG_OBJS          0x80
 
382
 
 
383
/*
 
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).
 
388
 */
 
389
 
 
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 */
 
397
 
 
398
/*
 
399
 * Structure used to specify how to handle argv options.
 
400
 */
 
401
 
 
402
typedef struct {
 
403
    CONST86 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
    CONST86 char *help;         /* Documentation message describing this
 
411
                                 * option. */
 
412
} Tk_ArgvInfo;
 
413
 
 
414
/*
 
415
 * Legal values for the type field of a Tk_ArgvInfo: see the user
 
416
 * documentation for details.
 
417
 */
 
418
 
 
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
 
432
 
 
433
/*
 
434
 * Flag bits for passing to Tk_ParseArgv:
 
435
 */
 
436
 
 
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
 
441
 
 
442
/*
 
443
 * Enumerated type for describing actions to be taken in response to a
 
444
 * restrictProc established by Tk_RestrictEvents.
 
445
 */
 
446
 
 
447
typedef enum {
 
448
    TK_DEFER_EVENT, TK_PROCESS_EVENT, TK_DISCARD_EVENT
 
449
} Tk_RestrictAction;
 
450
 
 
451
/*
 
452
 * Priority levels to pass to Tk_AddOption:
 
453
 */
 
454
 
 
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
 
460
 
 
461
/*
 
462
 * Relief values returned by Tk_GetRelief:
 
463
 */
 
464
 
 
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
 
472
 
 
473
/*
 
474
 * "Which" argument values for Tk_3DBorderGC:
 
475
 */
 
476
 
 
477
#define TK_3D_FLAT_GC           1
 
478
#define TK_3D_LIGHT_GC          2
 
479
#define TK_3D_DARK_GC           3
 
480
 
 
481
/*
 
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.
 
486
 */
 
487
 
 
488
#define TK_NOTIFY_SHARE         20
 
489
 
 
490
/*
 
491
 * Enumerated type for describing a point by which to anchor something:
 
492
 */
 
493
 
 
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;
 
499
 
 
500
/*
 
501
 * Enumerated type for describing a style of justification:
 
502
 */
 
503
 
 
504
typedef enum {
 
505
    TK_JUSTIFY_LEFT, TK_JUSTIFY_RIGHT, TK_JUSTIFY_CENTER
 
506
} Tk_Justify;
 
507
 
 
508
/*
 
509
 * The following structure is used by Tk_GetFontMetrics() to return
 
510
 * information about the properties of a Tk_Font.
 
511
 */
 
512
 
 
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;
 
528
 
 
529
/*
 
530
 * Flags passed to Tk_MeasureChars:
 
531
 */
 
532
 
 
533
#define TK_WHOLE_WORDS          1
 
534
#define TK_AT_LEAST_ONE         2
 
535
#define TK_PARTIAL_OK           4
 
536
 
 
537
/*
 
538
 * Flags passed to Tk_ComputeTextLayout:
 
539
 */
 
540
 
 
541
#define TK_IGNORE_TABS          8
 
542
#define TK_IGNORE_NEWLINES      16
 
543
 
 
544
/*
 
545
 * Widget class procedures used to implement platform specific widget
 
546
 * behavior.
 
547
 */
 
548
 
 
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);
 
553
 
 
554
typedef struct Tk_ClassProcs {
 
555
    unsigned int size;
 
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. */
 
567
} Tk_ClassProcs;
 
568
 
 
569
/*
 
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).
 
574
 *
 
575
 * A more general version of this function may be useful if other
 
576
 * size-versioned structure pop up in the future:
 
577
 *
 
578
 *      #define Tk_GetField(name, who, which) \
 
579
 *          (((who) == NULL) ? NULL :
 
580
 *          (((who)->size <= Tk_Offset(name, which)) ? NULL :(name)->which))
 
581
 */
 
582
 
 
583
#define Tk_GetClassProc(procs, which) \
 
584
    (((procs) == NULL) ? NULL : \
 
585
    (((procs)->size <= Tk_Offset(Tk_ClassProcs, which)) ? NULL:(procs)->which))
 
586
 
 
587
/*
 
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.
 
591
 */
 
592
 
 
593
typedef void (Tk_GeomRequestProc) (ClientData clientData, Tk_Window tkwin);
 
594
typedef void (Tk_GeomLostSlaveProc) (ClientData clientData, Tk_Window tkwin);
 
595
 
 
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. */
 
608
} Tk_GeomMgr;
 
609
 
 
610
/*
 
611
 * Result values returned by Tk_GetScrollInfo:
 
612
 */
 
613
 
 
614
#define TK_SCROLL_MOVETO        1
 
615
#define TK_SCROLL_PAGES         2
 
616
#define TK_SCROLL_UNITS         3
 
617
#define TK_SCROLL_ERROR         4
 
618
 
 
619
/*
 
620
 *----------------------------------------------------------------------
 
621
 *
 
622
 * Extensions to the X event set
 
623
 *
 
624
 *----------------------------------------------------------------------
 
625
 */
 
626
 
 
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)
 
632
 
 
633
#define MouseWheelMask      (1L << 28)
 
634
#define ActivateMask        (1L << 29)
 
635
#define VirtualEventMask    (1L << 30)
 
636
 
 
637
/*
 
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
 
643
 * being triggered.
 
644
 *
 
645
 * When using this structure, you should ensure that you zero out all the
 
646
 * fields first using memset() or bzero().
 
647
 */
 
648
 
 
649
typedef struct {
 
650
    int type;
 
651
    unsigned long serial;       /* # of last request processed by server. */
 
652
    Bool send_event;            /* True if this came from a SendEvent
 
653
                                 * request. */
 
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
 
660
                                 * window. */
 
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
 
668
                                 * event. */
 
669
} XVirtualEvent;
 
670
 
 
671
typedef struct {
 
672
    int type;
 
673
    unsigned long serial;       /* # of last request processed by server. */
 
674
    Bool send_event;            /* True if this came from a SendEvent
 
675
                                 * request. */
 
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;
 
681
 
 
682
/*
 
683
 *----------------------------------------------------------------------
 
684
 *
 
685
 * Macros for querying Tk_Window structures. See the manual entries for
 
686
 * documentation.
 
687
 *
 
688
 *----------------------------------------------------------------------
 
689
 */
 
690
 
 
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)
 
741
 
 
742
/*
 
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.
 
750
 */
 
751
 
 
752
typedef struct Tk_FakeWin {
 
753
    Display *display;
 
754
    char *dummy1;               /* dispPtr */
 
755
    int screenNum;
 
756
    Visual *visual;
 
757
    int depth;
 
758
    Window window;
 
759
    char *dummy2;               /* childList */
 
760
    char *dummy3;               /* lastChildPtr */
 
761
    Tk_Window parentPtr;        /* parentPtr */
 
762
    char *dummy4;               /* nextPtr */
 
763
    char *dummy5;               /* mainPtr */
 
764
    char *pathName;
 
765
    Tk_Uid nameUid;
 
766
    Tk_Uid classUid;
 
767
    XWindowChanges changes;
 
768
    unsigned int dummy6;        /* dirtyChanges */
 
769
    XSetWindowAttributes atts;
 
770
    unsigned long dummy7;       /* dirtyAtts */
 
771
    unsigned int flags;
 
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;
 
791
    int minReqWidth;
 
792
    int minReqHeight;
 
793
    char *dummy20;              /* geometryMaster */
 
794
} Tk_FakeWin;
 
795
 
 
796
/*
 
797
 * Flag values for TkWindow (and Tk_FakeWin) structures are:
 
798
 *
 
799
 * TK_MAPPED:                   1 means window is currently mapped,
 
800
 *                              0 means unmapped.
 
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
 
807
 *                              to be generated.
 
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
 
812
 *                              the field.
 
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
 
823
 *                              toplevel isn't.
 
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
 
830
 *                              inside the window.
 
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
 
839
 *                              information.
 
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
 
844
 *                              menubar windows.
 
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
 
856
 *                              window.
 
857
 * TK_WM_MANAGEABLE             1 marks a window as capable of being converted
 
858
 *                              into a toplevel using [wm manage].
 
859
 */
 
860
 
 
861
#define TK_MAPPED               1
 
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
 
880
 
 
881
/*
 
882
 *----------------------------------------------------------------------
 
883
 *
 
884
 * Procedure prototypes and structures used for defining new canvas items:
 
885
 *
 
886
 *----------------------------------------------------------------------
 
887
 */
 
888
 
 
889
typedef enum {
 
890
    TK_STATE_NULL = -1, TK_STATE_ACTIVE, TK_STATE_DISABLED,
 
891
    TK_STATE_NORMAL, TK_STATE_HIDDEN
 
892
} Tk_State;
 
893
 
 
894
typedef struct Tk_SmoothMethod {
 
895
    CONST86 char *name;
 
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);
 
900
} Tk_SmoothMethod;
 
901
 
 
902
/*
 
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.
 
906
 */
 
907
 
 
908
#define TK_TAG_SPACE 3
 
909
 
 
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
 
922
                                 * tagPtr. */
 
923
    int numTags;                /* Number of tag slots actually used at
 
924
                                 * *tagPtr. */
 
925
    struct Tk_ItemType *typePtr;/* Table of procedures that implement this
 
926
                                 * type of item. */
 
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
 
931
                                 * x2 and y2. */
 
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 */
 
938
 
 
939
    /*
 
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
 
944
     * record.
 
945
     *------------------------------------------------------------------
 
946
     */
 
947
} Tk_Item;
 
948
 
 
949
/*
 
950
 * Flag bits for canvases (redraw_flags):
 
951
 *
 
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.
 
957
 */
 
958
 
 
959
#define TK_ITEM_STATE_DEPENDANT         1
 
960
#define TK_ITEM_DONT_REDRAW             2
 
961
 
 
962
/*
 
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.
 
965
 */
 
966
 
 
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);
 
974
#else
 
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[],
 
979
                    int flags);
 
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,
 
984
                    Display *display);
 
985
typedef void    (Tk_ItemDisplayProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
 
986
                    Display *display, Drawable dst, int x, int y, int width,
 
987
                    int height);
 
988
typedef double  (Tk_ItemPointProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
 
989
                    double *pointPtr);
 
990
typedef int     (Tk_ItemAreaProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
 
991
                    double *rectPtr);
 
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,
 
996
                    double scaleY);
 
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);
 
1002
#else
 
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,
 
1007
                    int index);
 
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);
 
1013
#else
 
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);
 
1019
 
 
1020
#ifndef __NO_OLD_CONFIG
 
1021
 
 
1022
typedef struct Tk_ItemType {
 
1023
    CONST86 char *name;         /* The name of this type of item, such as
 
1024
                                 * "line". */
 
1025
    int itemSize;               /* Total amount of space needed for item's
 
1026
                                 * record. */
 
1027
    Tk_ItemCreateProc *createProc;
 
1028
                                /* Procedure to create a new item of this
 
1029
                                 * type. */
 
1030
    CONST86 Tk_ConfigSpec *configSpecs; /* Pointer to array of configuration specs for
 
1031
                                 * this type. Used for returning configuration
 
1032
                                 * info. */
 
1033
    Tk_ItemConfigureProc *configProc;
 
1034
                                /* Procedure to call to change configuration
 
1035
                                 * options. */
 
1036
    Tk_ItemCoordProc *coordProc;/* Procedure to call to get and set the item's
 
1037
                                 * coordinates. */
 
1038
    Tk_ItemDeleteProc *deleteProc;
 
1039
                                /* Procedure to delete existing item of this
 
1040
                                 * type. */
 
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
 
1045
                                 * off-screen. */
 
1046
    Tk_ItemPointProc *pointProc;/* Computes distance from item to a given
 
1047
                                 * point. */
 
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
 
1056
                                 * type. */
 
1057
    Tk_ItemIndexProc *indexProc;/* Procedure to determine index of indicated
 
1058
                                 * character. NULL if item doesn't support
 
1059
                                 * indexing. */
 
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
 
1068
                                 * item. */
 
1069
    Tk_ItemDCharsProc *dCharsProc;
 
1070
                                /* Procedure to delete characters from an
 
1071
                                 * item. */
 
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 */
 
1076
    char *reserved4;
 
1077
} Tk_ItemType;
 
1078
 
 
1079
/*
 
1080
 * Flag (used in the alwaysRedraw field) to say whether an item supports
 
1081
 * point-level manipulation like the line and polygon items.
 
1082
 */
 
1083
 
 
1084
#define TK_MOVABLE_POINTS       2
 
1085
 
 
1086
#endif /* __NO_OLD_CONFIG */
 
1087
 
 
1088
/*
 
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
 
1093
 * code.
 
1094
 */
 
1095
 
 
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
 
1100
                                 * to items. */
 
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
 
1105
                                 * items. */
 
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
 
1112
                                 * items. */
 
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
 
1116
                                 * items. */
 
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
 
1120
                                 * to items. */
 
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;
 
1131
 
 
1132
/*
 
1133
 * Structures used for Dashing and Outline.
 
1134
 */
 
1135
 
 
1136
typedef struct Tk_Dash {
 
1137
    int number;
 
1138
    union {
 
1139
        char *pt;
 
1140
        char array[sizeof(char *)];
 
1141
    } pattern;
 
1142
} Tk_Dash;
 
1143
 
 
1144
typedef struct Tk_TSOffset {
 
1145
    int flags;                  /* Flags; see below for possible values */
 
1146
    int xoffset;                /* x offset */
 
1147
    int yoffset;                /* y offset */
 
1148
} Tk_TSOffset;
 
1149
 
 
1150
/*
 
1151
 * Bit fields in Tk_Offset->flags:
 
1152
 */
 
1153
 
 
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
 
1162
 
 
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. */
 
1173
    void *reserved2;
 
1174
    void *reserved3;
 
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
 
1181
                                 * active. */
 
1182
    Pixmap disabledStipple;     /* Outline Stipple pattern if state is
 
1183
                                 * disabled. */
 
1184
} Tk_Outline;
 
1185
 
 
1186
/*
 
1187
 *----------------------------------------------------------------------
 
1188
 *
 
1189
 * Procedure prototypes and structures used for managing images:
 
1190
 *
 
1191
 *----------------------------------------------------------------------
 
1192
 */
 
1193
 
 
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);
 
1199
#else
 
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);
 
1215
 
 
1216
/*
 
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
 
1221
 * these structures.
 
1222
 */
 
1223
 
 
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
 
1228
                                 * this type. */
 
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
 
1237
                                 * image. */
 
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
 
1248
                                 * manager. */
 
1249
    char *reserved;             /* reserved for future expansion */
 
1250
};
 
1251
 
 
1252
/*
 
1253
 *----------------------------------------------------------------------
 
1254
 *
 
1255
 * Additional definitions used to manage images of type "photo".
 
1256
 *
 
1257
 *----------------------------------------------------------------------
 
1258
 */
 
1259
 
 
1260
/*
 
1261
 * The following type is used to identify a particular photo image to be
 
1262
 * manipulated:
 
1263
 */
 
1264
 
 
1265
typedef void *Tk_PhotoHandle;
 
1266
 
 
1267
/*
 
1268
 * The following structure describes a block of pixels in memory:
 
1269
 */
 
1270
 
 
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;
 
1283
 
 
1284
/*
 
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.
 
1287
 */
 
1288
 
 
1289
#define TK_PHOTO_COMPOSITE_OVERLAY      0
 
1290
#define TK_PHOTO_COMPOSITE_SET          1
 
1291
 
 
1292
/*
 
1293
 * Procedure prototypes and structures used in reading and writing photo
 
1294
 * images:
 
1295
 */
 
1296
 
 
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);
 
1313
#else
 
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 */
 
1329
 
 
1330
/*
 
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.
 
1334
 */
 
1335
 
 
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
 
1356
                                 * image.*/
 
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. */
 
1361
};
 
1362
 
 
1363
/*
 
1364
 *----------------------------------------------------------------------
 
1365
 *
 
1366
 * Procedure prototypes and structures used for managing styles:
 
1367
 *
 
1368
 *----------------------------------------------------------------------
 
1369
 */
 
1370
 
 
1371
/*
 
1372
 * Style support version tag.
 
1373
 */
 
1374
 
 
1375
#define TK_STYLE_VERSION_1      0x1
 
1376
#define TK_STYLE_VERSION        TK_STYLE_VERSION_1
 
1377
 
 
1378
/*
 
1379
 * The following structures and prototypes are used as static templates to
 
1380
 * declare widget elements.
 
1381
 */
 
1382
 
 
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,
 
1389
        int *heightPtr);
 
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);
 
1395
 
 
1396
typedef struct Tk_ElementOptionSpec {
 
1397
    char *name;                 /* Name of the required option. */
 
1398
    Tk_OptionType type;         /* Accepted option type. TK_OPTION_END means
 
1399
                                 * any. */
 
1400
} Tk_ElementOptionSpec;
 
1401
 
 
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
 
1407
                                 * must be NULL. */
 
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
 
1419
                                 * box. */
 
1420
} Tk_ElementSpec;
 
1421
 
 
1422
/*
 
1423
 * Element state flags. Can be OR'ed.
 
1424
 */
 
1425
 
 
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
 
1430
 
 
1431
/*
 
1432
 *----------------------------------------------------------------------
 
1433
 *
 
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
 
1436
 * Tcl.
 
1437
 *
 
1438
 *----------------------------------------------------------------------
 
1439
 */
 
1440
 
 
1441
#define TK_READABLE             TCL_READABLE
 
1442
#define TK_WRITABLE             TCL_WRITABLE
 
1443
#define TK_EXCEPTION            TCL_EXCEPTION
 
1444
 
 
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
 
1452
 
 
1453
#define Tk_IdleProc             Tcl_IdleProc
 
1454
#define Tk_FileProc             Tcl_FileProc
 
1455
#define Tk_TimerProc            Tcl_TimerProc
 
1456
#define Tk_TimerToken           Tcl_TimerToken
 
1457
 
 
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
 
1467
 
 
1468
/* Additional stuff that has moved to Tcl: */
 
1469
 
 
1470
#define Tk_EventuallyFree       Tcl_EventuallyFree
 
1471
#define Tk_FreeProc             Tcl_FreeProc
 
1472
#define Tk_Preserve             Tcl_Preserve
 
1473
#define Tk_Release              Tcl_Release
 
1474
 
 
1475
/* Removed Tk_Main, use macro instead */
 
1476
#ifdef _WIN32
 
1477
#define Tk_Main(argc, argv, proc) Tk_MainEx(argc, argv, proc, \
 
1478
        (Tcl_FindExecutable(0), (Tcl_CreateInterp)()))
 
1479
#else
 
1480
#define Tk_Main(argc, argv, proc) Tk_MainEx(argc, argv, proc, \
 
1481
        (Tcl_FindExecutable(argv[0]), (Tcl_CreateInterp)()))
 
1482
#endif
 
1483
const char *            Tk_InitStubs(Tcl_Interp *interp, const char *version,
 
1484
                                int exact);
 
1485
EXTERN const char *     Tk_PkgInitStubsCheck(Tcl_Interp *interp,
 
1486
                                const char *version, int exact);
 
1487
 
 
1488
#ifndef USE_TK_STUBS
 
1489
#define Tk_InitStubs(interp, version, exact) \
 
1490
    Tk_PkgInitStubsCheck(interp, version, exact)
 
1491
#endif /* USE_TK_STUBS */
 
1492
 
 
1493
#define Tk_InitImageArgs(interp, argc, argv) /**/
 
1494
 
 
1495
/*
 
1496
 *----------------------------------------------------------------------
 
1497
 *
 
1498
 * Additional procedure types defined by Tk.
 
1499
 *
 
1500
 *----------------------------------------------------------------------
 
1501
 */
 
1502
 
 
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,
 
1511
        XEvent *eventPtr);
 
1512
typedef int (Tk_SelectionProc) (ClientData clientData, int offset,
 
1513
        char *buffer, int maxBytes);
 
1514
 
 
1515
/*
 
1516
 *----------------------------------------------------------------------
 
1517
 *
 
1518
 * Platform independent exported procedures and variables.
 
1519
 *
 
1520
 *----------------------------------------------------------------------
 
1521
 */
 
1522
 
 
1523
#include "tkDecls.h"
 
1524
 
 
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 */
 
1531
 
 
1532
/*
 
1533
 *----------------------------------------------------------------------
 
1534
 *
 
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.
 
1537
 *
 
1538
 * This goes after the inclusion of the stubbed-decls so that the declarations
 
1539
 * of what is actually there can be correct.
 
1540
 */
 
1541
 
 
1542
#ifdef USE_COMPOSITELESS_PHOTO_PUT_BLOCK
 
1543
#   ifdef Tk_PhotoPutBlock
 
1544
#       undef Tk_PhotoPutBlock
 
1545
#   endif
 
1546
#   define Tk_PhotoPutBlock             Tk_PhotoPutBlock_NoComposite
 
1547
#   ifdef Tk_PhotoPutZoomedBlock
 
1548
#       undef Tk_PhotoPutZoomedBlock
 
1549
#   endif
 
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
 
1556
#       endif
 
1557
#       define Tk_PhotoPutBlock         Tk_PhotoPutBlock_Panic
 
1558
#       ifdef Tk_PhotoPutZoomedBlock
 
1559
#           undef Tk_PhotoPutZoomedBlock
 
1560
#       endif
 
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
 
1567
#   endif
 
1568
#   define Tk_PhotoExpand               Tk_PhotoExpand_Panic
 
1569
#   ifdef Tk_PhotoSetSize
 
1570
#       undef Tk_PhotoSetSize
 
1571
#   endif
 
1572
#   define Tk_PhotoSetSize              Tk_PhotoSetSize_Panic
 
1573
#endif /* USE_PANIC_ON_PHOTO_ALLOC_FAILURE */
 
1574
 
 
1575
#undef TCL_STORAGE_CLASS
 
1576
#define TCL_STORAGE_CLASS DLLIMPORT
 
1577
 
 
1578
#endif /* RC_INVOKED */
 
1579
 
 
1580
/*
 
1581
 * end block for C++
 
1582
 */
 
1583
 
 
1584
#ifdef __cplusplus
 
1585
}
 
1586
#endif
 
1587
 
 
1588
#endif /* _TK */
 
1589
 
 
1590
/*
 
1591
 * Local Variables:
 
1592
 * mode: c
 
1593
 * c-basic-offset: 4
 
1594
 * fill-column: 78
 
1595
 * End:
 
1596
 */