summaryrefslogtreecommitdiffstats
path: root/generic/tk.h
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tk.h')
-rw-r--r--generic/tk.h136
1 files changed, 33 insertions, 103 deletions
diff --git a/generic/tk.h b/generic/tk.h
index dd82f64..5001753 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -141,6 +141,14 @@ typedef struct Tk_StyledElement_ *Tk_StyledElement;
*/
typedef const char *Tk_Uid;
+
+#ifndef Tcl_Size
+# if TCL_MAJOR_VERSION > 8
+# define Tcl_Size size_t
+# else
+# define Tcl_Size int
+# endif
+#endif
/*
*----------------------------------------------------------------------
@@ -190,14 +198,13 @@ typedef struct Tk_OptionSpec {
const char *defValue; /* Default value for option if not specified
* in command line, the option database, or
* the system. */
-#if TCL_MAJOR_VERSION > 8
- size_t objOffset; /* Where in record to store a Tcl_Obj * that
+ Tcl_Size objOffset; /* Where in record to store a Tcl_Obj * that
* holds the value of this option, specified
* as an offset in bytes from the start of the
* record. Use the offsetof macro to generate
* values for this. TCL_INDEX_NONE means don't
* store the Tcl_Obj in the record. */
- size_t internalOffset; /* Where in record to store the internal
+ Tcl_Size internalOffset; /* Where in record to store the internal
* representation of the value of this option,
* such as an int or XColor *. This field is
* specified as an offset in bytes from the
@@ -205,10 +212,6 @@ typedef struct Tk_OptionSpec {
* macro to generate values for it.
* TCL_INDEX_NONE means don't store the
* internal representation in the record. */
-#else
- int objOffset;
- int internalOffset;
-#endif
int flags; /* Any combination of the values defined
* below. */
const void *clientData; /* An alternate place to put option-specific
@@ -237,19 +240,11 @@ typedef struct Tk_OptionSpec {
* option config code to handle a custom option.
*/
-#if TCL_MAJOR_VERSION > 8
typedef int (Tk_CustomOptionSetProc) (ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj **value, char *widgRec,
- size_t offset, char *saveInternalPtr, int flags);
+ Tcl_Size offset, char *saveInternalPtr, int flags);
typedef Tcl_Obj *(Tk_CustomOptionGetProc) (ClientData clientData,
- Tk_Window tkwin, char *widgRec, size_t offset);
-#else
-typedef int (Tk_CustomOptionSetProc) (ClientData clientData,
- Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj **value, char *widgRec,
- int offset, char *saveInternalPtr, int flags);
-typedef Tcl_Obj *(Tk_CustomOptionGetProc) (ClientData clientData,
- Tk_Window tkwin, char *widgRec, int offset);
-#endif
+ Tk_Window tkwin, char *widgRec, Tcl_Size offset);
typedef void (Tk_CustomOptionRestoreProc) (ClientData clientData,
Tk_Window tkwin, char *internalPtr, char *saveInternalPtr);
typedef void (Tk_CustomOptionFreeProc) (ClientData clientData, Tk_Window tkwin,
@@ -325,11 +320,7 @@ typedef struct Tk_SavedOptions {
* configuration options. */
Tk_Window tkwin; /* Window associated with recordPtr; needed to
* restore certain options. */
-#if TCL_MAJOR_VERSION > 8
- size_t numItems; /* The number of valid items in items field. */
-#else
- int numItems;
-#endif
+ Tcl_Size numItems; /* The number of valid items in items field. */
Tk_SavedOption items[TK_NUM_SAVED_OPTIONS];
/* Items used to hold old values. */
struct Tk_SavedOptions *nextPtr;
@@ -353,17 +344,10 @@ typedef struct Tk_SavedOptions {
#ifndef __NO_OLD_CONFIG
-#if TCL_MAJOR_VERSION > 8
typedef int (Tk_OptionParseProc) (ClientData clientData, Tcl_Interp *interp,
- Tk_Window tkwin, const char *value, char *widgRec, size_t offset);
+ Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset);
typedef const char *(Tk_OptionPrintProc) (ClientData clientData,
- Tk_Window tkwin, char *widgRec, size_t offset, Tcl_FreeProc **freeProcPtr);
-#else
-typedef int (Tk_OptionParseProc) (ClientData clientData, Tcl_Interp *interp,
- Tk_Window tkwin, const char *value, char *widgRec, int offset);
-typedef const char *(Tk_OptionPrintProc) (ClientData clientData,
- Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr);
-#endif
+ Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr);
typedef struct Tk_CustomOption {
Tk_OptionParseProc *parseProc;
@@ -394,13 +378,9 @@ typedef struct Tk_ConfigSpec {
Tk_Uid dbClass; /* Class for option in database. */
Tk_Uid defValue; /* Default value for option if not specified
* in command line or database. */
-#if TCL_MAJOR_VERSION > 8
- size_t offset; /* Where in widget record to store value; use
+ Tcl_Size offset; /* Where in widget record to store value; use
* offsetof macro to generate values for
* this. */
-#else
- int offset;
-#endif
int specFlags; /* Any combination of the values defined
* below; other bits are used internally by
* tkConfig.c. */
@@ -609,11 +589,7 @@ typedef void (Tk_ClassWorldChangedProc) (ClientData instanceData);
typedef void (Tk_ClassModalProc) (Tk_Window tkwin, XEvent *eventPtr);
typedef struct Tk_ClassProcs {
-#if TCL_MAJOR_VERSION > 8
- size_t size;
-#else
- unsigned int size;
-#endif
+ Tcl_Size size;
Tk_ClassWorldChangedProc *worldChangedProc;
/* Procedure to invoke when the widget needs
* to respond in some way to a change in the
@@ -837,13 +813,8 @@ typedef struct Tk_FakeWin {
XIC dummy9; /* inputContext */
#endif /* TK_USE_INPUT_METHODS */
ClientData *dummy10; /* tagPtr */
-#if TCL_MAJOR_VERSION > 8
- size_t dummy11; /* numTags */
- size_t dummy12; /* optionLevel */
-#else
- int dummy11;
- int dummy12;
-#endif
+ Tcl_Size dummy11; /* numTags */
+ Tcl_Size dummy12; /* optionLevel */
char *dummy13; /* selHandlerList */
char *dummy14; /* geomMgrPtr */
ClientData dummy15; /* geomData */
@@ -990,12 +961,8 @@ typedef struct Tk_SmoothMethod {
#define TK_TAG_SPACE 3
typedef struct Tk_Item {
-#if TCL_MAJOR_VERSION > 8
- size_t id; /* Unique identifier for this item (also
+ Tcl_Size id; /* Unique identifier for this item (also
* serves as first tag for item). */
-#else
- int id;
-#endif
struct Tk_Item *nextPtr; /* Next in display list of all items in this
* canvas. Later items in list are drawn on
* top of earlier ones. */
@@ -1004,14 +971,10 @@ typedef struct Tk_Item {
Tk_Uid *tagPtr; /* Pointer to array of tags. Usually points to
* staticTagSpace, but may point to malloc-ed
* space if there are lots of tags. */
-#if TCL_MAJOR_VERSION > 8
- size_t tagSpace; /* Total amount of tag space available at
+ Tcl_Size tagSpace; /* Total amount of tag space available at
* tagPtr. */
- size_t numTags; /* Number of tag slots actually used at
+ Tcl_Size numTags; /* Number of tag slots actually used at
* *tagPtr. */
-#else
- int tagSpace, numTags;
-#endif
struct Tk_ItemType *typePtr;/* Table of procedures that implement this
* type of item. */
int x1, y1, x2, y2; /* Bounding box for item, in integer canvas
@@ -1073,17 +1036,10 @@ typedef int (Tk_ItemConfigureProc)(Tcl_Interp *interp, Tk_Canvas canvas,
int flags);
typedef int (Tk_ItemCoordProc)(Tcl_Interp *interp, Tk_Canvas canvas,
Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]);
-#if TCL_MAJOR_VERSION > 8
typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
- size_t beforeThis, Tcl_Obj *string);
+ Tcl_Size beforeThis, Tcl_Obj *string);
typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas,
- Tk_Item *itemPtr, Tcl_Obj *indexString, size_t *indexPtr);
-#else
-typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
- int beforeThis, Tcl_Obj *string);
-typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas,
- Tk_Item *itemPtr, Tcl_Obj *indexString, int *indexPtr);
-#endif
+ Tk_Item *itemPtr, Tcl_Obj *indexString, Tcl_Size *indexPtr);
#endif /* USE_OLD_CANVAS */
typedef void (Tk_ItemDeleteProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
Display *display);
@@ -1103,33 +1059,20 @@ typedef void (Tk_ItemScaleProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
double scaleY);
typedef void (Tk_ItemTranslateProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
double deltaX, double deltaY);
-#if TCL_MAJOR_VERSION > 8
typedef void (Tk_ItemCursorProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
- size_t index);
+ Tcl_Size index);
typedef size_t (Tk_ItemSelectionProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
- size_t offset, char *buffer, size_t maxBytes);
+ Tcl_Size offset, char *buffer, Tcl_Size maxBytes);
typedef void (Tk_ItemDCharsProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
- size_t first, size_t last);
-#else
-typedef void (Tk_ItemCursorProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
- int index);
-typedef int (Tk_ItemSelectionProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
- int offset, char *buffer, int maxBytes);
-typedef void (Tk_ItemDCharsProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
- int first, int last);
-#endif
+ Tcl_Size first, Tcl_Size last);
#ifndef __NO_OLD_CONFIG
typedef struct Tk_ItemType {
const char *name; /* The name of this type of item, such as
* "line". */
-#if TCL_MAJOR_VERSION > 8
- size_t itemSize; /* Total amount of space needed for item's
+ Tcl_Size itemSize; /* Total amount of space needed for item's
* record. */
-#else
- int itemSize;
-#endif
Tk_ItemCreateProc *createProc;
/* Procedure to create a new item of this
* type. */
@@ -1211,25 +1154,17 @@ typedef struct Tk_CanvasTextInfo {
Tk_Item *selItemPtr; /* Pointer to selected item. NULL means
* selection isn't in this canvas. Writable by
* items. */
-#if TCL_MAJOR_VERSION > 8
- size_t selectFirst; /* Character index of first selected
+ Tcl_Size selectFirst; /* Character index of first selected
* character. Writable by items. */
- size_t selectLast; /* Character index of last selected character.
+ Tcl_Size selectLast; /* Character index of last selected character.
* Writable by items. */
-#else
- int selectFirst, selectLast;
-#endif
Tk_Item *anchorItemPtr; /* Item corresponding to "selectAnchor": not
* necessarily selItemPtr. Read-only to
* items. */
-#if TCL_MAJOR_VERSION > 8
- size_t selectAnchor; /* Character index of fixed end of selection
+ Tcl_Size selectAnchor; /* Character index of fixed end of selection
* (i.e. "select to" operation will use this
* as one end of the selection). Writable by
* items. */
-#else
- int selectAnchor;
-#endif
Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion
* cursor. Read-only to items. */
int insertWidth; /* Total width of insertion cursor. Read-only
@@ -1689,13 +1624,8 @@ typedef int (Tk_GetSelProc) (ClientData clientData, Tcl_Interp *interp,
typedef void (Tk_LostSelProc) (ClientData clientData);
typedef Tk_RestrictAction (Tk_RestrictProc) (ClientData clientData,
XEvent *eventPtr);
-#if TCL_MAJOR_VERSION > 8
-typedef size_t (Tk_SelectionProc) (ClientData clientData, size_t offset,
- char *buffer, size_t maxBytes);
-#else
-typedef int (Tk_SelectionProc) (ClientData clientData, int offset,
- char *buffer, int maxBytes);
-#endif
+typedef size_t (Tk_SelectionProc) (ClientData clientData, Tcl_Size offset,
+ char *buffer, Tcl_Size maxBytes);
/*
*----------------------------------------------------------------------