📄 tk.h
字号:
} Tk_FakeWin;/* * Flag values for TkWindow (and Tk_FakeWin) structures are: * * TK_MAPPED: 1 means window is currently mapped, * 0 means unmapped. * TK_TOP_LEVEL: 1 means this is a top-level widget. * TK_ALREADY_DEAD: 1 means the window is in the process of * being destroyed already. * TK_NEED_CONFIG_NOTIFY: 1 means that the window has been reconfigured * before it was made to exist. At the time of * making it exist a ConfigureNotify event needs * to be generated. * TK_GRAB_FLAG: Used to manage grabs. See tkGrab.c for * details. * TK_CHECKED_IC: 1 means we've already tried to get an input * context for this window; if the ic field * is NULL it means that there isn't a context * for the field. * TK_DONT_DESTROY_WINDOW: 1 means that Tk_DestroyWindow should not * invoke XDestroyWindow to destroy this widget's * X window. The flag is set when the window * has already been destroyed elsewhere (e.g. * by another application) or when it will be * destroyed later (e.g. by destroying its * parent). * TK_WM_COLORMAP_WINDOW: 1 means that this window has at some time * appeared in the WM_COLORMAP_WINDOWS property * for its toplevel, so we have to remove it * from that property if the window is * deleted and the toplevel isn't. * TK_EMBEDDED: 1 means that this window (which must be a * toplevel) is not a free-standing window but * rather is embedded in some other application. * TK_CONTAINER: 1 means that this window is a container, and * that some other application (either in * this process or elsewhere) may be * embedding itself inside the window. * TK_BOTH_HALVES: 1 means that this window is used for * application embedding (either as * container or embedded application), and * both the containing and embedded halves * are associated with windows in this * particular process. * TK_DEFER_MODAL: 1 means that this window has deferred a modal * loop until all of the bindings for the current * event have been invoked. * TK_WRAPPER: 1 means that this window is the extra * wrapper window created around a toplevel * to hold the menubar under Unix. See * tkUnixWm.c for more information. * TK_REPARENTED: 1 means that this window has been reparented * so that as far as the window system is * concerned it isn't a child of its Tk * parent. Initially this is used only for * special Unix menubar windows. * TK_ANONYMOUS_WINDOW: 1 means that this window has no name, and is * thus not accessible from Tk. * TK_HAS_WRAPPER 1 means that this window has a wrapper window * TK_WIN_MANAGED 1 means that this window is a child of the * root window, and is managed by the window * manager. * TK_TOP_HIERARCHY 1 means this window is at the top of a * physical window hierarchy within this * process, i.e. the window's parent * either doesn't exist or is not owned by * this Tk application. * TK_PROP_PROPCHANGE 1 means that PropertyNotify events in * this window's children should propagate * up to this window. */#define TK_MAPPED 1#define TK_TOP_LEVEL 2#define TK_ALREADY_DEAD 4#define TK_NEED_CONFIG_NOTIFY 8#define TK_GRAB_FLAG 0x10#define TK_CHECKED_IC 0x20#define TK_DONT_DESTROY_WINDOW 0x40#define TK_WM_COLORMAP_WINDOW 0x80#define TK_EMBEDDED 0x100#define TK_CONTAINER 0x200#define TK_BOTH_HALVES 0x400#define TK_DEFER_MODAL 0x800#define TK_WRAPPER 0x1000#define TK_REPARENTED 0x2000#define TK_ANONYMOUS_WINDOW 0x4000#define TK_HAS_WRAPPER 0x8000#define TK_WIN_MANAGED 0x10000#define TK_TOP_HIERARCHY 0x20000#define TK_PROP_PROPCHANGE 0x40000/* *-------------------------------------------------------------- * * Procedure prototypes and structures used for defining new canvas * items: * *-------------------------------------------------------------- */typedef enum { TK_STATE_NULL = -1, TK_STATE_ACTIVE, TK_STATE_DISABLED, TK_STATE_NORMAL, TK_STATE_HIDDEN} Tk_State;typedef struct Tk_SmoothMethod { char *name; int (*coordProc) _ANSI_ARGS_((Tk_Canvas canvas, double *pointPtr, int numPoints, int numSteps, XPoint xPoints[], double dblPoints[])); void (*postscriptProc) _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, double *coordPtr, int numPoints, int numSteps));} Tk_SmoothMethod;/* * For each item in a canvas widget there exists one record with * the following structure. Each actual item is represented by * a record with the following stuff at its beginning, plus additional * type-specific stuff after that. */#define TK_TAG_SPACE 3typedef struct Tk_Item { int id; /* Unique identifier for this item * (also serves as first tag for * item). */ 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. */ Tk_Uid staticTagSpace[TK_TAG_SPACE];/* Built-in space for limited # of * tags. */ 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. */ int tagSpace; /* Total amount of tag space available * at tagPtr. */ int numTags; /* Number of tag slots actually used * at *tagPtr. */ 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 units. Set by item-specific * code and guaranteed to contain every * pixel drawn in item. Item area * includes x1 and y1 but not x2 * and y2. */ struct Tk_Item *prevPtr; /* Previous in display list of all * items in this canvas. Later items * in list are drawn just below earlier * ones. */ Tk_State state; /* state of item */ char *reserved1; /* reserved for future use */ int redraw_flags; /* some flags used in the canvas */ /* *------------------------------------------------------------------ * Starting here is additional type-specific stuff; see the * declarations for individual types to see what is part of * each type. The actual space below is determined by the * "itemInfoSize" of the type's Tk_ItemType record. *------------------------------------------------------------------ */} Tk_Item;/* * Flag bits for canvases (redraw_flags): * * TK_ITEM_STATE_DEPENDANT - 1 means that object needs to be * redrawn if the canvas state changes. * TK_ITEM_DONT_REDRAW - 1 means that the object redraw is already * been prepared, so the general canvas code * doesn't need to do that any more. */#define TK_ITEM_STATE_DEPENDANT 1#define TK_ITEM_DONT_REDRAW 2/* * Records of the following type are used to describe a type of * item (e.g. lines, circles, etc.) that can form part of a * canvas widget. */#ifdef USE_OLD_CANVAStypedef int Tk_ItemCreateProc _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int argc, char **argv));typedef int Tk_ItemConfigureProc _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int argc, char **argv, int flags));typedef int Tk_ItemCoordProc _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int argc, char **argv));#elsetypedef int Tk_ItemCreateProc _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int argc, Tcl_Obj *CONST objv[]));typedef int Tk_ItemConfigureProc _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int argc, Tcl_Obj *CONST objv[], int flags));typedef int Tk_ItemCoordProc _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int argc, Tcl_Obj *CONST argv[]));#endiftypedef void Tk_ItemDeleteProc _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, Display *display));typedef void Tk_ItemDisplayProc _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, int x, int y, int width, int height));typedef double Tk_ItemPointProc _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, double *pointPtr));typedef int Tk_ItemAreaProc _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr));typedef int Tk_ItemPostscriptProc _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass));typedef void Tk_ItemScaleProc _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY));typedef void Tk_ItemTranslateProc _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY));typedef int Tk_ItemIndexProc _ANSI_ARGS_((Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, char *indexString, int *indexPtr));typedef void Tk_ItemCursorProc _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, int index));typedef int Tk_ItemSelectionProc _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, int offset, char *buffer, int maxBytes));typedef void Tk_ItemInsertProc _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, int beforeThis, char *string));typedef void Tk_ItemDCharsProc _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, int first, int last));#ifndef __NO_OLD_CONFIGtypedef struct Tk_ItemType { char *name; /* The name of this type of item, such * as "line". */ int itemSize; /* Total amount of space needed for * item's record. */ Tk_ItemCreateProc *createProc; /* Procedure to create a new item of * this type. */ Tk_ConfigSpec *configSpecs; /* Pointer to array of configuration * specs for this type. Used for * returning configuration info. */ Tk_ItemConfigureProc *configProc; /* Procedure to call to change * configuration options. */ Tk_ItemCoordProc *coordProc; /* Procedure to call to get and set * the item's coordinates. */ Tk_ItemDeleteProc *deleteProc; /* Procedure to delete existing item of * this type. */ Tk_ItemDisplayProc *displayProc; /* Procedure to display items of * this type. */ int alwaysRedraw; /* Non-zero means displayProc should * be called even when the item has * been moved off-screen. */ Tk_ItemPointProc *pointProc; /* Computes distance from item to * a given point. */ Tk_ItemAreaProc *areaProc; /* Computes whether item is inside, * outside, or overlapping an area. */ Tk_ItemPostscriptProc *postscriptProc; /* Procedure to write a Postscript * description for items of this * type. */ Tk_ItemScaleProc *scaleProc; /* Procedure to rescale items of * this type. */ Tk_ItemTranslateProc *translateProc;/* Procedure to translate items of * this type. */ Tk_ItemIndexProc *indexProc; /* Procedure to determine index of * indicated character. NULL if * item doesn't support indexing. */ Tk_ItemCursorProc *icursorProc; /* Procedure to set insert cursor pos. * to just before a given position. */ Tk_ItemSelectionProc *selectionProc;/* Procedure to return selection (in * STRING format) when it is in this * item. */ Tk_ItemInsertProc *insertProc; /* Procedure to insert something into * an item. */ Tk_ItemDCharsProc *dCharsProc; /* Procedure to delete characters * from an item. */ struct Tk_ItemType *nextPtr; /* Used to link types together into * a list. */ char *reserved1; /* Reserved for future extension. */ int reserved2; /* Carefully compatible with */ char *reserved3; /* Jan Nijtmans dash patch */ char *reserved4;} Tk_ItemType;#endif/* * The following structure provides information about the selection and * the insertion cursor. It is needed by only a few items, such as * those that display text. It is shared by the generic canvas code * and the item-specific code, but most of the fields should be written * only by the canvas generic code. */typedef struct Tk_CanvasTextInfo { Tk_3DBorder selBorder; /* Border and background for selected * characters. Read-only to items.*/ int selBorderWidth; /* Width of border around selection. * Read-only to items. */ XColor *selFgColorPtr; /* Foreground color for selected text. * Read-only to items. */ Tk_Item *selItemPtr; /* Pointer to selected item. NULL means * selection isn't in this canvas. * Writable by items. */ int selectFirst; /* Character index of first selected * character. Writable by items. */ int selectLast; /* Character index of last selected * character. Writable by items. */ Tk_Item *anchorItemPtr; /* Item corresponding to "selectAnchor": * not necessarily selItemPtr. Read-only * to items. */ int 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. */ Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion * cursor. Read-only to items. */ int insertWidth; /* Total width of insertion cursor. Read-only * to items. */ int insertBorderWidth; /* Width of 3-D border around insert cursor. * Read-only to items. */ Tk_Item *focusItemPtr; /* Item that currently has the input focus, * or NULL if no such item. Read-only to * items. */ int gotFocus; /* Non-zero means that the canvas widget has * the input focus. Read-only to items.*/ int cursorOn; /* Non-zero means that an insertion cursor * should be displayed in focusItemPtr. * Read-only to items.*/} Tk_CanvasTextInfo;/* * Structures used for Dashing and Outline. */typedef struct Tk_Dash { int number; union { char *pt; char array[sizeof(char *)]; } pattern;} Tk_Dash;typedef struct Tk_TSOffset { int flags; /* flags; see below for possible values */ int xoffset; /* x offset */ int yoffset; /* y offset */} Tk_TSOffset;/* * Bit fields in Tk_Offset->flags: */#define TK_OFFSET_INDEX 1#define TK_OFFSET_RELATIVE 2#define TK_OFFSET_LEFT 4#define TK_OFFSET_CENTER 8#define TK_OFFSET_RIGHT 16#define TK_OFFSET_TOP 32#define TK_OFFSET_MIDDLE 64#define TK_OFFSET_BOTTOM 128typedef struct Tk_Outline { GC gc; /* Graphics context. */ double width; /* Width of outline. */ double activeWidth; /* Width of outline. */ double disabledWidth; /* Width of outline. */ int offset; /* Dash offset */ Tk_Dash dash; /* Dash pattern */ Tk_Dash activeDash; /* Dash pattern if state is active*/ Tk_Dash disabledDash; /* Dash pattern if state is disabled*/ VOID *reserved1; /* reserved for future expansion */ VOID *reserved2; VOID *reserved3; Tk_TSOffset tsoffset; /* stipple offset for outline*/ XColor *color; /* Outline color. */ XColor *activeColor; /* Outline color if state is active. */ XColor *disabledColor; /* Outline color if state is disabled. */ Pixmap stipple; /* Outline Stipple pattern. */ Pixmap activeStipple; /* Outline Stipple pattern if state is active. */ Pixmap disabledStipple; /* Outline Stipple pattern if state is disabled. */} Tk_Outline;/* *-------------------------------------------------------------- * * Procedure prototypes and structures used for managing images: * *-------------------------------------------------------------- */typedef struct Tk_ImageType Tk_ImageType;#ifdef USE_OLD_IMAGE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -