00001
00002
00003 #ifndef _GOOCANVASMM_CANVAS_H
00004 #define _GOOCANVASMM_CANVAS_H
00005
00006
00007 #include <glibmm.h>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
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>
00037
00038
00039 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00040 typedef struct _GooCanvas GooCanvas;
00041 typedef struct _GooCanvasClass GooCanvasClass;
00042 #endif
00043
00044
00045 namespace Goocanvas
00046 { class Canvas_Class; }
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
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
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
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
00095 #ifdef GLIBMM_VFUNCS_ENABLED
00096 #endif //GLIBMM_VFUNCS_ENABLED
00097
00098 protected:
00099
00100 #ifdef GLIBMM_VFUNCS_ENABLED
00101 #endif //GLIBMM_VFUNCS_ENABLED
00102
00103
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
00120 Glib::RefPtr<Item> get_root_item();
00121
00125 Glib::RefPtr<const Item> get_root_item() const;
00126
00130 void set_root_item(const Glib::RefPtr<Item>& item);
00131
00132
00136 Glib::RefPtr<ItemModel> get_root_item_model();
00137
00141 Glib::RefPtr<const ItemModel> get_root_item_model() const;
00142
00149 void set_root_item_model(const Glib::RefPtr<ItemModel>& model);
00150
00151
00171 Glib::RefPtr<Item> get_item(const Glib::RefPtr<ItemModel>& model);
00172
00192 Glib::RefPtr<const Item> get_item(const Glib::RefPtr<ItemModel>& model) const;
00193
00194
00202 Glib::RefPtr<Item> get_item_at(double x, double y, bool is_pointer_event);
00203
00211 Glib::RefPtr<const Item> get_item_at(double x, double y, bool is_pointer_event) const;
00212
00213 #
00214 #
00215
00216
00217 #
00218
00219
00229 Glib::ListHandle< Glib::RefPtr<Item> > get_items_at(double x, double y, bool is_pointer_event);
00230
00240 Glib::ListHandle< Glib::RefPtr<const Item> > get_items_at(double x, double y, bool is_pointer_event) const;
00241
00253 Glib::ListHandle< Glib::RefPtr<Item> > get_items_in_area(const Bounds& area, bool inside_area, bool allow_overlaps, bool include_containers);
00254
00266 Glib::ListHandle< Glib::RefPtr<const Item> > get_items_in_area(const Bounds& area, bool inside_area, bool allow_overlaps, bool include_containers) const;
00267
00268
00276 double get_scale() const;
00277
00285 void set_scale(double scale);
00286
00287
00297 void get_bounds(double& left, double& top, double& right, double& bottom) const;
00298 void get_bounds(Bounds& bounds) const;
00299
00300
00310 void set_bounds(double left, double top, double right, double bottom);
00311 void set_bounds(const Bounds& bounds);
00312
00313
00319 void scroll_to(double left, double top);
00320
00321
00325 void grab_focus(const Glib::RefPtr<Item>& item);
00326
00327
00335 void render(const Cairo::RefPtr<Cairo::Context>& context, const Bounds& bounds, double scale = 0.0);
00336 void render(const Cairo::RefPtr<Cairo::Context>& context, double scale = 0.0);
00337
00338
00350 void convert_to_pixels(double& x, double& y) const;
00351
00363 void convert_from_pixels(double& x, double& y) const;
00364
00372 void convert_to_item_space(const Glib::RefPtr<Item>& item, double& x, double& y) const;
00373
00381 void convert_from_item_space(const Glib::RefPtr<Item>& item, double& x, double& y) const;
00382
00383
00384
00385
00394 Gdk::GrabStatus pointer_grab(const Glib::RefPtr<Item>& item, Gdk::EventMask mask, const Gdk::Cursor& cursor, guint32 time);
00395 Gdk::GrabStatus pointer_grab(const Glib::RefPtr<Item>& item, Gdk::EventMask mask, guint32 time);
00396
00397
00403 void pointer_ungrab(const Glib::RefPtr<Item>& item, guint32 time);
00404
00414 GdkGrabStatus keyboard_grab(const Glib::RefPtr<Item>& item, bool owner_events, guint32 time);
00415
00421 void keyboard_ungrab(const Glib::RefPtr<Item>& item, guint32 time);
00422
00423
00427 Cairo::RefPtr<Cairo::Context> create_cairo_context();
00428
00429
00445 Glib::RefPtr<Item> create_item(const Glib::RefPtr<ItemModel>& model);
00446
00454 void unregister_item(const Glib::RefPtr<ItemModel>& model);
00455
00456
00465 void update();
00466
00474 void request_update();
00475
00482 void request_redraw(const Bounds& bounds);
00483
00487 double get_default_line_width() const;
00488
00489
00497 void register_widget_item(const Glib::RefPtr<Goocanvas::Widget>& widget);
00498
00506 void unregister_widget_item(const Glib::RefPtr<Goocanvas::Widget>& widget);
00507
00508
00514 Glib::SignalProxy2< void,Gtk::Adjustment*,Gtk::Adjustment* > signal_set_scroll_adjustments();
00515
00516
00522 Glib::SignalProxy2< void,const Glib::RefPtr<Item>&,const Glib::RefPtr<ItemModel>& > signal_item_created();
00523
00524
00525 #ifdef GLIBMM_PROPERTIES_ENABLED
00526
00532 Glib::PropertyProxy<double> property_scale() ;
00533 #endif //#GLIBMM_PROPERTIES_ENABLED
00534
00535 #ifdef GLIBMM_PROPERTIES_ENABLED
00536
00542 Glib::PropertyProxy_ReadOnly<double> property_scale() const;
00543 #endif //#GLIBMM_PROPERTIES_ENABLED
00544
00545 #ifdef GLIBMM_PROPERTIES_ENABLED
00546
00552 Glib::PropertyProxy<double> property_scale_x() ;
00553 #endif //#GLIBMM_PROPERTIES_ENABLED
00554
00555 #ifdef GLIBMM_PROPERTIES_ENABLED
00556
00562 Glib::PropertyProxy_ReadOnly<double> property_scale_x() const;
00563 #endif //#GLIBMM_PROPERTIES_ENABLED
00564
00565 #ifdef GLIBMM_PROPERTIES_ENABLED
00566
00572 Glib::PropertyProxy<double> property_scale_y() ;
00573 #endif //#GLIBMM_PROPERTIES_ENABLED
00574
00575 #ifdef GLIBMM_PROPERTIES_ENABLED
00576
00582 Glib::PropertyProxy_ReadOnly<double> property_scale_y() const;
00583 #endif //#GLIBMM_PROPERTIES_ENABLED
00584
00585 #ifdef GLIBMM_PROPERTIES_ENABLED
00586
00592 Glib::PropertyProxy<Gtk::AnchorType> property_anchor() ;
00593 #endif //#GLIBMM_PROPERTIES_ENABLED
00594
00595 #ifdef GLIBMM_PROPERTIES_ENABLED
00596
00602 Glib::PropertyProxy_ReadOnly<Gtk::AnchorType> property_anchor() const;
00603 #endif //#GLIBMM_PROPERTIES_ENABLED
00604
00605 #ifdef GLIBMM_PROPERTIES_ENABLED
00606
00612 Glib::PropertyProxy<double> property_x1() ;
00613 #endif //#GLIBMM_PROPERTIES_ENABLED
00614
00615 #ifdef GLIBMM_PROPERTIES_ENABLED
00616
00622 Glib::PropertyProxy_ReadOnly<double> property_x1() const;
00623 #endif //#GLIBMM_PROPERTIES_ENABLED
00624
00625 #ifdef GLIBMM_PROPERTIES_ENABLED
00626
00632 Glib::PropertyProxy<double> property_y1() ;
00633 #endif //#GLIBMM_PROPERTIES_ENABLED
00634
00635 #ifdef GLIBMM_PROPERTIES_ENABLED
00636
00642 Glib::PropertyProxy_ReadOnly<double> property_y1() const;
00643 #endif //#GLIBMM_PROPERTIES_ENABLED
00644
00645 #ifdef GLIBMM_PROPERTIES_ENABLED
00646
00652 Glib::PropertyProxy<double> property_x2() ;
00653 #endif //#GLIBMM_PROPERTIES_ENABLED
00654
00655 #ifdef GLIBMM_PROPERTIES_ENABLED
00656
00662 Glib::PropertyProxy_ReadOnly<double> property_x2() const;
00663 #endif //#GLIBMM_PROPERTIES_ENABLED
00664
00665 #ifdef GLIBMM_PROPERTIES_ENABLED
00666
00672 Glib::PropertyProxy<double> property_y2() ;
00673 #endif //#GLIBMM_PROPERTIES_ENABLED
00674
00675 #ifdef GLIBMM_PROPERTIES_ENABLED
00676
00682 Glib::PropertyProxy_ReadOnly<double> property_y2() const;
00683 #endif //#GLIBMM_PROPERTIES_ENABLED
00684
00685 #ifdef GLIBMM_PROPERTIES_ENABLED
00686
00692 Glib::PropertyProxy<bool> property_automatic_bounds() ;
00693 #endif //#GLIBMM_PROPERTIES_ENABLED
00694
00695 #ifdef GLIBMM_PROPERTIES_ENABLED
00696
00702 Glib::PropertyProxy_ReadOnly<bool> property_automatic_bounds() const;
00703 #endif //#GLIBMM_PROPERTIES_ENABLED
00704
00705 #ifdef GLIBMM_PROPERTIES_ENABLED
00706
00712 Glib::PropertyProxy<bool> property_bounds_from_origin() ;
00713 #endif //#GLIBMM_PROPERTIES_ENABLED
00714
00715 #ifdef GLIBMM_PROPERTIES_ENABLED
00716
00722 Glib::PropertyProxy_ReadOnly<bool> property_bounds_from_origin() const;
00723 #endif //#GLIBMM_PROPERTIES_ENABLED
00724
00725 #ifdef GLIBMM_PROPERTIES_ENABLED
00726
00732 Glib::PropertyProxy<double> property_bounds_padding() ;
00733 #endif //#GLIBMM_PROPERTIES_ENABLED
00734
00735 #ifdef GLIBMM_PROPERTIES_ENABLED
00736
00742 Glib::PropertyProxy_ReadOnly<double> property_bounds_padding() const;
00743 #endif //#GLIBMM_PROPERTIES_ENABLED
00744
00745 #ifdef GLIBMM_PROPERTIES_ENABLED
00746
00752 Glib::PropertyProxy<Gtk::Unit> property_units() ;
00753 #endif //#GLIBMM_PROPERTIES_ENABLED
00754
00755 #ifdef GLIBMM_PROPERTIES_ENABLED
00756
00762 Glib::PropertyProxy_ReadOnly<Gtk::Unit> property_units() const;
00763 #endif //#GLIBMM_PROPERTIES_ENABLED
00764
00765 #ifdef GLIBMM_PROPERTIES_ENABLED
00766
00772 Glib::PropertyProxy<double> property_resolution_x() ;
00773 #endif //#GLIBMM_PROPERTIES_ENABLED
00774
00775 #ifdef GLIBMM_PROPERTIES_ENABLED
00776
00782 Glib::PropertyProxy_ReadOnly<double> property_resolution_x() const;
00783 #endif //#GLIBMM_PROPERTIES_ENABLED
00784
00785 #ifdef GLIBMM_PROPERTIES_ENABLED
00786
00792 Glib::PropertyProxy<double> property_resolution_y() ;
00793 #endif //#GLIBMM_PROPERTIES_ENABLED
00794
00795 #ifdef GLIBMM_PROPERTIES_ENABLED
00796
00802 Glib::PropertyProxy_ReadOnly<double> property_resolution_y() const;
00803 #endif //#GLIBMM_PROPERTIES_ENABLED
00804
00805 #ifdef GLIBMM_PROPERTIES_ENABLED
00806
00812 Glib::PropertyProxy_WriteOnly<Glib::ustring> property_background_color() ;
00813 #endif //#GLIBMM_PROPERTIES_ENABLED
00814
00815
00816 #ifdef GLIBMM_PROPERTIES_ENABLED
00817
00823 Glib::PropertyProxy_WriteOnly<guint> property_background_color_rgb() ;
00824 #endif //#GLIBMM_PROPERTIES_ENABLED
00825
00826
00827 #ifdef GLIBMM_PROPERTIES_ENABLED
00828
00834 Glib::PropertyProxy<bool> property_integer_layout() ;
00835 #endif //#GLIBMM_PROPERTIES_ENABLED
00836
00837 #ifdef GLIBMM_PROPERTIES_ENABLED
00838
00844 Glib::PropertyProxy_ReadOnly<bool> property_integer_layout() const;
00845 #endif //#GLIBMM_PROPERTIES_ENABLED
00846
00847 #ifdef GLIBMM_PROPERTIES_ENABLED
00848
00854 Glib::PropertyProxy<bool> property_clear_background() ;
00855 #endif //#GLIBMM_PROPERTIES_ENABLED
00856
00857 #ifdef GLIBMM_PROPERTIES_ENABLED
00858
00864 Glib::PropertyProxy_ReadOnly<bool> property_clear_background() const;
00865 #endif //#GLIBMM_PROPERTIES_ENABLED
00866
00867
00868 protected:
00869 #ifdef GLIBMM_VFUNCS_ENABLED
00870 virtual Glib::RefPtr<Item> create_item_vfunc(const Glib::RefPtr<ItemModel>& model);
00871 #endif //GLIBMM_VFUNCS_ENABLED
00872
00873
00874 };
00875
00876 }
00877
00878
00879 namespace Glib
00880 {
00889 Goocanvas::Canvas* wrap(GooCanvas* object, bool take_copy = false);
00890 }
00891
00892
00893 #endif
00894