⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tk.h

📁 是初学者升入中级必看的书籍
💻 H
📖 第 1 页 / 共 4 页
字号:
/* * Possible flag values for Tk_ConfigSpec structures.  Any bits at * or above TK_CONFIG_USER_BIT may be used by clients for selecting * certain entries.  Before changing any values here, coordinate with * tkOldConfig.c (internal-use-only flags are defined there). */#define TK_CONFIG_NULL_OK		(1 << 0)#define TK_CONFIG_COLOR_ONLY		(1 << 1)#define TK_CONFIG_MONO_ONLY		(1 << 2)#define TK_CONFIG_DONT_SET_DEFAULT	(1 << 3)#define TK_CONFIG_OPTION_SPECIFIED      (1 << 4)#define TK_CONFIG_USER_BIT		0x100#endif /* __NO_OLD_CONFIG *//* * Structure used to specify how to handle argv options. */typedef struct {    char *key;		/* The key string that flags the option in the			 * argv array. */    int type;		/* Indicates option type;  see below. */    char *src;		/* Value to be used in setting dst;  usage			 * depends on type. */    char *dst;		/* Address of value to be modified;  usage			 * depends on type. */    char *help;		/* Documentation message describing this option. */} Tk_ArgvInfo;/* * Legal values for the type field of a Tk_ArgvInfo: see the user * documentation for details. */#define TK_ARGV_CONSTANT		15#define TK_ARGV_INT			16#define TK_ARGV_STRING			17#define TK_ARGV_UID			18#define TK_ARGV_REST			19#define TK_ARGV_FLOAT			20#define TK_ARGV_FUNC			21#define TK_ARGV_GENFUNC			22#define TK_ARGV_HELP			23#define TK_ARGV_CONST_OPTION		24#define TK_ARGV_OPTION_VALUE		25#define TK_ARGV_OPTION_NAME_VALUE	26#define TK_ARGV_END			27/* * Flag bits for passing to Tk_ParseArgv: */#define TK_ARGV_NO_DEFAULTS		0x1#define TK_ARGV_NO_LEFTOVERS		0x2#define TK_ARGV_NO_ABBREV		0x4#define TK_ARGV_DONT_SKIP_FIRST_ARG	0x8/* * Enumerated type for describing actions to be taken in response * to a restrictProc established by Tk_RestrictEvents. */typedef enum {    TK_DEFER_EVENT, TK_PROCESS_EVENT, TK_DISCARD_EVENT} Tk_RestrictAction;/* * Priority levels to pass to Tk_AddOption: */#define TK_WIDGET_DEFAULT_PRIO	20#define TK_STARTUP_FILE_PRIO	40#define TK_USER_DEFAULT_PRIO	60#define TK_INTERACTIVE_PRIO	80#define TK_MAX_PRIO		100/* * Relief values returned by Tk_GetRelief: */#define TK_RELIEF_NULL		-1#define TK_RELIEF_FLAT		0#define TK_RELIEF_GROOVE	1#define TK_RELIEF_RAISED	2#define TK_RELIEF_RIDGE		3#define TK_RELIEF_SOLID		4#define TK_RELIEF_SUNKEN	5/* * "Which" argument values for Tk_3DBorderGC: */#define TK_3D_FLAT_GC		1#define TK_3D_LIGHT_GC		2#define TK_3D_DARK_GC		3/* * 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/* * Widget class procedures used to implement platform specific widget * behavior. */typedef Window (Tk_ClassCreateProc) _ANSI_ARGS_((Tk_Window tkwin,	Window parent, ClientData instanceData));typedef void (Tk_ClassWorldChangedProc) _ANSI_ARGS_((ClientData instanceData));typedef void (Tk_ClassModalProc) _ANSI_ARGS_((Tk_Window tkwin,	XEvent *eventPtr));typedef struct Tk_ClassProcs {    unsigned int size;    Tk_ClassWorldChangedProc *worldChangedProc;				/* Procedure to invoke when the widget needs to				 * respond in some way to a change in the				 * world (font changes, etc.) */    Tk_ClassCreateProc *createProc;				/* Procedure to invoke when the				 * platform-dependent window needs to be                                 * created. */    Tk_ClassModalProc *modalProc;				/* Procedure to invoke after all bindings on a				 * widget have been triggered in order to				 * handle a modal loop. */} Tk_ClassProcs;/* * Simple accessor for Tk_ClassProcs structure.  Checks that the structure * is not NULL, then checks the size field and returns either the requested * field, if present, or NULL if the structure is too small to have the field * (or NULL if the structure is NULL). * * A more general version of this function may be useful if other * size-versioned structure pop up in the future: * *	#define Tk_GetField(name, who, which) \ *	    (((who) == NULL) ? NULL : *	    (((who)->size <= Tk_Offset(name, which)) ? NULL :(name)->which)) */#define Tk_GetClassProc(procs, which) \    (((procs) == NULL) ? NULL : \    (((procs)->size <= Tk_Offset(Tk_ClassProcs, which)) ? NULL:(procs)->which))/* * 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 MouseWheelEvent     (LASTEvent + 3)#define TK_LASTEVENT	    (LASTEvent + 4)#define MouseWheelMask	    (1L << 28)#define ActivateMask	    (1L << 29)#define VirtualEventMask    (1L << 30)#define TK_LASTEVENT	    (LASTEvent + 4)/* * 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_HasWrapper(tkwin) \    (((Tk_FakeWin *) (tkwin))->flags & TK_HAS_WRAPPER)#define Tk_WinManaged(tkwin) \    (((Tk_FakeWin *) (tkwin))->flags & TK_WIN_MANAGED)#define Tk_TopWinHierarchy(tkwin) \    (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY)#define Tk_ReqWidth(tkwin)		(((Tk_FakeWin *) (tkwin))->reqWidth)#define Tk_ReqHeight(tkwin)		(((Tk_FakeWin *) (tkwin))->reqHeight)/* Tk_InternalBorderWidth is deprecated */#define Tk_InternalBorderWidth(tkwin) \    (((Tk_FakeWin *) (tkwin))->internalBorderLeft)#define Tk_InternalBorderLeft(tkwin) \    (((Tk_FakeWin *) (tkwin))->internalBorderLeft)#define Tk_InternalBorderRight(tkwin) \    (((Tk_FakeWin *) (tkwin))->internalBorderRight)#define Tk_InternalBorderTop(tkwin) \    (((Tk_FakeWin *) (tkwin))->internalBorderTop)#define Tk_InternalBorderBottom(tkwin) \    (((Tk_FakeWin *) (tkwin))->internalBorderBottom)#define Tk_MinReqWidth(tkwin)		(((Tk_FakeWin *) (tkwin))->minReqWidth)#define Tk_MinReqHeight(tkwin)		(((Tk_FakeWin *) (tkwin))->minReqHeight)#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;		/* dispPtr */    int screenNum;    Visual *visual;    int depth;    Window window;    char *dummy2;		/* childList */    char *dummy3;		/* lastChildPtr */    Tk_Window parentPtr;	/* parentPtr */    char *dummy4;		/* nextPtr */    char *dummy5;		/* mainPtr */    char *pathName;    Tk_Uid nameUid;    Tk_Uid classUid;    XWindowChanges changes;    unsigned int dummy6;	/* dirtyChanges */    XSetWindowAttributes atts;    unsigned long dummy7;	/* dirtyAtts */    unsigned int flags;    char *dummy8;		/* handlerList */#ifdef TK_USE_INPUT_METHODS    XIC dummy9;			/* inputContext */#endif /* TK_USE_INPUT_METHODS */    ClientData *dummy10;	/* tagPtr */    int dummy11;		/* numTags */    int dummy12;		/* optionLevel */    char *dummy13;		/* selHandlerList */    char *dummy14;		/* geomMgrPtr */    ClientData dummy15;		/* geomData */    int reqWidth, reqHeight;    int internalBorderLeft;    char *dummy16;		/* wmInfoPtr */    char *dummy17;		/* classProcPtr */    ClientData dummy18;		/* instanceData */    char *dummy19;		/* privatePtr */    int internalBorderRight;    int internalBorderTop;    int internalBorderBottom;    int minReqWidth;    int minReqHeight;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -