2
// Generated by gtkmmproc -- DO NOT MODIFY!
3
#ifndef _LIBGNOMECANVASMM_ITEM_H
4
#define _LIBGNOMECANVASMM_ITEM_H
13
* Copyright (C) 1998 EMC Capital Management Inc.
14
* Developed by Havoc Pennington <hp@pobox.com>
16
* Copyright (C) 1999 The Gtk-- Development Team
18
* This library is free software; you can redistribute it and/or
19
* modify it under the terms of the GNU Library General Public
20
* License as published by the Free Software Foundation; either
21
* version 2 of the License, or (at your option) any later version.
23
* This library is distributed in the hope that it will be useful,
24
* but WITHOUT ANY WARRANTY; without even the implied warranty of
25
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26
* Library General Public License for more details.
28
* You should have received a copy of the GNU Library General Public
29
* License along with this library; if not, write to the Free
30
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33
#include <gtkmm/object.h>
34
#include <gdkmm/cursor.h>
35
#include <libgnomecanvas/gnome-canvas.h>
37
#include <libgnomecanvasmm/point.h>
38
#include <libgnomecanvasmm/affinetrans.h>
39
#include <libgnomecanvasmm/properties.h>
42
#ifndef DOXYGEN_SHOULD_SKIP_THIS
43
typedef struct _GnomeCanvasItem GnomeCanvasItem;
44
typedef struct _GnomeCanvasItemClass GnomeCanvasItemClass;
45
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
52
{ class Item_Class; } // namespace Canvas
65
class Item : public Gtk::Object
68
#ifndef DOXYGEN_SHOULD_SKIP_THIS
69
typedef Item CppObjectType;
70
typedef Item_Class CppClassType;
71
typedef GnomeCanvasItem BaseObjectType;
72
typedef GnomeCanvasItemClass BaseClassType;
73
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
77
#ifndef DOXYGEN_SHOULD_SKIP_THIS
80
friend class Item_Class;
81
static CppClassType item_class_;
85
Item& operator=(const Item&);
88
explicit Item(const Glib::ConstructParams& construct_params);
89
explicit Item(GnomeCanvasItem* castitem);
91
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
94
#ifndef DOXYGEN_SHOULD_SKIP_THIS
95
static GType get_type() G_GNUC_CONST;
96
static GType get_base_type() G_GNUC_CONST;
99
///Provides access to the underlying C GtkObject.
100
GnomeCanvasItem* gobj() { return reinterpret_cast<GnomeCanvasItem*>(gobject_); }
102
///Provides access to the underlying C GtkObject.
103
const GnomeCanvasItem* gobj() const { return reinterpret_cast<GnomeCanvasItem*>(gobject_); }
107
//C++ methods used to invoke GTK+ virtual functions:
110
//GTK+ Virtual Functions (override these to change behaviour):
112
//Default Signal Handlers::
113
virtual bool on_event(GdkEvent* p1);
121
//: Move an item by the specified amount
123
/** Moves a canvas item by creating an affine transformation matrix for
124
* translation by using the specified values. This happens in item
125
* local coordinate system, so if you have nontrivial transform, it
126
* most probably does not do, what you want.
127
* @param dx Horizontal offset.
128
* @param dy Vertical offset.
130
void move(double dx, double dy);
132
//: Raise an item in the z-order of its parent group by the specified
133
//: number of positions. If the number is zero, then the item will
134
//: be made the topmost of its parent group.
136
/** Raises the item in its parent's stack by the specified number of positions.
137
* If the number of positions is greater than the distance to the top of the
138
* stack, then the item is put at the top.
139
* @param positions Number of steps to raise the item.
141
void raise(int positions);
143
//: Lower an item in the z-order of its parent group by the specified
144
//: number of positions. If the number is zero, then the item will be
145
//: made the bottommost of its parent group. */
147
/** Lowers the item in its parent's stack by the specified number of positions.
148
* If the number of positions is greater than the distance to the bottom of the
149
* stack, then the item is put at the bottom.
150
* @param positions Number of steps to lower the item.
152
void lower(int positions);
154
//: Raise an item to the top of its parent group's z-order.
156
/** Raises an item to the top of its parent's stack.
160
//: Lower an item to the bottom of its parent group's z-order
162
/** Lowers an item to the bottom of its parent's stack.
164
void lower_to_bottom();
166
//: Grab the mouse for the specified item. Only the events in
167
//: event_mask will be reported. If cursor is non-NULL, it will be
168
//: used during the duration of the grab. Time is a proper X event
169
//: time parameter. Returns the same values as XGrabPointer().
170
int grab(unsigned int event_mask, const Gdk::Cursor& cursor, guint32 etime);
171
int grab(unsigned int event_mask, guint32 etime);
174
//: Ungrabs the mouse -- the specified item must be the same that was
175
//: passed to gnome_canvas_item_grab(). Time is a proper X event
178
/** Ungrabs the item, which must have been grabbed in the canvas, and ungrabs the
180
* @param etime The timestamp for ungrabbing the mouse.
182
void ungrab(guint32 etime);
184
//: These functions convert from a coordinate system to another. "w"
185
//: is world coordinates and "i" is item coordinates.
187
/** Converts a coordinate pair from world coordinates to item-relative
189
* @param x X coordinate to convert (input/output value).
190
* @param y Y coordinate to convert (input/output value).
192
void w2i(double& x, double& y);
194
/** Converts a coordinate pair from item-relative coordinates to world
196
* @param x X coordinate to convert (input/output value).
197
* @param y Y coordinate to convert (input/output value).
199
void i2w(double& x, double& y);
201
//: Used to send all of the keystroke events to a specific item as well
202
//: as GDK_FOCUS_CHANGE events.
204
/** Makes the specified item take the keyboard focus, so all keyboard events will
205
* be sent to it. If the canvas widget itself did not have the focus, it grabs
210
//: Fetch the bounding box of the item. The bounding box may not be
211
//: exactly tight, but the canvas items will do the best they can.
213
/** Queries the bounding box of a canvas item. The bounds are returned in the
214
* coordinate system of the item's parent.
215
* @param x1 Leftmost edge of the bounding box (return value).
216
* @param y1 Upper edge of the bounding box (return value).
217
* @param x2 Rightmost edge of the bounding box (return value).
218
* @param y2 Lower edge of the bounding box (return value).
220
void get_bounds(double& x1, double& y1, double& x2, double& y2) const;
222
//: Make the item visible
224
/** Shows a canvas item. If the item was already shown, then no action is taken.
230
/** Hides a canvas item. If the item was already hidden, then no action is
235
//: Apply a relative affine transformation to the item
236
void affine_relative(const Art::AffineTrans &affine);
239
//: Apply an absolute affine transformation to the item
240
void affine_absolute(const Art::AffineTrans &affine);
243
//: Gets the affine transform that converts from item-relative
244
//: coordinates to world coordinates
245
Art::AffineTrans get_i2w_affine() const;
248
//: Gets the affine transform that converts from item-relative
249
//: coordinates to canvas pixel coordinates
250
Art::AffineTrans get_i2c_affine() const;
253
/** Changes the parent of the specified item to be the new group. The item keeps
254
* its group-relative coordinates as for its old parent, so the item may change
255
* its absolute position within the canvas.
256
* @param new_group A canvas group.
258
void reparent(Group& new_group);
260
/// Returns the canvas we're on.
261
Canvas* get_canvas() const;
263
virtual void update_vfunc(double* affine, ArtSVP* clip_path, int flags);
264
virtual void realize_vfunc();
265
virtual void unrealize_vfunc();
266
virtual void map_vfunc();
267
virtual void unmap_vfunc();
268
virtual ArtUta* coverage_vfunc();
269
virtual void draw_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable, int x, int y, int width, int height);
270
virtual void render_vfunc(GnomeCanvasBuf* buf);
271
virtual double point_vfunc(double x, double y, int cx, int cy, GnomeCanvasItem** actual_item);
272
virtual void bounds_vfunc(double* x1, double* y1, double* x2, double* y2);
274
//: Signal: an event ocurred for an item of this type. The(x, y)
275
//: coordinates are in the canvas world coordinate system.
278
Glib::SignalProxy1< bool,GdkEvent* > signal_event();
283
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
284
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
285
* the value of the property changes.
287
Glib::PropertyProxy<Group*> property_parent() ;
291
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
292
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
293
* the value of the property changes.
295
Glib::PropertyProxy_ReadOnly<Group*> property_parent() const;
300
//- For class children use only
301
void item_construct(Group& group);
303
//- Unsafe version - can't use a _gtk_string here, C++ doesn't like
304
//- classes being passed before ellipses('...') args
305
void item_construct(Group& group, const gchar* first_arg_name,
308
//- Set arguments - For class children use only
309
void set(const gchar* first_arg_name, ...);
311
//: Request that the update method eventually get called. This should be used
312
//: only by item implementations.
314
/** To be used only by item implementations. Requests that the canvas queue an
315
* update for the specified item.
317
void request_update();
320
/** Resets the bounding box of a canvas item to an empty rectangle.
324
/** Sets the svp to the new value, requesting repaint on what's changed. This
325
* function takes responsibility for freeing new_svp. This routine also adds the
326
* svp's bbox to the item's.
327
* @param p_svp A pointer to the existing svp.
328
* @param new_svp The new svp.
330
void update_svp(ArtSVP **p_svp, ArtSVP *new_svp);
332
/** Sets the svp to the new value, clipping if necessary, and requesting repaint
333
* on what's changed. This function takes responsibility for freeing new_svp.
334
* @param p_svp A pointer to the existing svp.
335
* @param new_svp The new svp.
336
* @param clip_svp A clip path, if non-null.
338
void update_svp_clip(ArtSVP **p_svp, ArtSVP *new_svp, ArtSVP *clip_svp);
340
/** Request redraw of the svp if in aa mode, or the entire item in in xlib mode.
341
* @param svp The svp that needs to be redrawn.
343
void request_redraw_svp(const ArtSVP* svp);
345
/** Sets the bbox to the new value, requesting full repaint.
346
* @param item The canvas item needing update.
347
* @param x1 Left coordinate of the new bounding box.
348
* @param y1 Top coordinate of the new bounding box.
349
* @param x2 Right coordinate of the new bounding box.
350
* @param y2 Bottom coordinate of the new bounding box.
352
void update_bbox(int x1, int y1, int x2, int y2);
357
} /* namespace Canvas */
358
} /* namespace Gnome */
362
/** @relates Gnome::Canvas::Item
363
* @param object The C instance
364
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
365
* @result A C++ instance that wraps this C instance.
367
Gnome::Canvas::Item* wrap(GnomeCanvasItem* object, bool take_copy = false);
369
#endif /* _LIBGNOMECANVASMM_ITEM_H */