tk.h 57 KB

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