📄 tk.h
字号:
typedef int (Tk_ImageCreateProc) _ANSI_ARGS_((Tcl_Interp *interp, char *name, int argc, char **argv, Tk_ImageType *typePtr, Tk_ImageMaster master, ClientData *masterDataPtr));#elsetypedef int (Tk_ImageCreateProc) _ANSI_ARGS_((Tcl_Interp *interp, char *name, int objc, Tcl_Obj *CONST objv[], Tk_ImageType *typePtr, Tk_ImageMaster master, ClientData *masterDataPtr));#endiftypedef ClientData (Tk_ImageGetProc) _ANSI_ARGS_((Tk_Window tkwin, ClientData masterData));typedef void (Tk_ImageDisplayProc) _ANSI_ARGS_((ClientData instanceData, Display *display, Drawable drawable, int imageX, int imageY, int width, int height, int drawableX, int drawableY));typedef void (Tk_ImageFreeProc) _ANSI_ARGS_((ClientData instanceData, Display *display));typedef void (Tk_ImageDeleteProc) _ANSI_ARGS_((ClientData masterData));typedef void (Tk_ImageChangedProc) _ANSI_ARGS_((ClientData clientData, int x, int y, int width, int height, int imageWidth, int imageHeight));typedef int (Tk_ImagePostscriptProc) _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo, int x, int y, int width, int height, int prepass));/* * The following structure represents a particular type of image * (bitmap, xpm image, etc.). It provides information common to * all images of that type, such as the type name and a collection * of procedures in the image manager that respond to various * events. Each image manager is represented by one of these * structures. */struct Tk_ImageType { char *name; /* Name of image type. */ Tk_ImageCreateProc *createProc; /* Procedure to call to create a new image * of this type. */ Tk_ImageGetProc *getProc; /* Procedure to call the first time * Tk_GetImage is called in a new way * (new visual or screen). */ Tk_ImageDisplayProc *displayProc; /* Call to draw image, in response to * Tk_RedrawImage calls. */ Tk_ImageFreeProc *freeProc; /* Procedure to call whenever Tk_FreeImage * is called to release an instance of an * image. */ Tk_ImageDeleteProc *deleteProc; /* Procedure to call to delete image. It * will not be called until after freeProc * has been called for each instance of the * image. */ Tk_ImagePostscriptProc *postscriptProc; /* Procedure to call to produce postscript * output for the image. */ struct Tk_ImageType *nextPtr; /* Next in list of all image types currently * known. Filled in by Tk, not by image * manager. */ char *reserved; /* reserved for future expansion */};/* *-------------------------------------------------------------- * * Additional definitions used to manage images of type "photo". * *-------------------------------------------------------------- *//* * The following type is used to identify a particular photo image * to be manipulated: */typedef void *Tk_PhotoHandle;/* * The following structure describes a block of pixels in memory: */typedef struct Tk_PhotoImageBlock { unsigned char *pixelPtr; /* Pointer to the first pixel. */ int width; /* Width of block, in pixels. */ int height; /* Height of block, in pixels. */ int pitch; /* Address difference between corresponding * pixels in successive lines. */ int pixelSize; /* Address difference between successive * pixels in the same line. */ int offset[4]; /* Address differences between the red, green, * blue and alpha components of the pixel and * the pixel as a whole. */} Tk_PhotoImageBlock;/* * The following values control how blocks are combined into photo * images when the alpha component of a pixel is not 255, a.k.a. the * compositing rule. */#define TK_PHOTO_COMPOSITE_OVERLAY 0#define TK_PHOTO_COMPOSITE_SET 1/* * Procedure prototypes and structures used in reading and * writing photo images: */typedef struct Tk_PhotoImageFormat Tk_PhotoImageFormat;#ifdef USE_OLD_IMAGEtypedef int (Tk_ImageFileMatchProc) _ANSI_ARGS_((Tcl_Channel chan, char *fileName, char *formatString, int *widthPtr, int *heightPtr));typedef int (Tk_ImageStringMatchProc) _ANSI_ARGS_((char *string, char *formatString, int *widthPtr, int *heightPtr));typedef int (Tk_ImageFileReadProc) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Channel chan, char *fileName, char *formatString, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY));typedef int (Tk_ImageStringReadProc) _ANSI_ARGS_((Tcl_Interp *interp, char *string, char *formatString, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY));typedef int (Tk_ImageFileWriteProc) _ANSI_ARGS_((Tcl_Interp *interp, char *fileName, char *formatString, Tk_PhotoImageBlock *blockPtr));typedef int (Tk_ImageStringWriteProc) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_DString *dataPtr, char *formatString, Tk_PhotoImageBlock *blockPtr));#elsetypedef int (Tk_ImageFileMatchProc) _ANSI_ARGS_((Tcl_Channel chan, CONST char *fileName, Tcl_Obj *format, int *widthPtr, int *heightPtr, Tcl_Interp *interp));typedef int (Tk_ImageStringMatchProc) _ANSI_ARGS_((Tcl_Obj *dataObj, Tcl_Obj *format, int *widthPtr, int *heightPtr, Tcl_Interp *interp));typedef int (Tk_ImageFileReadProc) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Channel chan, CONST char *fileName, Tcl_Obj *format, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY));typedef int (Tk_ImageStringReadProc) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *dataObj, Tcl_Obj *format, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY));typedef int (Tk_ImageFileWriteProc) _ANSI_ARGS_((Tcl_Interp *interp, CONST char *fileName, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr));typedef int (Tk_ImageStringWriteProc) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr));#endif/* * The following structure represents a particular file format for * storing images (e.g., PPM, GIF, JPEG, etc.). It provides information * to allow image files of that format to be recognized and read into * a photo image. */struct Tk_PhotoImageFormat { char *name; /* Name of image file format */ Tk_ImageFileMatchProc *fileMatchProc; /* Procedure to call to determine whether * an image file matches this format. */ Tk_ImageStringMatchProc *stringMatchProc; /* Procedure to call to determine whether * the data in a string matches this format. */ Tk_ImageFileReadProc *fileReadProc; /* Procedure to call to read data from * an image file into a photo image. */ Tk_ImageStringReadProc *stringReadProc; /* Procedure to call to read data from * a string into a photo image. */ Tk_ImageFileWriteProc *fileWriteProc; /* Procedure to call to write data from * a photo image to a file. */ Tk_ImageStringWriteProc *stringWriteProc; /* Procedure to call to obtain a string * representation of the data in a photo * image.*/ struct Tk_PhotoImageFormat *nextPtr; /* Next in list of all photo image formats * currently known. Filled in by Tk, not * by image format handler. */};EXTERN void Tk_CreateOldImageType _ANSI_ARGS_(( Tk_ImageType *typePtr));EXTERN void Tk_CreateOldPhotoImageFormat _ANSI_ARGS_(( Tk_PhotoImageFormat *formatPtr));#if !defined(USE_TK_STUBS) && defined(USE_OLD_IMAGE)#define Tk_CreateImageType Tk_CreateOldImageType#define Tk_CreatePhotoImageFormat Tk_CreateOldPhotoImageFormat#endif/* *-------------------------------------------------------------- * * Procedure prototypes and structures used for managing styles: * *-------------------------------------------------------------- *//* * Style support version tag. */#define TK_STYLE_VERSION_1 0x1#define TK_STYLE_VERSION TK_STYLE_VERSION_1/* * The following structures and prototypes are used as static templates to * declare widget elements. */typedef void (Tk_GetElementSizeProc) _ANSI_ARGS_((ClientData clientData, char *recordPtr, CONST Tk_OptionSpec **optionsPtr, Tk_Window tkwin, int width, int height, int inner, int *widthPtr, int *heightPtr));typedef void (Tk_GetElementBoxProc) _ANSI_ARGS_((ClientData clientData, char *recordPtr, CONST Tk_OptionSpec **optionsPtr, Tk_Window tkwin, int x, int y, int width, int height, int inner, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr));typedef int (Tk_GetElementBorderWidthProc) _ANSI_ARGS_((ClientData clientData, char *recordPtr, CONST Tk_OptionSpec **optionsPtr, Tk_Window tkwin));typedef void (Tk_DrawElementProc) _ANSI_ARGS_((ClientData clientData, char *recordPtr, CONST Tk_OptionSpec **optionsPtr, Tk_Window tkwin, Drawable d, int x, int y, int width, int height, int state));typedef struct Tk_ElementOptionSpec { char *name; /* Name of the required option. */ Tk_OptionType type; /* Accepted option type. TK_OPTION_END means * any. */} Tk_ElementOptionSpec;typedef struct Tk_ElementSpec { int version; /* Version of the style support. */ char *name; /* Name of element. */ Tk_ElementOptionSpec *options; /* List of required options. Last one's name * must be NULL. */ /* * Hooks */ Tk_GetElementSizeProc *getSize; /* Compute the external (resp. internal) size of * the element from its desired internal (resp. * external) size. */ Tk_GetElementBoxProc *getBox; /* Compute the inscribed or bounding boxes * within a given area. */ Tk_GetElementBorderWidthProc *getBorderWidth; /* Return the element's internal border width. * Mostly useful for widgets. */ Tk_DrawElementProc *draw; /* Draw the element in the given bounding box.*/} Tk_ElementSpec;/* * Element state flags. Can be OR'ed. */#define TK_ELEMENT_STATE_ACTIVE 1<<0#define TK_ELEMENT_STATE_DISABLED 1<<1#define TK_ELEMENT_STATE_FOCUS 1<<2#define TK_ELEMENT_STATE_PRESSED 1<<3/* *-------------------------------------------------------------- * * The definitions below provide backward compatibility for * functions and types related to event handling that used to * be in Tk but have moved to Tcl. * *-------------------------------------------------------------- */#define TK_READABLE TCL_READABLE#define TK_WRITABLE TCL_WRITABLE#define TK_EXCEPTION TCL_EXCEPTION#define TK_DONT_WAIT TCL_DONT_WAIT#define TK_X_EVENTS TCL_WINDOW_EVENTS#define TK_WINDOW_EVENTS TCL_WINDOW_EVENTS#define TK_FILE_EVENTS TCL_FILE_EVENTS#define TK_TIMER_EVENTS TCL_TIMER_EVENTS#define TK_IDLE_EVENTS TCL_IDLE_EVENTS#define TK_ALL_EVENTS TCL_ALL_EVENTS#define Tk_IdleProc Tcl_IdleProc#define Tk_FileProc Tcl_FileProc#define Tk_TimerProc Tcl_TimerProc#define Tk_TimerToken Tcl_TimerToken#define Tk_BackgroundError Tcl_BackgroundError#define Tk_CancelIdleCall Tcl_CancelIdleCall#define Tk_CreateFileHandler Tcl_CreateFileHandler#define Tk_CreateTimerHandler Tcl_CreateTimerHandler#define Tk_DeleteFileHandler Tcl_DeleteFileHandler#define Tk_DeleteTimerHandler Tcl_DeleteTimerHandler#define Tk_DoOneEvent Tcl_DoOneEvent#define Tk_DoWhenIdle Tcl_DoWhenIdle#define Tk_Sleep Tcl_Sleep/* Additional stuff that has moved to Tcl: */#define Tk_EventuallyFree Tcl_EventuallyFree#define Tk_FreeProc Tcl_FreeProc#define Tk_Preserve Tcl_Preserve#define Tk_Release Tcl_Release/* Removed Tk_Main, use macro instead */#define Tk_Main(argc, argv, proc) \ Tk_MainEx(argc, argv, proc, Tcl_CreateInterp())CONST char *Tk_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, char *version, int exact));#ifndef USE_TK_STUBS#define Tk_InitStubs(interp, version, exact) \ Tcl_PkgRequire(interp, "Tk", version, exact)#endifvoid Tk_InitImageArgs _ANSI_ARGS_((Tcl_Interp *interp, int argc, char ***argv));#if !defined(USE_TK_STUBS) || !defined(USE_OLD_IMAGE)#define Tk_InitImageArgs(interp, argc, argv) /**/#endif/* *-------------------------------------------------------------- * * Additional procedure types defined by Tk. * *-------------------------------------------------------------- */typedef int (Tk_ErrorProc) _ANSI_ARGS_((ClientData clientData, XErrorEvent *errEventPtr));typedef void (Tk_EventProc) _ANSI_ARGS_((ClientData clientData, XEvent *eventPtr));typedef int (Tk_GenericProc) _ANSI_ARGS_((ClientData clientData, XEvent *eventPtr));typedef int (Tk_ClientMessageProc) _ANSI_ARGS_((Tk_Window tkwin, XEvent *eventPtr));typedef int (Tk_GetSelProc) _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, char *portion));typedef void (Tk_LostSelProc) _ANSI_ARGS_((ClientData clientData));typedef Tk_RestrictAction (Tk_RestrictProc) _ANSI_ARGS_(( ClientData clientData, XEvent *eventPtr));typedef int (Tk_SelectionProc) _ANSI_ARGS_((ClientData clientData, int offset, char *buffer, int maxBytes));/* *-------------------------------------------------------------- * * Platform independant exported procedures and variables. * *-------------------------------------------------------------- */#include "tkDecls.h"/* * Allow users to say that they don't want to alter their source to * add the extra argument to Tk_PhotoPutBlock(); DO NOT DEFINE THIS * WHEN BUILDING TK. * * This goes after the inclusion of the stubbed-decls so that the * declarations of what is actually there can be correct. */#ifdef USE_COMPOSITELESS_PHOTO_PUT_BLOCK# ifdef Tk_PhotoPutBlock# undef Tk_PhotoPutBlock# endif# define Tk_PhotoPutBlock Tk_PhotoPutBlock_NoComposite# ifdef Tk_PhotoPutZoomedBlock# undef Tk_PhotoPutZoomedBlock# endif# define Tk_PhotoPutZoomedBlock Tk_PhotoPutZoomedBlock_NoComposite#endif /* USE_COMPOSITELESS_PHOTO_PUT_BLOCK *//* * Tcl commands exported by Tk: */#undef TCL_STORAGE_CLASS#define TCL_STORAGE_CLASS DLLIMPORT#endif /* RC_INVOKED *//* * end block for C++ */ #ifdef __cplusplus}#endif #endif /* _TK */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -