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 
00110 protected:
00111   //GTK+ Virtual Functions (override these to change behaviour):
00112 
00113   //Default Signal Handlers::
00114   virtual bool on_event(GdkEvent* p1);
00115 
00116 
00117 private:
00118 
00119   
00120 public:
00121 
00122   //:  Move an item by the specified amount
00123   
00131   void move(double dx, double dy);
00132 
00133   //: Raise an item in the z-order of its parent group by the specified
00134   //: number of positions.  If the number is zero, then the item will
00135   //: be made the topmost of its parent group.
00136   
00142   void raise(int positions);
00143 
00144   //: Lower an item in the z-order of its parent group by the specified
00145   //: number of positions.  If the number is zero, then the item will be
00146   //: made the bottommost of its parent group.  */
00147   
00153   void lower(int positions);
00154 
00155   //: Raise an item to the top of its parent group's z-order.
00156   
00159   void raise_to_top();
00160 
00161   //: Lower an item to the bottom of its parent group's z-order
00162   
00165   void lower_to_bottom();
00166 
00167   //: Grab the mouse for the specified item.  Only the events in
00168   //: event_mask will be reported.  If cursor is non-NULL, it will be
00169   //: used during the duration of the grab.  Time is a proper X event
00170   //: time parameter.  Returns the same values as XGrabPointer().
00171   int grab(unsigned int event_mask, const Gdk::Cursor& cursor, guint32 etime);
00172   int grab(unsigned int event_mask, guint32 etime);
00173   
00174 
00175   //: Ungrabs the mouse -- the specified item must be the same that was
00176   //: passed to gnome_canvas_item_grab().  Time is a proper X event
00177   //: time parameter. 
00178   
00183   void ungrab(guint32 etime);
00184 
00185   //: These functions convert from a coordinate system to another.  "w"
00186   //: is world coordinates and "i" is item coordinates. 
00187   
00193   void w2i(double& x, double& y);
00194   
00200   void i2w(double& x, double& y);
00201 
00202   //: Used to send all of the keystroke events to a specific item as well 
00203   //: as GDK_FOCUS_CHANGE events.
00204   
00209   void grab_focus();
00210 
00211   //: Fetch the bounding box of the item.  The bounding box may not be 
00212   //: exactly tight, but the canvas items will do the best they can.
00213   
00221   void get_bounds(double& x1, double& y1, double& x2, double& y2) const;
00222 
00223   //: Make the item visible
00224   
00227   void show();
00228   
00229   //: Hide the item
00230   
00234   void hide();
00235 
00236   //: Apply a relative affine transformation to the item 
00237   void affine_relative(const Art::AffineTrans &affine);
00238   
00239 
00240   //: Apply an absolute affine transformation to the item
00241   void affine_absolute(const Art::AffineTrans &affine);
00242   
00243 
00244   //: Gets the affine transform that converts from item-relative
00245   //: coordinates to world coordinates
00246   Art::AffineTrans get_i2w_affine() const;
00247   
00248 
00249   //: Gets the affine transform that converts from item-relative
00250   //: coordinates to canvas pixel coordinates
00251   Art::AffineTrans get_i2c_affine() const;
00252   
00253 
00259   void reparent(Group& new_group);
00260 
00262    Canvas* get_canvas() const;
00263  
00264     virtual void update_vfunc(double* affine, ArtSVP* clip_path, int flags);
00265     virtual void realize_vfunc();
00266     virtual void unrealize_vfunc();
00267     virtual void map_vfunc();
00268     virtual void unmap_vfunc();
00269     virtual ArtUta* coverage_vfunc();
00270     virtual void draw_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable, int x, int y, int width, int height);
00271     virtual void render_vfunc(GnomeCanvasBuf* buf);
00272     virtual double point_vfunc(double x, double y, int cx, int cy, GnomeCanvasItem** actual_item);
00273     virtual void bounds_vfunc(double* x1, double* y1, double* x2, double* y2);
00274 
00275   //: Signal: an event ocurred for an item of this type.  The(x, y)
00276   //: coordinates are in the canvas world coordinate system.
00277   
00278 
00279   Glib::SignalProxy1< bool,GdkEvent* > signal_event();
00280 
00281 
00282   Group* get_parent_group();
00283   const Group* get_parent_group() const;
00284 
00291   Glib::PropertyProxy<Group*> property_parent() ;
00292 
00299   Glib::PropertyProxy_ReadOnly<Group*> property_parent() const;
00300 
00301 
00302 protected:
00303 
00304   //- For class children use only
00305   void item_construct(Group& group);
00306 
00307   //- Unsafe version - can't use a _gtk_string here, C++ doesn't like
00308   //- classes being passed before ellipses('...') args
00309   void item_construct(Group& group, const gchar* first_arg_name,
00310                       va_list ap);
00311 
00312   //- Set arguments - For class children use only
00313   void set(const gchar* first_arg_name, ...);
00314 
00315   //: Request that the update method eventually get called.  This should be used
00316   //: only by item implementations.
00317   
00321   void request_update();
00322 
00323 
00326   void reset_bounds();
00327   
00334   void update_svp(ArtSVP **p_svp, ArtSVP *new_svp);
00335   
00342   void update_svp_clip(ArtSVP **p_svp, ArtSVP *new_svp, ArtSVP *clip_svp);
00343   
00347   void request_redraw_svp(const ArtSVP* svp);
00348   
00356   void update_bbox(int x1, int y1, int x2, int y2);
00357   
00358 
00359 };
00360 
00361 } /* namespace Canvas */
00362 } /* namespace Gnome */
00363 
00364 
00365 namespace Glib
00366 {
00372   Gnome::Canvas::Item* wrap(GnomeCanvasItem* object, bool take_copy = false);
00373 } //namespace Glib
00374 
00375 
00376 #endif /* _LIBGNOMECANVASMM_ITEM_H */
00377 

Generated on Tue Jun 13 01:14:33 2006 for libgnomecanvasmm by  doxygen 1.4.6