~ubuntu-branches/ubuntu/vivid/ardour/vivid-proposed

« back to all changes in this revision

Viewing changes to libs/libgnomecanvasmm/libgnomecanvasmm/item.h

  • Committer: Package Import Robot
  • Author(s): Felipe Sateler, Jaromír Mikeš, Felipe Sateler
  • Date: 2014-05-22 14:39:25 UTC
  • mfrom: (29 sid)
  • mto: This revision was merged to the branch mainline in revision 30.
  • Revision ID: package-import@ubuntu.com-20140522143925-vwqfo9287pmkrroe
Tags: 1:2.8.16+git20131003-3
* Team upload

[ Jaromír Mikeš ]
* Add -dbg package

[ Felipe Sateler ]
* Upload to experimental

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- c++ -*-
 
2
// Generated by gtkmmproc -- DO NOT MODIFY!
 
3
#ifndef _LIBGNOMECANVASMM_ITEM_H
 
4
#define _LIBGNOMECANVASMM_ITEM_H
 
5
 
 
6
#include <glibmm.h>
 
7
 
 
8
// -*- C++ -*-
 
9
/* $Id$ */
 
10
 
 
11
/* item.h
 
12
 * 
 
13
 * Copyright (C) 1998 EMC Capital Management Inc.
 
14
 * Developed by Havoc Pennington <hp@pobox.com>
 
15
 *
 
16
 * Copyright (C) 1999 The Gtk-- Development Team
 
17
 *
 
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.
 
22
 *
 
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.
 
27
 *
 
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.
 
31
 */
 
32
 
 
33
#include <gtkmm/object.h>
 
34
#include <gdkmm/cursor.h>
 
35
#include <libgnomecanvas/gnome-canvas.h>
 
36
 
 
37
#include <libgnomecanvasmm/point.h>
 
38
#include <libgnomecanvasmm/affinetrans.h>
 
39
#include <libgnomecanvasmm/properties.h>
 
40
 
 
41
 
 
42
#ifndef DOXYGEN_SHOULD_SKIP_THIS
 
43
typedef struct _GnomeCanvasItem GnomeCanvasItem;
 
44
typedef struct _GnomeCanvasItemClass GnomeCanvasItemClass;
 
45
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
46
 
 
47
 
 
48
namespace Gnome
 
49
{
 
50
 
 
51
namespace Canvas
 
52
{ class Item_Class; } // namespace Canvas
 
53
 
 
54
} // namespace Gnome
 
55
namespace Gnome
 
56
{
 
57
 
 
58
namespace Canvas
 
59
{
 
60
 
 
61
class Canvas;
 
62
class Group;
 
63
 
 
64
 
 
65
class Item : public Gtk::Object
 
66
{
 
67
  public:
 
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 */
 
74
 
 
75
  virtual ~Item();
 
76
 
 
77
#ifndef DOXYGEN_SHOULD_SKIP_THIS
 
78
 
 
79
private:
 
80
  friend class Item_Class;
 
81
  static CppClassType item_class_;
 
82
 
 
83
  // noncopyable
 
84
  Item(const Item&);
 
85
  Item& operator=(const Item&);
 
86
 
 
87
protected:
 
88
  explicit Item(const Glib::ConstructParams& construct_params);
 
89
  explicit Item(GnomeCanvasItem* castitem);
 
90
 
 
91
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
92
 
 
93
public:
 
94
#ifndef DOXYGEN_SHOULD_SKIP_THIS
 
95
  static GType get_type()      G_GNUC_CONST;
 
96
  static GType get_base_type() G_GNUC_CONST;
 
97
#endif
 
98
 
 
99
  ///Provides access to the underlying C GtkObject.
 
100
  GnomeCanvasItem*       gobj()       { return reinterpret_cast<GnomeCanvasItem*>(gobject_); }
 
101
 
 
102
  ///Provides access to the underlying C GtkObject.
 
103
  const GnomeCanvasItem* gobj() const { return reinterpret_cast<GnomeCanvasItem*>(gobject_); }
 
104
 
 
105
 
 
106
public:
 
107
  //C++ methods used to invoke GTK+ virtual functions:
 
108
 
 
109
protected:
 
110
  //GTK+ Virtual Functions (override these to change behaviour):
 
111
 
 
112
  //Default Signal Handlers::
 
113
  virtual bool on_event(GdkEvent* p1);
 
114
 
 
115
 
 
116
private:
 
117
 
 
118
  
 
119
public:
 
120
 
 
121
  //:  Move an item by the specified amount
 
122
  
 
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.
 
129
   */
 
130
  void move(double dx, double dy);
 
131
 
 
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.
 
135
  
 
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.
 
140
   */
 
141
  void raise(int positions);
 
142
 
 
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.  */
 
146
  
 
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.
 
151
   */
 
152
  void lower(int positions);
 
153
 
 
154
  //: Raise an item to the top of its parent group's z-order.
 
155
  
 
156
  /** Raises an item to the top of its parent's stack.
 
157
   */
 
158
  void raise_to_top();
 
159
 
 
160
  //: Lower an item to the bottom of its parent group's z-order
 
161
  
 
162
  /** Lowers an item to the bottom of its parent's stack.
 
163
   */
 
164
  void lower_to_bottom();
 
165
 
 
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);
 
172
  
 
173
 
 
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
 
176
  //: time parameter. 
 
177
  
 
178
  /** Ungrabs the item, which must have been grabbed in the canvas, and ungrabs the
 
179
   * mouse.
 
180
   * @param etime The timestamp for ungrabbing the mouse.
 
181
   */
 
182
  void ungrab(guint32 etime);
 
183
 
 
184
  //: These functions convert from a coordinate system to another.  "w"
 
185
  //: is world coordinates and "i" is item coordinates. 
 
186
  
 
187
  /** Converts a coordinate pair from world coordinates to item-relative
 
188
   * coordinates.
 
189
   * @param x X coordinate to convert (input/output value).
 
190
   * @param y Y coordinate to convert (input/output value).
 
191
   */
 
192
  void w2i(double& x, double& y);
 
193
  
 
194
  /** Converts a coordinate pair from item-relative coordinates to world
 
195
   * coordinates.
 
196
   * @param x X coordinate to convert (input/output value).
 
197
   * @param y Y coordinate to convert (input/output value).
 
198
   */
 
199
  void i2w(double& x, double& y);
 
200
 
 
201
  //: Used to send all of the keystroke events to a specific item as well 
 
202
  //: as GDK_FOCUS_CHANGE events.
 
203
  
 
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
 
206
   * it as well.
 
207
   */
 
208
  void grab_focus();
 
209
 
 
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.
 
212
  
 
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).
 
219
   */
 
220
  void get_bounds(double& x1, double& y1, double& x2, double& y2) const;
 
221
 
 
222
  //: Make the item visible
 
223
  
 
224
  /** Shows a canvas item.  If the item was already shown, then no action is taken.
 
225
   */
 
226
  void show();
 
227
  
 
228
  //: Hide the item
 
229
  
 
230
  /** Hides a canvas item.  If the item was already hidden, then no action is
 
231
   * taken.
 
232
   */
 
233
  void hide();
 
234
 
 
235
  //: Apply a relative affine transformation to the item 
 
236
  void affine_relative(const Art::AffineTrans &affine);
 
237
  
 
238
 
 
239
  //: Apply an absolute affine transformation to the item
 
240
  void affine_absolute(const Art::AffineTrans &affine);
 
241
  
 
242
 
 
243
  //: Gets the affine transform that converts from item-relative
 
244
  //: coordinates to world coordinates
 
245
  Art::AffineTrans get_i2w_affine() const;
 
246
  
 
247
 
 
248
  //: Gets the affine transform that converts from item-relative
 
249
  //: coordinates to canvas pixel coordinates
 
250
  Art::AffineTrans get_i2c_affine() const;
 
251
  
 
252
 
 
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.
 
257
   */
 
258
  void reparent(Group& new_group);
 
259
 
 
260
  /// Returns the canvas we're on.
 
261
  Canvas* get_canvas() const;
 
262
 
 
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);
 
273
 
 
274
  //: Signal: an event ocurred for an item of this type.  The(x, y)
 
275
  //: coordinates are in the canvas world coordinate system.
 
276
  
 
277
 
 
278
  Glib::SignalProxy1< bool,GdkEvent* > signal_event();
 
279
 
 
280
 
 
281
  /** 
 
282
   *
 
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.
 
286
   */
 
287
  Glib::PropertyProxy<Group*> property_parent() ;
 
288
 
 
289
/** 
 
290
   *
 
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.
 
294
   */
 
295
  Glib::PropertyProxy_ReadOnly<Group*> property_parent() const;
 
296
 
 
297
 
 
298
protected:
 
299
 
 
300
  //- For class children use only
 
301
  void item_construct(Group& group);
 
302
 
 
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,
 
306
                      va_list ap);
 
307
 
 
308
  //- Set arguments - For class children use only
 
309
  void set(const gchar* first_arg_name, ...);
 
310
 
 
311
  //: Request that the update method eventually get called.  This should be used
 
312
  //: only by item implementations.
 
313
  
 
314
  /** To be used only by item implementations.  Requests that the canvas queue an
 
315
   * update for the specified item.
 
316
   */
 
317
  void request_update();
 
318
 
 
319
 
 
320
  /** Resets the bounding box of a canvas item to an empty rectangle.
 
321
   */
 
322
  void reset_bounds();
 
323
  
 
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.
 
329
   */
 
330
  void update_svp(ArtSVP **p_svp, ArtSVP *new_svp);
 
331
  
 
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.
 
337
   */
 
338
  void update_svp_clip(ArtSVP **p_svp, ArtSVP *new_svp, ArtSVP *clip_svp);
 
339
  
 
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.
 
342
   */
 
343
  void request_redraw_svp(const ArtSVP* svp);
 
344
  
 
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.
 
351
   */
 
352
  void update_bbox(int x1, int y1, int x2, int y2);
 
353
  
 
354
 
 
355
};
 
356
 
 
357
} /* namespace Canvas */
 
358
} /* namespace Gnome */
 
359
 
 
360
namespace Glib
 
361
{
 
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.
 
366
   */
 
367
  Gnome::Canvas::Item* wrap(GnomeCanvasItem* object, bool take_copy = false);
 
368
}
 
369
#endif /* _LIBGNOMECANVASMM_ITEM_H */
 
370