diff options
Diffstat (limited to 'generic/tkCanvas.h')
-rw-r--r-- | generic/tkCanvas.h | 257 |
1 files changed, 129 insertions, 128 deletions
diff --git a/generic/tkCanvas.h b/generic/tkCanvas.h index ad6c555..d009cfa 100644 --- a/generic/tkCanvas.h +++ b/generic/tkCanvas.h @@ -1,15 +1,14 @@ /* * tkCanvas.h -- * - * Declarations shared among all the files that implement - * canvas widgets. + * Declarations shared among all the files that implement canvas widgets. * * Copyright (c) 1991-1994 The Regents of the University of California. * Copyright (c) 1994-1995 Sun Microsystems, Inc. * Copyright (c) 1998 by Scriptics Corporation. * - * See the file "license.terms" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TKCANVAS @@ -23,36 +22,39 @@ typedef struct TagSearchExpr_s TagSearchExpr; struct TagSearchExpr_s { - TagSearchExpr *next; /* for linked lists of expressions - used in bindings */ - Tk_Uid uid; /* the uid of the whole expression */ - Tk_Uid *uids; /* expresion compiled to an array of uids */ - int allocated; /* available space for array of uids */ - int length; /* length of expression */ - int index; /* current position in expression evaluation */ - int match; /* this expression matches event's item's tags*/ + TagSearchExpr *next; /* For linked lists of expressions - used in + * bindings. */ + Tk_Uid uid; /* The uid of the whole expression. */ + Tk_Uid *uids; /* Expresion compiled to an array of uids. */ + int allocated; /* Available space for array of uids. */ + int length; /* Length of expression. */ + int index; /* Current position in expression + * evaluation. */ + int match; /* This expression matches event's item's + * tags. */ }; #endif /* not USE_OLD_TAG_SEARCH */ /* - * The record below describes a canvas widget. It is made available - * to the item procedures so they can access certain shared fields such - * as the overall displacement and scale factor for the canvas. + * The record below describes a canvas widget. It is made available to the + * item functions so they can access certain shared fields such as the overall + * displacement and scale factor for the canvas. */ typedef struct TkCanvas { - Tk_Window tkwin; /* Window that embodies the canvas. NULL - * means that the window has been destroyed - * but the data structures haven't yet been - * cleaned up.*/ - Display *display; /* Display containing widget; needed, among + Tk_Window tkwin; /* Window that embodies the canvas. NULL means + * that the window has been destroyed but the + * data structures haven't yet been cleaned + * up.*/ + Display *display; /* Display containing widget; needed, among * other things, to release resources after * tkwin has already gone away. */ Tcl_Interp *interp; /* Interpreter associated with canvas. */ Tcl_Command widgetCmd; /* Token for canvas's widget command. */ - Tk_Item *firstItemPtr; /* First in list of all items in canvas, - * or NULL if canvas empty. */ - Tk_Item *lastItemPtr; /* Last in list of all items in canvas, - * or NULL if canvas empty. */ + Tk_Item *firstItemPtr; /* First in list of all items in canvas, or + * NULL if canvas empty. */ + Tk_Item *lastItemPtr; /* Last in list of all items in canvas, or + * NULL if canvas empty. */ /* * Information used when displaying widget: @@ -62,39 +64,39 @@ typedef struct TkCanvas { Tk_3DBorder bgBorder; /* Used for canvas background. */ int relief; /* Indicates whether window as a whole is * raised, sunken, or flat. */ - int highlightWidth; /* Width in pixels of highlight to draw - * around widget when it has the focus. - * <= 0 means don't draw a highlight. */ + int highlightWidth; /* Width in pixels of highlight to draw around + * widget when it has the focus. <= 0 means + * don't draw a highlight. */ XColor *highlightBgColorPtr; - /* Color for drawing traversal highlight - * area when highlight is off. */ + /* Color for drawing traversal highlight area + * when highlight is off. */ XColor *highlightColorPtr; /* Color for drawing traversal highlight. */ int inset; /* Total width of all borders, including * traversal highlight and 3-D border. - * Indicates how much interior stuff must - * be offset from outside edges to leave - * room for borders. */ + * Indicates how much interior stuff must be + * offset from outside edges to leave room for + * borders. */ GC pixmapGC; /* Used to copy bits from a pixmap to the * screen and also to clear the pixmap. */ int width, height; /* Dimensions to request for canvas window, * specified in pixels. */ - int redrawX1, redrawY1; /* Upper left corner of area to redraw, - * in pixel coordinates. Border pixels - * are included. Only valid if - * REDRAW_PENDING flag is set. */ - int redrawX2, redrawY2; /* Lower right corner of area to redraw, - * in integer canvas coordinates. Border - * pixels will *not* be redrawn. */ - int confine; /* Non-zero means constrain view to keep - * as much of canvas visible as possible. */ + int redrawX1, redrawY1; /* Upper left corner of area to redraw, in + * pixel coordinates. Border pixels are + * included. Only valid if REDRAW_PENDING flag + * is set. */ + int redrawX2, redrawY2; /* Lower right corner of area to redraw, in + * integer canvas coordinates. Border pixels + * will *not* be redrawn. */ + int confine; /* Non-zero means constrain view to keep as + * much of canvas visible as possible. */ /* * Information used to manage the selection and insertion cursor: */ - Tk_CanvasTextInfo textInfo; /* Contains lots of fields; see tk.h for - * details. This structure is shared with - * the code that implements individual items. */ + Tk_CanvasTextInfo textInfo; /* Contains lots of fields; see tk.h for + * details. This structure is shared with the + * code that implements individual items. */ int insertOnTime; /* Number of milliseconds cursor should spend * in "on" state for each blink. */ int insertOffTime; /* Number of milliseconds cursor should spend @@ -104,7 +106,7 @@ typedef struct TkCanvas { * off. */ /* - * Transformation applied to canvas as a whole: to compute screen + * Transformation applied to canvas as a whole: to compute screen * coordinates (X,Y) from canvas coordinates (x,y), do the following: * * X = x - xOrigin; @@ -116,65 +118,63 @@ typedef struct TkCanvas { * canvas pixel units. */ int drawableXOrigin, drawableYOrigin; /* During redisplay, these fields give the - * canvas coordinates corresponding to - * the upper-left corner of the drawable - * where items are actually being drawn - * (typically a pixmap smaller than the - * whole window). */ + * canvas coordinates corresponding to the + * upper-left corner of the drawable where + * items are actually being drawn (typically a + * pixmap smaller than the whole window). */ /* * Information used for event bindings associated with items. */ Tk_BindingTable bindingTable; - /* Table of all bindings currently defined - * for this canvas. NULL means that no - * bindings exist, so the table hasn't been - * created. Each "object" used for this - * table is either a Tk_Uid for a tag or - * the address of an item named by id. */ + /* Table of all bindings currently defined for + * this canvas. NULL means that no bindings + * exist, so the table hasn't been created. + * Each "object" used for this table is either + * a Tk_Uid for a tag or the address of an + * item named by id. */ Tk_Item *currentItemPtr; /* The item currently containing the mouse * pointer, or NULL if none. */ Tk_Item *newCurrentPtr; /* The item that is about to become the - * current one, or NULL. This field is - * used to detect deletions of the new - * current item pointer that occur during - * Leave processing of the previous current - * item. */ - double closeEnough; /* The mouse is assumed to be inside an - * item if it is this close to it. */ - XEvent pickEvent; /* The event upon which the current choice - * of currentItem is based. Must be saved - * so that if the currentItem is deleted, - * can pick another. */ - int state; /* Last known modifier state. Used to - * defer picking a new current object - * while buttons are down. */ + * current one, or NULL. This field is used to + * detect deletions of the new current item + * pointer that occur during Leave processing + * of the previous current item. */ + double closeEnough; /* The mouse is assumed to be inside an item + * if it is this close to it. */ + XEvent pickEvent; /* The event upon which the current choice of + * currentItem is based. Must be saved so that + * if the currentItem is deleted, can pick + * another. */ + int state; /* Last known modifier state. Used to defer + * picking a new current object while buttons + * are down. */ /* * Information used for managing scrollbars: */ char *xScrollCmd; /* Command prefix for communicating with - * horizontal scrollbar. NULL means no - * horizontal scrollbar. Malloc'ed*/ + * horizontal scrollbar. NULL means no + * horizontal scrollbar. Malloc'ed. */ char *yScrollCmd; /* Command prefix for communicating with - * vertical scrollbar. NULL means no - * vertical scrollbar. Malloc'ed*/ + * vertical scrollbar. NULL means no vertical + * scrollbar. Malloc'ed. */ int scrollX1, scrollY1, scrollX2, scrollY2; /* These four coordinates define the region * that is the 100% area for scrolling (i.e. * these numbers determine the size and * location of the sliders on scrollbars). * Units are pixels in canvas coords. */ - char *regionString; /* The option string from which scrollX1 - * etc. are derived. Malloc'ed. */ + char *regionString; /* The option string from which scrollX1 etc. + * are derived. Malloc'ed. */ int xScrollIncrement; /* If >0, defines a grid for horizontal - * scrolling. This is the size of the "unit", + * scrolling. This is the size of the "unit", * and the left edge of the screen will always * lie on an even unit boundary. */ int yScrollIncrement; /* If >0, defines a grid for horizontal - * scrolling. This is the size of the "unit", + * scrolling. This is the size of the "unit", * and the left edge of the screen will always * lie on an even unit boundary. */ @@ -195,11 +195,11 @@ typedef struct TkCanvas { */ Tk_Item *hotPtr; /* Pointer to "hot" item (one that's been - * recently used. NULL means there's no - * hot item. */ + * recently used. NULL means there's no hot + * item. */ Tk_Item *hotPrevPtr; /* Pointer to predecessor to hotPtr (NULL - * means item is first in list). This is - * only a hint and may not really be hotPtr's + * means item is first in list). This is only + * a hint and may not really be hotPtr's * predecessor. */ /* @@ -207,61 +207,61 @@ typedef struct TkCanvas { */ Tk_Cursor cursor; /* Current cursor for window, or None. */ - char *takeFocus; /* Value of -takefocus option; not used in - * the C code, but used by keyboard traversal - * scripts. Malloc'ed, but may be NULL. */ - double pixelsPerMM; /* Scale factor between MM and pixels; - * used when converting coordinates. */ - int flags; /* Various flags; see below for + char *takeFocus; /* Value of -takefocus option; not used in the + * C code, but used by keyboard traversal + * scripts. Malloc'ed, but may be NULL. */ + double pixelsPerMM; /* Scale factor between MM and pixels; used + * when converting coordinates. */ + int flags; /* Various flags; see below for * definitions. */ - int nextId; /* Number to use as id for next item - * created in widget. */ - Tk_PostscriptInfo psInfo; - /* Pointer to information used for generating - * Postscript for the canvas. NULL means - * no Postscript is currently being - * generated. */ + int nextId; /* Number to use as id for next item created + * in widget. */ + Tk_PostscriptInfo psInfo; /* Pointer to information used for generating + * Postscript for the canvas. NULL means no + * Postscript is currently being generated. */ Tcl_HashTable idTable; /* Table of integer indices. */ + /* * Additional information, added by the 'dash'-patch */ - VOID *reserved1; - Tk_State canvas_state; /* state of canvas */ - VOID *reserved2; - VOID *reserved3; + + void *reserved1; + Tk_State canvas_state; /* State of canvas. */ + void *reserved2; + void *reserved3; Tk_TSOffset tsoffset; #ifndef USE_OLD_TAG_SEARCH - TagSearchExpr *bindTagExprs; /* linked list of tag expressions used in bindings */ + TagSearchExpr *bindTagExprs;/* Linked list of tag expressions used in + * bindings. */ #endif } TkCanvas; /* * Flag bits for canvases: * - * REDRAW_PENDING - 1 means a DoWhenIdle handler has already - * been created to redraw some or all of the - * canvas. + * REDRAW_PENDING - 1 means a DoWhenIdle handler has already been + * created to redraw some or all of the canvas. * REDRAW_BORDERS - 1 means that the borders need to be redrawn * during the next redisplay operation. * REPICK_NEEDED - 1 means DisplayCanvas should pick a new * current item before redrawing the canvas. - * GOT_FOCUS - 1 means the focus is currently in this - * widget, so should draw the insertion cursor - * and traversal highlight. + * GOT_FOCUS - 1 means the focus is currently in this widget, + * so should draw the insertion cursor and + * traversal highlight. * CURSOR_ON - 1 means the insertion cursor is in the "on" - * phase of its blink cycle. 0 means either - * we don't have the focus or the cursor is in - * the "off" phase of its cycle. - * UPDATE_SCROLLBARS - 1 means the scrollbars should get updated - * as part of the next display operation. - * LEFT_GRABBED_ITEM - 1 means that the mouse left the current - * item while a grab was in effect, so we - * didn't change canvasPtr->currentItemPtr. + * phase of its blink cycle. 0 means either we + * don't have the focus or the cursor is in the + * "off" phase of its cycle. + * UPDATE_SCROLLBARS - 1 means the scrollbars should get updated as + * part of the next display operation. + * LEFT_GRABBED_ITEM - 1 means that the mouse left the current item + * while a grab was in effect, so we didn't + * change canvasPtr->currentItemPtr. * REPICK_IN_PROGRESS - 1 means PickCurrentItem is currently - * executing. If it should be called recursively, + * executing. If it should be called recursively, * it should simply return immediately. - * BBOX_NOT_EMPTY - 1 means that the bounding box of the area - * that should be redrawn is not empty. + * BBOX_NOT_EMPTY - 1 means that the bounding box of the area that + * should be redrawn is not empty. */ #define REDRAW_PENDING 1 @@ -277,8 +277,8 @@ typedef struct TkCanvas { /* * Flag bits for canvas items (redraw_flags): * - * FORCE_REDRAW - 1 means that the new coordinates of some - * item are not yet registered using + * FORCE_REDRAW - 1 means that the new coordinates of some item + * are not yet registered using * Tk_CanvasEventuallyRedraw(). It should still * be done by the general canvas code. */ @@ -286,20 +286,21 @@ typedef struct TkCanvas { #define FORCE_REDRAW 8 /* - * Canvas-related procedures that are shared among Tk modules but not - * exported to the outside world: + * Canvas-related functions that are shared among Tk modules but not exported + * to the outside world: */ -extern int TkCanvPostscriptCmd _ANSI_ARGS_((TkCanvas *canvasPtr, - Tcl_Interp *interp, int argc, CONST char **argv)); - +MODULE_SCOPE int TkCanvPostscriptCmd(TkCanvas *canvasPtr, + Tcl_Interp *interp, int argc, CONST char **argv); +MODULE_SCOPE int TkCanvTranslatePath(TkCanvas *canvPtr, + int numVertex, double *coordPtr, int closed, + XPoint *outPtr); /* - * Other procedures that are shared among Tk canvas modules but not exported - * to the outside world: + * Standard item types provided by Tk: */ -extern int TkCanvTranslatePath _ANSI_ARGS_((TkCanvas *canvPtr, - int numVertex, double *coordPtr, int closed, - XPoint *outPtr)); +MODULE_SCOPE Tk_ItemType tkArcType, tkBitmapType, tkImageType, tkLineType; +MODULE_SCOPE Tk_ItemType tkOvalType, tkPolygonType; +MODULE_SCOPE Tk_ItemType tkRectangleType, tkTextType, tkWindowType; #endif /* _TKCANVAS */ |