gmlTcl_GRItem.h

00001 // gml/tcl/wrapper/canvas/gmlTcl_GRItem.h --
00002 //
00003 //  Wraps gml_TRItem objects into a gmlCanvas: a Tcl/Tk canvas patched
00004 //  for GRItems. This files containes the common declaration for all GLCanvas items.
00005 //
00006 //  Copyright (c) 2003 CLIPS-IMAG
00007 //
00008 //  See the file "gml_LicenseTerms.txt" for information on usage and redistribution
00009 //  of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00010 //
00011 //  Created on November 24, 2003 (FB, according to Yohan Piccoli).
00012 
00013 #ifndef __GMLTCL_GRITEM__
00014 #define __GMLTCL_GRITEM__
00015 
00016 #include "tcl.h"
00017 #include "tk.h"
00018 
00019 #include "gml/ui/gml_GRItem.h"
00020 
00021 
00022 extern Tk_ObjCustomOption     gmlTcl_gOption_GRItem;              /* defined in "gmlTcl_GLCanvas.cc"              */
00023 extern Tk_ObjCustomOption     gmlTcl_gOption_Tags;                /* defined in "gmlTcl_GLCanvas.cc"              */
00024 extern Tk_ObjCustomOption     gmlTcl_gOption_GRItemParam;         /* defined in "gmlTcl_GRItem.cc"                */
00025 extern Tk_ObjCustomOption     gmlTcl_gOption_StdTransfo;          /* defined in "gmlTcl_GRItem.cc"                */
00026 extern Tk_ObjCustomOption     gmlTcl_gOption_ProjTransfo;         /* defined in "gmlTcl_GRItem.cc"                */
00027 extern Tk_ObjCustomOption     gmlTcl_gOption_RGBColor;            /* defined in "gmlTcl_GRItem.cc"                */
00028 
00029 extern Tk_ItemType            gmlTcl_gGLCanvType_Text;            /* defined in "gmlTcl_GRItemText.cc"            */
00030 extern Tk_ItemType            gmlTcl_gGLCanvType_Polygon;         /* defined in "gmlTcl_GRItemPolygon.cc"         */
00031 extern Tcl_ObjType            gmlTcl_gGRItemParam_Type;           /* defined in "gmlTcl_GRItem.cc"                */
00032 
00033 // Tk_SetOption bit definitions.
00034 const int                     gmlTcl_cGRItem_ParentSet      = (1 << 0);  /* Parent is set                                */
00035 const int                     gmlTcl_cGRItem_TransfoSet     = (1 << 1);  /* Transformation has been set                  */
00036 const int                     gmlTcl_cGRItem_ProjTransfoSet = (1 << 2);  /* Proj. transformation has been set            */
00037 const int                     gmlTcl_cGRItem_ClipperSet     = (1 << 3);  /* The clipper item has been set                  */
00038 const int                     gmlTcl_cGRItem_Config         = (1 << 4);  /* "Configure" must be called on item           */
00039 const int                     gmlTcl_cGRItem_Texture        = (1 << 5);  /* Texture has been set                         */
00040 const int                     gmlTcl_cGRItem_Layer          = (1 << 6);  /* Layer has been set                             */
00041 const int                     gmlTcl_cGRItem_Visible        = (1 << 7);  /* Visibility has been set                        */
00042 const int                     gmlTcl_cGRItem_Event          = (1 << 8);  /* Transparency to event has been set             */
00043 
00044 const int                     gmlTcl_cGRItem_CreateConfig   = (1 << 31); /* This is the creation configure: do all options */
00045 
00046 
00047 
00048 // gmlTcl_TTagStruct --
00049 //
00050 //  Must reproduce the corresponding sub-structure in Tk_Item
00051 
00052 typedef struct gmlTcl_TTagStruct {
00053 
00054   Tk_Uid                staticTagSpace[TK_TAG_SPACE];
00055   Tk_Uid*               tagPtr;
00056   int                   tagSpace;
00057   int                   numTags;
00058   Tk_ItemType*          typePtr;  /* if NULL, this is a gmlTcl_TTagStruct that must be freed,
00059                                       otherwise it is part of a Tk_Item */
00060 
00061 } gmlTcl_TTagStruct;
00062 
00063 
00064 // gmlTcl_TGRItem --
00065 
00066 struct gmlTcl_TGLCanvas;
00067 typedef struct gmlTcl_TGRItem {
00068   Tk_Item             header;         /* Generic stuff that's the same for all
00069                                          types.  MUST BE FIRST IN STRUCTURE.                    */
00070   gmlTcl_TGLCanvas*   canvas;         /* The canvas in which this item exists                   */
00071   gmlTcl_TGRItem*     parent;         /* Wrapper of parent item, or NULL for root item          */
00072   gmlTcl_TGRItem*     clipper;        /* Wrapper of clipper item, or NULL if item is not clipped  */
00073   gml_TGRItem*        grItem;         /* The C-level GRItem object                              */
00074   gml_TGRItemParam*   transfo;        /* 5 parameters (tx ty rot sx sy) standard transformation */
00075   gml_TGRItemParam*   projtransfo;    /* 9 parameters (a00 a01 a02 a10 a11 a12 a20 a21 a22) standard transformation */
00076   int                 layer;          /* Layer level of item                                      */
00077   int                 visible;        /* Is item visible or not?                                  */
00078   int                 event;          /* Does item catch events or not?                           */
00079 
00080   gmlTcl_TTagStruct*  tagStruct;      /* pointer to the "Tk_Item" fields that store tags        */
00081 
00082 } gmlTcl_TGRItem;
00083 
00084 
00085 
00086 int gmlTcl_GetGRItemParamFromObj (Tcl_Interp*           interp,
00087                                   Tcl_Obj*              objPtr,
00088                                   gml_TGRItemParam*     paramPtr);
00089 Tcl_Obj* gmlTcl_NewGRItemParamObj (gml_TGRItemParam param);
00090 
00091 int gmlTcl_GetGRItemStdTranfoFromObj (Tcl_Interp*           interp,
00092                                       Tcl_Obj*              objPtr,
00093                                       gml_TGRItemParam*     transfo);
00094 Tcl_Obj* gmlTcl_NewGRItemStdTransfoObj (gml_TGRItemParam*   transfo);
00095 
00096 int gmlTcl_GetGRItemProjTranfoFromObj (Tcl_Interp*           interp,
00097                                       Tcl_Obj*              objPtr,
00098                                       gml_TGRItemParam*     projtransfo);
00099 Tcl_Obj* gmlTcl_NewGRItemProjTransfoObj (gml_TGRItemParam*   projtransfo);
00100 
00101 
00102 int     gmlTcl_GRItemCreate  (Tcl_Interp*     interp,
00103                               Tk_Canvas       canvas,
00104                               Tk_Item*        itemPtr,
00105                               gml_TGRItem*    cItem);
00106 
00107 int     gmlTcl_GRItemConfigure (Tcl_Interp*       interp,
00108                                 Tk_Item*          itemPtr,
00109                                 int               objc,
00110                                 Tcl_Obj**         objv,
00111                                 Tk_SavedOptions*  savedOptions,
00112                                 int*              mask,
00113                                 int               flags);
00114 
00115 void    gmlTcl_GRItemDelete (Tk_Item* itemPtr);
00116 
00117 double  gmlTcl_GRItem_pointProc (Tk_Canvas canvas, Tk_Item* itemPtr, double* pointPtr);
00118 
00119 int     gmlTcl_GRItem_areaProc (Tk_Canvas canvas, Tk_Item* itemPtr, double* rectPtr);
00120 
00121 
00122 
00123 #endif
Generated on Tue Jun 12 14:03:27 2007 for gml by Doxygen 1.5.2.