Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

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 #include <glibmm.h>
00007 
00008 // -*- C++ -*-
00009 /* $Id: item.hg,v 1.6 2004/04/07 19:13:51 murrayc Exp $ */
00010 
00011 /* item.h
00012  * 
00013  * Copyright (C) 1998 EMC Capital Management Inc.
00014  * Developed by Havoc Pennington <hp@pobox.com>
00015  *
00016  * Copyright (C) 1999 The Gtk-- Development Team
00017  *
00018  * This library is free software; you can redistribute it and/or
00019  * modify it under the terms of the GNU Library General Public
00020  * License as published by the Free Software Foundation; either
00021  * version 2 of the License, or (at your option) any later version.
00022  *
00023  * This library is distributed in the hope that it will be useful,
00024  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00025  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00026  * Library General Public License for more details.
00027  *
00028  * You should have received a copy of the GNU Library General Public
00029  * License along with this library; if not, write to the Free
00030  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00031  */
00032 
00033 #include <gtkmm/object.h>
00034 #include <gdkmm/cursor.h>
00035 #include <libgnomecanvas/gnome-canvas.h>
00036 
00037 #include <libgnomecanvasmm/point.h>
00038 #include <libgnomecanvasmm/affinetrans.h>
00039 #include <libgnomecanvasmm/properties.h>
00040 
00041 
00042 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00043 typedef struct _GnomeCanvasItem GnomeCanvasItem;
00044 typedef struct _GnomeCanvasItemClass GnomeCanvasItemClass;
00045 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00046 
00047 
00048 namespace Gnome
00049 {
00050 
00051 namespace Canvas
00052 { class Item_Class; } // namespace Canvas
00053 
00054 } // namespace Gnome
00055 namespace Gnome
00056 {
00057 
00058 namespace Canvas
00059 {
00060 
00061 class Canvas;
00062 class Group;
00063 
00064 
00065 class Item : public Gtk::Object
00066 {
00067   public:
00068 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00069   typedef Item CppObjectType;
00070   typedef Item_Class CppClassType;
00071   typedef GnomeCanvasItem BaseObjectType;
00072   typedef GnomeCanvasItemClass BaseClassType;
00073 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00074 
00075   virtual ~Item();
00076 
00077 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00078 
00079 private:
00080   friend class Item_Class;
00081   static CppClassType item_class_;
00082 
00083   // noncopyable
00084   Item(const Item&);
00085   Item& operator=(const Item&);
00086 
00087 protected:
00088   explicit Item(const Glib::ConstructParams& construct_params);
00089   explicit Item(GnomeCanvasItem* castitem);
00090 
00091 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00092 
00093 public:
00094 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00095   static GType get_type()      G_GNUC_CONST;
00096   static GType get_base_type() G_GNUC_CONST;
00097 #endif
00098 
00100   GnomeCanvasItem*       gobj()       { return reinterpret_cast<GnomeCanvasItem*>(gobject_); }
00101 
00103   const GnomeCanvasItem* gobj() const { return reinterpret_cast<GnomeCanvasItem*>(gobject_); }
00104 
00105 
00106 public:
00107   //C++ methods used to invoke GTK+ virtual functions:
00108 
00109 protected:
00110   //GTK+ Virtual Functions (override these to change behaviour):
00111 
00112   //Default Signal Handlers::
00113   virtual bool on_event(GdkEvent* p1);
00114 
00115 
00116 private:
00117 
00118   
00119 public:
00120 
00121   //:  Move an item by the specified amount
00122   
00130   void move(double dx, double dy);
00131 
00132   //: Raise an item in the z-order of its parent group by the specified
00133   //: number of positions.  If the number is zero, then the item will
00134   //: be made the topmost of its parent group.
00135   
00141   void raise(int positions);
00142 
00143   //: Lower an item in the z-order of its parent group by the specified
00144   //: number of positions.  If the number is zero, then the item will be
00145   //: made the bottommost of its parent group.  */
00146   
00152   void lower(int positions);
00153 
00154   //: Raise an item to the top of its parent group's z-order.
00155   
00158   void raise_to_top();
00159 
00160   //: Lower an item to the bottom of its parent group's z-order
00161   
00164   void lower_to_bottom();
00165 
00166   //: Grab the mouse for the specified item.  Only the events in
00167   //: event_mask will be reported.  If cursor is non-NULL, it will be
00168   //: used during the duration of the grab.  Time is a proper X event
00169   //: time parameter.  Returns the same values as XGrabPointer().
00170   int grab(unsigned int event_mask, const Gdk::Cursor& cursor, guint32 etime);
00171   int grab(unsigned int event_mask, guint32 etime);
00172   
00173 
00174   //: Ungrabs the mouse -- the specified item must be the same that was
00175   //: passed to gnome_canvas_item_grab().  Time is a proper X event
00176   //: time parameter. 
00177   
00182   void ungrab(guint32 etime);
00183 
00184   //: These functions convert from a coordinate system to another.  "w"
00185   //: is world coordinates and "i" is item coordinates. 
00186   
00192   void w2i(double& x, double& y);
00193   
00199   void i2w(double& x, double& y);
00200 
00201   //: Used to send all of the keystroke events to a specific item as well 
00202   //: as GDK_FOCUS_CHANGE events.
00203   
00208   void grab_focus();
00209 
00210   //: Fetch the bounding box of the item.  The bounding box may not be 
00211   //: exactly tight, but the canvas items will do the best they can.
00212   
00220   void get_bounds(double& x1, double& y1, double& x2, double& y2) const;
00221 
00222   //: Make the item visible
00223   
00226   void show();
00227   
00228   //: Hide the item
00229   
00233   void hide();
00234 
00235   //: Apply a relative affine transformation to the item 
00236   void affine_relative(const Art::AffineTrans &affine);
00237   
00238 
00239   //: Apply an absolute affine transformation to the item
00240   void affine_absolute(const Art::AffineTrans &affine);
00241   
00242 
00243   //: Gets the affine transform that converts from item-relative
00244   //: coordinates to world coordinates
00245   Art::AffineTrans get_i2w_affine() const;
00246   
00247 
00248   //: Gets the affine transform that converts from item-relative
00249   //: coordinates to canvas pixel coordinates
00250   Art::AffineTrans get_i2c_affine() const;
00251   
00252 
00258   void reparent(Group& new_group);
00259 
00261   Canvas* get_canvas() const;
00262 
00263     virtual void update_vfunc(double* affine, ArtSVP* clip_path, int flags);
00264     virtual void realize_vfunc();
00265     virtual void unrealize_vfunc();
00266     virtual void map_vfunc();
00267     virtual void unmap_vfunc();
00268     virtual ArtUta* coverage_vfunc();
00269     virtual void draw_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable, int x, int y, int width, int height);
00270     virtual void render_vfunc(GnomeCanvasBuf* buf);
00271     virtual double point_vfunc(double x, double y, int cx, int cy, GnomeCanvasItem** actual_item);
00272     virtual void bounds_vfunc(double* x1, double* y1, double* x2, double* y2);
00273 
00274   //: Signal: an event ocurred for an item of this type.  The(x, y)
00275   //: coordinates are in the canvas world coordinate system.
00276   
00277 
00278   Glib::SignalProxy1< bool,GdkEvent* > signal_event();
00279 
00280 
00285   Glib::PropertyProxy<Group*> property_parent() ;
00286 
00291   Glib::PropertyProxy_ReadOnly<Group*> property_parent() const;
00292 
00293 
00294 protected:
00295 
00296   //- For class children use only
00297   void item_construct(Group& group);
00298 
00299   //- Unsafe version - can't use a _gtk_string here, C++ doesn't like
00300   //- classes being passed before ellipses('...') args
00301   void item_construct(Group& group, const gchar* first_arg_name,
00302                       va_list ap);
00303 
00304   //- Set arguments - For class children use only
00305   void set(const gchar* first_arg_name, ...);
00306 
00307   //: Request that the update method eventually get called.  This should be used
00308   //: only by item implementations.
00309   
00313   void request_update();
00314 
00315 
00318   void reset_bounds();
00319   
00326   void update_svp(ArtSVP **p_svp, ArtSVP *new_svp);
00327   
00334   void update_svp_clip(ArtSVP **p_svp, ArtSVP *new_svp, ArtSVP *clip_svp);
00335   
00339   void request_redraw_svp(const ArtSVP* svp);
00340   
00348   void update_bbox(int x1, int y1, int x2, int y2);
00349   
00350 
00351 };
00352 
00353 } /* namespace Canvas */
00354 } /* namespace Gnome */
00355 
00356 namespace Glib
00357 {
00363   Gnome::Canvas::Item* wrap(GnomeCanvasItem* object, bool take_copy = false);
00364 }
00365 #endif /* _LIBGNOMECANVASMM_ITEM_H */
00366 

Generated on Tue Feb 1 05:03:04 2005 for libgnomecanvasmm by  doxygen 1.4.1