Tk

 view release on metacpan or  search on metacpan

pTk/mTk/generic/tk.h  view on Meta::CPAN

 * 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;
} 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 3

typedef 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. */



( run in 0.567 second using v1.01-cache-2.11-cpan-71847e10f99 )