item.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 // Generated by gtkmmproc -- DO NOT MODIFY!
00003 #ifndef _LIBGNOMECANVASMM_ITEM_H
00004 #define _LIBGNOMECANVASMM_ITEM_H
00005 
00006 
00007 #include <glibmm.h>
00008 
00009 // -*- C++ -*-
00010 /* $Id: item.hg,v 1.7 2005/06/09 11:26:34 murrayc Exp $ */
00011 
00012 /* item.h
00013  * 
00014  * Copyright (C) 1998 EMC Capital Management Inc.
00015  * Developed by Havoc Pennington <hp@pobox.com>
00016  *
00017  * Copyright (C) 1999 The Gtk-- Development Team
00018  *
00019  * This library is free software; you can redistribute it and/or
00020  * modify it under the terms of the GNU Library General Public
00021  * License as published by the Free Software Foundation; either
00022  * version 2 of the License, or (at your option) any later version.
00023  *
00024  * This library is distributed in the hope that it will be useful,
00025  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00026  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00027  * Library General Public License for more details.
00028  *
00029  * You should have received a copy of the GNU Library General Public
00030  * License along with this library; if not, write to the Free
00031  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00032  */
00033 
00034 #include <gtkmm/object.h>
00035 #include <gdkmm/cursor.h>
00036 #include <libgnomecanvas/gnome-canvas.h>
00037 
00038 #include <libgnomecanvasmm/point.h>
00039 #include <libgnomecanvasmm/affinetrans.h>
00040 #include <libgnomecanvasmm/properties.h>
00041 
00042 
00043 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00044 typedef struct _GnomeCanvasItem GnomeCanvasItem;
00045 typedef struct _GnomeCanvasItemClass GnomeCanvasItemClass;
00046 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00047 
00048 
00049 namespace Gnome
00050 {
00051 
00052 namespace Canvas
00053 { class Item_Class; } // namespace Canvas
00054 
00055 } // namespace Gnome
00056 namespace Gnome
00057 {
00058 
00059 namespace Canvas
00060 {
00061 
00062 class Canvas;
00063 class Group;
00064 
00065 
00066 class Item : public Gtk::Object
00067 {
00068   public:
00069 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00070   typedef Item CppObjectType;
00071   typedef Item_Class CppClassType;
00072   typedef GnomeCanvasItem BaseObjectType;
00073   typedef GnomeCanvasItemClass BaseClassType;
00074 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00075 
00076   virtual ~Item();
00077 
00078 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00079 
00080 private:
00081   friend class Item_Class;
00082   static CppClassType item_class_;
00083 
00084   // noncopyable
00085   Item(const Item&);
00086   Item& operator=(const Item&);
00087 
00088 protected:
00089   explicit Item(const Glib::ConstructParams& construct_params);
00090   explicit Item(GnomeCanvasItem* castitem);
00091 
00092 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00093 
00094 public:
00095 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00096   static GType get_type()      G_GNUC_CONST;
00097   static GType get_base_type() G_GNUC_CONST;
00098 #endif
00099 
00101   GnomeCanvasItem*       gobj()       { return reinterpret_cast<GnomeCanvasItem*>(gobject_); }
00102 
00104   const GnomeCanvasItem* gobj() const { return reinterpret_cast<GnomeCanvasItem*>(gobject_); }
00105 
00106 
00107 public:
00108   //C++ methods used to invoke GTK+ virtual functions:
00109 #ifdef GLIBMM_VFUNCS_ENABLED
00110 #endif //GLIBMM_VFUNCS_ENABLED
00111 
00112 protected:
00113   //GTK+ Virtual Functions (override these to change behaviour):
00114 #ifdef GLIBMM_VFUNCS_ENABLED
00115 #endif //GLIBMM_VFUNCS_ENABLED
00116 
00117   //Default Signal Handlers::
00118   virtual bool on_event(GdkEvent* p1);
00119 
00120 
00121 private:
00122 
00123   
00124 public:
00125 
00126   //:  Move an item by the specified amount
00127   
00135   void move(double dx, double dy);
00136 
00137   //: Raise an item in the z-order of its parent group by the specified
00138   //: number of positions.  If the number is zero, then the item will
00139   //: be made the topmost of its parent group.
00140   
00146   void raise(int positions);
00147 
00148   //: Lower an item in the z-order of its parent group by the specified
00149   //: number of positions.  If the number is zero, then the item will be
00150   //: made the bottommost of its parent group.  */
00151   
00157   void lower(int positions);
00158 
00159   //: Raise an item to the top of its parent group's z-order.
00160   
00163   void raise_to_top();
00164 
00165   //: Lower an item to the bottom of its parent group's z-order
00166   
00169   void lower_to_bottom();
00170 
00171   //: Grab the mouse for the specified item.  Only the events in
00172   //: event_mask will be reported.  If cursor is non-NULL, it will be
00173   //: used during the duration of the grab.  Time is a proper X event
00174   //: time parameter.  Returns the same values as XGrabPointer().
00175   int grab(unsigned int event_mask, const Gdk::Cursor& cursor, guint32 etime);
00176   int grab(unsigned int event_mask, guint32 etime);
00177   
00178 
00179   //: Ungrabs the mouse -- the specified item must be the same that was
00180   //: passed to gnome_canvas_item_grab().  Time is a proper X event
00181   //: time parameter. 
00182   
00187   void ungrab(guint32 etime);
00188 
00189   //: These functions convert from a coordinate system to another.  "w"
00190   //: is world coordinates and "i" is item coordinates. 
00191   
00197   void w2i(double& x, double& y);
00198   
00204   void i2w(double& x, double& y);
00205 
00206   //: Used to send all of the keystroke events to a specific item as well 
00207   //: as GDK_FOCUS_CHANGE events.
00208   
00213   void grab_focus();
00214 
00215   //: Fetch the bounding box of the item.  The bounding box may not be 
00216   //: exactly tight, but the canvas items will do the best they can.
00217   
00225   void get_bounds(double& x1, double& y1, double& x2, double& y2) const;
00226 
00227   //: Make the item visible
00228   
00231   void show();
00232   
00233   //: Hide the item
00234   
00238   void hide();
00239 
00240   //: Apply a relative affine transformation to the item 
00241   void affine_relative(const Art::AffineTrans &affine);
00242   
00243 
00244   //: Apply an absolute affine transformation to the item
00245   void affine_absolute(const Art::AffineTrans &affine);
00246   
00247 
00248   //: Gets the affine transform that converts from item-relative
00249   //: coordinates to world coordinates
00250   Art::AffineTrans get_i2w_affine() const;
00251   
00252 
00253   //: Gets the affine transform that converts from item-relative
00254   //: coordinates to canvas pixel coordinates
00255   Art::AffineTrans get_i2c_affine() const;
00256   
00257 
00263   void reparent(Group& new_group);
00264 
00266    Canvas* get_canvas() const;
00267  
00268   #ifdef GLIBMM_VFUNCS_ENABLED
00269   virtual void update_vfunc(double* affine, ArtSVP* clip_path, int flags);
00270 #endif //GLIBMM_VFUNCS_ENABLED
00271 
00272   #ifdef GLIBMM_VFUNCS_ENABLED
00273   virtual void realize_vfunc();
00274 #endif //GLIBMM_VFUNCS_ENABLED
00275 
00276   #ifdef GLIBMM_VFUNCS_ENABLED
00277   virtual void unrealize_vfunc();
00278 #endif //GLIBMM_VFUNCS_ENABLED
00279 
00280   #ifdef GLIBMM_VFUNCS_ENABLED
00281   virtual void map_vfunc();
00282 #endif //GLIBMM_VFUNCS_ENABLED
00283 
00284   #ifdef GLIBMM_VFUNCS_ENABLED
00285   virtual void unmap_vfunc();
00286 #endif //GLIBMM_VFUNCS_ENABLED
00287 
00288   #ifdef GLIBMM_VFUNCS_ENABLED
00289   virtual ArtUta* coverage_vfunc();
00290 #endif //GLIBMM_VFUNCS_ENABLED
00291 
00292   #ifdef GLIBMM_VFUNCS_ENABLED
00293   virtual void draw_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable, int x, int y, int width, int height);
00294 #endif //GLIBMM_VFUNCS_ENABLED
00295 
00296   #ifdef GLIBMM_VFUNCS_ENABLED
00297   virtual void render_vfunc(GnomeCanvasBuf* buf);
00298 #endif //GLIBMM_VFUNCS_ENABLED
00299 
00300   #ifdef GLIBMM_VFUNCS_ENABLED
00301   virtual double point_vfunc(double x, double y, int cx, int cy, GnomeCanvasItem** actual_item);
00302 #endif //GLIBMM_VFUNCS_ENABLED
00303 
00304   #ifdef GLIBMM_VFUNCS_ENABLED
00305   virtual void bounds_vfunc(double* x1, double* y1, double* x2, double* y2);
00306 #endif //GLIBMM_VFUNCS_ENABLED
00307 
00308 
00309   //: Signal: an event ocurred for an item of this type.  The(x, y)
00310   //: coordinates are in the canvas world coordinate system.
00311   
00312 
00313   Glib::SignalProxy1< bool,GdkEvent* > signal_event();
00314 
00315 
00316   Group* get_parent_group();
00317   const Group* get_parent_group() const;
00318 
00319   #ifdef GLIBMM_PROPERTIES_ENABLED
00320 
00326   Glib::PropertyProxy<Group*> property_parent() ;
00327 #endif //#GLIBMM_PROPERTIES_ENABLED
00328 
00329 #ifdef GLIBMM_PROPERTIES_ENABLED
00330 
00336   Glib::PropertyProxy_ReadOnly<Group*> property_parent() const;
00337 #endif //#GLIBMM_PROPERTIES_ENABLED
00338 
00339 
00340 protected:
00341 
00342   //- For class children use only
00343   void item_construct(Group& group);
00344 
00345   //- Unsafe version - can't use a _gtk_string here, C++ doesn't like
00346   //- classes being passed before ellipses('...') args
00347   void item_construct(Group& group, const gchar* first_arg_name,
00348                       va_list ap);
00349 
00350   //- Set arguments - For class children use only
00351   void set(const gchar* first_arg_name, ...);
00352 
00353   //: Request that the update method eventually get called.  This should be used
00354   //: only by item implementations.
00355   
00359   void request_update();
00360 
00361 
00364   void reset_bounds();
00365   
00372   void update_svp(ArtSVP **p_svp, ArtSVP *new_svp);
00373   
00380   void update_svp_clip(ArtSVP **p_svp, ArtSVP *new_svp, ArtSVP *clip_svp);
00381   
00385   void request_redraw_svp(const ArtSVP* svp);
00386   
00394   void update_bbox(int x1, int y1, int x2, int y2);
00395   
00396 
00397 };
00398 
00399 } /* namespace Canvas */
00400 } /* namespace Gnome */
00401 
00402 
00403 namespace Glib
00404 {
00410   Gnome::Canvas::Item* wrap(GnomeCanvasItem* object, bool take_copy = false);
00411 } //namespace Glib
00412 
00413 
00414 #endif /* _LIBGNOMECANVASMM_ITEM_H */
00415 

Generated on Tue Aug 22 06:04:42 2006 for libgnomecanvasmm by  doxygen 1.4.7