Home Page Toolkit Overview Using GML User Input Services Finger Tracker Calibrator Frame Grabber Service protocol Obtaining GML Installing GML Licence Developer Documentation Tcl/Tk API The GML Canvas Image processing Tcl Scripts Library List of Classes List of Files C/C++ API List of Classes List of Files |
gmlTcl_GLCanvas.h00001 /* 00002 * tkCanvas.h -- 00003 * 00004 * Declarations shared among all the files that implement 00005 * canvas widgets. 00006 * 00007 * Copyright (c) 1991-1994 The Regents of the University of California. 00008 * Copyright (c) 1994-1995 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: tkCanvas.h,v 1.4 1999/12/14 06:52:27 hobbs Exp $ 00015 */ 00016 00017 #ifndef __GMLTCL_GLCANVAS__ 00018 #define __GMLTCL_GLCANVAS__ 00019 00020 #ifndef _TK 00021 #include "tk.h" 00022 #endif 00023 00024 /* gmlTcl_TGLCanvas patch (2002 08 19 - FB) */ 00025 00026 #include "gml/gl/gml_GL_Base.h" 00027 00028 #include "gml/tcl/wrapper/wrapper/gmlTcl_Wrapper.h" 00029 #include "gml/tcl/wrapper/canvas/gmlTcl_GLCanvasDecls.h" 00030 #include "gml/tcl/wrapper/canvas/gmlTcl_GLCanvasOpenGL.h" 00031 #include "gml/tcl/wrapper/canvas/gmlTcl_GRItem.h" 00032 #include "gml/ui/gml_GRItem_Polygon_GL.h" 00033 #include "gml/ui/gml_GRItem_DisplayList.h" 00034 00035 /* Private function in the Tk canvas that we need to export */ 00036 00037 extern int gmlTcl_GLCanvasWidgetCmd (ClientData clientData, 00038 Tcl_Interp* interp, 00039 int argc, 00040 Tcl_Obj*CONST* argv); 00041 extern void gmlTcl_GLCanvasEventuallyRedrawItem (Tk_Canvas canvas, 00042 Tk_Item* itemPtr); 00043 00044 struct TagSearch; 00045 extern int 00046 gmlTcl_GLCanvasRelinkItems (gmlTcl_TGLCanvas* canvasPtr, 00047 Tcl_Obj* tag, 00048 Tk_Item* prevPtr, 00049 TagSearch** searchPtrPtr, 00050 int withHierarchy, 00051 int raise); 00052 00053 void 00054 gmlTcl_GLCanvasTagSearchDestroy (TagSearch* tag); 00055 00056 00057 /* Functions and globals defined and documented in "gmlTcl_GLCanvasExtensions.cc" */ 00058 00059 extern char* gmlTcl_gGLCanvas_classString; 00060 extern gml_TList* gmlTclgGLCanvasInstanceList; 00061 00062 00063 struct gmlTcl_TGLCanvas; 00064 extern int gmlTcl_GLCanvasRegisterOwnedObject (Tcl_Interp* interp, 00065 gmlTcl_TGLCanvas* canvas, 00066 gmlTcl_TWrapObject object); 00067 00068 extern void gmlTcl_GLCanvasDeregisterOwnedObject (gmlTcl_TGLCanvas* canvas, 00069 gmlTcl_TWrapObject object); 00070 00071 extern void gmlTcl_GLCanvasRedrawItemCallback (gml_TError err, gml_TPointer clientData); 00072 00073 extern gmlTcl_TWrapParseProc* gmlTcl_gWrapParseGLCanvas; 00074 00075 /* end of gmlTcl_TGLCanvas patch */ 00076 00077 00078 typedef struct TagSearchExpr_s TagSearchExpr; 00079 00080 struct TagSearchExpr_s { 00081 TagSearchExpr *next; /* for linked lists of expressions - used in bindings */ 00082 Tk_Uid uid; /* the uid of the whole expression */ 00083 Tk_Uid *uids; /* expresion compiled to an array of uids */ 00084 int allocated; /* available space for array of uids */ 00085 int length; /* length of expression */ 00086 int index; /* current position in expression evaluation */ 00087 int match; /* this expression matches event's item's tags*/ 00088 }; 00089 00090 /* 00091 * The record below describes a canvas widget. It is made available 00092 * to the item procedures so they can access certain shared fields such 00093 * as the overall displacement and scale factor for the canvas. 00094 */ 00095 00096 typedef struct gmlTcl_TGLCanvas { 00097 Tk_Window tkwin; /* Window that embodies the canvas. NULL 00098 * means that the window has been destroyed 00099 * but the data structures haven't yet been 00100 * cleaned up.*/ 00101 Display *display; /* Display containing widget; needed, among 00102 * other things, to release resources after 00103 * tkwin has already gone away. */ 00104 Tcl_Interp *interp; /* Interpreter associated with canvas. */ 00105 Tcl_Command widgetCmd; /* Token for canvas's widget command. */ 00106 Tk_Item *firstItemPtr; /* First in list of all items in canvas, 00107 * or NULL if canvas empty. */ 00108 Tk_Item *lastItemPtr; /* Last in list of all items in canvas, 00109 * or NULL if canvas empty. */ 00110 00111 /* 00112 * Information used when displaying widget: 00113 */ 00114 00115 int borderWidth; /* Width of 3-D border around window. */ 00116 Tk_3DBorder bgBorder; /* Used for canvas background. */ 00117 int relief; /* Indicates whether window as a whole is 00118 * raised, sunken, or flat. */ 00119 int highlightWidth; /* Width in pixels of highlight to draw 00120 * around widget when it has the focus. 00121 * <= 0 means don't draw a highlight. */ 00122 XColor *highlightBgColorPtr; 00123 /* Color for drawing traversal highlight 00124 * area when highlight is off. */ 00125 XColor *highlightColorPtr; /* Color for drawing traversal highlight. */ 00126 int inset; /* Total width of all borders, including 00127 * traversal highlight and 3-D border. 00128 * Indicates how much interior stuff must 00129 * be offset from outside edges to leave 00130 * room for borders. */ 00131 GC pixmapGC; /* Used to copy bits from a pixmap to the 00132 * screen and also to clear the pixmap. */ 00133 int width, height; /* Dimensions to request for canvas window, 00134 * specified in pixels. */ 00135 int redrawX1, redrawY1; /* Upper left corner of area to redraw, 00136 * in pixel coordinates. Border pixels 00137 * are included. Only valid if 00138 * REDRAW_PENDING flag is set. */ 00139 int redrawX2, redrawY2; /* Lower right corner of area to redraw, 00140 * in integer canvas coordinates. Border 00141 * pixels will *not* be redrawn. */ 00142 int confine; /* Non-zero means constrain view to keep 00143 * as much of canvas visible as possible. */ 00144 00145 /* 00146 * Information used to manage the selection and insertion cursor: 00147 */ 00148 00149 Tk_CanvasTextInfo textInfo; /* Contains lots of fields; see tk.h for 00150 * details. This structure is shared with 00151 * the code that implements individual items. */ 00152 int insertOnTime; /* Number of milliseconds cursor should spend 00153 * in "on" state for each blink. */ 00154 int insertOffTime; /* Number of milliseconds cursor should spend 00155 * in "off" state for each blink. */ 00156 Tcl_TimerToken insertBlinkHandler; 00157 /* Timer handler used to blink cursor on and 00158 * off. */ 00159 00160 /* 00161 * Transformation applied to canvas as a whole: to compute screen 00162 * coordinates (X,Y) from canvas coordinates (x,y), do the following: 00163 * 00164 * X = x - xOrigin; 00165 * Y = y - yOrigin; 00166 */ 00167 00168 int xOrigin, yOrigin; /* Canvas coordinates corresponding to 00169 * upper-left corner of window, given in 00170 * canvas pixel units. */ 00171 int drawableXOrigin, drawableYOrigin; 00172 /* During redisplay, these fields give the 00173 * canvas coordinates corresponding to 00174 * the upper-left corner of the drawable 00175 * where items are actually being drawn 00176 * (typically a pixmap smaller than the 00177 * whole window). */ 00178 00179 /* 00180 * Information used for event bindings associated with items. 00181 */ 00182 00183 Tk_BindingTable bindingTable; 00184 /* Table of all bindings currently defined 00185 * for this canvas. NULL means that no 00186 * bindings exist, so the table hasn't been 00187 * created. Each "object" used for this 00188 * table is either a Tk_Uid for a tag or 00189 * the address of an item named by id. */ 00190 Tk_Item *currentItemPtr; /* The item currently containing the mouse 00191 * pointer, or NULL if none. */ 00192 Tk_Item *newCurrentPtr; /* The item that is about to become the 00193 * current one, or NULL. This field is 00194 * used to detect deletions of the new 00195 * current item pointer that occur during 00196 * Leave processing of the previous current 00197 * item. */ 00198 double closeEnough; /* The mouse is assumed to be inside an 00199 * item if it is this close to it. */ 00200 XEvent pickEvent; /* The event upon which the current choice 00201 * of currentItem is based. Must be saved 00202 * so that if the currentItem is deleted, 00203 * can pick another. */ 00204 int state; /* Last known modifier state. Used to 00205 * defer picking a new current object 00206 * while buttons are down. */ 00207 00208 /* 00209 * Information used for managing scrollbars: 00210 */ 00211 00212 char *xScrollCmd; /* Command prefix for communicating with 00213 * horizontal scrollbar. NULL means no 00214 * horizontal scrollbar. Malloc'ed*/ 00215 char *yScrollCmd; /* Command prefix for communicating with 00216 * vertical scrollbar. NULL means no 00217 * vertical scrollbar. Malloc'ed*/ 00218 int scrollX1, scrollY1, scrollX2, scrollY2; 00219 /* These four coordinates define the region 00220 * that is the 100% area for scrolling (i.e. 00221 * these numbers determine the size and 00222 * location of the sliders on scrollbars). 00223 * Units are pixels in canvas coords. */ 00224 char *regionString; /* The option string from which scrollX1 00225 * etc. are derived. Malloc'ed. */ 00226 int xScrollIncrement; /* If >0, defines a grid for horizontal 00227 * scrolling. This is the size of the "unit", 00228 * and the left edge of the screen will always 00229 * lie on an even unit boundary. */ 00230 int yScrollIncrement; /* If >0, defines a grid for horizontal 00231 * scrolling. This is the size of the "unit", 00232 * and the left edge of the screen will always 00233 * lie on an even unit boundary. */ 00234 00235 /* 00236 * Information used for scanning: 00237 */ 00238 00239 int scanX; /* X-position at which scan started (e.g. 00240 * button was pressed here). */ 00241 int scanXOrigin; /* Value of xOrigin field when scan started. */ 00242 int scanY; /* Y-position at which scan started (e.g. 00243 * button was pressed here). */ 00244 int scanYOrigin; /* Value of yOrigin field when scan started. */ 00245 00246 /* 00247 * Information used to speed up searches by remembering the last item 00248 * created or found with an item id search. 00249 */ 00250 00251 Tk_Item *hotPtr; /* Pointer to "hot" item (one that's been 00252 * recently used. NULL means there's no 00253 * hot item. */ 00254 Tk_Item *hotPrevPtr; /* Pointer to predecessor to hotPtr (NULL 00255 * means item is first in list). This is 00256 * only a hint and may not really be hotPtr's 00257 * predecessor. */ 00258 00259 /* 00260 * Miscellaneous information: 00261 */ 00262 00263 Tk_Cursor cursor; /* Current cursor for window, or None. */ 00264 char *takeFocus; /* Value of -takefocus option; not used in 00265 * the C code, but used by keyboard traversal 00266 * scripts. Malloc'ed, but may be NULL. */ 00267 double pixelsPerMM; /* Scale factor between MM and pixels; 00268 * used when converting coordinates. */ 00269 int flags; /* Various flags; see below for 00270 * definitions. */ 00271 int nextId; /* Number to use as id for next item 00272 * created in widget. */ 00273 Tk_PostscriptInfo psInfo; 00274 /* Pointer to information used for generating 00275 * Postscript for the canvas. NULL means 00276 * no Postscript is currently being 00277 * generated. */ 00278 Tcl_HashTable idTable; /* Table of integer indices. */ 00279 /* 00280 * Additional information, added by the 'dash'-patch 00281 */ 00282 VOID *reserved1; 00283 Tk_State canvas_state; /* state of canvas */ 00284 VOID *reserved2; 00285 VOID *reserved3; 00286 Tk_TSOffset tsoffset; 00287 TagSearchExpr *bindTagExprs; /* linked list of tag expressions used in bindings */ 00288 00289 /* 00290 * PATCH: gmlTcl_TGLCanvas fields 00291 */ 00292 00293 Tcl_Obj* glNameOfCanvas; /* Stores the string name of the canvas */ 00294 gml_TDrawable glDrawable; /* The drawable where the canvas is drawn */ 00295 gml_TDisplay glDisplay; /* The display where the canvas is drawn */ 00296 gml_TVisual glVisual; /* The visual used to draw the canvas */ 00297 gmlGL_TContext glContext; /* The OpenGL context */ 00298 int glLastTopW; /* Last know width and height of the drawable, */ 00299 int glLastTopH; /* used to detect when the drawable is resized */ 00300 int glLastX; /* Last position and size of the canvas within its */ 00301 int glLastY; /* drawable. Used to detect when the canvas */ 00302 int glLastW; /* is moved or resized. */ 00303 int glLastH; 00304 gml_TRGBColor glBgColor; /* Background color of the canvas */ 00305 gml_TGRItem_Polygon_GL* glRootGRItem; /* The root item (the canvas itself) has no tcl interface */ 00306 gml_TGRItem_Scene_GL* glScene; /* Scene in which items are drawn */ 00307 gml_TList* glOwnedObjects; /* List of wrapped objects owned by the canvas */ 00308 /* 00309 * END PATCH: gmlTcl_TGLCanvas fields 00310 */ 00311 } gmlTcl_TGLCanvas; 00312 00313 /* 00314 * Flag bits for canvases: 00315 * 00316 * REDRAW_PENDING - 1 means a DoWhenIdle handler has already 00317 * been created to redraw some or all of the 00318 * canvas. 00319 * REDRAW_BORDERS - 1 means that the borders need to be redrawn 00320 * during the next redisplay operation. 00321 * REPICK_NEEDED - 1 means DisplayCanvas should pick a new 00322 * current item before redrawing the canvas. 00323 * GOT_FOCUS - 1 means the focus is currently in this 00324 * widget, so should draw the insertion cursor 00325 * and traversal highlight. 00326 * CURSOR_ON - 1 means the insertion cursor is in the "on" 00327 * phase of its blink cycle. 0 means either 00328 * we don't have the focus or the cursor is in 00329 * the "off" phase of its cycle. 00330 * UPDATE_SCROLLBARS - 1 means the scrollbars should get updated 00331 * as part of the next display operation. 00332 * LEFT_GRABBED_ITEM - 1 means that the mouse left the current 00333 * item while a grab was in effect, so we 00334 * didn't change canvasPtr->currentItemPtr. 00335 * REPICK_IN_PROGRESS - 1 means PickCurrentItem is currently 00336 * executing. If it should be called recursively, 00337 * it should simply return immediately. 00338 * BBOX_NOT_EMPTY - 1 means that the bounding box of the area 00339 * that should be redrawn is not empty. 00340 */ 00341 00342 #define REDRAW_PENDING 1 00343 #define REDRAW_BORDERS 2 00344 #define REPICK_NEEDED 4 00345 #define GOT_FOCUS 8 00346 #define CURSOR_ON 0x10 00347 #define UPDATE_SCROLLBARS 0x20 00348 #define LEFT_GRABBED_ITEM 0x40 00349 #define REPICK_IN_PROGRESS 0x100 00350 #define BBOX_NOT_EMPTY 0x200 00351 00352 /* 00353 * Flag bits for canvas items (redraw_flags): 00354 * 00355 * FORCE_REDRAW - 1 means that the new coordinates of some 00356 * item are not yet registered using 00357 * Tk_CanvasEventuallyRedraw(). It should still 00358 * be done by the general canvas code. 00359 */ 00360 00361 #define FORCE_REDRAW 8 00362 00363 /* 00364 * Canvas-related procedures that are shared among Tk modules but not 00365 * exported to the outside world: 00366 */ 00367 00368 extern int gmlGLCanvPostscriptCmd _ANSI_ARGS_((gmlTcl_TGLCanvas *canvasPtr, 00369 Tcl_Interp *interp, int argc, char **argv)); 00370 00371 /* 00372 * The following definition is shared between tkCanvPs.c and tkCanvImg.c, 00373 * and is used in generating postscript for images and windows. 00374 */ 00375 00376 typedef struct TkColormapData { /* Hold color information for a window */ 00377 int separated; /* Whether to use separate color bands */ 00378 int color; /* Whether window is color or black/white */ 00379 int ncolors; /* Number of color values stored */ 00380 XColor *colors; /* Pixel value -> RGB mappings */ 00381 int red_mask, green_mask, blue_mask; /* Masks and shifts for each */ 00382 int red_shift, green_shift, blue_shift; /* color band */ 00383 } TkColormapData; 00384 00385 #endif /* _GMLTCLCANVAS */
Generated on Tue Jun 12 14:03:27 2007 for gml by
Doxygen 1.5.2.
|
Contact: julien (dot) letessier (at) gmail (dot) com.
Copyright (c) 2000-2007 CLIPS-IMAG Laboratory, Grenoble, France. All rights reserved. W3CXHTML 1.0 W3CCSS 2.0 |