canvas.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 // Generated by gtkmmproc -- DO NOT MODIFY!
00003 #ifndef _GOOCANVASMM_CANVAS_H
00004 #define _GOOCANVASMM_CANVAS_H
00005 
00006 
00007 #include <glibmm.h>
00008 
00009 /* Copyright (C) 1998-2006 The gtkmm Development Team
00010  *
00011  * This library is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU Library General Public
00013  * License as published by the Free Software Foundation; either
00014  * version 2 of the License, or (at your option) any later version.
00015  *
00016  * This library is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * Library General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Library General Public
00022  * License along with this library; if not, write to the Free
00023  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00024  */
00025 
00026 #include <goocanvasmm/item.h>
00027 #include <goocanvasmm/itemmodel.h>
00028 #include <goocanvasmm/itemsimple.h>
00029 #include <goocanvasmm/style.h>
00030 #include <goocanvasmm/widget.h>
00031 
00032 #include <gtkmm/adjustment.h>
00033 #include <gtkmm/container.h>
00034 #include <gdkmm/cursor.h>
00035 #include <cairomm/context.h>
00036 #include <gtkmm/papersize.h> //For Gtk::Unit
00037 
00038 
00039 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00040 typedef struct _GooCanvas GooCanvas;
00041 typedef struct _GooCanvasClass GooCanvasClass;
00042 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00043 
00044 
00045 namespace Goocanvas
00046 { class Canvas_Class; } // namespace Goocanvas
00047 namespace Goocanvas
00048 {
00049 
00050 
00051 class Canvas :
00052   public Gtk::Container
00053 {
00054   public:
00055 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00056   typedef Canvas CppObjectType;
00057   typedef Canvas_Class CppClassType;
00058   typedef GooCanvas BaseObjectType;
00059   typedef GooCanvasClass BaseClassType;
00060 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00061 
00062   virtual ~Canvas();
00063 
00064 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00065 
00066 private:
00067   friend class Canvas_Class;
00068   static CppClassType canvas_class_;
00069 
00070   // noncopyable
00071   Canvas(const Canvas&);
00072   Canvas& operator=(const Canvas&);
00073 
00074 protected:
00075   explicit Canvas(const Glib::ConstructParams& construct_params);
00076   explicit Canvas(GooCanvas* castitem);
00077 
00078 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00079 
00080 public:
00081 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00082   static GType get_type()      G_GNUC_CONST;
00083   static GType get_base_type() G_GNUC_CONST;
00084 #endif
00085 
00087   GooCanvas*       gobj()       { return reinterpret_cast<GooCanvas*>(gobject_); }
00088 
00090   const GooCanvas* gobj() const { return reinterpret_cast<GooCanvas*>(gobject_); }
00091 
00092 
00093 public:
00094   //C++ methods used to invoke GTK+ virtual functions:
00095 #ifdef GLIBMM_VFUNCS_ENABLED
00096 #endif //GLIBMM_VFUNCS_ENABLED
00097 
00098 protected:
00099   //GTK+ Virtual Functions (override these to change behaviour):
00100 #ifdef GLIBMM_VFUNCS_ENABLED
00101 #endif //GLIBMM_VFUNCS_ENABLED
00102 
00103   //Default Signal Handlers::
00104 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00105   virtual void on_set_scroll_adjustments(Gtk::Adjustment* hadjustment, Gtk::Adjustment* vadjustment);
00106   virtual void on_item_created(const Glib::RefPtr<Item>& item, const Glib::RefPtr<ItemModel>& model);
00107 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00108 
00109 
00110 private:
00111 
00112 
00113 public:
00114   Canvas();
00115 
00116   
00117   Glib::RefPtr<Item> get_root_item();
00118   
00119   Glib::RefPtr<const Item> get_root_item() const;
00120   
00121   void set_root_item(const Glib::RefPtr<Item>& item);
00122 
00123   
00124   Glib::RefPtr<ItemModel> get_root_item_model();
00125   
00126   Glib::RefPtr<const ItemModel> get_root_item_model() const;
00127   
00128   void set_root_item_model(const Glib::RefPtr<ItemModel>& model);
00129 
00130   
00131   Glib::RefPtr<Item> get_item(const Glib::RefPtr<ItemModel>& model);
00132   
00133   Glib::RefPtr<const Item> get_item(const Glib::RefPtr<ItemModel>& model) const;
00134 
00135   
00136   Glib::RefPtr<Item> get_item_at(double x, double y, bool is_pointer_event);
00137   
00138   Glib::RefPtr<const Item> get_item_at(double x, double y, bool is_pointer_event) const;
00139 
00140   //TODO: Ref the items?
00141   //TODO: Add const versions
00142 
00143 #
00144 #
00145 
00146 
00147   Glib::ListHandle< Glib::RefPtr<Item> > get_items_at(double x, double y, bool is_pointer_event);
00148   
00149   Glib::ListHandle< Glib::RefPtr<Item> > get_items_in_area(const Bounds& area, bool inside_area, bool allow_overlaps, bool include_containers) const;
00150 
00151   
00152   double get_scale() const;
00153   
00154   void set_scale(double scale);
00155 
00156 
00157   void get_bounds(double& left, double& top, double& right, double& bottom) const;
00158   void get_bounds(Bounds& bounds) const;
00159 
00160   
00161   void set_bounds(double left, double top, double right, double bottom);
00162   void set_bounds(const Bounds& bounds);
00163 
00164   
00165   void scroll_to(double left, double top);
00166 
00167   
00168   void grab_focus(const Glib::RefPtr<Item>& item);
00169 
00170   
00171   void render(const Cairo::RefPtr<Cairo::Context>& context, const Bounds& bounds, double scale = 0.0);
00172   void render(const Cairo::RefPtr<Cairo::Context>& context, double scale = 0.0);
00173 
00174   
00175   void convert_to_pixels(double& x, double& y) const;
00176   
00177   void convert_from_pixels(double& x, double& y) const;
00178   
00179   void convert_to_item_space(const Glib::RefPtr<Item>& item, double& x, double& y) const;
00180   
00181   void convert_from_item_space(const Glib::RefPtr<Item>& item, double& x, double& y) const;
00182 
00183   //TODO: Use C++ types?
00184  
00185 
00186   Gdk::GrabStatus pointer_grab(const Glib::RefPtr<Item>& item, Gdk::EventMask mask, const Gdk::Cursor& cursor, guint32 time);
00187   Gdk::GrabStatus pointer_grab(const Glib::RefPtr<Item>& item, Gdk::EventMask mask, guint32 time);
00188 
00189   
00190   void pointer_ungrab(const Glib::RefPtr<Item>& item, guint32 time);
00191   
00192   GdkGrabStatus keyboard_grab(const Glib::RefPtr<Item>& item, bool owner_events, guint32 time);
00193   
00194   void keyboard_ungrab(const Glib::RefPtr<Item>& item, guint32 time);
00195 
00196   
00197   Cairo::RefPtr<Cairo::Context> create_cairo_context();
00198 
00199   
00200   Glib::RefPtr<Item> create_item(const Glib::RefPtr<ItemModel>& model);
00201   
00202   void unregister_item(const Glib::RefPtr<ItemModel>& model);
00203 
00204   
00205   void update();
00206   
00207   void request_update();
00208   
00209   void request_redraw(const Bounds& bounds);
00210   
00211   double get_default_line_width() const;
00212 
00213   
00214   void register_widget_item(const Glib::RefPtr<Goocanvas::Widget>& widget);
00215   
00216   void unregister_widget_item(const Glib::RefPtr<Goocanvas::Widget>& widget);
00217 
00218  
00224   Glib::SignalProxy2< void,Gtk::Adjustment*,Gtk::Adjustment* > signal_set_scroll_adjustments();
00225 
00226 
00232   Glib::SignalProxy2< void,const Glib::RefPtr<Item>&,const Glib::RefPtr<ItemModel>& > signal_item_created();
00233 
00234 
00235   #ifdef GLIBMM_PROPERTIES_ENABLED
00236 
00242   Glib::PropertyProxy<double> property_scale() ;
00243 #endif //#GLIBMM_PROPERTIES_ENABLED
00244 
00245 #ifdef GLIBMM_PROPERTIES_ENABLED
00246 
00252   Glib::PropertyProxy_ReadOnly<double> property_scale() const;
00253 #endif //#GLIBMM_PROPERTIES_ENABLED
00254 
00255   #ifdef GLIBMM_PROPERTIES_ENABLED
00256 
00262   Glib::PropertyProxy<double> property_scale_x() ;
00263 #endif //#GLIBMM_PROPERTIES_ENABLED
00264 
00265 #ifdef GLIBMM_PROPERTIES_ENABLED
00266 
00272   Glib::PropertyProxy_ReadOnly<double> property_scale_x() const;
00273 #endif //#GLIBMM_PROPERTIES_ENABLED
00274 
00275   #ifdef GLIBMM_PROPERTIES_ENABLED
00276 
00282   Glib::PropertyProxy<double> property_scale_y() ;
00283 #endif //#GLIBMM_PROPERTIES_ENABLED
00284 
00285 #ifdef GLIBMM_PROPERTIES_ENABLED
00286 
00292   Glib::PropertyProxy_ReadOnly<double> property_scale_y() const;
00293 #endif //#GLIBMM_PROPERTIES_ENABLED
00294 
00295   #ifdef GLIBMM_PROPERTIES_ENABLED
00296 
00302   Glib::PropertyProxy<Gtk::AnchorType> property_anchor() ;
00303 #endif //#GLIBMM_PROPERTIES_ENABLED
00304 
00305 #ifdef GLIBMM_PROPERTIES_ENABLED
00306 
00312   Glib::PropertyProxy_ReadOnly<Gtk::AnchorType> property_anchor() const;
00313 #endif //#GLIBMM_PROPERTIES_ENABLED
00314 
00315   #ifdef GLIBMM_PROPERTIES_ENABLED
00316 
00322   Glib::PropertyProxy<double> property_x1() ;
00323 #endif //#GLIBMM_PROPERTIES_ENABLED
00324 
00325 #ifdef GLIBMM_PROPERTIES_ENABLED
00326 
00332   Glib::PropertyProxy_ReadOnly<double> property_x1() const;
00333 #endif //#GLIBMM_PROPERTIES_ENABLED
00334 
00335   #ifdef GLIBMM_PROPERTIES_ENABLED
00336 
00342   Glib::PropertyProxy<double> property_y1() ;
00343 #endif //#GLIBMM_PROPERTIES_ENABLED
00344 
00345 #ifdef GLIBMM_PROPERTIES_ENABLED
00346 
00352   Glib::PropertyProxy_ReadOnly<double> property_y1() const;
00353 #endif //#GLIBMM_PROPERTIES_ENABLED
00354 
00355   #ifdef GLIBMM_PROPERTIES_ENABLED
00356 
00362   Glib::PropertyProxy<double> property_x2() ;
00363 #endif //#GLIBMM_PROPERTIES_ENABLED
00364 
00365 #ifdef GLIBMM_PROPERTIES_ENABLED
00366 
00372   Glib::PropertyProxy_ReadOnly<double> property_x2() const;
00373 #endif //#GLIBMM_PROPERTIES_ENABLED
00374 
00375   #ifdef GLIBMM_PROPERTIES_ENABLED
00376 
00382   Glib::PropertyProxy<double> property_y2() ;
00383 #endif //#GLIBMM_PROPERTIES_ENABLED
00384 
00385 #ifdef GLIBMM_PROPERTIES_ENABLED
00386 
00392   Glib::PropertyProxy_ReadOnly<double> property_y2() const;
00393 #endif //#GLIBMM_PROPERTIES_ENABLED
00394 
00395   #ifdef GLIBMM_PROPERTIES_ENABLED
00396 
00402   Glib::PropertyProxy<bool> property_automatic_bounds() ;
00403 #endif //#GLIBMM_PROPERTIES_ENABLED
00404 
00405 #ifdef GLIBMM_PROPERTIES_ENABLED
00406 
00412   Glib::PropertyProxy_ReadOnly<bool> property_automatic_bounds() const;
00413 #endif //#GLIBMM_PROPERTIES_ENABLED
00414 
00415   #ifdef GLIBMM_PROPERTIES_ENABLED
00416 
00422   Glib::PropertyProxy<bool> property_bounds_from_origin() ;
00423 #endif //#GLIBMM_PROPERTIES_ENABLED
00424 
00425 #ifdef GLIBMM_PROPERTIES_ENABLED
00426 
00432   Glib::PropertyProxy_ReadOnly<bool> property_bounds_from_origin() const;
00433 #endif //#GLIBMM_PROPERTIES_ENABLED
00434 
00435   #ifdef GLIBMM_PROPERTIES_ENABLED
00436 
00442   Glib::PropertyProxy<double> property_bounds_padding() ;
00443 #endif //#GLIBMM_PROPERTIES_ENABLED
00444 
00445 #ifdef GLIBMM_PROPERTIES_ENABLED
00446 
00452   Glib::PropertyProxy_ReadOnly<double> property_bounds_padding() const;
00453 #endif //#GLIBMM_PROPERTIES_ENABLED
00454 
00455   #ifdef GLIBMM_PROPERTIES_ENABLED
00456 
00462   Glib::PropertyProxy<Gtk::Unit> property_units() ;
00463 #endif //#GLIBMM_PROPERTIES_ENABLED
00464 
00465 #ifdef GLIBMM_PROPERTIES_ENABLED
00466 
00472   Glib::PropertyProxy_ReadOnly<Gtk::Unit> property_units() const;
00473 #endif //#GLIBMM_PROPERTIES_ENABLED
00474 
00475   #ifdef GLIBMM_PROPERTIES_ENABLED
00476 
00482   Glib::PropertyProxy<double> property_resolution_x() ;
00483 #endif //#GLIBMM_PROPERTIES_ENABLED
00484 
00485 #ifdef GLIBMM_PROPERTIES_ENABLED
00486 
00492   Glib::PropertyProxy_ReadOnly<double> property_resolution_x() const;
00493 #endif //#GLIBMM_PROPERTIES_ENABLED
00494 
00495   #ifdef GLIBMM_PROPERTIES_ENABLED
00496 
00502   Glib::PropertyProxy<double> property_resolution_y() ;
00503 #endif //#GLIBMM_PROPERTIES_ENABLED
00504 
00505 #ifdef GLIBMM_PROPERTIES_ENABLED
00506 
00512   Glib::PropertyProxy_ReadOnly<double> property_resolution_y() const;
00513 #endif //#GLIBMM_PROPERTIES_ENABLED
00514 
00515   #ifdef GLIBMM_PROPERTIES_ENABLED
00516 
00522   Glib::PropertyProxy_WriteOnly<Glib::ustring> property_background_color() ;
00523 #endif //#GLIBMM_PROPERTIES_ENABLED
00524 
00525 
00526   #ifdef GLIBMM_PROPERTIES_ENABLED
00527 
00533   Glib::PropertyProxy_WriteOnly<guint> property_background_color_rgb() ;
00534 #endif //#GLIBMM_PROPERTIES_ENABLED
00535 
00536 
00537   #ifdef GLIBMM_PROPERTIES_ENABLED
00538 
00544   Glib::PropertyProxy<bool> property_integer_layout() ;
00545 #endif //#GLIBMM_PROPERTIES_ENABLED
00546 
00547 #ifdef GLIBMM_PROPERTIES_ENABLED
00548 
00554   Glib::PropertyProxy_ReadOnly<bool> property_integer_layout() const;
00555 #endif //#GLIBMM_PROPERTIES_ENABLED
00556 
00557 
00558 };
00559 
00560 } //namespace Goocanvas
00561 
00562 
00563 namespace Glib
00564 {
00573   Goocanvas::Canvas* wrap(GooCanvas* object, bool take_copy = false);
00574 } //namespace Glib
00575 
00576 
00577 #endif /* _GOOCANVASMM_CANVAS_H */
00578 

Generated on Thu Nov 29 16:28:34 2007 for goocanvasmm by  doxygen 1.5.2