libgnomecanvasmm
|
00001 // -*- c++ -*- 00002 // Generated by gtkmmproc -- DO NOT MODIFY! 00003 #ifndef _LIBGNOMECANVASMM_ITEM_H 00004 #define _LIBGNOMECANVASMM_ITEM_H 00005 00006 00007 #include <glibmm.h> 00008 00009 // -*- C++ -*- 00010 /* $Id: item.hg,v 1.7 2005/06/09 11:26:34 murrayc Exp $ */ 00011 00012 /* item.h 00013 * 00014 * Copyright (C) 1998 EMC Capital Management Inc. 00015 * Developed by Havoc Pennington <hp@pobox.com> 00016 * 00017 * Copyright (C) 1999 The Gtk-- Development Team 00018 * 00019 * This library is free software; you can redistribute it and/or 00020 * modify it under the terms of the GNU Lesser General Public 00021 * License as published by the Free Software Foundation; either 00022 * version 2.1 of the License, or (at your option) any later version. 00023 * 00024 * This library is distributed in the hope that it will be useful, 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00027 * Lesser General Public License for more details. 00028 * 00029 * You should have received a copy of the GNU Lesser General Public 00030 * License along with this library; if not, write to the Free 00031 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00032 */ 00033 00034 #include <gtkmm/object.h> 00035 #include <gdkmm/cursor.h> 00036 #include <libgnomecanvas/gnome-canvas.h> 00037 00038 #include <libgnomecanvasmm/point.h> 00039 #include <libgnomecanvasmm/affinetrans.h> 00040 #include <libgnomecanvasmm/properties.h> 00041 00042 00043 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00044 typedef struct _GnomeCanvasItem GnomeCanvasItem; 00045 typedef struct _GnomeCanvasItemClass GnomeCanvasItemClass; 00046 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00047 00048 00049 namespace Gnome 00050 { 00051 00052 namespace Canvas 00053 { class Item_Class; } // namespace Canvas 00054 00055 } // namespace Gnome 00056 namespace Gnome 00057 { 00058 00059 namespace Canvas 00060 { 00061 00062 class Canvas; 00063 class Group; 00064 00065 00066 class Item : public Gtk::Object 00067 { 00068 public: 00069 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00070 typedef Item CppObjectType; 00071 typedef Item_Class CppClassType; 00072 typedef GnomeCanvasItem BaseObjectType; 00073 typedef GnomeCanvasItemClass BaseClassType; 00074 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00075 00076 virtual ~Item(); 00077 00078 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00079 00080 private: 00081 friend class Item_Class; 00082 static CppClassType item_class_; 00083 00084 // noncopyable 00085 Item(const Item&); 00086 Item& operator=(const Item&); 00087 00088 protected: 00089 explicit Item(const Glib::ConstructParams& construct_params); 00090 explicit Item(GnomeCanvasItem* castitem); 00091 00092 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00093 00094 public: 00095 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00096 static GType get_type() G_GNUC_CONST; 00097 static GType get_base_type() G_GNUC_CONST; 00098 #endif 00099 00101 GnomeCanvasItem* gobj() { return reinterpret_cast<GnomeCanvasItem*>(gobject_); } 00102 00104 const GnomeCanvasItem* gobj() const { return reinterpret_cast<GnomeCanvasItem*>(gobject_); } 00105 00106 00107 public: 00108 //C++ methods used to invoke GTK+ virtual functions: 00109 #ifdef GLIBMM_VFUNCS_ENABLED 00110 #endif //GLIBMM_VFUNCS_ENABLED 00111 00112 protected: 00113 //GTK+ Virtual Functions (override these to change behaviour): 00114 #ifdef GLIBMM_VFUNCS_ENABLED 00115 #endif //GLIBMM_VFUNCS_ENABLED 00116 00117 //Default Signal Handlers:: 00118 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED 00119 virtual bool on_event(GdkEvent* p1); 00120 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED 00121 00122 00123 private: 00124 00125 00126 public: 00127 00128 //: Move an item by the specified amount 00129 00137 void move(double dx, double dy); 00138 00139 //: Raise an item in the z-order of its parent group by the specified 00140 //: number of positions. If the number is zero, then the item will 00141 //: be made the topmost of its parent group. 00142 00148 void raise(int positions); 00149 00150 //: Lower an item in the z-order of its parent group by the specified 00151 //: number of positions. If the number is zero, then the item will be 00152 //: made the bottommost of its parent group. */ 00153 00159 void lower(int positions); 00160 00161 //: Raise an item to the top of its parent group's z-order. 00162 00165 void raise_to_top(); 00166 00167 //: Lower an item to the bottom of its parent group's z-order 00168 00171 void lower_to_bottom(); 00172 00173 //: Grab the mouse for the specified item. Only the events in 00174 //: event_mask will be reported. If cursor is non-NULL, it will be 00175 //: used during the duration of the grab. Time is a proper X event 00176 //: time parameter. Returns the same values as XGrabPointer(). 00177 int grab(unsigned int event_mask, const Gdk::Cursor& cursor, guint32 etime); 00178 int grab(unsigned int event_mask, guint32 etime); 00179 00180 00181 //: Ungrabs the mouse -- the specified item must be the same that was 00182 //: passed to gnome_canvas_item_grab(). Time is a proper X event 00183 //: time parameter. 00184 00189 void ungrab(guint32 etime); 00190 00191 //: These functions convert from a coordinate system to another. "w" 00192 //: is world coordinates and "i" is item coordinates. 00193 00199 void w2i(double& x, double& y); 00200 00206 void i2w(double& x, double& y); 00207 00208 //: Used to send all of the keystroke events to a specific item as well 00209 //: as GDK_FOCUS_CHANGE events. 00210 00215 void grab_focus(); 00216 00217 //: Fetch the bounding box of the item. The bounding box may not be 00218 //: exactly tight, but the canvas items will do the best they can. 00219 00227 void get_bounds(double& x1, double& y1, double& x2, double& y2) const; 00228 00229 //: Make the item visible 00230 00233 void show(); 00234 00235 //: Hide the item 00236 00240 void hide(); 00241 00242 //: Apply a relative affine transformation to the item 00243 void affine_relative(const Art::AffineTrans &affine); 00244 00245 00246 //: Apply an absolute affine transformation to the item 00247 void affine_absolute(const Art::AffineTrans &affine); 00248 00249 00250 //: Gets the affine transform that converts from item-relative 00251 //: coordinates to world coordinates 00252 Art::AffineTrans get_i2w_affine() const; 00253 00254 00255 //: Gets the affine transform that converts from item-relative 00256 //: coordinates to canvas pixel coordinates 00257 Art::AffineTrans get_i2c_affine() const; 00258 00259 00265 void reparent(Group& new_group); 00266 00268 Canvas* get_canvas() const; 00269 00270 #ifdef GLIBMM_VFUNCS_ENABLED 00271 virtual void update_vfunc(double* affine, ArtSVP* clip_path, int flags); 00272 #endif //GLIBMM_VFUNCS_ENABLED 00273 00274 #ifdef GLIBMM_VFUNCS_ENABLED 00275 virtual void realize_vfunc(); 00276 #endif //GLIBMM_VFUNCS_ENABLED 00277 00278 #ifdef GLIBMM_VFUNCS_ENABLED 00279 virtual void unrealize_vfunc(); 00280 #endif //GLIBMM_VFUNCS_ENABLED 00281 00282 #ifdef GLIBMM_VFUNCS_ENABLED 00283 virtual void map_vfunc(); 00284 #endif //GLIBMM_VFUNCS_ENABLED 00285 00286 #ifdef GLIBMM_VFUNCS_ENABLED 00287 virtual void unmap_vfunc(); 00288 #endif //GLIBMM_VFUNCS_ENABLED 00289 00290 #ifdef GLIBMM_VFUNCS_ENABLED 00291 virtual ArtUta* coverage_vfunc(); 00292 #endif //GLIBMM_VFUNCS_ENABLED 00293 00294 #ifdef GLIBMM_VFUNCS_ENABLED 00295 virtual void draw_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable, int x, int y, int width, int height); 00296 #endif //GLIBMM_VFUNCS_ENABLED 00297 00298 #ifdef GLIBMM_VFUNCS_ENABLED 00299 virtual void render_vfunc(GnomeCanvasBuf* buf); 00300 #endif //GLIBMM_VFUNCS_ENABLED 00301 00302 #ifdef GLIBMM_VFUNCS_ENABLED 00303 virtual double point_vfunc(double x, double y, int cx, int cy, GnomeCanvasItem** actual_item); 00304 #endif //GLIBMM_VFUNCS_ENABLED 00305 00306 #ifdef GLIBMM_VFUNCS_ENABLED 00307 virtual void bounds_vfunc(double* x1, double* y1, double* x2, double* y2); 00308 #endif //GLIBMM_VFUNCS_ENABLED 00309 00310 00311 //: Signal: an event ocurred for an item of this type. The(x, y) 00312 //: coordinates are in the canvas world coordinate system. 00313 00319 Glib::SignalProxy1< bool,GdkEvent* > signal_event(); 00320 00321 00322 Group* get_parent_group(); 00323 const Group* get_parent_group() const; 00324 00325 #ifdef GLIBMM_PROPERTIES_ENABLED 00326 00332 Glib::PropertyProxy<Group*> property_parent() ; 00333 #endif //#GLIBMM_PROPERTIES_ENABLED 00334 00335 #ifdef GLIBMM_PROPERTIES_ENABLED 00336 00342 Glib::PropertyProxy_ReadOnly<Group*> property_parent() const; 00343 #endif //#GLIBMM_PROPERTIES_ENABLED 00344 00345 00346 protected: 00347 00348 //- For class children use only 00349 void item_construct(Group& group); 00350 00351 //- Unsafe version - can't use a _gtk_string here, C++ doesn't like 00352 //- classes being passed before ellipses('...') args 00353 void item_construct(Group& group, const gchar* first_arg_name, 00354 va_list ap); 00355 00356 //- Set arguments - For class children use only 00357 void set(const gchar* first_arg_name, ...); 00358 00359 //: Request that the update method eventually get called. This should be used 00360 //: only by item implementations. 00361 00365 void request_update(); 00366 00367 00370 void reset_bounds(); 00371 00378 void update_svp(ArtSVP **p_svp, ArtSVP *new_svp); 00379 00386 void update_svp_clip(ArtSVP **p_svp, ArtSVP *new_svp, ArtSVP *clip_svp); 00387 00391 void request_redraw_svp(const ArtSVP* svp); 00392 00400 void update_bbox(int x1, int y1, int x2, int y2); 00401 00402 00403 }; 00404 00405 } /* namespace Canvas */ 00406 } /* namespace Gnome */ 00407 00408 00409 namespace Glib 00410 { 00419 Gnome::Canvas::Item* wrap(GnomeCanvasItem* object, bool take_copy = false); 00420 } //namespace Glib 00421 00422 00423 #endif /* _LIBGNOMECANVASMM_ITEM_H */ 00424