📄 tk.h
字号:
* Special EnterNotify/LeaveNotify "mode" for use in events * generated by tkShare.c. Pick a high enough value that it's * unlikely to conflict with existing values (like NotifyNormal) * or any new values defined in the future. */#define TK_NOTIFY_SHARE 20/* * Enumerated type for describing a point by which to anchor something: */typedef enum { TK_ANCHOR_N, TK_ANCHOR_NE, TK_ANCHOR_E, TK_ANCHOR_SE, TK_ANCHOR_S, TK_ANCHOR_SW, TK_ANCHOR_W, TK_ANCHOR_NW, TK_ANCHOR_CENTER} Tk_Anchor;/* * Enumerated type for describing a style of justification: */typedef enum { TK_JUSTIFY_LEFT, TK_JUSTIFY_RIGHT, TK_JUSTIFY_CENTER} Tk_Justify;/* * The following structure is used by Tk_GetFontMetrics() to return * information about the properties of a Tk_Font. */typedef struct Tk_FontMetrics { int ascent; /* The amount in pixels that the tallest * letter sticks up above the baseline, plus * any extra blank space added by the designer * of the font. */ int descent; /* The largest amount in pixels that any * letter sticks below the baseline, plus any * extra blank space added by the designer of * the font. */ int linespace; /* The sum of the ascent and descent. How * far apart two lines of text in the same * font should be placed so that none of the * characters in one line overlap any of the * characters in the other line. */} Tk_FontMetrics;/* * Flags passed to Tk_MeasureChars: */#define TK_WHOLE_WORDS 1#define TK_AT_LEAST_ONE 2#define TK_PARTIAL_OK 4/* * Flags passed to Tk_ComputeTextLayout: */#define TK_IGNORE_TABS 8#define TK_IGNORE_NEWLINES 16/* * Each geometry manager (the packer, the placer, etc.) is represented * by a structure of the following form, which indicates procedures * to invoke in the geometry manager to carry out certain functions. */typedef void (Tk_GeomRequestProc) _ANSI_ARGS_((ClientData clientData, Tk_Window tkwin));typedef void (Tk_GeomLostSlaveProc) _ANSI_ARGS_((ClientData clientData, Tk_Window tkwin));typedef struct Tk_GeomMgr { char *name; /* Name of the geometry manager (command * used to invoke it, or name of widget * class that allows embedded widgets). */ Tk_GeomRequestProc *requestProc; /* Procedure to invoke when a slave's * requested geometry changes. */ Tk_GeomLostSlaveProc *lostSlaveProc; /* Procedure to invoke when a slave is * taken away from one geometry manager * by another. NULL means geometry manager * doesn't care when slaves are lost. */} Tk_GeomMgr;/* * Result values returned by Tk_GetScrollInfo: */#define TK_SCROLL_MOVETO 1#define TK_SCROLL_PAGES 2#define TK_SCROLL_UNITS 3#define TK_SCROLL_ERROR 4/* *--------------------------------------------------------------------------- * * Extensions to the X event set * *--------------------------------------------------------------------------- */#define VirtualEvent (LASTEvent)#define ActivateNotify (LASTEvent + 1)#define DeactivateNotify (LASTEvent + 2)#define TK_LASTEVENT (LASTEvent + 3)#define VirtualEventMask (1L << 30)#define ActivateMask (1L << 29)#define TK_LASTEVENT (LASTEvent + 3)/* * A virtual event shares most of its fields with the XKeyEvent and * XButtonEvent structures. 99% of the time a virtual event will be * an abstraction of a key or button event, so this structure provides * the most information to the user. The only difference is the changing * of the detail field for a virtual event so that it holds the name of the * virtual event being triggered. */typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* True if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; /* Window on which event was requested. */ Window root; /* root window that the event occured on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* pointer x, y coordinates in event window */ int x_root, y_root; /* coordinates relative to root */ unsigned int state; /* key or button mask */ Tk_Uid name; /* Name of virtual event. */ Bool same_screen; /* same screen flag */} XVirtualEvent;typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* True if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* Window in which event occurred. */} XActivateDeactivateEvent;typedef XActivateDeactivateEvent XActivateEvent;typedef XActivateDeactivateEvent XDeactivateEvent;/* *-------------------------------------------------------------- * * Macros for querying Tk_Window structures. See the * manual entries for documentation. * *-------------------------------------------------------------- */#define Tk_Display(tkwin) (((Tk_FakeWin *) (tkwin))->display)#define Tk_ScreenNumber(tkwin) (((Tk_FakeWin *) (tkwin))->screenNum)#define Tk_Screen(tkwin) (ScreenOfDisplay(Tk_Display(tkwin), \ Tk_ScreenNumber(tkwin)))#define Tk_Depth(tkwin) (((Tk_FakeWin *) (tkwin))->depth)#define Tk_Visual(tkwin) (((Tk_FakeWin *) (tkwin))->visual)#define Tk_WindowId(tkwin) (((Tk_FakeWin *) (tkwin))->window)#define Tk_PathName(tkwin) (((Tk_FakeWin *) (tkwin))->pathName)#define Tk_Name(tkwin) (((Tk_FakeWin *) (tkwin))->nameUid)#define Tk_Class(tkwin) (((Tk_FakeWin *) (tkwin))->classUid)#define Tk_X(tkwin) (((Tk_FakeWin *) (tkwin))->changes.x)#define Tk_Y(tkwin) (((Tk_FakeWin *) (tkwin))->changes.y)#define Tk_Width(tkwin) (((Tk_FakeWin *) (tkwin))->changes.width)#define Tk_Height(tkwin) \ (((Tk_FakeWin *) (tkwin))->changes.height)#define Tk_Changes(tkwin) (&((Tk_FakeWin *) (tkwin))->changes)#define Tk_Attributes(tkwin) (&((Tk_FakeWin *) (tkwin))->atts)#define Tk_IsEmbedded(tkwin) \ (((Tk_FakeWin *) (tkwin))->flags & TK_EMBEDDED)#define Tk_IsContainer(tkwin) \ (((Tk_FakeWin *) (tkwin))->flags & TK_CONTAINER)#define Tk_IsMapped(tkwin) \ (((Tk_FakeWin *) (tkwin))->flags & TK_MAPPED)#define Tk_IsTopLevel(tkwin) \ (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_LEVEL)#define Tk_ReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->reqWidth)#define Tk_ReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->reqHeight)#define Tk_InternalBorderWidth(tkwin) \ (((Tk_FakeWin *) (tkwin))->internalBorderWidth)#define Tk_Parent(tkwin) (((Tk_FakeWin *) (tkwin))->parentPtr)#define Tk_Colormap(tkwin) (((Tk_FakeWin *) (tkwin))->atts.colormap)/* * The structure below is needed by the macros above so that they can * access the fields of a Tk_Window. The fields not needed by the macros * are declared as "dummyX". The structure has its own type in order to * prevent applications from accessing Tk_Window fields except using * official macros. WARNING!! The structure definition must be kept * consistent with the TkWindow structure in tkInt.h. If you change one, * then change the other. See the declaration in tkInt.h for * documentation on what the fields are used for internally. */typedef struct Tk_FakeWin { Display *display; char *dummy1; int screenNum; Visual *visual; int depth; Window window; char *dummy2; char *dummy3; Tk_Window parentPtr; char *dummy4; char *dummy5; char *pathName; Tk_Uid nameUid; Tk_Uid classUid; XWindowChanges changes; unsigned int dummy6; XSetWindowAttributes atts; unsigned long dummy7; unsigned int flags; char *dummy8;#ifdef TK_USE_INPUT_METHODS XIC dummy9;#endif /* TK_USE_INPUT_METHODS */ ClientData *dummy10; int dummy11; int dummy12; char *dummy13; char *dummy14; ClientData dummy15; int reqWidth, reqHeight; int internalBorderWidth; char *dummy16; char *dummy17; ClientData dummy18; char *dummy19;} 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 window (it * was or will be created as a child of * a root window). * 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. */#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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -