📄 tkcanvas.h
字号:
/* * tkCanvas.h -- * * Declarations shared among all the files that implement * canvas widgets. * * Copyright (c) 1991-1993 The Regents of the University of California. * All rights reserved. * * Permission is hereby granted, without written agreement and without * license or royalty fees, to use, copy, modify, and distribute this * software and its documentation for any purpose, provided that the * above copyright notice and the following two paragraphs appear in * all copies of this software. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. * * $Header: /home/MPI/cvsMaster/mpich/mpe/profiling/nupshot/tkCanvas.h,v 1.1.1.1 1997/09/17 20:38:59 gropp Exp $ SPRITE (Berkeley) */#ifndef _TKCANVAS#define _TKCANVAS#ifndef _TK#include "tk.h"#endif/* * For each item in a canvas widget there exists one record with * the following structure. Each actual item is represented by * a record with the following stuff at its beginning, plus additional * type-specific stuff after that. */#define TK_TAG_SPACE 3typedef struct Tk_Item { int id; /* Unique identifier for this item * (also serves as first tag for * item). */ struct Tk_Item *nextPtr; /* Next in display list of all * items in this canvas. Later items * in list are drawn on top of earlier * ones. */ Tk_Uid staticTagSpace[TK_TAG_SPACE];/* Built-in space for limited # of * tags. */ Tk_Uid *tagPtr; /* Pointer to array of tags. Usually * points to staticTagSpace, but * may point to malloc-ed space if * there are lots of tags. */ int tagSpace; /* Total amount of tag space available * at tagPtr. */ int numTags; /* Number of tag slots actually used * at *tagPtr. */ struct Tk_ItemType *typePtr; /* Table of procedures that implement * this type of item. */ int x1, y1, x2, y2; /* Bounding box for item, in integer * canvas units. Set by item-specific * code and guaranteed to contain every * pixel drawn in item. Item area * includes x1 and y1 but not x2 * and y2. */ /* *------------------------------------------------------------------ * Starting here is additional type-specific stuff; see the * declarations for individual types to see what is part of * each type. The actual space below is determined by the * "itemInfoSize" of the type's Tk_ItemType record. *------------------------------------------------------------------ */} Tk_Item;/* * 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. */typedef struct { 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. */ 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: */ int borderWidth; /* Width of 3-D border around window. */ Tk_3DBorder bgBorder; /* Used for canvas background. */ int relief; /* Indicates whether window as a whole is * raised, sunken, or flat. */ 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 pixel 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 and display selection: */ Tk_3DBorder selBorder; /* Border and background for selected * characters. */ int selBorderWidth; /* Width of border around selection. */ XColor *selFgColorPtr; /* Foreground color for selected text. */ Tk_Item *selItemPtr; /* Pointer to selected item. NULL means * selection isn't in this canvas. */ int selectFirst; /* Index of first selected character. */ int selectLast; /* Index of last selected character. */ Tk_Item *anchorItemPtr; /* Item corresponding to "selectAnchor": * not necessarily selItemPtr. */ int selectAnchor; /* Fixed end of selection (i.e. "select to" * operation will use this as one end of the * selection). */ /* * Information for display insertion cursor in text: */ Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion * cursor. */ int insertWidth; /* Total width of insertion cursor. */ int insertBorderWidth; /* Width of 3-D border around insert cursor. */ int insertOnTime; /* Number of milliseconds cursor should spend * in "on" state for each blink. */ int insertOffTime; /* Number of milliseconds cursor should spend * in "off" state for each blink. */ Tk_TimerToken insertBlinkHandler; /* Timer handler used to blink cursor on and * off. */ Tk_Item *focusItemPtr; /* Item that currently has the input focus, * or NULL if no such item. */ /* * Transformation applied to canvas as a whole: to compute screen * coordinates (X,Y) from canvas coordinates (x,y), do the following: * * X = x - xOrigin; * Y = y - yOrigin; */ int xOrigin, yOrigin; /* Canvas coordinates corresponding to * upper-left corner of window, given in * 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). */ /* * 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. */ Tk_Item *currentItemPtr; /* The item currently containing the mouse * pointer, or NULL if none. */ 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*/ char *yScrollCmd; /* Command prefix for communicating with * 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.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -