tkInt.h

Go to the documentation of this file.
00001 /*
00002  * tkInt.h --
00003  *
00004  *      Declarations for things used internally by the Tk
00005  *      procedures but not exported outside the module.
00006  *
00007  * Copyright (c) 1990-1994 The Regents of the University of California.
00008  * Copyright (c) 1994-1997 Sun Microsystems, Inc.
00009  * Copyright (c) 1998 by Scriptics Corporation.
00010  *
00011  * See the file "license.terms" for information on usage and redistribution
00012  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00013  *
00014  * RCS: $Id: tkInt.h,v 1.1 2001/08/18 00:48:55 fmk Exp $ 
00015  */
00016 
00017 #ifndef _TKINT
00018 #define _TKINT
00019 
00020 #ifndef _TK
00021 #include "tk.h"
00022 #endif
00023 #ifndef _TCL
00024 #include "tcl.h"
00025 #endif
00026 #ifndef _TKPORT
00027 #include <tkPort.h>
00028 #endif
00029 
00030 /*
00031  * Opaque type declarations:
00032  */
00033 
00034 typedef struct TkColormap TkColormap;
00035 typedef struct TkGrabEvent TkGrabEvent;
00036 typedef struct TkpCursor_ *TkpCursor;
00037 typedef struct TkRegion_ *TkRegion;
00038 typedef struct TkStressedCmap TkStressedCmap;
00039 typedef struct TkBindInfo_ *TkBindInfo;
00040 
00041 /*
00042  * Procedure types.
00043  */
00044 
00045 typedef int (TkBindEvalProc) _ANSI_ARGS_((ClientData clientData,
00046         Tcl_Interp *interp, XEvent *eventPtr, Tk_Window tkwin,
00047         KeySym keySym));
00048 typedef void (TkBindFreeProc) _ANSI_ARGS_((ClientData clientData));
00049 typedef Window (TkClassCreateProc) _ANSI_ARGS_((Tk_Window tkwin,
00050         Window parent, ClientData instanceData));
00051 typedef void (TkClassGeometryProc) _ANSI_ARGS_((ClientData instanceData));
00052 typedef void (TkClassModalProc) _ANSI_ARGS_((Tk_Window tkwin,
00053         XEvent *eventPtr));
00054 
00055 
00056 /*
00057  * Widget class procedures used to implement platform specific widget
00058  * behavior.
00059  */
00060 
00061 typedef struct TkClassProcs {
00062     TkClassCreateProc *createProc;
00063                                 /* Procedure to invoke when the
00064                                    platform-dependent window needs to be
00065                                    created. */
00066     TkClassGeometryProc *geometryProc;
00067                                 /* Procedure to invoke when the geometry of a
00068                                    window needs to be recalculated as a result
00069                                    of some change in the system. */
00070     TkClassModalProc *modalProc;
00071                                 /* Procedure to invoke after all bindings on a
00072                                    widget have been triggered in order to
00073                                    handle a modal loop. */
00074 } TkClassProcs;
00075 
00076 /*
00077  * One of the following structures is maintained for each cursor in
00078  * use in the system.  This structure is used by tkCursor.c and the
00079  * various system specific cursor files.
00080  */
00081 
00082 typedef struct TkCursor {
00083     Tk_Cursor cursor;           /* System specific identifier for cursor. */
00084     Display *display;           /* Display containing cursor. Needed for
00085                                  * disposal and retrieval of cursors. */
00086     int resourceRefCount;       /* Number of active uses of this cursor (each
00087                                  * active use corresponds to a call to
00088                                  * Tk_AllocPreserveFromObj or Tk_Preserve).
00089                                  * If this count is 0, then this structure
00090                                  * is no longer valid and it isn't present
00091                                  * in a hash table: it is being kept around
00092                                  * only because there are objects referring
00093                                  * to it.  The structure is freed when
00094                                  * resourceRefCount and objRefCount are
00095                                  * both 0. */
00096     int objRefCount;            /* Number of Tcl objects that reference
00097                                  * this structure.. */
00098     Tcl_HashTable *otherTable;  /* Second table (other than idTable) used
00099                                  * to index this entry. */
00100     Tcl_HashEntry *hashPtr;     /* Entry in otherTable for this structure
00101                                  * (needed when deleting). */
00102     Tcl_HashEntry *idHashPtr;   /* Entry in idTable for this structure
00103                                  * (needed when deleting). */
00104     struct TkCursor *nextPtr;   /* Points to the next TkCursor structure with
00105                                  * the same name.  Cursors with the same
00106                                  * name but different displays are chained
00107                                  * together off a single hash table entry. */
00108 } TkCursor;
00109 
00110 /*
00111  * One of the following structures is maintained for each display
00112  * containing a window managed by Tk.  In part, the structure is 
00113  * used to store thread-specific data, since each thread will have 
00114  * its own TkDisplay structure.
00115  */
00116 
00117 typedef struct TkDisplay {
00118     Display *display;           /* Xlib's info about display. */
00119     struct TkDisplay *nextPtr;  /* Next in list of all displays. */
00120     char *name;                 /* Name of display (with any screen
00121                                  * identifier removed).  Malloc-ed. */
00122     Time lastEventTime;         /* Time of last event received for this
00123                                  * display. */
00124 
00125     /*
00126      * Information used primarily by tk3d.c:
00127      */
00128 
00129     int borderInit;             /* 0 means borderTable needs initializing. */
00130     Tcl_HashTable borderTable;  /* Maps from color name to TkBorder 
00131                                  * structure. */
00132 
00133     /*
00134      * Information used by tkAtom.c only:
00135      */
00136 
00137     int atomInit;               /* 0 means stuff below hasn't been
00138                                  * initialized yet. */
00139     Tcl_HashTable nameTable;    /* Maps from names to Atom's. */
00140     Tcl_HashTable atomTable;    /* Maps from Atom's back to names. */
00141 
00142     /*
00143      * Information used primarily by tkBind.c:
00144      */
00145 
00146     int bindInfoStale;          /* Non-zero means the variables in this
00147                                  * part of the structure are potentially
00148                                  * incorrect and should be recomputed. */
00149     unsigned int modeModMask;   /* Has one bit set to indicate the modifier
00150                                  * corresponding to "mode shift".  If no
00151                                  * such modifier, than this is zero. */
00152     unsigned int metaModMask;   /* Has one bit set to indicate the modifier
00153                                  * corresponding to the "Meta" key.  If no
00154                                  * such modifier, then this is zero. */
00155     unsigned int altModMask;    /* Has one bit set to indicate the modifier
00156                                  * corresponding to the "Meta" key.  If no
00157                                  * such modifier, then this is zero. */
00158     enum {LU_IGNORE, LU_CAPS, LU_SHIFT} lockUsage;
00159                                 /* Indicates how to interpret lock modifier. */
00160     int numModKeyCodes;         /* Number of entries in modKeyCodes array
00161                                  * below. */
00162     KeyCode *modKeyCodes;       /* Pointer to an array giving keycodes for
00163                                  * all of the keys that have modifiers
00164                                  * associated with them.  Malloc'ed, but
00165                                  * may be NULL. */
00166 
00167     /*
00168      * Information used by tkBitmap.c only:
00169      */
00170   
00171     int bitmapInit;             /* 0 means tables above need initializing. */
00172     int bitmapAutoNumber;       /* Used to number bitmaps. */
00173     Tcl_HashTable bitmapNameTable;    
00174                                 /* Maps from name of bitmap to the first 
00175                                  * TkBitmap record for that name. */
00176     Tcl_HashTable bitmapIdTable;/* Maps from bitmap id to the TkBitmap
00177                                  * structure for the bitmap. */
00178     Tcl_HashTable bitmapDataTable;    
00179                                 /* Used by Tk_GetBitmapFromData to map from
00180                                  * a collection of in-core data about a 
00181                                  * bitmap to a reference giving an auto-
00182                                  * matically-generated name for the bitmap. */
00183 
00184     /*
00185      * Information used by tkCanvas.c only:
00186      */
00187 
00188     int numIdSearches;          
00189     int numSlowSearches;
00190 
00191     /*
00192      * Used by tkColor.c only:
00193      */
00194 
00195     int colorInit;              /* 0 means color module needs initializing. */
00196     TkStressedCmap *stressPtr;  /* First in list of colormaps that have
00197                                  * filled up, so we have to pick an
00198                                  * approximate color. */
00199     Tcl_HashTable colorNameTable;
00200                                 /* Maps from color name to TkColor structure
00201                                  * for that color. */
00202     Tcl_HashTable colorValueTable;
00203                                 /* Maps from integer RGB values to TkColor
00204                                  * structures. */
00205 
00206     /*
00207      * Used by tkCursor.c only:
00208      */
00209 
00210     int cursorInit;             /* 0 means cursor module need initializing. */
00211     Tcl_HashTable cursorNameTable;
00212                                 /* Maps from a string name to a cursor to the
00213                                  * TkCursor record for the cursor. */
00214     Tcl_HashTable cursorDataTable;
00215                                 /* Maps from a collection of in-core data
00216                                  * about a cursor to a TkCursor structure. */
00217     Tcl_HashTable cursorIdTable;
00218                                 /* Maps from a cursor id to the TkCursor
00219                                  * structure for the cursor. */
00220     char cursorString[20];      /* Used to store a cursor id string. */
00221     Font cursorFont;            /* Font to use for standard cursors.
00222                                  * None means font not loaded yet. */
00223 
00224     /*
00225      * Information used by tkError.c only:
00226      */
00227 
00228     struct TkErrorHandler *errorPtr;
00229                                 /* First in list of error handlers
00230                                  * for this display.  NULL means
00231                                  * no handlers exist at present. */
00232     int deleteCount;            /* Counts # of handlers deleted since
00233                                  * last time inactive handlers were
00234                                  * garbage-collected.  When this number
00235                                  * gets big, handlers get cleaned up. */
00236 
00237     /*
00238      * Used by tkEvent.c only:
00239      */
00240 
00241     struct TkWindowEvent *delayedMotionPtr;
00242                                 /* Points to a malloc-ed motion event
00243                                  * whose processing has been delayed in
00244                                  * the hopes that another motion event
00245                                  * will come along right away and we can
00246                                  * merge the two of them together.  NULL
00247                                  * means that there is no delayed motion
00248                                  * event. */
00249 
00250     /*
00251      * Information used by tkFocus.c only:
00252      */
00253 
00254     int focusDebug;             /* 1 means collect focus debugging 
00255                                  * statistics. */
00256     struct TkWindow *implicitWinPtr;
00257                                 /* If the focus arrived at a toplevel window
00258                                  * implicitly via an Enter event (rather
00259                                  * than via a FocusIn event), this points
00260                                  * to the toplevel window.  Otherwise it is
00261                                  * NULL. */
00262     struct TkWindow *focusPtr;  /* Points to the window on this display that
00263                                  * should be receiving keyboard events.  When
00264                                  * multiple applications on the display have
00265                                  * the focus, this will refer to the
00266                                  * innermost window in the innermost
00267                                  * application.  This information isn't used
00268                                  * under Unix or Windows, but it's needed on
00269                                  * the Macintosh. */
00270 
00271     /*
00272      * Information used by tkGC.c only:
00273      */
00274     
00275     Tcl_HashTable gcValueTable; /* Maps from a GC's values to a TkGC structure
00276                                  * describing a GC with those values. */
00277     Tcl_HashTable gcIdTable;    /* Maps from a GC to a TkGC. */ 
00278     int gcInit;                 /* 0 means the tables below need 
00279                                  * initializing. */
00280 
00281     /*
00282      * Information used by tkGeometry.c only:
00283      */
00284 
00285     Tcl_HashTable maintainHashTable;
00286                                 /* Hash table that maps from a master's 
00287                                  * Tk_Window token to a list of slaves
00288                                  * managed by that master. */
00289     int geomInit;    
00290 
00291     /*
00292      * Information used by tkGet.c only:
00293      */
00294   
00295     Tcl_HashTable uidTable;     /* Stores all Tk_Uid  used in a thread. */
00296     int uidInit;                /* 0 means uidTable needs initializing. */
00297 
00298     /*
00299      * Information used by tkGrab.c only:
00300      */
00301 
00302     struct TkWindow *grabWinPtr;
00303                                 /* Window in which the pointer is currently
00304                                  * grabbed, or NULL if none. */
00305     struct TkWindow *eventualGrabWinPtr;
00306                                 /* Value that grabWinPtr will have once the
00307                                  * grab event queue (below) has been
00308                                  * completely emptied. */
00309     struct TkWindow *buttonWinPtr;
00310                                 /* Window in which first mouse button was
00311                                  * pressed while grab was in effect, or NULL
00312                                  * if no such press in effect. */
00313     struct TkWindow *serverWinPtr;
00314                                 /* If no application contains the pointer then
00315                                  * this is NULL.  Otherwise it contains the
00316                                  * last window for which we've gotten an
00317                                  * Enter or Leave event from the server (i.e.
00318                                  * the last window known to have contained
00319                                  * the pointer).  Doesn't reflect events
00320                                  * that were synthesized in tkGrab.c. */
00321     TkGrabEvent *firstGrabEventPtr;
00322                                 /* First in list of enter/leave events
00323                                  * synthesized by grab code.  These events
00324                                  * must be processed in order before any other
00325                                  * events are processed.  NULL means no such
00326                                  * events. */
00327     TkGrabEvent *lastGrabEventPtr;
00328                                 /* Last in list of synthesized events, or NULL
00329                                  * if list is empty. */
00330     int grabFlags;              /* Miscellaneous flag values.  See definitions
00331                                  * in tkGrab.c. */
00332 
00333     /*
00334      * Information used by tkGrid.c only:
00335      */
00336 
00337     int gridInit;               /* 0 means table below needs initializing. */
00338     Tcl_HashTable gridHashTable;/* Maps from Tk_Window tokens to 
00339                                  * corresponding Grid structures. */
00340 
00341     /*
00342      * Information used by tkImage.c only:
00343      */
00344 
00345     int imageId;                /* Value used to number image ids. */
00346 
00347     /*
00348      * Information used by tkMacWinMenu.c only:
00349      */
00350 
00351     int postCommandGeneration;  
00352 
00353     /*
00354      * Information used by tkOption.c only.
00355      */
00356 
00357 
00358 
00359     /*
00360      * Information used by tkPack.c only.
00361      */
00362 
00363     int packInit;              /* 0 means table below needs initializing. */
00364     Tcl_HashTable packerHashTable;
00365                                /* Maps from Tk_Window tokens to 
00366                                 * corresponding Packer structures. */
00367     
00368 
00369     /*
00370      * Information used by tkPlace.c only.
00371      */
00372 
00373     int placeInit;              /* 0 means tables below need initializing. */
00374     Tcl_HashTable masterTable;  /* Maps from Tk_Window toke to the Master
00375                                  * structure for the window, if it exists. */
00376     Tcl_HashTable slaveTable;   /* Maps from Tk_Window toke to the Slave
00377                                  * structure for the window, if it exists. */
00378 
00379     /*
00380      * Information used by tkSelect.c and tkClipboard.c only:
00381      */
00382 
00383     struct TkSelectionInfo *selectionInfoPtr;
00384                                 /* First in list of selection information
00385                                  * records.  Each entry contains information
00386                                  * about the current owner of a particular
00387                                  * selection on this display. */
00388     Atom multipleAtom;          /* Atom for MULTIPLE.  None means
00389                                  * selection stuff isn't initialized. */
00390     Atom incrAtom;              /* Atom for INCR. */
00391     Atom targetsAtom;           /* Atom for TARGETS. */
00392     Atom timestampAtom;         /* Atom for TIMESTAMP. */
00393     Atom textAtom;              /* Atom for TEXT. */
00394     Atom compoundTextAtom;      /* Atom for COMPOUND_TEXT. */
00395     Atom applicationAtom;       /* Atom for TK_APPLICATION. */
00396     Atom windowAtom;            /* Atom for TK_WINDOW. */
00397     Atom clipboardAtom;         /* Atom for CLIPBOARD. */
00398 
00399     Tk_Window clipWindow;       /* Window used for clipboard ownership and to
00400                                  * retrieve selections between processes. NULL
00401                                  * means clipboard info hasn't been
00402                                  * initialized. */
00403     int clipboardActive;        /* 1 means we currently own the clipboard
00404                                  * selection, 0 means we don't. */
00405     struct TkMainInfo *clipboardAppPtr;
00406                                 /* Last application that owned clipboard. */
00407     struct TkClipboardTarget *clipTargetPtr;
00408                                 /* First in list of clipboard type information
00409                                  * records.  Each entry contains information
00410                                  * about the buffers for a given selection
00411                                  * target. */
00412 
00413     /*
00414      * Information used by tkSend.c only:
00415      */
00416 
00417     Tk_Window commTkwin;        /* Window used for communication
00418                                  * between interpreters during "send"
00419                                  * commands.  NULL means send info hasn't
00420                                  * been initialized yet. */
00421     Atom commProperty;          /* X's name for comm property. */
00422     Atom registryProperty;      /* X's name for property containing
00423                                  * registry of interpreter names. */
00424     Atom appNameProperty;       /* X's name for property used to hold the
00425                                  * application name on each comm window. */
00426 
00427     /*
00428      * Information used by tkXId.c only:
00429      */
00430 
00431     struct TkIdStack *idStackPtr;
00432                                 /* First in list of chunks of free resource
00433                                  * identifiers, or NULL if there are no free
00434                                  * resources. */
00435     XID (*defaultAllocProc) _ANSI_ARGS_((Display *display));
00436                                 /* Default resource allocator for display. */
00437     struct TkIdStack *windowStackPtr;
00438                                 /* First in list of chunks of window
00439                                  * identifers that can't be reused right
00440                                  * now. */
00441     int idCleanupScheduled;     /* 1 means a call to WindowIdCleanup has
00442                                  * already been scheduled, 0 means it
00443                                  * hasn't. */
00444 
00445     /*
00446      * Information used by tkUnixWm.c and tkWinWm.c only:
00447      */
00448 
00449     int wmTracing;              /* Used to enable or disable tracing in 
00450                                  * this module.  If tracing is enabled, 
00451                                  * then information is printed on
00452                                  * standard output about interesting 
00453                                  * interactions with the window manager. */
00454     struct TkWmInfo *firstWmPtr;  /* Points to first top-level window. */
00455     struct TkWmInfo *foregroundWmPtr;    
00456                                 /* Points to the foreground window. */
00457 
00458     /*
00459      * Information maintained by tkWindow.c for use later on by tkXId.c:
00460      */
00461 
00462 
00463     int destroyCount;           /* Number of Tk_DestroyWindow operations
00464                                  * in progress. */
00465     unsigned long lastDestroyRequest;
00466                                 /* Id of most recent XDestroyWindow request;
00467                                  * can re-use ids in windowStackPtr when
00468                                  * server has seen this request and event
00469                                  * queue is empty. */
00470 
00471     /*
00472      * Information used by tkVisual.c only:
00473      */
00474 
00475     TkColormap *cmapPtr;        /* First in list of all non-default colormaps
00476                                  * allocated for this display. */
00477 
00478     /*
00479      * Miscellaneous information:
00480      */
00481 
00482 #ifdef TK_USE_INPUT_METHODS
00483     XIM inputMethod;            /* Input method for this display */
00484 #endif /* TK_USE_INPUT_METHODS */
00485     Tcl_HashTable winTable;     /* Maps from X window ids to TkWindow ptrs. */
00486 
00487     int refCount;               /* Reference count of how many Tk applications
00488                                  * are using this display. Used to clean up
00489                                  * the display when we no longer have any
00490                                  * Tk applications using it.
00491                                  */
00492     /*
00493      * The following field were all added for Tk8.3
00494      */
00495     int mouseButtonState;       /* current mouse button state for this
00496                                  * display */
00497     int warpInProgress;
00498     Window warpWindow;
00499     int warpX;
00500     int warpY;
00501     int useInputMethods;        /* Whether to use input methods */
00502 } TkDisplay;
00503 
00504 /*
00505  * One of the following structures exists for each error handler
00506  * created by a call to Tk_CreateErrorHandler.  The structure
00507  * is managed by tkError.c.
00508  */
00509 
00510 typedef struct TkErrorHandler {
00511     TkDisplay *dispPtr;         /* Display to which handler applies. */
00512     unsigned long firstRequest; /* Only errors with serial numbers
00513                                  * >= to this are considered. */
00514     unsigned long lastRequest;  /* Only errors with serial numbers
00515                                  * <= to this are considered.  This
00516                                  * field is filled in when XUnhandle
00517                                  * is called.  -1 means XUnhandle
00518                                  * hasn't been called yet. */
00519     int error;                  /* Consider only errors with this
00520                                  * error_code (-1 means consider
00521                                  * all errors). */
00522     int request;                /* Consider only errors with this
00523                                  * major request code (-1 means
00524                                  * consider all major codes). */
00525     int minorCode;              /* Consider only errors with this
00526                                  * minor request code (-1 means
00527                                  * consider all minor codes). */
00528     Tk_ErrorProc *errorProc;    /* Procedure to invoke when a matching
00529                                  * error occurs.  NULL means just ignore
00530                                  * errors. */
00531     ClientData clientData;      /* Arbitrary value to pass to
00532                                  * errorProc. */
00533     struct TkErrorHandler *nextPtr;
00534                                 /* Pointer to next older handler for
00535                                  * this display, or NULL for end of
00536                                  * list. */
00537 } TkErrorHandler;
00538 
00539 
00540 
00541 
00542 /*
00543  * One of the following structures exists for each event handler
00544  * created by calling Tk_CreateEventHandler.  This information
00545  * is used by tkEvent.c only.
00546  */
00547 
00548 typedef struct TkEventHandler {
00549     unsigned long mask;         /* Events for which to invoke
00550                                  * proc. */
00551     Tk_EventProc *proc;         /* Procedure to invoke when an event
00552                                  * in mask occurs. */
00553     ClientData clientData;      /* Argument to pass to proc. */
00554     struct TkEventHandler *nextPtr;
00555                                 /* Next in list of handlers
00556                                  * associated with window (NULL means
00557                                  * end of list). */
00558 } TkEventHandler;
00559 
00560 /*
00561  * Tk keeps one of the following data structures for each main
00562  * window (created by a call to TkCreateMainWindow).  It stores
00563  * information that is shared by all of the windows associated
00564  * with a particular main window.
00565  */
00566 
00567 typedef struct TkMainInfo {
00568     int refCount;               /* Number of windows whose "mainPtr" fields
00569                                  * point here.  When this becomes zero, can
00570                                  * free up the structure (the reference
00571                                  * count is zero because windows can get
00572                                  * deleted in almost any order;  the main
00573                                  * window isn't necessarily the last one
00574                                  * deleted). */
00575     struct TkWindow *winPtr;    /* Pointer to main window. */
00576     Tcl_Interp *interp;         /* Interpreter associated with application. */
00577     Tcl_HashTable nameTable;    /* Hash table mapping path names to TkWindow
00578                                  * structs for all windows related to this
00579                                  * main window.  Managed by tkWindow.c. */
00580     Tk_BindingTable bindingTable;
00581                                 /* Used in conjunction with "bind" command
00582                                  * to bind events to Tcl commands. */
00583     TkBindInfo bindInfo;        /* Information used by tkBind.c on a per
00584                                  * application basis. */
00585     struct TkFontInfo *fontInfoPtr;
00586                                 /* Information used by tkFont.c on a per
00587                                  * application basis. */
00588 
00589     /*
00590      * Information used only by tkFocus.c and tk*Embed.c:
00591      */
00592 
00593     struct TkToplevelFocusInfo *tlFocusPtr;
00594                                 /* First in list of records containing focus
00595                                  * information for each top-level in the
00596                                  * application.  Used only by tkFocus.c. */
00597     struct TkDisplayFocusInfo *displayFocusPtr;
00598                                 /* First in list of records containing focus
00599                                  * information for each display that this
00600                                  * application has ever used.  Used only
00601                                  * by tkFocus.c. */
00602 
00603     struct ElArray *optionRootPtr;
00604                                 /* Top level of option hierarchy for this
00605                                  * main window.  NULL means uninitialized.
00606                                  * Managed by tkOption.c. */
00607     Tcl_HashTable imageTable;   /* Maps from image names to Tk_ImageMaster
00608                                  * structures.  Managed by tkImage.c. */
00609     int strictMotif;            /* This is linked to the tk_strictMotif
00610                                  * global variable. */
00611     struct TkMainInfo *nextPtr; /* Next in list of all main windows managed by
00612                                  * this process. */
00613 } TkMainInfo;
00614 
00615 /*
00616  * Tk keeps the following data structure for each of it's builtin
00617  * bitmaps.  This structure is only used by tkBitmap.c and other
00618  * platform specific bitmap files.
00619  */
00620 
00621 typedef struct {
00622     char *source;               /* Bits for bitmap. */
00623     int width, height;          /* Dimensions of bitmap. */
00624     int native;                 /* 0 means generic (X style) bitmap,
00625                                  * 1 means native style bitmap. */
00626 } TkPredefBitmap;
00627 
00628 /*
00629  * Tk keeps one of the following structures for each window.
00630  * Some of the information (like size and location) is a shadow
00631  * of information managed by the X server, and some is special
00632  * information used here, such as event and geometry management
00633  * information.  This information is (mostly) managed by tkWindow.c.
00634  * WARNING: the declaration below must be kept consistent with the
00635  * Tk_FakeWin structure in tk.h.  If you change one, be sure to
00636  * change the other!!
00637  */
00638 
00639 typedef struct TkWindow {
00640 
00641     /*
00642      * Structural information:
00643      */
00644 
00645     Display *display;           /* Display containing window. */
00646     TkDisplay *dispPtr;         /* Tk's information about display
00647                                  * for window. */
00648     int screenNum;              /* Index of screen for window, among all
00649                                  * those for dispPtr. */
00650     Visual *visual;             /* Visual to use for window.  If not default,
00651                                  * MUST be set before X window is created. */
00652     int depth;                  /* Number of bits/pixel. */
00653     Window window;              /* X's id for window.   NULL means window
00654                                  * hasn't actually been created yet, or it's
00655                                  * been deleted. */
00656     struct TkWindow *childList; /* First in list of child windows,
00657                                  * or NULL if no children.  List is in
00658                                  * stacking order, lowest window first.*/
00659     struct TkWindow *lastChildPtr;
00660                                 /* Last in list of child windows (highest
00661                                  * in stacking order), or NULL if no
00662                                  * children. */
00663     struct TkWindow *parentPtr; /* Pointer to parent window (logical
00664                                  * parent, not necessarily X parent).  NULL
00665                                  * means either this is the main window, or
00666                                  * the window's parent has already been
00667                                  * deleted. */
00668     struct TkWindow *nextPtr;   /* Next higher sibling (in stacking order)
00669                                  * in list of children with same parent.  NULL
00670                                  * means end of list. */
00671     TkMainInfo *mainPtr;        /* Information shared by all windows
00672                                  * associated with a particular main
00673                                  * window.  NULL means this window is
00674                                  * a rogue that isn't associated with
00675                                  * any application (at present, this
00676                                  * only happens for the dummy windows
00677                                  * used for "send" communication).  */
00678 
00679     /*
00680      * Name and type information for the window:
00681      */
00682 
00683     char *pathName;             /* Path name of window (concatenation
00684                                  * of all names between this window and
00685                                  * its top-level ancestor).  This is a
00686                                  * pointer into an entry in
00687                                  * mainPtr->nameTable.  NULL means that
00688                                  * the window hasn't been completely
00689                                  * created yet. */
00690     Tk_Uid nameUid;             /* Name of the window within its parent
00691                                  * (unique within the parent). */
00692     Tk_Uid classUid;            /* Class of the window.  NULL means window
00693                                  * hasn't been given a class yet. */
00694 
00695     /*
00696      * Geometry and other attributes of window.  This information
00697      * may not be updated on the server immediately;  stuff that
00698      * hasn't been reflected in the server yet is called "dirty".
00699      * At present, information can be dirty only if the window
00700      * hasn't yet been created.
00701      */
00702 
00703     XWindowChanges changes;     /* Geometry and other info about
00704                                  * window. */
00705     unsigned int dirtyChanges;  /* Bits indicate fields of "changes"
00706                                  * that are dirty. */
00707     XSetWindowAttributes atts;  /* Current attributes of window. */
00708     unsigned long dirtyAtts;    /* Bits indicate fields of "atts"
00709                                  * that are dirty. */
00710 
00711     unsigned int flags;         /* Various flag values:  these are all
00712                                  * defined in tk.h (confusing, but they're
00713                                  * needed there for some query macros). */
00714 
00715     /*
00716      * Information kept by the event manager (tkEvent.c):
00717      */
00718 
00719     TkEventHandler *handlerList;/* First in list of event handlers
00720                                  * declared for this window, or
00721                                  * NULL if none. */
00722 #ifdef TK_USE_INPUT_METHODS
00723     XIC inputContext;           /* Input context (for input methods). */
00724 #endif /* TK_USE_INPUT_METHODS */
00725 
00726     /*
00727      * Information used for event bindings (see "bind" and "bindtags"
00728      * commands in tkCmds.c):
00729      */
00730 
00731     ClientData *tagPtr;         /* Points to array of tags used for bindings
00732                                  * on this window.  Each tag is a Tk_Uid.
00733                                  * Malloc'ed.  NULL means no tags. */
00734     int numTags;                /* Number of tags at *tagPtr. */
00735 
00736     /*
00737      * Information used by tkOption.c to manage options for the
00738      * window.
00739      */
00740 
00741     int optionLevel;            /* -1 means no option information is
00742                                  * currently cached for this window.
00743                                  * Otherwise this gives the level in
00744                                  * the option stack at which info is
00745                                  * cached. */
00746     /*
00747      * Information used by tkSelect.c to manage the selection.
00748      */
00749 
00750     struct TkSelHandler *selHandlerList;
00751                                 /* First in list of handlers for
00752                                  * returning the selection in various
00753                                  * forms. */
00754 
00755     /*
00756      * Information used by tkGeometry.c for geometry management.
00757      */
00758 
00759     Tk_GeomMgr *geomMgrPtr;     /* Information about geometry manager for
00760                                  * this window. */
00761     ClientData geomData;        /* Argument for geometry manager procedures. */
00762     int reqWidth, reqHeight;    /* Arguments from last call to
00763                                  * Tk_GeometryRequest, or 0's if
00764                                  * Tk_GeometryRequest hasn't been
00765                                  * called. */
00766     int internalBorderWidth;    /* Width of internal border of window
00767                                  * (0 means no internal border).  Geometry
00768                                  * managers should not normally place children
00769                                  * on top of the border. */
00770 
00771     /*
00772      * Information maintained by tkWm.c for window manager communication.
00773      */
00774 
00775     struct TkWmInfo *wmInfoPtr; /* For top-level windows (and also
00776                                  * for special Unix menubar and wrapper
00777                                  * windows), points to structure with
00778                                  * wm-related info (see tkWm.c).  For
00779                                  * other windows, this is NULL. */
00780 
00781     /*
00782      * Information used by widget classes.
00783      */
00784 
00785     TkClassProcs *classProcsPtr;
00786     ClientData instanceData;
00787 
00788     /*
00789      * Platform specific information private to each port.
00790      */
00791 
00792     struct TkWindowPrivate *privatePtr;
00793 } TkWindow;
00794 
00795 /*
00796  * The following structure is used as a two way map between integers
00797  * and strings, usually to map between an internal C representation
00798  * and the strings used in Tcl.
00799  */
00800 
00801 typedef struct TkStateMap {
00802     int numKey;                 /* Integer representation of a value. */
00803     char *strKey;               /* String representation of a value. */
00804 } TkStateMap;
00805 
00806 /*
00807  * This structure is used by the Mac and Window porting layers as
00808  * the internal representation of a clip_mask in a GC.
00809  */
00810 
00811 typedef struct TkpClipMask {
00812     int type;                   /* One of TKP_CLIP_PIXMAP or TKP_CLIP_REGION */
00813     union {
00814         Pixmap pixmap;
00815         TkRegion region;
00816     } value;
00817 } TkpClipMask;
00818 
00819 #define TKP_CLIP_PIXMAP 0
00820 #define TKP_CLIP_REGION 1
00821 
00822 /*
00823  * Pointer to first entry in list of all displays currently known.
00824  */
00825 
00826 extern TkDisplay *tkDisplayList;
00827 
00828 /*
00829  * Return values from TkGrabState:
00830  */
00831 
00832 #define TK_GRAB_NONE            0
00833 #define TK_GRAB_IN_TREE         1
00834 #define TK_GRAB_ANCESTOR        2
00835 #define TK_GRAB_EXCLUDED        3
00836 
00837 /*
00838  * The macro below is used to modify a "char" value (e.g. by casting
00839  * it to an unsigned character) so that it can be used safely with
00840  * macros such as isspace.
00841  */
00842 
00843 #define UCHAR(c) ((unsigned char) (c))
00844 
00845 /*
00846  * The following symbol is used in the mode field of FocusIn events
00847  * generated by an embedded application to request the input focus from
00848  * its container.
00849  */
00850 
00851 #define EMBEDDED_APP_WANTS_FOCUS (NotifyNormal + 20)
00852 
00853 /*
00854  * The following special modifier mask bits are defined, to indicate
00855  * logical modifiers such as Meta and Alt that may float among the
00856  * actual modifier bits.
00857  */
00858 
00859 #define META_MASK       (AnyModifier<<1)
00860 #define ALT_MASK        (AnyModifier<<2)
00861 
00862 /*
00863  * Miscellaneous variables shared among Tk modules but not exported
00864  * to the outside world:
00865  */
00866 
00867 extern Tk_SmoothMethod          tkBezierSmoothMethod;
00868 extern Tk_ImageType             tkBitmapImageType;
00869 extern Tk_PhotoImageFormat      tkImgFmtGIF;
00870 extern void                     (*tkHandleEventProc) _ANSI_ARGS_((
00871                                     XEvent* eventPtr));
00872 extern Tk_PhotoImageFormat      tkImgFmtPPM;
00873 extern TkMainInfo               *tkMainWindowList;
00874 extern Tk_ImageType             tkPhotoImageType;
00875 extern Tcl_HashTable            tkPredefBitmapTable;
00876 extern int                      tkSendSerial;
00877 
00878 #include "tkIntDecls.h"
00879 
00880 #ifdef BUILD_tk
00881 # undef TCL_STORAGE_CLASS
00882 # define TCL_STORAGE_CLASS DLLEXPORT
00883 #endif
00884 
00885 /*
00886  * Internal procedures shared among Tk modules but not exported
00887  * to the outside world:
00888  */
00889 
00890 EXTERN int              Tk_AfterCmd _ANSI_ARGS_((ClientData clientData,
00891                             Tcl_Interp *interp, int argc, char **argv));
00892 EXTERN int              Tk_BellObjCmd _ANSI_ARGS_((ClientData clientData,
00893                             Tcl_Interp *interp, int objc, 
00894                             Tcl_Obj *CONST objv[]));
00895 EXTERN int              Tk_BindCmd _ANSI_ARGS_((ClientData clientData,
00896                             Tcl_Interp *interp, int argc, char **argv));
00897 EXTERN int              Tk_BindtagsCmd _ANSI_ARGS_((ClientData clientData,
00898                             Tcl_Interp *interp, int argc, char **argv));
00899 EXTERN int              Tk_ButtonObjCmd _ANSI_ARGS_((ClientData clientData,
00900                             Tcl_Interp *interp, int objc,
00901                             Tcl_Obj *CONST objv[]));
00902 EXTERN int              Tk_CanvasObjCmd _ANSI_ARGS_((ClientData clientData,
00903                             Tcl_Interp *interp, int argc, Tcl_Obj *CONST objv[]));
00904 EXTERN int              Tk_CheckbuttonObjCmd _ANSI_ARGS_((ClientData clientData,
00905                             Tcl_Interp *interp, int objc,
00906                             Tcl_Obj *CONST objv[]));
00907 EXTERN int              Tk_ClipboardCmd _ANSI_ARGS_((ClientData clientData,
00908                             Tcl_Interp *interp, int argc, char **argv));
00909 EXTERN int              Tk_ChooseColorObjCmd _ANSI_ARGS_((
00910                             ClientData clientData, Tcl_Interp *interp,
00911                             int objc, Tcl_Obj *CONST objv[]));
00912 EXTERN int              Tk_ChooseDirectoryObjCmd _ANSI_ARGS_((
00913                             ClientData clientData, Tcl_Interp *interp,
00914                             int objc, Tcl_Obj *CONST objv[]));
00915 EXTERN int              Tk_ChooseFontObjCmd _ANSI_ARGS_((ClientData clientData,
00916                             Tcl_Interp *interp, int objc, 
00917                             Tcl_Obj *CONST objv[]));
00918 EXTERN int              Tk_DestroyObjCmd _ANSI_ARGS_((ClientData clientData,
00919                             Tcl_Interp *interp, int objc, 
00920                             Tcl_Obj *CONST objv[]));
00921 EXTERN int              Tk_EntryObjCmd _ANSI_ARGS_((ClientData clientData,
00922                             Tcl_Interp *interp, int objc, 
00923                             Tcl_Obj *CONST objv[]));
00924 EXTERN int              Tk_EventObjCmd _ANSI_ARGS_((ClientData clientData,
00925                             Tcl_Interp *interp, int objc,
00926                             Tcl_Obj *CONST objv[]));
00927 EXTERN int              Tk_FileeventCmd _ANSI_ARGS_((ClientData clientData,
00928                             Tcl_Interp *interp, int argc, char **argv));
00929 EXTERN int              Tk_FrameObjCmd _ANSI_ARGS_((ClientData clientData,
00930                             Tcl_Interp *interp, int objc,
00931                             Tcl_Obj *CONST objv[]));
00932 EXTERN int              Tk_FocusObjCmd _ANSI_ARGS_((ClientData clientData,
00933                             Tcl_Interp *interp, int objc, 
00934                             Tcl_Obj *CONST objv[]));
00935 EXTERN int              Tk_FontObjCmd _ANSI_ARGS_((ClientData clientData,
00936                             Tcl_Interp *interp, int objc, 
00937                             Tcl_Obj *CONST objv[]));
00938 EXTERN int              Tk_GetOpenFileObjCmd _ANSI_ARGS_((ClientData clientData,
00939                             Tcl_Interp *interp, int objc, 
00940                             Tcl_Obj *CONST objv[]));
00941 EXTERN int              Tk_GetSaveFileObjCmd _ANSI_ARGS_((ClientData clientData,
00942                             Tcl_Interp *interp, int objc, 
00943                             Tcl_Obj *CONST objv[]));
00944 EXTERN int              Tk_GrabCmd _ANSI_ARGS_((ClientData clientData,
00945                             Tcl_Interp *interp, int argc, char **argv));
00946 EXTERN int              Tk_GridCmd _ANSI_ARGS_((ClientData clientData,
00947                             Tcl_Interp *interp, int argc, char **argv));
00948 EXTERN int              Tk_ImageObjCmd _ANSI_ARGS_((ClientData clientData,
00949                             Tcl_Interp *interp, int objc, 
00950                             Tcl_Obj *CONST objv[]));
00951 EXTERN int              Tk_LabelObjCmd _ANSI_ARGS_((ClientData clientData,
00952                             Tcl_Interp *interp, int objc,
00953                             Tcl_Obj *CONST objv[]));
00954 EXTERN int              Tk_ListboxObjCmd _ANSI_ARGS_((ClientData clientData,
00955                             Tcl_Interp *interp, int objc,
00956                             Tcl_Obj *CONST objv[]));
00957 EXTERN int              Tk_LowerObjCmd _ANSI_ARGS_((ClientData clientData,
00958                             Tcl_Interp *interp, int objc,
00959                             Tcl_Obj *CONST objv[]));
00960 EXTERN int              Tk_MenubuttonObjCmd _ANSI_ARGS_((ClientData clientData,
00961                             Tcl_Interp *interp, int objc, 
00962                             Tcl_Obj *CONST objv[]));
00963 EXTERN int              Tk_MessageBoxObjCmd _ANSI_ARGS_((ClientData clientData,
00964                             Tcl_Interp *interp, int objc, 
00965                             Tcl_Obj *CONST objv[]));
00966 EXTERN int              Tk_MessageCmd _ANSI_ARGS_((ClientData clientData,
00967                             Tcl_Interp *interp, int argc, char **argv));
00968 EXTERN int              Tk_OptionObjCmd _ANSI_ARGS_((ClientData clientData,
00969                             Tcl_Interp *interp, int objc,
00970                             Tcl_Obj *CONST objv[]));
00971 EXTERN int              Tk_PackCmd _ANSI_ARGS_((ClientData clientData,
00972                             Tcl_Interp *interp, int argc, char **argv));
00973 EXTERN int              Tk_PlaceCmd _ANSI_ARGS_((ClientData clientData,
00974                             Tcl_Interp *interp, int argc, char **argv));
00975 EXTERN int              Tk_RadiobuttonObjCmd _ANSI_ARGS_((ClientData clientData,
00976                             Tcl_Interp *interp, int objc,
00977                             Tcl_Obj *CONST objv[]));
00978 EXTERN int              Tk_RaiseObjCmd _ANSI_ARGS_((ClientData clientData,
00979                             Tcl_Interp *interp, int objc,
00980                             Tcl_Obj *CONST objv[]));
00981 EXTERN int              Tk_ScaleObjCmd _ANSI_ARGS_((ClientData clientData,
00982                             Tcl_Interp *interp, int objc, 
00983                             Tcl_Obj *CONST objv[]));
00984 EXTERN int              Tk_ScrollbarCmd _ANSI_ARGS_((ClientData clientData,
00985                             Tcl_Interp *interp, int argc, char **argv));
00986 EXTERN int              Tk_SelectionCmd _ANSI_ARGS_((ClientData clientData,
00987                             Tcl_Interp *interp, int argc, char **argv));
00988 EXTERN int              Tk_SendCmd _ANSI_ARGS_((ClientData clientData,
00989                             Tcl_Interp *interp, int argc, char **argv));
00990 EXTERN int              Tk_SendObjCmd _ANSI_ARGS_((ClientData clientData,
00991                             Tcl_Interp *interp, int objc, 
00992                             Tcl_Obj *CONST objv[]));
00993 EXTERN int              Tk_TextCmd _ANSI_ARGS_((ClientData clientData,
00994                             Tcl_Interp *interp, int argc, char **argv));
00995 EXTERN int              Tk_TkObjCmd _ANSI_ARGS_((ClientData clientData,
00996                             Tcl_Interp *interp, int objc,
00997                             Tcl_Obj *CONST objv[]));
00998 EXTERN int              Tk_TkwaitCmd _ANSI_ARGS_((ClientData clientData,
00999                             Tcl_Interp *interp, int argc, char **argv));
01000 EXTERN int              Tk_ToplevelObjCmd _ANSI_ARGS_((ClientData clientData,
01001                             Tcl_Interp *interp, int objc,
01002                             Tcl_Obj *CONST objv[]));
01003 EXTERN int              Tk_UpdateObjCmd _ANSI_ARGS_((ClientData clientData,
01004                             Tcl_Interp *interp, int objc, 
01005                             Tcl_Obj *CONST objv[]));
01006 EXTERN int              Tk_WinfoObjCmd _ANSI_ARGS_((ClientData clientData,
01007                             Tcl_Interp *interp, int objc,
01008                             Tcl_Obj *CONST objv[]));
01009 EXTERN int              Tk_WmCmd _ANSI_ARGS_((ClientData clientData,
01010                             Tcl_Interp *interp, int argc, char **argv));
01011 
01012 void    TkConsolePrint _ANSI_ARGS_((Tcl_Interp *interp,
01013                             int devId, char *buffer, long size));
01014 
01015 EXTERN void             TkEventInit _ANSI_ARGS_((void));
01016 
01017 EXTERN int              TkCreateMenuCmd _ANSI_ARGS_((Tcl_Interp *interp));
01018 EXTERN int              TkDeadAppCmd _ANSI_ARGS_((ClientData clientData,
01019                             Tcl_Interp *interp, int argc, char **argv));
01020 
01021 EXTERN int              TkpTestembedCmd _ANSI_ARGS_((ClientData clientData,
01022                             Tcl_Interp *interp, int argc, char **argv));
01023 EXTERN int              TkCanvasGetCoordObj _ANSI_ARGS_((Tcl_Interp *interp,
01024                             Tk_Canvas canvas, Tcl_Obj *obj,
01025                             double *doublePtr));
01026 EXTERN int              TkCanvasDashParseProc _ANSI_ARGS_((
01027                             ClientData clientData, Tcl_Interp *interp,
01028                             Tk_Window tkwin, CONST char *value, char *widgRec,
01029                             int offset));
01030 EXTERN char *           TkCanvasDashPrintProc _ANSI_ARGS_((
01031                             ClientData clientData, Tk_Window tkwin,
01032                             char *widgRec, int offset,
01033                             Tcl_FreeProc **freeProcPtr));
01034 EXTERN int              TkGetDoublePixels _ANSI_ARGS_((Tcl_Interp *interp,
01035                             Tk_Window tkwin, CONST char *string,
01036                             double *doublePtr));
01037 EXTERN int              TkOffsetParseProc _ANSI_ARGS_((
01038                             ClientData clientData, Tcl_Interp *interp,
01039                             Tk_Window tkwin, CONST char *value, char *widgRec,
01040                             int offset));
01041 EXTERN char *           TkOffsetPrintProc _ANSI_ARGS_((
01042                             ClientData clientData, Tk_Window tkwin,
01043                             char *widgRec, int offset,
01044                             Tcl_FreeProc **freeProcPtr));
01045 EXTERN int              TkOrientParseProc _ANSI_ARGS_((
01046                             ClientData clientData, Tcl_Interp *interp,
01047                             Tk_Window tkwin, CONST char *value,
01048                             char *widgRec, int offset));
01049 EXTERN char *           TkOrientPrintProc _ANSI_ARGS_((
01050                             ClientData clientData, Tk_Window tkwin,
01051                             char *widgRec, int offset,
01052                             Tcl_FreeProc **freeProcPtr));
01053 EXTERN int              TkPixelParseProc _ANSI_ARGS_((
01054                             ClientData clientData, Tcl_Interp *interp,
01055                             Tk_Window tkwin, CONST char *value, char *widgRec,
01056                             int offset));
01057 EXTERN char *           TkPixelPrintProc _ANSI_ARGS_((
01058                             ClientData clientData, Tk_Window tkwin,
01059                             char *widgRec, int offset,
01060                             Tcl_FreeProc **freeProcPtr));
01061 EXTERN int              TkPostscriptImage _ANSI_ARGS_((Tcl_Interp *interp,
01062                             Tk_Window tkwin, Tk_PostscriptInfo psInfo,
01063                             XImage *ximage, int x, int y, int width,
01064                             int height));
01065 EXTERN int              TkSmoothParseProc _ANSI_ARGS_((ClientData clientData,
01066                             Tcl_Interp *interp, Tk_Window tkwin,
01067                             CONST char *value, char *recordPtr, int offset));
01068 EXTERN char *           TkSmoothPrintProc _ANSI_ARGS_((ClientData clientData,
01069                             Tk_Window tkwin, char *recordPtr, int offset,
01070                             Tcl_FreeProc **freeProcPtr));
01071 EXTERN int              TkStateParseProc _ANSI_ARGS_((
01072                             ClientData clientData, Tcl_Interp *interp,
01073                             Tk_Window tkwin, CONST char *value,
01074                             char *widgRec, int offset));
01075 EXTERN char *           TkStatePrintProc _ANSI_ARGS_((
01076                             ClientData clientData, Tk_Window tkwin,
01077                             char *widgRec, int offset,
01078                             Tcl_FreeProc **freeProcPtr));
01079 EXTERN int              TkTileParseProc _ANSI_ARGS_((
01080                             ClientData clientData, Tcl_Interp *interp,
01081                             Tk_Window tkwin, CONST char *value, char *widgRec,
01082                             int offset));
01083 EXTERN char *           TkTilePrintProc _ANSI_ARGS_((
01084                             ClientData clientData, Tk_Window tkwin,
01085                             char *widgRec, int offset,
01086                             Tcl_FreeProc **freeProcPtr));
01087 
01088 /* 
01089  * Unsupported commands.
01090  */
01091 EXTERN int              TkUnsupported1Cmd _ANSI_ARGS_((ClientData clientData,
01092                             Tcl_Interp *interp, int argc, char **argv));
01093 
01094 # undef TCL_STORAGE_CLASS
01095 # define TCL_STORAGE_CLASS DLLIMPORT
01096 
01097 #endif  /* _TKINT */

Generated on Mon Oct 23 15:05:30 2006 for OpenSees by doxygen 1.5.0