OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [tk/] [generic/] [tkCanvas.h] - Diff between revs 579 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 579 Rev 1765
/*
/*
 * tkCanvas.h --
 * tkCanvas.h --
 *
 *
 *      Declarations shared among all the files that implement
 *      Declarations shared among all the files that implement
 *      canvas widgets.
 *      canvas widgets.
 *
 *
 * Copyright (c) 1991-1994 The Regents of the University of California.
 * Copyright (c) 1991-1994 The Regents of the University of California.
 * Copyright (c) 1994-1995 Sun Microsystems, Inc.
 * Copyright (c) 1994-1995 Sun Microsystems, Inc.
 * Copyright (c) 1998 by Scriptics Corporation.
 * Copyright (c) 1998 by Scriptics Corporation.
 *
 *
 * See the file "license.terms" for information on usage and redistribution
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 *
 * RCS: @(#) $Id: tkCanvas.h,v 1.1.1.1 2002-01-16 10:25:51 markom Exp $
 * RCS: @(#) $Id: tkCanvas.h,v 1.1.1.1 2002-01-16 10:25:51 markom Exp $
 */
 */
 
 
#ifndef _TKCANVAS
#ifndef _TKCANVAS
#define _TKCANVAS
#define _TKCANVAS
 
 
#ifndef _TK
#ifndef _TK
#include "tk.h"
#include "tk.h"
#endif
#endif
 
 
/*
/*
 * The record below describes a canvas widget.  It is made available
 * The record below describes a canvas widget.  It is made available
 * to the item procedures so they can access certain shared fields such
 * to the item procedures so they can access certain shared fields such
 * as the overall displacement and scale factor for the canvas.
 * as the overall displacement and scale factor for the canvas.
 */
 */
 
 
typedef struct TkCanvas {
typedef struct TkCanvas {
    Tk_Window tkwin;            /* Window that embodies the canvas.  NULL
    Tk_Window tkwin;            /* Window that embodies the canvas.  NULL
                                 * means that the window has been destroyed
                                 * means that the window has been destroyed
                                 * but the data structures haven't yet been
                                 * but the data structures haven't yet been
                                 * cleaned up.*/
                                 * cleaned up.*/
    Display *display;           /* Display containing widget;  needed, among
    Display *display;           /* Display containing widget;  needed, among
                                 * other things, to release resources after
                                 * other things, to release resources after
                                 * tkwin has already gone away. */
                                 * tkwin has already gone away. */
    Tcl_Interp *interp;         /* Interpreter associated with canvas. */
    Tcl_Interp *interp;         /* Interpreter associated with canvas. */
    Tcl_Command widgetCmd;      /* Token for canvas's widget command. */
    Tcl_Command widgetCmd;      /* Token for canvas's widget command. */
    Tk_Item *firstItemPtr;      /* First in list of all items in canvas,
    Tk_Item *firstItemPtr;      /* First in list of all items in canvas,
                                 * or NULL if canvas empty. */
                                 * or NULL if canvas empty. */
    Tk_Item *lastItemPtr;       /* Last in list of all items in canvas,
    Tk_Item *lastItemPtr;       /* Last in list of all items in canvas,
                                 * or NULL if canvas empty. */
                                 * or NULL if canvas empty. */
 
 
    /*
    /*
     * Information used when displaying widget:
     * Information used when displaying widget:
     */
     */
 
 
    int borderWidth;            /* Width of 3-D border around window. */
    int borderWidth;            /* Width of 3-D border around window. */
    Tk_3DBorder bgBorder;       /* Used for canvas background. */
    Tk_3DBorder bgBorder;       /* Used for canvas background. */
    int relief;                 /* Indicates whether window as a whole is
    int relief;                 /* Indicates whether window as a whole is
                                 * raised, sunken, or flat. */
                                 * raised, sunken, or flat. */
    int highlightWidth;         /* Width in pixels of highlight to draw
    int highlightWidth;         /* Width in pixels of highlight to draw
                                 * around widget when it has the focus.
                                 * around widget when it has the focus.
                                 * <= 0 means don't draw a highlight. */
                                 * <= 0 means don't draw a highlight. */
    XColor *highlightBgColorPtr;
    XColor *highlightBgColorPtr;
                                /* Color for drawing traversal highlight
                                /* Color for drawing traversal highlight
                                 * area when highlight is off. */
                                 * area when highlight is off. */
    XColor *highlightColorPtr;  /* Color for drawing traversal highlight. */
    XColor *highlightColorPtr;  /* Color for drawing traversal highlight. */
    int inset;                  /* Total width of all borders, including
    int inset;                  /* Total width of all borders, including
                                 * traversal highlight and 3-D border.
                                 * traversal highlight and 3-D border.
                                 * Indicates how much interior stuff must
                                 * Indicates how much interior stuff must
                                 * be offset from outside edges to leave
                                 * be offset from outside edges to leave
                                 * room for borders. */
                                 * room for borders. */
    GC pixmapGC;                /* Used to copy bits from a pixmap to the
    GC pixmapGC;                /* Used to copy bits from a pixmap to the
                                 * screen and also to clear the pixmap. */
                                 * screen and also to clear the pixmap. */
    int width, height;          /* Dimensions to request for canvas window,
    int width, height;          /* Dimensions to request for canvas window,
                                 * specified in pixels. */
                                 * specified in pixels. */
    int redrawX1, redrawY1;     /* Upper left corner of area to redraw,
    int redrawX1, redrawY1;     /* Upper left corner of area to redraw,
                                 * in pixel coordinates.  Border pixels
                                 * in pixel coordinates.  Border pixels
                                 * are included.  Only valid if
                                 * are included.  Only valid if
                                 * REDRAW_PENDING flag is set. */
                                 * REDRAW_PENDING flag is set. */
    int redrawX2, redrawY2;     /* Lower right corner of area to redraw,
    int redrawX2, redrawY2;     /* Lower right corner of area to redraw,
                                 * in integer canvas coordinates.  Border
                                 * in integer canvas coordinates.  Border
                                 * pixels will *not* be redrawn. */
                                 * pixels will *not* be redrawn. */
    int confine;                /* Non-zero means constrain view to keep
    int confine;                /* Non-zero means constrain view to keep
                                 * as much of canvas visible as possible. */
                                 * as much of canvas visible as possible. */
 
 
    /*
    /*
     * Information used to manage the selection and insertion cursor:
     * Information used to manage the selection and insertion cursor:
     */
     */
 
 
    Tk_CanvasTextInfo textInfo; /* Contains lots of fields;  see tk.h for
    Tk_CanvasTextInfo textInfo; /* Contains lots of fields;  see tk.h for
                                 * details.  This structure is shared with
                                 * details.  This structure is shared with
                                 * the code that implements individual items. */
                                 * the code that implements individual items. */
    int insertOnTime;           /* Number of milliseconds cursor should spend
    int insertOnTime;           /* Number of milliseconds cursor should spend
                                 * in "on" state for each blink. */
                                 * in "on" state for each blink. */
    int insertOffTime;          /* Number of milliseconds cursor should spend
    int insertOffTime;          /* Number of milliseconds cursor should spend
                                 * in "off" state for each blink. */
                                 * in "off" state for each blink. */
    Tcl_TimerToken insertBlinkHandler;
    Tcl_TimerToken insertBlinkHandler;
                                /* Timer handler used to blink cursor on and
                                /* Timer handler used to blink cursor on and
                                 * off. */
                                 * 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:
     * coordinates (X,Y) from canvas coordinates (x,y), do the following:
     *
     *
     * X = x - xOrigin;
     * X = x - xOrigin;
     * Y = y - yOrigin;
     * Y = y - yOrigin;
     */
     */
 
 
    int xOrigin, yOrigin;       /* Canvas coordinates corresponding to
    int xOrigin, yOrigin;       /* Canvas coordinates corresponding to
                                 * upper-left corner of window, given in
                                 * upper-left corner of window, given in
                                 * canvas pixel units. */
                                 * canvas pixel units. */
    int drawableXOrigin, drawableYOrigin;
    int drawableXOrigin, drawableYOrigin;
                                /* During redisplay, these fields give the
                                /* During redisplay, these fields give the
                                 * canvas coordinates corresponding to
                                 * canvas coordinates corresponding to
                                 * the upper-left corner of the drawable
                                 * the upper-left corner of the drawable
                                 * where items are actually being drawn
                                 * where items are actually being drawn
                                 * (typically a pixmap smaller than the
                                 * (typically a pixmap smaller than the
                                 * whole window). */
                                 * whole window). */
 
 
    /*
    /*
     * Information used for event bindings associated with items.
     * Information used for event bindings associated with items.
     */
     */
 
 
    Tk_BindingTable bindingTable;
    Tk_BindingTable bindingTable;
                                /* Table of all bindings currently defined
                                /* Table of all bindings currently defined
                                 * for this canvas.  NULL means that no
                                 * for this canvas.  NULL means that no
                                 * bindings exist, so the table hasn't been
                                 * bindings exist, so the table hasn't been
                                 * created.  Each "object" used for this
                                 * created.  Each "object" used for this
                                 * table is either a Tk_Uid for a tag or
                                 * table is either a Tk_Uid for a tag or
                                 * the address of an item named by id. */
                                 * the address of an item named by id. */
    Tk_Item *currentItemPtr;    /* The item currently containing the mouse
    Tk_Item *currentItemPtr;    /* The item currently containing the mouse
                                 * pointer, or NULL if none. */
                                 * pointer, or NULL if none. */
    Tk_Item *newCurrentPtr;     /* The item that is about to become the
    Tk_Item *newCurrentPtr;     /* The item that is about to become the
                                 * current one, or NULL.  This field is
                                 * current one, or NULL.  This field is
                                 * used to detect deletions  of the new
                                 * used to detect deletions  of the new
                                 * current item pointer that occur during
                                 * current item pointer that occur during
                                 * Leave processing of the previous current
                                 * Leave processing of the previous current
                                 * item.  */
                                 * item.  */
    double closeEnough;         /* The mouse is assumed to be inside an
    double closeEnough;         /* The mouse is assumed to be inside an
                                 * item if it is this close to it. */
                                 * item if it is this close to it. */
    XEvent pickEvent;           /* The event upon which the current choice
    XEvent pickEvent;           /* The event upon which the current choice
                                 * of currentItem is based.  Must be saved
                                 * of currentItem is based.  Must be saved
                                 * so that if the currentItem is deleted,
                                 * so that if the currentItem is deleted,
                                 * can pick another. */
                                 * can pick another. */
    int state;                  /* Last known modifier state.  Used to
    int state;                  /* Last known modifier state.  Used to
                                 * defer picking a new current object
                                 * defer picking a new current object
                                 * while buttons are down. */
                                 * while buttons are down. */
 
 
    /*
    /*
     * Information used for managing scrollbars:
     * Information used for managing scrollbars:
     */
     */
 
 
    char *xScrollCmd;           /* Command prefix for communicating with
    char *xScrollCmd;           /* Command prefix for communicating with
                                 * horizontal scrollbar.  NULL means no
                                 * horizontal scrollbar.  NULL means no
                                 * horizontal scrollbar.  Malloc'ed*/
                                 * horizontal scrollbar.  Malloc'ed*/
    char *yScrollCmd;           /* Command prefix for communicating with
    char *yScrollCmd;           /* Command prefix for communicating with
                                 * vertical scrollbar.  NULL means no
                                 * vertical scrollbar.  NULL means no
                                 * vertical scrollbar.  Malloc'ed*/
                                 * vertical scrollbar.  Malloc'ed*/
    int scrollX1, scrollY1, scrollX2, scrollY2;
    int scrollX1, scrollY1, scrollX2, scrollY2;
                                /* These four coordinates define the region
                                /* These four coordinates define the region
                                 * that is the 100% area for scrolling (i.e.
                                 * that is the 100% area for scrolling (i.e.
                                 * these numbers determine the size and
                                 * these numbers determine the size and
                                 * location of the sliders on scrollbars).
                                 * location of the sliders on scrollbars).
                                 * Units are pixels in canvas coords. */
                                 * Units are pixels in canvas coords. */
    char *regionString;         /* The option string from which scrollX1
    char *regionString;         /* The option string from which scrollX1
                                 * etc. are derived.  Malloc'ed. */
                                 * etc. are derived.  Malloc'ed. */
    int xScrollIncrement;       /* If >0, defines a grid for horizontal
    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
                                 * and the left edge of the screen will always
                                 * lie on an even unit boundary. */
                                 * lie on an even unit boundary. */
    int yScrollIncrement;       /* If >0, defines a grid for horizontal
    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
                                 * and the left edge of the screen will always
                                 * lie on an even unit boundary. */
                                 * lie on an even unit boundary. */
 
 
    /*
    /*
     * Information used for scanning:
     * Information used for scanning:
     */
     */
 
 
    int scanX;                  /* X-position at which scan started (e.g.
    int scanX;                  /* X-position at which scan started (e.g.
                                 * button was pressed here). */
                                 * button was pressed here). */
    int scanXOrigin;            /* Value of xOrigin field when scan started. */
    int scanXOrigin;            /* Value of xOrigin field when scan started. */
    int scanY;                  /* Y-position at which scan started (e.g.
    int scanY;                  /* Y-position at which scan started (e.g.
                                 * button was pressed here). */
                                 * button was pressed here). */
    int scanYOrigin;            /* Value of yOrigin field when scan started. */
    int scanYOrigin;            /* Value of yOrigin field when scan started. */
 
 
    /*
    /*
     * Information used to speed up searches by remembering the last item
     * Information used to speed up searches by remembering the last item
     * created or found with an item id search.
     * created or found with an item id search.
     */
     */
 
 
    Tk_Item *hotPtr;            /* Pointer to "hot" item (one that's been
    Tk_Item *hotPtr;            /* Pointer to "hot" item (one that's been
                                 * recently used.  NULL means there's no
                                 * recently used.  NULL means there's no
                                 * hot item. */
                                 * hot item. */
    Tk_Item *hotPrevPtr;        /* Pointer to predecessor to hotPtr (NULL
    Tk_Item *hotPrevPtr;        /* Pointer to predecessor to hotPtr (NULL
                                 * means item is first in list).  This is
                                 * means item is first in list).  This is
                                 * only a hint and may not really be hotPtr's
                                 * only a hint and may not really be hotPtr's
                                 * predecessor. */
                                 * predecessor. */
 
 
    /*
    /*
     * Miscellaneous information:
     * Miscellaneous information:
     */
     */
 
 
    Tk_Cursor cursor;           /* Current cursor for window, or None. */
    Tk_Cursor cursor;           /* Current cursor for window, or None. */
    char *takeFocus;            /* Value of -takefocus option;  not used in
    char *takeFocus;            /* Value of -takefocus option;  not used in
                                 * the C code, but used by keyboard traversal
                                 * the C code, but used by keyboard traversal
                                 * scripts.  Malloc'ed, but may be NULL. */
                                 * scripts.  Malloc'ed, but may be NULL. */
    double pixelsPerMM;         /* Scale factor between MM and pixels;
    double pixelsPerMM;         /* Scale factor between MM and pixels;
                                 * used when converting coordinates. */
                                 * used when converting coordinates. */
    int flags;                  /* Various flags;  see below for
    int flags;                  /* Various flags;  see below for
                                 * definitions. */
                                 * definitions. */
    int nextId;                 /* Number to use as id for next item
    int nextId;                 /* Number to use as id for next item
                                 * created in widget. */
                                 * created in widget. */
    struct TkPostscriptInfo *psInfoPtr;
    struct TkPostscriptInfo *psInfoPtr;
                                /* Pointer to information used for generating
                                /* Pointer to information used for generating
                                 * Postscript for the canvas.  NULL means
                                 * Postscript for the canvas.  NULL means
                                 * no Postscript is currently being
                                 * no Postscript is currently being
                                 * generated. */
                                 * generated. */
    Tcl_HashTable idTable;      /* Table of integer indices. */
    Tcl_HashTable idTable;      /* Table of integer indices. */
} TkCanvas;
} TkCanvas;
 
 
/*
/*
 * Flag bits for canvases:
 * Flag bits for canvases:
 *
 *
 * REDRAW_PENDING -             1 means a DoWhenIdle handler has already
 * REDRAW_PENDING -             1 means a DoWhenIdle handler has already
 *                              been created to redraw some or all of the
 *                              been created to redraw some or all of the
 *                              canvas.
 *                              canvas.
 * REDRAW_BORDERS -             1 means that the borders need to be redrawn
 * REDRAW_BORDERS -             1 means that the borders need to be redrawn
 *                              during the next redisplay operation.
 *                              during the next redisplay operation.
 * REPICK_NEEDED -              1 means DisplayCanvas should pick a new
 * REPICK_NEEDED -              1 means DisplayCanvas should pick a new
 *                              current item before redrawing the canvas.
 *                              current item before redrawing the canvas.
 * GOT_FOCUS -                  1 means the focus is currently in this
 * GOT_FOCUS -                  1 means the focus is currently in this
 *                              widget, so should draw the insertion cursor
 *                              widget, so should draw the insertion cursor
 *                              and traversal highlight.
 *                              and traversal highlight.
 * CURSOR_ON -                  1 means the insertion cursor is in the "on"
 * CURSOR_ON -                  1 means the insertion cursor is in the "on"
 *                              phase of its blink cycle.  0 means either
 *                              phase of its blink cycle.  0 means either
 *                              we don't have the focus or the cursor is in
 *                              we don't have the focus or the cursor is in
 *                              the "off" phase of its cycle.
 *                              the "off" phase of its cycle.
 * UPDATE_SCROLLBARS -          1 means the scrollbars should get updated
 * UPDATE_SCROLLBARS -          1 means the scrollbars should get updated
 *                              as part of the next display operation.
 *                              as part of the next display operation.
 * LEFT_GRABBED_ITEM -          1 means that the mouse left the current
 * LEFT_GRABBED_ITEM -          1 means that the mouse left the current
 *                              item while a grab was in effect, so we
 *                              item while a grab was in effect, so we
 *                              didn't change canvasPtr->currentItemPtr.
 *                              didn't change canvasPtr->currentItemPtr.
 * REPICK_IN_PROGRESS -         1 means PickCurrentItem is currently
 * 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.
 *                              it should simply return immediately.
 */
 */
 
 
#define REDRAW_PENDING          1
#define REDRAW_PENDING          1
#define REDRAW_BORDERS          2
#define REDRAW_BORDERS          2
#define REPICK_NEEDED           4
#define REPICK_NEEDED           4
#define GOT_FOCUS               8
#define GOT_FOCUS               8
#define CURSOR_ON               0x10
#define CURSOR_ON               0x10
#define UPDATE_SCROLLBARS       0x20
#define UPDATE_SCROLLBARS       0x20
#define LEFT_GRABBED_ITEM       0x40
#define LEFT_GRABBED_ITEM       0x40
#define REPICK_IN_PROGRESS      0x100
#define REPICK_IN_PROGRESS      0x100
 
 
/*
/*
 * Canvas-related procedures that are shared among Tk modules but not
 * Canvas-related procedures that are shared among Tk modules but not
 * exported to the outside world:
 * exported to the outside world:
 */
 */
 
 
extern int              TkCanvPostscriptCmd _ANSI_ARGS_((TkCanvas *canvasPtr,
extern int              TkCanvPostscriptCmd _ANSI_ARGS_((TkCanvas *canvasPtr,
                            Tcl_Interp *interp, int argc, char **argv));
                            Tcl_Interp *interp, int argc, char **argv));
 
 
#endif /* _TKCANVAS */
#endif /* _TKCANVAS */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.