Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | 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.5 2002/12/10 12:39:04 aholzmann 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   virtual void update_vfunc(double* affine, ArtSVP* clip_path, int flags);
00112   virtual void realize_vfunc();
00113   virtual void unrealize_vfunc();
00114   virtual void map_vfunc();
00115   virtual void unmap_vfunc();
00116   virtual ArtUta* coverage_vfunc();
00117   virtual void draw_vfunc(GdkDrawable* drawable, int x, int y, int width, int height);
00118   virtual void render_vfunc(GnomeCanvasBuf* buf);
00119   virtual double point_vfunc(double x, double y, int cx, int cy, GnomeCanvasItem** actual_item);
00120   virtual void bounds_vfunc(double* x1, double* y1, double* x2, double* y2);
00121 
00122   //Default Signal Handlers::
00123   virtual bool on_event(GdkEvent* p1);
00124 
00125 
00126 private:
00127 
00128   
00129 public:
00130 
00131   //:  Move an item by the specified amount
00132   
00140   void move(double dx, double dy);
00141 
00142   //: Raise an item in the z-order of its parent group by the specified
00143   //: number of positions.  If the number is zero, then the item will
00144   //: be made the topmost of its parent group.
00145   
00151   void raise(int positions);
00152 
00153   //: Lower an item in the z-order of its parent group by the specified
00154   //: number of positions.  If the number is zero, then the item will be
00155   //: made the bottommost of its parent group.  */
00156   
00162   void lower(int positions);
00163 
00164   //: Raise an item to the top of its parent group's z-order.
00165   
00168   void raise_to_top();
00169 
00170   //: Lower an item to the bottom of its parent group's z-order
00171   
00174   void lower_to_bottom();
00175 
00176   //: Grab the mouse for the specified item.  Only the events in
00177   //: event_mask will be reported.  If cursor is non-NULL, it will be
00178   //: used during the duration of the grab.  Time is a proper X event
00179   //: time parameter.  Returns the same values as XGrabPointer().
00180   int grab(unsigned int event_mask, const Gdk::Cursor& cursor, guint32 etime);
00181   int grab(unsigned int event_mask, guint32 etime);
00182   
00183 
00184   //: Ungrabs the mouse -- the specified item must be the same that was
00185   //: passed to gnome_canvas_item_grab().  Time is a proper X event
00186   //: time parameter. 
00187   
00192   void ungrab(guint32 etime);
00193 
00194   //: These functions convert from a coordinate system to another.  "w"
00195   //: is world coordinates and "i" is item coordinates. 
00196   
00202   void w2i(double& x, double& y);
00203   
00209   void i2w(double& x, double& y);
00210 
00211   //: Used to send all of the keystroke events to a specific item as well 
00212   //: as GDK_FOCUS_CHANGE events.
00213   
00218   void grab_focus();
00219 
00220   //: Fetch the bounding box of the item.  The bounding box may not be 
00221   //: exactly tight, but the canvas items will do the best they can.
00222   
00230   void get_bounds(double& x1, double& y1, double& x2, double& y2) const;
00231 
00232   //: Make the item visible
00233   
00236   void show();
00237   
00238   //: Hide the item
00239   
00243   void hide();
00244 
00245   //: Apply a relative affine transformation to the item 
00246   void affine_relative(const Art::AffineTrans &affine);
00247   
00248 
00249   //: Apply an absolute affine transformation to the item
00250   void affine_absolute(const Art::AffineTrans &affine);
00251   
00252 
00253   //: Gets the affine transform that converts from item-relative
00254   //: coordinates to world coordinates
00255   Art::AffineTrans get_i2w_affine() const;
00256   
00257 
00258   //: Gets the affine transform that converts from item-relative
00259   //: coordinates to canvas pixel coordinates
00260   Art::AffineTrans get_i2c_affine() const;
00261   
00262 
00268   void reparent(Group& new_group);
00269 
00271   Canvas* get_canvas() const;
00272 
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   
00281   Glib::SignalProxy1<bool,GdkEvent*> signal_event();
00282 
00283 
00289 Glib::PropertyProxy<Group*> property_parent();
00290 
00291 
00292 protected:
00293 
00294   //- For class children use only
00295   void item_construct(Group& group);
00296 
00297   //- Unsafe version - can't use a _gtk_string here, C++ doesn't like
00298   //- classes being passed before ellipses('...') args
00299   void item_construct(Group& group, const gchar* first_arg_name,
00300                       va_list ap);
00301 
00302   //- Set arguments - For class children use only
00303   void set(const gchar* first_arg_name, ...);
00304 
00305   //: Request that the update method eventually get called.  This should be used
00306   //: only by item implementations.
00307   
00311   void request_update();
00312 
00313 
00316   void reset_bounds();
00317   
00324   void update_svp(ArtSVP **p_svp, ArtSVP *new_svp);
00325   
00332   void update_svp_clip(ArtSVP **p_svp, ArtSVP *new_svp, ArtSVP *clip_svp);
00333   
00337   void request_redraw_svp(const ArtSVP* svp);
00338   
00346   void update_bbox(int x1, int y1, int x2, int y2);
00347   
00348 
00349 };
00350 
00351 } /* namespace Canvas */
00352 } /* namespace Gnome */
00353 
00354 namespace Glib
00355 {
00357   Gnome::Canvas::Item* wrap(GnomeCanvasItem* object, bool take_copy = false);
00358 }
00359 #endif /* _LIBGNOMECANVASMM_ITEM_H */
00360 

Generated on Fri Nov 12 14:55:52 2004 for libgnomecanvasmm by doxygen 1.3.5