libgnomecanvasmm
item.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _LIBGNOMECANVASMM_ITEM_H
4 #define _LIBGNOMECANVASMM_ITEM_H
5 
6 
7 #include <glibmm.h>
8 
9 // -*- C++ -*-
10 /* $Id: item.hg,v 1.7 2005/06/09 11:26:34 murrayc Exp $ */
11 
12 /* item.h
13  *
14  * Copyright (C) 1998 EMC Capital Management Inc.
15  * Developed by Havoc Pennington <hp@pobox.com>
16  *
17  * Copyright (C) 1999 The Gtk-- Development Team
18  *
19  * This library is free software; you can redistribute it and/or
20  * modify it under the terms of the GNU Lesser General Public
21  * License as published by the Free Software Foundation; either
22  * version 2.1 of the License, or (at your option) any later version.
23  *
24  * This library is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27  * Lesser General Public License for more details.
28  *
29  * You should have received a copy of the GNU Lesser General Public
30  * License along with this library; if not, write to the Free
31  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32  */
33 
34 #include <gtkmm/object.h>
35 #include <gdkmm/cursor.h>
36 #include <libgnomecanvas/gnome-canvas.h>
37 
38 #include <libgnomecanvasmm/point.h>
41 
42 
43 #ifndef DOXYGEN_SHOULD_SKIP_THIS
44 typedef struct _GnomeCanvasItem GnomeCanvasItem;
45 typedef struct _GnomeCanvasItemClass GnomeCanvasItemClass;
46 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
47 
48 
49 namespace Gnome
50 {
51 
52 namespace Canvas
53 { class Item_Class; } // namespace Canvas
54 
55 } // namespace Gnome
56 namespace Gnome
57 {
58 
59 namespace Canvas
60 {
61 
62 class Canvas;
63 class Group;
64 
65 
66 class Item : public Gtk::Object
67 {
68  public:
69 #ifndef DOXYGEN_SHOULD_SKIP_THIS
70  typedef Item CppObjectType;
71  typedef Item_Class CppClassType;
72  typedef GnomeCanvasItem BaseObjectType;
73  typedef GnomeCanvasItemClass BaseClassType;
74 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
75 
76  virtual ~Item();
77 
78 #ifndef DOXYGEN_SHOULD_SKIP_THIS
79 
80 private:
81  friend class Item_Class;
82  static CppClassType item_class_;
83 
84  // noncopyable
85  Item(const Item&);
86  Item& operator=(const Item&);
87 
88 protected:
89  explicit Item(const Glib::ConstructParams& construct_params);
90  explicit Item(GnomeCanvasItem* castitem);
91 
92 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
93 
94 public:
95 #ifndef DOXYGEN_SHOULD_SKIP_THIS
96  static GType get_type() G_GNUC_CONST;
97  static GType get_base_type() G_GNUC_CONST;
98 #endif
99 
101  GnomeCanvasItem* gobj() { return reinterpret_cast<GnomeCanvasItem*>(gobject_); }
102 
104  const GnomeCanvasItem* gobj() const { return reinterpret_cast<GnomeCanvasItem*>(gobject_); }
105 
106 
107 public:
108  //C++ methods used to invoke GTK+ virtual functions:
109 #ifdef GLIBMM_VFUNCS_ENABLED
110 #endif //GLIBMM_VFUNCS_ENABLED
111 
112 protected:
113  //GTK+ Virtual Functions (override these to change behaviour):
114 #ifdef GLIBMM_VFUNCS_ENABLED
115 #endif //GLIBMM_VFUNCS_ENABLED
116 
117  //Default Signal Handlers::
118 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
119  virtual bool on_event(GdkEvent* p1);
120 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
121 
122 
123 private:
124 
125 
126 public:
127 
128  //: Move an item by the specified amount
129 
137  void move(double dx, double dy);
138 
139  //: Raise an item in the z-order of its parent group by the specified
140  //: number of positions. If the number is zero, then the item will
141  //: be made the topmost of its parent group.
142 
148  void raise(int positions);
149 
150  //: Lower an item in the z-order of its parent group by the specified
151  //: number of positions. If the number is zero, then the item will be
152  //: made the bottommost of its parent group. */
153 
159  void lower(int positions);
160 
161  //: Raise an item to the top of its parent group's z-order.
162 
165  void raise_to_top();
166 
167  //: Lower an item to the bottom of its parent group's z-order
168 
172 
173  //: Grab the mouse for the specified item. Only the events in
174  //: event_mask will be reported. If cursor is non-NULL, it will be
175  //: used during the duration of the grab. Time is a proper X event
176  //: time parameter. Returns the same values as XGrabPointer().
177  int grab(unsigned int event_mask, const Gdk::Cursor& cursor, guint32 etime);
178  int grab(unsigned int event_mask, guint32 etime);
179 
180 
181  //: Ungrabs the mouse -- the specified item must be the same that was
182  //: passed to gnome_canvas_item_grab(). Time is a proper X event
183  //: time parameter.
184 
189  void ungrab(guint32 etime);
190 
191  //: These functions convert from a coordinate system to another. "w"
192  //: is world coordinates and "i" is item coordinates.
193 
199  void w2i(double& x, double& y);
200 
206  void i2w(double& x, double& y);
207 
208  //: Used to send all of the keystroke events to a specific item as well
209  //: as GDK_FOCUS_CHANGE events.
210 
215  void grab_focus();
216 
217  //: Fetch the bounding box of the item. The bounding box may not be
218  //: exactly tight, but the canvas items will do the best they can.
219 
227  void get_bounds(double& x1, double& y1, double& x2, double& y2) const;
228 
229  //: Make the item visible
230 
233  void show();
234 
235  //: Hide the item
236 
240  void hide();
241 
242  //: Apply a relative affine transformation to the item
243  void affine_relative(const Art::AffineTrans &affine);
244 
245 
246  //: Apply an absolute affine transformation to the item
247  void affine_absolute(const Art::AffineTrans &affine);
248 
249 
250  //: Gets the affine transform that converts from item-relative
251  //: coordinates to world coordinates
253 
254 
255  //: Gets the affine transform that converts from item-relative
256  //: coordinates to canvas pixel coordinates
258 
259 
265  void reparent(Group& new_group);
266 
268  Canvas* get_canvas() const;
269 
270  #ifdef GLIBMM_VFUNCS_ENABLED
271  virtual void update_vfunc(double* affine, ArtSVP* clip_path, int flags);
272 #endif //GLIBMM_VFUNCS_ENABLED
273 
274  #ifdef GLIBMM_VFUNCS_ENABLED
275  virtual void realize_vfunc();
276 #endif //GLIBMM_VFUNCS_ENABLED
277 
278  #ifdef GLIBMM_VFUNCS_ENABLED
279  virtual void unrealize_vfunc();
280 #endif //GLIBMM_VFUNCS_ENABLED
281 
282  #ifdef GLIBMM_VFUNCS_ENABLED
283  virtual void map_vfunc();
284 #endif //GLIBMM_VFUNCS_ENABLED
285 
286  #ifdef GLIBMM_VFUNCS_ENABLED
287  virtual void unmap_vfunc();
288 #endif //GLIBMM_VFUNCS_ENABLED
289 
290  #ifdef GLIBMM_VFUNCS_ENABLED
291  virtual ArtUta* coverage_vfunc();
292 #endif //GLIBMM_VFUNCS_ENABLED
293 
294  #ifdef GLIBMM_VFUNCS_ENABLED
295  virtual void draw_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable, int x, int y, int width, int height);
296 #endif //GLIBMM_VFUNCS_ENABLED
297 
298  #ifdef GLIBMM_VFUNCS_ENABLED
299  virtual void render_vfunc(GnomeCanvasBuf* buf);
300 #endif //GLIBMM_VFUNCS_ENABLED
301 
302  #ifdef GLIBMM_VFUNCS_ENABLED
303  virtual double point_vfunc(double x, double y, int cx, int cy, GnomeCanvasItem** actual_item);
304 #endif //GLIBMM_VFUNCS_ENABLED
305 
306  #ifdef GLIBMM_VFUNCS_ENABLED
307  virtual void bounds_vfunc(double* x1, double* y1, double* x2, double* y2);
308 #endif //GLIBMM_VFUNCS_ENABLED
309 
310 
311  //: Signal: an event ocurred for an item of this type. The(x, y)
312  //: coordinates are in the canvas world coordinate system.
313 
319  Glib::SignalProxy1< bool,GdkEvent* > signal_event();
320 
321 
323  const Group* get_parent_group() const;
324 
325  #ifdef GLIBMM_PROPERTIES_ENABLED
332  Glib::PropertyProxy<Group*> property_parent() ;
333 #endif //#GLIBMM_PROPERTIES_ENABLED
334 
335 #ifdef GLIBMM_PROPERTIES_ENABLED
342  Glib::PropertyProxy_ReadOnly<Group*> property_parent() const;
343 #endif //#GLIBMM_PROPERTIES_ENABLED
344 
345 
346 protected:
347 
348  //- For class children use only
349  void item_construct(Group& group);
350 
351  //- Unsafe version - can't use a _gtk_string here, C++ doesn't like
352  //- classes being passed before ellipses('...') args
353  void item_construct(Group& group, const gchar* first_arg_name,
354  va_list ap);
355 
356  //- Set arguments - For class children use only
357  void set(const gchar* first_arg_name, ...);
358 
359  //: Request that the update method eventually get called. This should be used
360  //: only by item implementations.
361 
366 
367 
370  void reset_bounds();
371 
378  void update_svp(ArtSVP **p_svp, ArtSVP *new_svp);
379 
386  void update_svp_clip(ArtSVP **p_svp, ArtSVP *new_svp, ArtSVP *clip_svp);
387 
391  void request_redraw_svp(const ArtSVP* svp);
392 
400  void update_bbox(int x1, int y1, int x2, int y2);
401 
402 
403 };
404 
405 } /* namespace Canvas */
406 } /* namespace Gnome */
407 
408 
409 namespace Glib
410 {
419  Gnome::Canvas::Item* wrap(GnomeCanvasItem* object, bool take_copy = false);
420 } //namespace Glib
421 
422 
423 #endif /* _LIBGNOMECANVASMM_ITEM_H */
424 
Definition: affinetrans.h:37
Canvas functions usually operate in either World coordinates (units for the entire canvas),...
Definition: canvas.h:69
Definition: group.h:60
Definition: item.h:67
void update_svp_clip(ArtSVP **p_svp, ArtSVP *new_svp, ArtSVP *clip_svp)
Sets the svp to the new value, clipping if necessary, and requesting repaint on what's changed.
void request_redraw_svp(const ArtSVP *svp)
Request redraw of the svp if in aa mode, or the entire item in in xlib mode.
void w2i(double &x, double &y)
Converts a coordinate pair from world coordinates to item-relative coordinates.
void i2w(double &x, double &y)
Converts a coordinate pair from item-relative coordinates to world coordinates.
Gnome::Canvas::Item * wrap(GnomeCanvasItem *object, bool take_copy=false)
A Glib::wrap() method for this object.
virtual void unmap_vfunc()
void update_svp(ArtSVP **p_svp, ArtSVP *new_svp)
Sets the svp to the new value, requesting repaint on what's changed.
virtual void render_vfunc(GnomeCanvasBuf *buf)
const Group * get_parent_group() const
virtual bool on_event(GdkEvent *p1)
virtual void unrealize_vfunc()
Glib::PropertyProxy_ReadOnly< Group * > property_parent() const
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
virtual void draw_vfunc(const Glib::RefPtr< Gdk::Drawable > &drawable, int x, int y, int width, int height)
const GnomeCanvasItem * gobj() const
Provides access to the underlying C GtkObject.
Definition: item.h:104
int grab(unsigned int event_mask, const Gdk::Cursor &cursor, guint32 etime)
void raise_to_top()
Raises an item to the top of its parent's stack.
void update_bbox(int x1, int y1, int x2, int y2)
Sets the bbox to the new value, requesting full repaint.
void get_bounds(double &x1, double &y1, double &x2, double &y2) const
Queries the bounding box of a canvas item.
void affine_relative(const Art::AffineTrans &affine)
Art::AffineTrans get_i2c_affine() const
void reset_bounds()
Resets the bounding box of a canvas item to an empty rectangle.
void reparent(Group &new_group)
Changes the parent of the specified item to be the new group.
void request_update()
To be used only by item implementations.
void hide()
Hides a canvas item.
GnomeCanvasItem * gobj()
Provides access to the underlying C GtkObject.
Definition: item.h:101
void set(const gchar *first_arg_name,...)
virtual void map_vfunc()
void item_construct(Group &group, const gchar *first_arg_name, va_list ap)
void move(double dx, double dy)
Moves a canvas item by creating an affine transformation matrix for translation by using the specifie...
Group * get_parent_group()
int grab(unsigned int event_mask, guint32 etime)
Art::AffineTrans get_i2w_affine() const
void lower_to_bottom()
Lowers an item to the bottom of its parent's stack.
virtual double point_vfunc(double x, double y, int cx, int cy, GnomeCanvasItem **actual_item)
Canvas * get_canvas() const
Returns the canvas we're on.
virtual void update_vfunc(double *affine, ArtSVP *clip_path, int flags)
virtual void realize_vfunc()
Glib::PropertyProxy< Group * > property_parent()
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
virtual ArtUta * coverage_vfunc()
void affine_absolute(const Art::AffineTrans &affine)
void show()
Shows a canvas item.
virtual void bounds_vfunc(double *x1, double *y1, double *x2, double *y2)
void item_construct(Group &group)
void ungrab(guint32 etime)
Ungrabs the item, which must have been grabbed in the canvas, and ungrabs the mouse.
Glib::SignalProxy1< bool, GdkEvent * > signal_event()
void grab_focus()
Makes the specified item take the keyboard focus, so all keyboard events will be sent to it.
void lower(int positions)
Lowers the item in its parent's stack by the specified number of positions.
Definition: bpath.h:150
Definition: affinetrans.h:30