tkInt.h
上传用户:shenzhenrh
上传日期:2013-05-12
资源大小:2904k
文件大小:36k
源码类别:

信息检索与抽取

开发平台:

Unix_Linux

  1. /*
  2.  * tkInt.h --
  3.  *
  4.  * Declarations for things used internally by the Tk
  5.  * procedures but not exported outside the module.
  6.  *
  7.  * Copyright (c) 1990-1994 The Regents of the University of California.
  8.  * Copyright (c) 1994-1997 Sun Microsystems, Inc.
  9.  *
  10.  * See the file "license.terms" for information on usage and redistribution
  11.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  12.  *
  13.  * SCCS: @(#) tkInt.h 1.204 97/10/31 09:55:20
  14.  */
  15. #ifndef _TKINT
  16. #define _TKINT
  17. #ifndef _TK
  18. #include "tk.h"
  19. #endif
  20. #ifndef _TCL
  21. #include "tcl.h"
  22. #endif
  23. #ifndef _TKPORT
  24. #include "tk/tkPort.h"
  25. #endif
  26. /*
  27.  * Opaque type declarations:
  28.  */
  29. typedef struct TkColormap TkColormap;
  30. typedef struct TkGrabEvent TkGrabEvent;
  31. #if 0
  32. typedef struct Tk_PostscriptInfo Tk_PostscriptInfo;
  33. #endif
  34. typedef struct TkpCursor_ *TkpCursor;
  35. typedef struct TkRegion_ *TkRegion;
  36. typedef struct TkStressedCmap TkStressedCmap;
  37. typedef struct TkBindInfo_ *TkBindInfo;
  38. /*
  39.  * Procedure types.
  40.  */
  41. typedef int (TkBindEvalProc) _ANSI_ARGS_((ClientData clientData,
  42. Tcl_Interp *interp, XEvent *eventPtr, Tk_Window tkwin,
  43. KeySym keySym));
  44. typedef void (TkBindFreeProc) _ANSI_ARGS_((ClientData clientData));
  45. typedef Window (TkClassCreateProc) _ANSI_ARGS_((Tk_Window tkwin,
  46. Window parent, ClientData instanceData));
  47. typedef void (TkClassGeometryProc) _ANSI_ARGS_((ClientData instanceData));
  48. typedef void (TkClassModalProc) _ANSI_ARGS_((Tk_Window tkwin,
  49. XEvent *eventPtr));
  50. /*
  51.  * Widget class procedures used to implement platform specific widget
  52.  * behavior.
  53.  */
  54. typedef struct TkClassProcs {
  55.     TkClassCreateProc *createProc;
  56. /* Procedure to invoke when the
  57.                                    platform-dependent window needs to be
  58.                                    created. */
  59.     TkClassGeometryProc *geometryProc;
  60. /* Procedure to invoke when the geometry of a
  61.    window needs to be recalculated as a result
  62.    of some change in the system. */
  63.     TkClassModalProc *modalProc;
  64. /* Procedure to invoke after all bindings on a
  65.    widget have been triggered in order to
  66.    handle a modal loop. */
  67. } TkClassProcs;
  68. /*
  69.  * One of the following structures is maintained for each cursor in
  70.  * use in the system.  This structure is used by tkCursor.c and the
  71.  * various system specific cursor files.
  72.  */
  73. typedef struct TkCursor {
  74.     Tk_Cursor cursor; /* System specific identifier for cursor. */
  75.     int refCount; /* Number of active uses of cursor. */
  76.     Tcl_HashTable *otherTable; /* Second table (other than idTable) used
  77.  * to index this entry. */
  78.     Tcl_HashEntry *hashPtr; /* Entry in otherTable for this structure
  79.  * (needed when deleting). */
  80. } TkCursor;
  81. /*
  82.  * One of the following structures is maintained for each display
  83.  * containing a window managed by Tk:
  84.  */
  85. typedef struct TkDisplay {
  86.     Display *display; /* Xlib's info about display. */
  87.     struct TkDisplay *nextPtr; /* Next in list of all displays. */
  88.     char *name; /* Name of display (with any screen
  89.  * identifier removed).  Malloc-ed. */
  90.     Time lastEventTime; /* Time of last event received for this
  91.  * display. */
  92.     /*
  93.      * Information used primarily by tkBind.c:
  94.      */
  95.     int bindInfoStale; /* Non-zero means the variables in this
  96.  * part of the structure are potentially
  97.  * incorrect and should be recomputed. */
  98.     unsigned int modeModMask; /* Has one bit set to indicate the modifier
  99.  * corresponding to "mode shift".  If no
  100.  * such modifier, than this is zero. */
  101.     unsigned int metaModMask; /* Has one bit set to indicate the modifier
  102.  * corresponding to the "Meta" key.  If no
  103.  * such modifier, then this is zero. */
  104.     unsigned int altModMask; /* Has one bit set to indicate the modifier
  105.  * corresponding to the "Meta" key.  If no
  106.  * such modifier, then this is zero. */
  107.     enum {LU_IGNORE, LU_CAPS, LU_SHIFT} lockUsage;
  108. /* Indicates how to interpret lock modifier. */
  109.     int numModKeyCodes; /* Number of entries in modKeyCodes array
  110.  * below. */
  111.     KeyCode *modKeyCodes; /* Pointer to an array giving keycodes for
  112.  * all of the keys that have modifiers
  113.  * associated with them.  Malloc'ed, but
  114.  * may be NULL. */
  115.     /*
  116.      * Information used by tkError.c only:
  117.      */
  118.     struct TkErrorHandler *errorPtr;
  119. /* First in list of error handlers
  120.  * for this display.  NULL means
  121.  * no handlers exist at present. */
  122.     int deleteCount; /* Counts # of handlers deleted since
  123.  * last time inactive handlers were
  124.  * garbage-collected.  When this number
  125.  * gets big, handlers get cleaned up. */
  126.     /*
  127.      * Information used by tkSend.c only:
  128.      */
  129.     Tk_Window commTkwin; /* Window used for communication
  130.  * between interpreters during "send"
  131.  * commands.  NULL means send info hasn't
  132.  * been initialized yet. */
  133.     Atom commProperty; /* X's name for comm property. */
  134.     Atom registryProperty; /* X's name for property containing
  135.  * registry of interpreter names. */
  136.     Atom appNameProperty; /* X's name for property used to hold the
  137.  * application name on each comm window. */
  138.     /*
  139.      * Information used by tkSelect.c and tkClipboard.c only:
  140.      */
  141.     struct TkSelectionInfo *selectionInfoPtr;
  142. /* First in list of selection information
  143.  * records.  Each entry contains information
  144.  * about the current owner of a particular
  145.  * selection on this display. */
  146.     Atom multipleAtom; /* Atom for MULTIPLE.  None means
  147.  * selection stuff isn't initialized. */
  148.     Atom incrAtom; /* Atom for INCR. */
  149.     Atom targetsAtom; /* Atom for TARGETS. */
  150.     Atom timestampAtom; /* Atom for TIMESTAMP. */
  151.     Atom textAtom; /* Atom for TEXT. */
  152.     Atom compoundTextAtom; /* Atom for COMPOUND_TEXT. */
  153.     Atom applicationAtom; /* Atom for TK_APPLICATION. */
  154.     Atom windowAtom; /* Atom for TK_WINDOW. */
  155.     Atom clipboardAtom; /* Atom for CLIPBOARD. */
  156.     Tk_Window clipWindow; /* Window used for clipboard ownership and to
  157.  * retrieve selections between processes. NULL
  158.  * means clipboard info hasn't been
  159.  * initialized. */
  160.     int clipboardActive; /* 1 means we currently own the clipboard
  161.  * selection, 0 means we don't. */
  162.     struct TkMainInfo *clipboardAppPtr;
  163. /* Last application that owned clipboard. */
  164.     struct TkClipboardTarget *clipTargetPtr;
  165. /* First in list of clipboard type information
  166.  * records.  Each entry contains information
  167.  * about the buffers for a given selection
  168.  * target. */
  169.     /*
  170.      * Information used by tkAtom.c only:
  171.      */
  172.     int atomInit; /* 0 means stuff below hasn't been
  173.  * initialized yet. */
  174.     Tcl_HashTable nameTable; /* Maps from names to Atom's. */
  175.     Tcl_HashTable atomTable; /* Maps from Atom's back to names. */
  176.     /*
  177.      * Information used by tkCursor.c only:
  178.      */
  179.     Font cursorFont; /* Font to use for standard cursors.
  180.  * None means font not loaded yet. */
  181.     /*
  182.      * Information used by tkGrab.c only:
  183.      */
  184.     struct TkWindow *grabWinPtr;
  185. /* Window in which the pointer is currently
  186.  * grabbed, or NULL if none. */
  187.     struct TkWindow *eventualGrabWinPtr;
  188. /* Value that grabWinPtr will have once the
  189.  * grab event queue (below) has been
  190.  * completely emptied. */
  191.     struct TkWindow *buttonWinPtr;
  192. /* Window in which first mouse button was
  193.  * pressed while grab was in effect, or NULL
  194.  * if no such press in effect. */
  195.     struct TkWindow *serverWinPtr;
  196. /* If no application contains the pointer then
  197.  * this is NULL.  Otherwise it contains the
  198.  * last window for which we've gotten an
  199.  * Enter or Leave event from the server (i.e.
  200.  * the last window known to have contained
  201.  * the pointer).  Doesn't reflect events
  202.  * that were synthesized in tkGrab.c. */
  203.     TkGrabEvent *firstGrabEventPtr;
  204. /* First in list of enter/leave events
  205.  * synthesized by grab code.  These events
  206.  * must be processed in order before any other
  207.  * events are processed.  NULL means no such
  208.  * events. */
  209.     TkGrabEvent *lastGrabEventPtr;
  210. /* Last in list of synthesized events, or NULL
  211.  * if list is empty. */
  212.     int grabFlags; /* Miscellaneous flag values.  See definitions
  213.  * in tkGrab.c. */
  214.     /*
  215.      * Information used by tkXId.c only:
  216.      */
  217.     struct TkIdStack *idStackPtr;
  218. /* First in list of chunks of free resource
  219.  * identifiers, or NULL if there are no free
  220.  * resources. */
  221.     XID (*defaultAllocProc) _ANSI_ARGS_((Display *display));
  222. /* Default resource allocator for display. */
  223.     struct TkIdStack *windowStackPtr;
  224. /* First in list of chunks of window
  225.  * identifers that can't be reused right
  226.  * now. */
  227.     int idCleanupScheduled; /* 1 means a call to WindowIdCleanup has
  228.  * already been scheduled, 0 means it
  229.  * hasn't. */
  230.     /*
  231.      * Information maintained by tkWindow.c for use later on by tkXId.c:
  232.      */
  233.     int destroyCount; /* Number of Tk_DestroyWindow operations
  234.  * in progress. */
  235.     unsigned long lastDestroyRequest;
  236. /* Id of most recent XDestroyWindow request;
  237.  * can re-use ids in windowStackPtr when
  238.  * server has seen this request and event
  239.  * queue is empty. */
  240.     /*
  241.      * Information used by tkVisual.c only:
  242.      */
  243.     TkColormap *cmapPtr; /* First in list of all non-default colormaps
  244.  * allocated for this display. */
  245.     /*
  246.      * Information used by tkFocus.c only:
  247.      */
  248.     struct TkWindow *implicitWinPtr;
  249. /* If the focus arrived at a toplevel window
  250.  * implicitly via an Enter event (rather
  251.  * than via a FocusIn event), this points
  252.  * to the toplevel window.  Otherwise it is
  253.  * NULL. */
  254.     struct TkWindow *focusPtr; /* Points to the window on this display that
  255.  * should be receiving keyboard events.  When
  256.  * multiple applications on the display have
  257.  * the focus, this will refer to the
  258.  * innermost window in the innermost
  259.  * application.  This information isn't used
  260.  * under Unix or Windows, but it's needed on
  261.  * the Macintosh. */
  262.     /*
  263.      * Used by tkColor.c only:
  264.      */
  265.     TkStressedCmap *stressPtr; /* First in list of colormaps that have
  266.  * filled up, so we have to pick an
  267.  * approximate color. */
  268.     /*
  269.      * Used by tkEvent.c only:
  270.      */
  271.     struct TkWindowEvent *delayedMotionPtr;
  272. /* Points to a malloc-ed motion event
  273.  * whose processing has been delayed in
  274.  * the hopes that another motion event
  275.  * will come along right away and we can
  276.  * merge the two of them together.  NULL
  277.  * means that there is no delayed motion
  278.  * event. */
  279.     /*
  280.      * Miscellaneous information:
  281.      */
  282. #ifdef TK_USE_INPUT_METHODS
  283.     XIM inputMethod; /* Input method for this display */
  284. #endif /* TK_USE_INPUT_METHODS */
  285.     Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */
  286.     int refCount; /* Reference count of how many Tk applications
  287.                                  * are using this display. Used to clean up
  288.                                  * the display when we no longer have any
  289.                                  * Tk applications using it.
  290.                                  */
  291. } TkDisplay;
  292. /*
  293.  * One of the following structures exists for each error handler
  294.  * created by a call to Tk_CreateErrorHandler.  The structure
  295.  * is managed by tkError.c.
  296.  */
  297. typedef struct TkErrorHandler {
  298.     TkDisplay *dispPtr; /* Display to which handler applies. */
  299.     unsigned long firstRequest; /* Only errors with serial numbers
  300.  * >= to this are considered. */
  301.     unsigned long lastRequest; /* Only errors with serial numbers
  302.  * <= to this are considered.  This
  303.  * field is filled in when XUnhandle
  304.  * is called.  -1 means XUnhandle
  305.  * hasn't been called yet. */
  306.     int error; /* Consider only errors with this
  307.  * error_code (-1 means consider
  308.  * all errors). */
  309.     int request; /* Consider only errors with this
  310.  * major request code (-1 means
  311.  * consider all major codes). */
  312.     int minorCode; /* Consider only errors with this
  313.  * minor request code (-1 means
  314.  * consider all minor codes). */
  315.     Tk_ErrorProc *errorProc; /* Procedure to invoke when a matching
  316.  * error occurs.  NULL means just ignore
  317.  * errors. */
  318.     ClientData clientData; /* Arbitrary value to pass to
  319.  * errorProc. */
  320.     struct TkErrorHandler *nextPtr;
  321. /* Pointer to next older handler for
  322.  * this display, or NULL for end of
  323.  * list. */
  324. } TkErrorHandler;
  325. /*
  326.  * One of the following structures exists for each event handler
  327.  * created by calling Tk_CreateEventHandler.  This information
  328.  * is used by tkEvent.c only.
  329.  */
  330. typedef struct TkEventHandler {
  331.     unsigned long mask; /* Events for which to invoke
  332.  * proc. */
  333.     Tk_EventProc *proc; /* Procedure to invoke when an event
  334.  * in mask occurs. */
  335.     ClientData clientData; /* Argument to pass to proc. */
  336.     struct TkEventHandler *nextPtr;
  337. /* Next in list of handlers
  338.  * associated with window (NULL means
  339.  * end of list). */
  340. } TkEventHandler;
  341. /*
  342.  * Tk keeps one of the following data structures for each main
  343.  * window (created by a call to Tk_CreateMainWindow).  It stores
  344.  * information that is shared by all of the windows associated
  345.  * with a particular main window.
  346.  */
  347. typedef struct TkMainInfo {
  348.     int refCount; /* Number of windows whose "mainPtr" fields
  349.  * point here.  When this becomes zero, can
  350.  * free up the structure (the reference
  351.  * count is zero because windows can get
  352.  * deleted in almost any order;  the main
  353.  * window isn't necessarily the last one
  354.  * deleted). */
  355.     struct TkWindow *winPtr; /* Pointer to main window. */
  356.     Tcl_Interp *interp; /* Interpreter associated with application. */
  357.     Tcl_HashTable nameTable; /* Hash table mapping path names to TkWindow
  358.  * structs for all windows related to this
  359.  * main window.  Managed by tkWindow.c. */
  360.     Tk_BindingTable bindingTable;
  361. /* Used in conjunction with "bind" command
  362.  * to bind events to Tcl commands. */
  363.     TkBindInfo bindInfo; /* Information used by tkBind.c on a per
  364.  * interpreter basis. */
  365.     struct TkFontInfo *fontInfoPtr;
  366. /* Hold named font tables.  Used only by
  367.  * tkFont.c. */
  368.     /*
  369.      * Information used only by tkFocus.c and tk*Embed.c:
  370.      */
  371.     struct TkToplevelFocusInfo *tlFocusPtr;
  372. /* First in list of records containing focus
  373.  * information for each top-level in the
  374.  * application.  Used only by tkFocus.c. */
  375.     struct TkDisplayFocusInfo *displayFocusPtr;
  376. /* First in list of records containing focus
  377.  * information for each display that this
  378.  * application has ever used.  Used only
  379.  * by tkFocus.c. */
  380.     struct ElArray *optionRootPtr;
  381. /* Top level of option hierarchy for this
  382.  * main window.  NULL means uninitialized.
  383.  * Managed by tkOption.c. */
  384.     Tcl_HashTable imageTable; /* Maps from image names to Tk_ImageMaster
  385.  * structures.  Managed by tkImage.c. */
  386.     int strictMotif; /* This is linked to the tk_strictMotif
  387.  * global variable. */
  388.     struct TkMainInfo *nextPtr; /* Next in list of all main windows managed by
  389.  * this process. */
  390. } TkMainInfo;
  391. /*
  392.  * Tk keeps the following data structure for each of it's builtin
  393.  * bitmaps.  This structure is only used by tkBitmap.c and other
  394.  * platform specific bitmap files.
  395.  */
  396. typedef struct {
  397.     char *source; /* Bits for bitmap. */
  398.     int width, height; /* Dimensions of bitmap. */
  399.     int native; /* 0 means generic (X style) bitmap,
  400.       * 1 means native style bitmap. */
  401. } TkPredefBitmap;
  402. /*
  403.  * Tk keeps one of the following structures for each window.
  404.  * Some of the information (like size and location) is a shadow
  405.  * of information managed by the X server, and some is special
  406.  * information used here, such as event and geometry management
  407.  * information.  This information is (mostly) managed by tkWindow.c.
  408.  * WARNING: the declaration below must be kept consistent with the
  409.  * Tk_FakeWin structure in tk.h.  If you change one, be sure to
  410.  * change the other!!
  411.  */
  412. typedef struct TkWindow {
  413.     /*
  414.      * Structural information:
  415.      */
  416.     Display *display; /* Display containing window. */
  417.     TkDisplay *dispPtr; /* Tk's information about display
  418.  * for window. */
  419.     int screenNum; /* Index of screen for window, among all
  420.  * those for dispPtr. */
  421.     Visual *visual; /* Visual to use for window.  If not default,
  422.  * MUST be set before X window is created. */
  423.     int depth; /* Number of bits/pixel. */
  424.     Window window; /* X's id for window.   NULL means window
  425.  * hasn't actually been created yet, or it's
  426.  * been deleted. */
  427.     struct TkWindow *childList; /* First in list of child windows,
  428.  * or NULL if no children.  List is in
  429.  * stacking order, lowest window first.*/
  430.     struct TkWindow *lastChildPtr;
  431. /* Last in list of child windows (highest
  432.  * in stacking order), or NULL if no
  433.  * children. */
  434.     struct TkWindow *parentPtr; /* Pointer to parent window (logical
  435.  * parent, not necessarily X parent).  NULL
  436.  * means either this is the main window, or
  437.  * the window's parent has already been
  438.  * deleted. */
  439.     struct TkWindow *nextPtr; /* Next higher sibling (in stacking order)
  440.  * in list of children with same parent.  NULL
  441.  * means end of list. */
  442.     TkMainInfo *mainPtr; /* Information shared by all windows
  443.  * associated with a particular main
  444.  * window.  NULL means this window is
  445.  * a rogue that isn't associated with
  446.  * any application (at present, this
  447.  * only happens for the dummy windows
  448.  * used for "send" communication).  */
  449.     /*
  450.      * Name and type information for the window:
  451.      */
  452.     char *pathName; /* Path name of window (concatenation
  453.  * of all names between this window and
  454.  * its top-level ancestor).  This is a
  455.  * pointer into an entry in
  456.  * mainPtr->nameTable.  NULL means that
  457.  * the window hasn't been completely
  458.  * created yet. */
  459.     Tk_Uid nameUid; /* Name of the window within its parent
  460.  * (unique within the parent). */
  461.     Tk_Uid classUid; /* Class of the window.  NULL means window
  462.  * hasn't been given a class yet. */
  463.     /*
  464.      * Geometry and other attributes of window.  This information
  465.      * may not be updated on the server immediately;  stuff that
  466.      * hasn't been reflected in the server yet is called "dirty".
  467.      * At present, information can be dirty only if the window
  468.      * hasn't yet been created.
  469.      */
  470.     XWindowChanges changes; /* Geometry and other info about
  471.  * window. */
  472.     unsigned int dirtyChanges; /* Bits indicate fields of "changes"
  473.  * that are dirty. */
  474.     XSetWindowAttributes atts; /* Current attributes of window. */
  475.     unsigned long dirtyAtts; /* Bits indicate fields of "atts"
  476.  * that are dirty. */
  477.     unsigned int flags; /* Various flag values:  these are all
  478.  * defined in tk.h (confusing, but they're
  479.  * needed there for some query macros). */
  480.     /*
  481.      * Information kept by the event manager (tkEvent.c):
  482.      */
  483.     TkEventHandler *handlerList;/* First in list of event handlers
  484.  * declared for this window, or
  485.  * NULL if none. */
  486. #ifdef TK_USE_INPUT_METHODS
  487.     XIC inputContext; /* Input context (for input methods). */
  488. #endif /* TK_USE_INPUT_METHODS */
  489.     /*
  490.      * Information used for event bindings (see "bind" and "bindtags"
  491.      * commands in tkCmds.c):
  492.      */
  493.     ClientData *tagPtr; /* Points to array of tags used for bindings
  494.  * on this window.  Each tag is a Tk_Uid.
  495.  * Malloc'ed.  NULL means no tags. */
  496.     int numTags; /* Number of tags at *tagPtr. */
  497.     /*
  498.      * Information used by tkOption.c to manage options for the
  499.      * window.
  500.      */
  501.     int optionLevel; /* -1 means no option information is
  502.  * currently cached for this window.
  503.  * Otherwise this gives the level in
  504.  * the option stack at which info is
  505.  * cached. */
  506.     /*
  507.      * Information used by tkSelect.c to manage the selection.
  508.      */
  509.     struct TkSelHandler *selHandlerList;
  510. /* First in list of handlers for
  511.  * returning the selection in various
  512.  * forms. */
  513.     /*
  514.      * Information used by tkGeometry.c for geometry management.
  515.      */
  516.     Tk_GeomMgr *geomMgrPtr; /* Information about geometry manager for
  517.  * this window. */
  518.     ClientData geomData; /* Argument for geometry manager procedures. */
  519.     int reqWidth, reqHeight; /* Arguments from last call to
  520.  * Tk_GeometryRequest, or 0's if
  521.  * Tk_GeometryRequest hasn't been
  522.  * called. */
  523.     int internalBorderWidth; /* Width of internal border of window
  524.  * (0 means no internal border).  Geometry
  525.  * managers should not normally place children
  526.  * on top of the border. */
  527.     /*
  528.      * Information maintained by tkWm.c for window manager communication.
  529.      */
  530.     struct TkWmInfo *wmInfoPtr; /* For top-level windows (and also
  531.  * for special Unix menubar and wrapper
  532.  * windows), points to structure with
  533.  * wm-related info (see tkWm.c).  For
  534.  * other windows, this is NULL. */
  535.     /*
  536.      * Information used by widget classes.
  537.      */
  538.     TkClassProcs *classProcsPtr;
  539.     ClientData instanceData;
  540.     /*
  541.      * Platform specific information private to each port.
  542.      */
  543.     struct TkWindowPrivate *privatePtr;
  544. } TkWindow;
  545. /*
  546.  * The following structure is used as a two way map between integers
  547.  * and strings, usually to map between an internal C representation
  548.  * and the strings used in Tcl.
  549.  */
  550. typedef struct TkStateMap {
  551.     int numKey; /* Integer representation of a value. */
  552.     char *strKey; /* String representation of a value. */
  553. } TkStateMap;
  554. /*
  555.  * This structure is used by the Mac and Window porting layers as
  556.  * the internal representation of a clip_mask in a GC.
  557.  */
  558. typedef struct TkpClipMask {
  559.     int type; /* One of TKP_CLIP_PIXMAP or TKP_CLIP_REGION */
  560.     union {
  561.         X11Pixmap pixmap;
  562. TkRegion region;
  563.     } value;
  564. } TkpClipMask;
  565. #define TKP_CLIP_PIXMAP 0
  566. #define TKP_CLIP_REGION 1
  567. /*
  568.  * Pointer to first entry in list of all displays currently known.
  569.  */
  570. extern TkDisplay *tkDisplayList;
  571. /*
  572.  * Return values from TkGrabState:
  573.  */
  574. #define TK_GRAB_NONE 0
  575. #define TK_GRAB_IN_TREE 1
  576. #define TK_GRAB_ANCESTOR 2
  577. #define TK_GRAB_EXCLUDED 3
  578. /*
  579.  * The macro below is used to modify a "char" value (e.g. by casting
  580.  * it to an unsigned character) so that it can be used safely with
  581.  * macros such as isspace.
  582.  */
  583. #define UCHAR(c) ((unsigned char) (c))
  584. /*
  585.  * The following symbol is used in the mode field of FocusIn events
  586.  * generated by an embedded application to request the input focus from
  587.  * its container.
  588.  */
  589. #define EMBEDDED_APP_WANTS_FOCUS (NotifyNormal + 20)
  590. /*
  591.  * Miscellaneous variables shared among Tk modules but not exported
  592.  * to the outside world:
  593.  */
  594. extern Tk_Uid tkActiveUid;
  595. extern Tk_ImageType tkBitmapImageType;
  596. extern Tk_Uid tkDisabledUid;
  597. extern Tk_PhotoImageFormat tkImgFmtGIF;
  598. extern void (*tkHandleEventProc) _ANSI_ARGS_((
  599.          XEvent* eventPtr));
  600. extern Tk_PhotoImageFormat tkImgFmtPPM;
  601. extern TkMainInfo *tkMainWindowList;
  602. extern Tk_Uid tkNormalUid;
  603. extern Tk_ImageType tkPhotoImageType;
  604. extern Tcl_HashTable tkPredefBitmapTable;
  605. extern int tkSendSerial;
  606. /*
  607.  * Internal procedures shared among Tk modules but not exported
  608.  * to the outside world:
  609.  */
  610. EXTERN char * TkAlignImageData _ANSI_ARGS_((XImage *image,
  611.     int alignment, int bitOrder));
  612. EXTERN TkWindow * TkAllocWindow _ANSI_ARGS_((TkDisplay *dispPtr,
  613.     int screenNum, TkWindow *parentPtr));
  614. EXTERN int TkAreaToPolygon _ANSI_ARGS_((double *polyPtr,
  615.     int numPoints, double *rectPtr));
  616. EXTERN void TkBezierPoints _ANSI_ARGS_((double control[],
  617.     int numSteps, double *coordPtr));
  618. EXTERN void TkBezierScreenPoints _ANSI_ARGS_((Tk_Canvas canvas,
  619.     double control[], int numSteps,
  620.     XPoint *xPointPtr));
  621. EXTERN void TkBindDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
  622. EXTERN void TkBindEventProc _ANSI_ARGS_((TkWindow *winPtr,
  623.     XEvent *eventPtr));
  624. EXTERN void TkBindFree _ANSI_ARGS_((TkMainInfo *mainPtr));
  625. EXTERN void TkBindInit _ANSI_ARGS_((TkMainInfo *mainPtr));
  626. EXTERN void TkChangeEventWindow _ANSI_ARGS_((XEvent *eventPtr,
  627.     TkWindow *winPtr));
  628. #ifndef TkClipBox
  629. EXTERN void TkClipBox _ANSI_ARGS_((TkRegion rgn,
  630.     XRectangle* rect_return));
  631. #endif
  632. EXTERN int TkClipInit _ANSI_ARGS_((Tcl_Interp *interp,
  633.     TkDisplay *dispPtr));
  634. EXTERN void TkComputeAnchor _ANSI_ARGS_((Tk_Anchor anchor,
  635.     Tk_Window tkwin, int padX, int padY,
  636.     int innerWidth, int innerHeight, int *xPtr,
  637.     int *yPtr));
  638. EXTERN int TkCopyAndGlobalEval _ANSI_ARGS_((Tcl_Interp *interp,
  639.     char *script));
  640. EXTERN unsigned long TkCreateBindingProcedure _ANSI_ARGS_((
  641.     Tcl_Interp *interp, Tk_BindingTable bindingTable,
  642.     ClientData object, char *eventString,
  643.     TkBindEvalProc *evalProc, TkBindFreeProc *freeProc,
  644.     ClientData clientData));
  645. EXTERN TkCursor * TkCreateCursorFromData _ANSI_ARGS_((Tk_Window tkwin,
  646.     char *source, char *mask, int width, int height,
  647.     int xHot, int yHot, XColor fg, XColor bg));
  648. EXTERN int TkCreateFrame _ANSI_ARGS_((ClientData clientData,
  649.     Tcl_Interp *interp, int argc, char **argv,
  650.     int toplevel, char *appName));
  651. EXTERN Tk_Window TkCreateMainWindow _ANSI_ARGS_((Tcl_Interp *interp,
  652.     char *screenName, char *baseName));
  653. #ifndef TkCreateRegion
  654. EXTERN TkRegion TkCreateRegion _ANSI_ARGS_((void));
  655. #endif
  656. EXTERN Time TkCurrentTime _ANSI_ARGS_((TkDisplay *dispPtr));
  657. EXTERN int TkDeadAppCmd _ANSI_ARGS_((ClientData clientData,
  658.     Tcl_Interp *interp, int argc, char **argv));
  659. EXTERN void TkDeleteAllImages _ANSI_ARGS_((TkMainInfo *mainPtr));
  660. #ifndef TkDestroyRegion
  661. EXTERN void TkDestroyRegion _ANSI_ARGS_((TkRegion rgn));
  662. #endif
  663. EXTERN void TkDoConfigureNotify _ANSI_ARGS_((TkWindow *winPtr));
  664. EXTERN void TkDrawInsetFocusHighlight _ANSI_ARGS_((
  665.     Tk_Window tkwin, GC gc, int width,
  666.     Drawable drawable, int padding));
  667. EXTERN void TkEventCleanupProc _ANSI_ARGS_((
  668.     ClientData clientData, Tcl_Interp *interp));
  669. EXTERN void TkEventDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
  670. EXTERN void TkFillPolygon _ANSI_ARGS_((Tk_Canvas canvas,
  671.     double *coordPtr, int numPoints, Display *display,
  672.     Drawable drawable, GC gc, GC outlineGC));
  673. EXTERN int TkFindStateNum _ANSI_ARGS_((Tcl_Interp *interp,
  674.     CONST char *option, CONST TkStateMap *mapPtr,
  675.     CONST char *strKey));
  676. EXTERN char * TkFindStateString _ANSI_ARGS_((
  677.     CONST TkStateMap *mapPtr, int numKey));
  678. EXTERN void TkFocusDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
  679. EXTERN int TkFocusFilterEvent _ANSI_ARGS_((TkWindow *winPtr,
  680.     XEvent *eventPtr));
  681. EXTERN TkWindow * TkFocusKeyEvent _ANSI_ARGS_((TkWindow *winPtr,
  682.     XEvent *eventPtr));
  683. EXTERN void TkFontPkgInit _ANSI_ARGS_((TkMainInfo *mainPtr));
  684. EXTERN void TkFontPkgFree _ANSI_ARGS_((TkMainInfo *mainPtr));
  685. EXTERN void TkFreeBindingTags _ANSI_ARGS_((TkWindow *winPtr));
  686. EXTERN void TkFreeCursor _ANSI_ARGS_((TkCursor *cursorPtr));
  687. EXTERN void TkFreeWindowId _ANSI_ARGS_((TkDisplay *dispPtr,
  688.     Window w));
  689. EXTERN void TkGenerateActivateEvents _ANSI_ARGS_((
  690.     TkWindow *winPtr, int active));
  691. EXTERN char * TkGetBitmapData _ANSI_ARGS_((Tcl_Interp *interp,
  692.     char *string, char *fileName, int *widthPtr,
  693.     int *heightPtr, int *hotXPtr, int *hotYPtr));
  694. EXTERN void TkGetButtPoints _ANSI_ARGS_((double p1[], double p2[],
  695.     double width, int project, double m1[],
  696.     double m2[]));
  697. EXTERN TkCursor * TkGetCursorByName _ANSI_ARGS_((Tcl_Interp *interp,
  698.     Tk_Window tkwin, Tk_Uid string));
  699. EXTERN char * TkGetDefaultScreenName _ANSI_ARGS_((Tcl_Interp *interp,
  700.     char *screenName));
  701. EXTERN TkDisplay * TkGetDisplay _ANSI_ARGS_((Display *display));
  702. EXTERN int TkGetDisplayOf _ANSI_ARGS_((Tcl_Interp *interp,
  703.     int objc, Tcl_Obj *CONST objv[],
  704.     Tk_Window *tkwinPtr));
  705. EXTERN TkWindow * TkGetFocusWin _ANSI_ARGS_((TkWindow *winPtr));
  706. EXTERN int TkGetInterpNames _ANSI_ARGS_((Tcl_Interp *interp,
  707.     Tk_Window tkwin));
  708. EXTERN int TkGetMiterPoints _ANSI_ARGS_((double p1[], double p2[],
  709.     double p3[], double width, double m1[],
  710.     double m2[]));
  711. #ifndef TkGetNativeProlog
  712. EXTERN int TkGetNativeProlog _ANSI_ARGS_((Tcl_Interp *interp));
  713. #endif
  714. EXTERN void TkGetPointerCoords _ANSI_ARGS_((Tk_Window tkwin,
  715.     int *xPtr, int *yPtr));
  716. EXTERN int TkGetProlog _ANSI_ARGS_((Tcl_Interp *interp));
  717. EXTERN void TkGetServerInfo _ANSI_ARGS_((Tcl_Interp *interp,
  718.     Tk_Window tkwin));
  719. EXTERN void TkGrabDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
  720. EXTERN int TkGrabState _ANSI_ARGS_((TkWindow *winPtr));
  721. EXTERN TkWindow *       TkIDToWindow _ANSI_ARGS_((Window window, 
  722.     TkDisplay *display));
  723. EXTERN void TkIncludePoint _ANSI_ARGS_((Tk_Item *itemPtr,
  724.     double *pointPtr));
  725. EXTERN void TkInitXId _ANSI_ARGS_((TkDisplay *dispPtr));
  726. EXTERN void TkInOutEvents _ANSI_ARGS_((XEvent *eventPtr,
  727.     TkWindow *sourcePtr, TkWindow *destPtr,
  728.     int leaveType, int enterType,
  729.     Tcl_QueuePosition position));
  730. EXTERN void TkInstallFrameMenu _ANSI_ARGS_((Tk_Window tkwin));
  731. #ifndef TkIntersectRegion
  732. EXTERN void TkIntersectRegion _ANSI_ARGS_((TkRegion sra,
  733.     TkRegion srcb, TkRegion dr_return));
  734. #endif
  735. EXTERN char * TkKeysymToString _ANSI_ARGS_((KeySym keysym));
  736. EXTERN int TkLineToArea _ANSI_ARGS_((double end1Ptr[2],
  737.     double end2Ptr[2], double rectPtr[4]));
  738. EXTERN double TkLineToPoint _ANSI_ARGS_((double end1Ptr[2],
  739.     double end2Ptr[2], double pointPtr[2]));
  740. EXTERN int TkListAppend _ANSI_ARGS_((void **headPtrPtr,
  741.     void *itemPtr, size_t size));
  742. EXTERN int TkListDelete _ANSI_ARGS_((void **headPtrPtr,
  743.     void *itemPtr, size_t size));
  744. EXTERN void * TkListFind _ANSI_ARGS_((void *headPtr, void *itemPtr,
  745.     size_t size));
  746. EXTERN int TkMakeBezierCurve _ANSI_ARGS_((Tk_Canvas canvas,
  747.     double *pointPtr, int numPoints, int numSteps,
  748.     XPoint xPoints[], double dblPoints[]));
  749. EXTERN void TkMakeBezierPostscript _ANSI_ARGS_((Tcl_Interp *interp,
  750.     Tk_Canvas canvas, double *pointPtr,
  751.     int numPoints));
  752. EXTERN void TkOptionClassChanged _ANSI_ARGS_((TkWindow *winPtr));
  753. EXTERN void TkOptionDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
  754. EXTERN int TkOvalToArea _ANSI_ARGS_((double *ovalPtr,
  755.     double *rectPtr));
  756. EXTERN double TkOvalToPoint _ANSI_ARGS_((double ovalPtr[4],
  757.     double width, int filled, double pointPtr[2]));
  758. EXTERN int TkpChangeFocus _ANSI_ARGS_((TkWindow *winPtr,
  759.     int force));
  760. EXTERN void TkpCloseDisplay _ANSI_ARGS_((TkDisplay *dispPtr));
  761. EXTERN void TkpClaimFocus _ANSI_ARGS_((TkWindow *topLevelPtr,
  762.     int force));
  763. #ifndef TkpCmapStressed
  764. EXTERN int TkpCmapStressed _ANSI_ARGS_((Tk_Window tkwin,
  765.     X11Colormap colormap));
  766. #endif
  767. #ifndef TkpCreateNativeBitmap
  768. EXTERN X11Pixmap TkpCreateNativeBitmap _ANSI_ARGS_((Display *display,
  769.     char * source));
  770. #endif
  771. #ifndef TkpDefineNativeBitmaps
  772. EXTERN void TkpDefineNativeBitmaps _ANSI_ARGS_((void));
  773. #endif
  774. EXTERN void TkpDisplayWarning _ANSI_ARGS_((char *msg,
  775.     char *title));
  776. EXTERN void TkpGetAppName _ANSI_ARGS_((Tcl_Interp *interp,
  777.     Tcl_DString *name));
  778. EXTERN unsigned long TkpGetMS _ANSI_ARGS_((void));
  779. #ifndef TkpGetNativeAppBitmap
  780. EXTERN X11Pixmap TkpGetNativeAppBitmap _ANSI_ARGS_((Display *display,
  781.     char *name, int *width, int *height));
  782. #endif
  783. EXTERN TkWindow * TkpGetOtherWindow _ANSI_ARGS_((TkWindow *winPtr));
  784. EXTERN TkWindow * TkpGetWrapperWindow _ANSI_ARGS_((TkWindow *winPtr));
  785. EXTERN int TkpInit _ANSI_ARGS_((Tcl_Interp *interp));
  786. EXTERN void TkpInitializeMenuBindings _ANSI_ARGS_((
  787.     Tcl_Interp *interp, Tk_BindingTable bindingTable));
  788. EXTERN void TkpMakeContainer _ANSI_ARGS_((Tk_Window tkwin));
  789. EXTERN void TkpMakeMenuWindow _ANSI_ARGS_((Tk_Window tkwin,
  790.     int transient));
  791. EXTERN Window TkpMakeWindow _ANSI_ARGS_((TkWindow *winPtr,
  792.     Window parent));
  793. EXTERN void TkpMenuNotifyToplevelCreate _ANSI_ARGS_((
  794.     Tcl_Interp *, char *menuName));
  795. EXTERN TkDisplay * TkpOpenDisplay _ANSI_ARGS_((char *display_name));
  796. EXTERN void TkPointerDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
  797. EXTERN int TkPointerEvent _ANSI_ARGS_((XEvent *eventPtr,
  798.     TkWindow *winPtr));
  799. EXTERN int TkPolygonToArea _ANSI_ARGS_((double *polyPtr,
  800.     int numPoints, double *rectPtr));
  801. EXTERN double TkPolygonToPoint _ANSI_ARGS_((double *polyPtr,
  802.     int numPoints, double *pointPtr));
  803. EXTERN int TkPositionInTree _ANSI_ARGS_((TkWindow *winPtr,
  804.     TkWindow *treePtr));
  805. #ifndef TkpPrintWindowId
  806. EXTERN void TkpPrintWindowId _ANSI_ARGS_((char *buf,
  807.     Window window));
  808. #endif
  809. EXTERN void TkpRedirectKeyEvent _ANSI_ARGS_((TkWindow *winPtr,
  810.     XEvent *eventPtr));
  811. #ifndef TkpScanWindowId
  812. EXTERN int TkpScanWindowId _ANSI_ARGS_((Tcl_Interp *interp,
  813.     char *string, int *idPtr));
  814. #endif
  815. EXTERN void TkpSetCapture _ANSI_ARGS_((TkWindow *winPtr));
  816. EXTERN void TkpSetCursor _ANSI_ARGS_((TkpCursor cursor));
  817. EXTERN void TkpSetMainMenubar _ANSI_ARGS_((Tcl_Interp *interp,
  818.     Tk_Window tkwin, char *menuName));
  819. #ifndef TkpSync
  820. EXTERN void TkpSync _ANSI_ARGS_((Display *display));
  821. #endif
  822. EXTERN int TkpTestembedCmd _ANSI_ARGS_((ClientData clientData,
  823.     Tcl_Interp *interp, int argc, char **argv));
  824. EXTERN int TkpUseWindow _ANSI_ARGS_((Tcl_Interp *interp,
  825.     Tk_Window tkwin, char *string));
  826. #ifndef TkPutImage
  827. EXTERN void TkPutImage _ANSI_ARGS_((unsigned long *colors,
  828.     int ncolors, Display* display, Drawable d,
  829.     GC gc, XImage* image, int src_x, int src_y,
  830.     int dest_x, int dest_y, unsigned int width,
  831.     unsigned int height));
  832. #endif
  833. EXTERN int TkpWindowWasRecentlyDeleted _ANSI_ARGS_((Window win,
  834.     TkDisplay *dispPtr));
  835. EXTERN void TkpWmSetState _ANSI_ARGS_((TkWindow *winPtr,
  836.     int state));
  837. EXTERN void TkQueueEventForAllChildren _ANSI_ARGS_((
  838.     TkWindow *winPtr, XEvent *eventPtr));
  839. #ifndef TkRectInRegion
  840. EXTERN int TkRectInRegion _ANSI_ARGS_((TkRegion rgn,
  841.     int x, int y, unsigned int width,
  842.     unsigned int height));
  843. #endif
  844. EXTERN int TkScrollWindow _ANSI_ARGS_((Tk_Window tkwin, GC gc,
  845.     int x, int y, int width, int height, int dx,
  846.     int dy, TkRegion damageRgn));
  847. EXTERN void TkSelDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
  848. EXTERN void TkSelEventProc _ANSI_ARGS_((Tk_Window tkwin,
  849.     XEvent *eventPtr));
  850. EXTERN void TkSelInit _ANSI_ARGS_((Tk_Window tkwin));
  851. EXTERN void TkSelPropProc _ANSI_ARGS_((XEvent *eventPtr));
  852. EXTERN void TkSetClassProcs _ANSI_ARGS_((Tk_Window tkwin,
  853.     TkClassProcs *procs, ClientData instanceData));
  854. #ifndef TkSetPixmapColormap
  855. EXTERN void TkSetPixmapColormap _ANSI_ARGS_((X11Pixmap pixmap,
  856.     Colormap colormap));
  857. #endif
  858. #ifndef TkSetRegion
  859. EXTERN void TkSetRegion _ANSI_ARGS_((Display* display, GC gc,
  860.     TkRegion rgn));
  861. #endif
  862. EXTERN void TkSetWindowMenuBar _ANSI_ARGS_((Tcl_Interp *interp,
  863.     Tk_Window tkwin, char *oldMenuName, 
  864.     char *menuName));
  865. EXTERN KeySym TkStringToKeysym _ANSI_ARGS_((char *name));
  866. EXTERN int TkThickPolyLineToArea _ANSI_ARGS_((double *coordPtr,
  867.     int numPoints, double width, int capStyle,
  868.     int joinStyle, double *rectPtr));
  869. #ifndef TkUnionRectWithRegion
  870. EXTERN void TkUnionRectWithRegion _ANSI_ARGS_((XRectangle* rect,
  871.     TkRegion src, TkRegion dr_return));
  872. #endif
  873. EXTERN void TkWmAddToColormapWindows _ANSI_ARGS_((
  874.     TkWindow *winPtr));
  875. EXTERN void TkWmDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
  876. EXTERN TkWindow * TkWmFocusToplevel _ANSI_ARGS_((TkWindow *winPtr));
  877. EXTERN void TkWmMapWindow _ANSI_ARGS_((TkWindow *winPtr));
  878. EXTERN void TkWmNewWindow _ANSI_ARGS_((TkWindow *winPtr));
  879. EXTERN void TkWmProtocolEventProc _ANSI_ARGS_((TkWindow *winPtr,
  880.     XEvent *evenvPtr));
  881. EXTERN void TkWmRemoveFromColormapWindows _ANSI_ARGS_((
  882.     TkWindow *winPtr));
  883. EXTERN void TkWmRestackToplevel _ANSI_ARGS_((TkWindow *winPtr,
  884.     int aboveBelow, TkWindow *otherPtr));
  885. EXTERN void TkWmSetClass _ANSI_ARGS_((TkWindow *winPtr));
  886. EXTERN void TkWmUnmapWindow _ANSI_ARGS_((TkWindow *winPtr));
  887. EXTERN int TkXFileProc _ANSI_ARGS_((ClientData clientData,
  888.     int mask, int flags));
  889. /* 
  890.  * Unsupported commands.
  891.  */
  892. EXTERN int TkUnsupported1Cmd _ANSI_ARGS_((ClientData clientData,
  893.     Tcl_Interp *interp, int argc, char **argv));
  894. #endif  /* _TKINT */