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
00152 Glib::RefPtr<Item> get_static_root_item();
00153
00154 Glib::RefPtr<const Item> get_static_root_item() const;
00155
00156 void set_static_root_item(const Glib::RefPtr<Item>& item);
00157
00158
00159 Glib::RefPtr<ItemModel> get_static_root_item_model();
00160
00161 Glib::RefPtr<const ItemModel> get_static_root_item_model() const;
00162
00163 void set_static_root_item_model(const Glib::RefPtr<ItemModel>& model);
00164
00165
00185 Glib::RefPtr<Item> get_item(const Glib::RefPtr<ItemModel>& model);
00186
00206 Glib::RefPtr<const Item> get_item(const Glib::RefPtr<ItemModel>& model) const;
00207
00208
00216 Glib::RefPtr<Item> get_item_at(double x, double y, bool is_pointer_event);
00217
00225 Glib::RefPtr<const Item> get_item_at(double x, double y, bool is_pointer_event) const;
00226
00227 #
00228 #
00229
00230
00231 #
00232
00233
00243 Glib::ListHandle< Glib::RefPtr<Item> > get_items_at(double x, double y, bool is_pointer_event);
00244
00254 Glib::ListHandle< Glib::RefPtr<const Item> > get_items_at(double x, double y, bool is_pointer_event) const;
00255
00267 Glib::ListHandle< Glib::RefPtr<Item> > get_items_in_area(const Bounds& area, bool inside_area, bool allow_overlaps, bool include_containers);
00268
00280 Glib::ListHandle< Glib::RefPtr<const Item> > get_items_in_area(const Bounds& area, bool inside_area, bool allow_overlaps, bool include_containers) const;
00281
00282
00290 double get_scale() const;
00291
00299 void set_scale(double scale);
00300
00301
00311 void get_bounds(double& left, double& top, double& right, double& bottom) const;
00312 void get_bounds(Bounds& bounds) const;
00313
00314
00324 void set_bounds(double left, double top, double right, double bottom);
00325 void set_bounds(const Bounds& bounds);
00326
00327
00333 void scroll_to(double left, double top);
00334
00335
00339 void grab_focus(const Glib::RefPtr<Item>& item);
00340
00341
00349 void render(const Cairo::RefPtr<Cairo::Context>& context, const Bounds& bounds, double scale = 0.0);
00350 void render(const Cairo::RefPtr<Cairo::Context>& context, double scale = 0.0);
00351
00352
00364 void convert_to_pixels(double& x, double& y) const;
00365
00377 void convert_from_pixels(double& x, double& y) const;
00378
00386 void convert_to_item_space(const Glib::RefPtr<Item>& item, double& x, double& y) const;
00387
00395 void convert_from_item_space(const Glib::RefPtr<Item>& item, double& x, double& y) const;
00396
00397 void convert_bounds_to_item_space(const Glib::RefPtr<Item>& item, Bounds& bounds) const;
00398
00399
00400
00401
00410 Gdk::GrabStatus pointer_grab(const Glib::RefPtr<Item>& item, Gdk::EventMask mask, const Gdk::Cursor& cursor, guint32 time);
00411 Gdk::GrabStatus pointer_grab(const Glib::RefPtr<Item>& item, Gdk::EventMask mask, guint32 time);
00412
00413
00419 void pointer_ungrab(const Glib::RefPtr<Item>& item, guint32 time);
00420
00430 GdkGrabStatus keyboard_grab(const Glib::RefPtr<Item>& item, bool owner_events, guint32 time);
00431
00437 void keyboard_ungrab(const Glib::RefPtr<Item>& item, guint32 time);
00438
00439
00443 Cairo::RefPtr<Cairo::Context> create_cairo_context();
00444
00445
00461 Glib::RefPtr<Item> create_item(const Glib::RefPtr<ItemModel>& model);
00462
00470 void unregister_item(const Glib::RefPtr<ItemModel>& model);
00471
00472
00481 void update();
00482
00490 void request_update();
00491
00498 void request_redraw(const Bounds& bounds);
00499
00500 void request_item_redraw(const Bounds& bounds, bool is_static = false);
00501
00505 double get_default_line_width() const;
00506
00507
00515 void register_widget_item(const Glib::RefPtr<Goocanvas::Widget>& widget);
00516
00524 void unregister_widget_item(const Glib::RefPtr<Goocanvas::Widget>& widget);
00525
00526
00532 Glib::SignalProxy2< void,Gtk::Adjustment*,Gtk::Adjustment* > signal_set_scroll_adjustments();
00533
00534
00540 Glib::SignalProxy2< void,const Glib::RefPtr<Item>&,const Glib::RefPtr<ItemModel>& > signal_item_created();
00541
00542
00543 #ifdef GLIBMM_PROPERTIES_ENABLED
00544
00550 Glib::PropertyProxy<double> property_scale() ;
00551 #endif //#GLIBMM_PROPERTIES_ENABLED
00552
00553 #ifdef GLIBMM_PROPERTIES_ENABLED
00554
00560 Glib::PropertyProxy_ReadOnly<double> property_scale() const;
00561 #endif //#GLIBMM_PROPERTIES_ENABLED
00562
00563 #ifdef GLIBMM_PROPERTIES_ENABLED
00564
00570 Glib::PropertyProxy<double> property_scale_x() ;
00571 #endif //#GLIBMM_PROPERTIES_ENABLED
00572
00573 #ifdef GLIBMM_PROPERTIES_ENABLED
00574
00580 Glib::PropertyProxy_ReadOnly<double> property_scale_x() const;
00581 #endif //#GLIBMM_PROPERTIES_ENABLED
00582
00583 #ifdef GLIBMM_PROPERTIES_ENABLED
00584
00590 Glib::PropertyProxy<double> property_scale_y() ;
00591 #endif //#GLIBMM_PROPERTIES_ENABLED
00592
00593 #ifdef GLIBMM_PROPERTIES_ENABLED
00594
00600 Glib::PropertyProxy_ReadOnly<double> property_scale_y() const;
00601 #endif //#GLIBMM_PROPERTIES_ENABLED
00602
00603 #ifdef GLIBMM_PROPERTIES_ENABLED
00604
00610 Glib::PropertyProxy<Gtk::AnchorType> property_anchor() ;
00611 #endif //#GLIBMM_PROPERTIES_ENABLED
00612
00613 #ifdef GLIBMM_PROPERTIES_ENABLED
00614
00620 Glib::PropertyProxy_ReadOnly<Gtk::AnchorType> property_anchor() const;
00621 #endif //#GLIBMM_PROPERTIES_ENABLED
00622
00623 #ifdef GLIBMM_PROPERTIES_ENABLED
00624
00630 Glib::PropertyProxy<double> property_x1() ;
00631 #endif //#GLIBMM_PROPERTIES_ENABLED
00632
00633 #ifdef GLIBMM_PROPERTIES_ENABLED
00634
00640 Glib::PropertyProxy_ReadOnly<double> property_x1() const;
00641 #endif //#GLIBMM_PROPERTIES_ENABLED
00642
00643 #ifdef GLIBMM_PROPERTIES_ENABLED
00644
00650 Glib::PropertyProxy<double> property_y1() ;
00651 #endif //#GLIBMM_PROPERTIES_ENABLED
00652
00653 #ifdef GLIBMM_PROPERTIES_ENABLED
00654
00660 Glib::PropertyProxy_ReadOnly<double> property_y1() const;
00661 #endif //#GLIBMM_PROPERTIES_ENABLED
00662
00663 #ifdef GLIBMM_PROPERTIES_ENABLED
00664
00670 Glib::PropertyProxy<double> property_x2() ;
00671 #endif //#GLIBMM_PROPERTIES_ENABLED
00672
00673 #ifdef GLIBMM_PROPERTIES_ENABLED
00674
00680 Glib::PropertyProxy_ReadOnly<double> property_x2() const;
00681 #endif //#GLIBMM_PROPERTIES_ENABLED
00682
00683 #ifdef GLIBMM_PROPERTIES_ENABLED
00684
00690 Glib::PropertyProxy<double> property_y2() ;
00691 #endif //#GLIBMM_PROPERTIES_ENABLED
00692
00693 #ifdef GLIBMM_PROPERTIES_ENABLED
00694
00700 Glib::PropertyProxy_ReadOnly<double> property_y2() const;
00701 #endif //#GLIBMM_PROPERTIES_ENABLED
00702
00703 #ifdef GLIBMM_PROPERTIES_ENABLED
00704
00710 Glib::PropertyProxy<bool> property_automatic_bounds() ;
00711 #endif //#GLIBMM_PROPERTIES_ENABLED
00712
00713 #ifdef GLIBMM_PROPERTIES_ENABLED
00714
00720 Glib::PropertyProxy_ReadOnly<bool> property_automatic_bounds() const;
00721 #endif //#GLIBMM_PROPERTIES_ENABLED
00722
00723 #ifdef GLIBMM_PROPERTIES_ENABLED
00724
00730 Glib::PropertyProxy<bool> property_bounds_from_origin() ;
00731 #endif //#GLIBMM_PROPERTIES_ENABLED
00732
00733 #ifdef GLIBMM_PROPERTIES_ENABLED
00734
00740 Glib::PropertyProxy_ReadOnly<bool> property_bounds_from_origin() const;
00741 #endif //#GLIBMM_PROPERTIES_ENABLED
00742
00743 #ifdef GLIBMM_PROPERTIES_ENABLED
00744
00750 Glib::PropertyProxy<double> property_bounds_padding() ;
00751 #endif //#GLIBMM_PROPERTIES_ENABLED
00752
00753 #ifdef GLIBMM_PROPERTIES_ENABLED
00754
00760 Glib::PropertyProxy_ReadOnly<double> property_bounds_padding() const;
00761 #endif //#GLIBMM_PROPERTIES_ENABLED
00762
00763 #ifdef GLIBMM_PROPERTIES_ENABLED
00764
00770 Glib::PropertyProxy<Gtk::Unit> property_units() ;
00771 #endif //#GLIBMM_PROPERTIES_ENABLED
00772
00773 #ifdef GLIBMM_PROPERTIES_ENABLED
00774
00780 Glib::PropertyProxy_ReadOnly<Gtk::Unit> property_units() const;
00781 #endif //#GLIBMM_PROPERTIES_ENABLED
00782
00783 #ifdef GLIBMM_PROPERTIES_ENABLED
00784
00790 Glib::PropertyProxy<double> property_resolution_x() ;
00791 #endif //#GLIBMM_PROPERTIES_ENABLED
00792
00793 #ifdef GLIBMM_PROPERTIES_ENABLED
00794
00800 Glib::PropertyProxy_ReadOnly<double> property_resolution_x() const;
00801 #endif //#GLIBMM_PROPERTIES_ENABLED
00802
00803 #ifdef GLIBMM_PROPERTIES_ENABLED
00804
00810 Glib::PropertyProxy<double> property_resolution_y() ;
00811 #endif //#GLIBMM_PROPERTIES_ENABLED
00812
00813 #ifdef GLIBMM_PROPERTIES_ENABLED
00814
00820 Glib::PropertyProxy_ReadOnly<double> property_resolution_y() const;
00821 #endif //#GLIBMM_PROPERTIES_ENABLED
00822
00823 #ifdef GLIBMM_PROPERTIES_ENABLED
00824
00830 Glib::PropertyProxy_WriteOnly<Glib::ustring> property_background_color() ;
00831 #endif //#GLIBMM_PROPERTIES_ENABLED
00832
00833
00834 #ifdef GLIBMM_PROPERTIES_ENABLED
00835
00841 Glib::PropertyProxy_WriteOnly<guint> property_background_color_rgb() ;
00842 #endif //#GLIBMM_PROPERTIES_ENABLED
00843
00844
00845 #ifdef GLIBMM_PROPERTIES_ENABLED
00846
00852 Glib::PropertyProxy<bool> property_integer_layout() ;
00853 #endif //#GLIBMM_PROPERTIES_ENABLED
00854
00855 #ifdef GLIBMM_PROPERTIES_ENABLED
00856
00862 Glib::PropertyProxy_ReadOnly<bool> property_integer_layout() const;
00863 #endif //#GLIBMM_PROPERTIES_ENABLED
00864
00865 #ifdef GLIBMM_PROPERTIES_ENABLED
00866
00872 Glib::PropertyProxy<bool> property_clear_background() ;
00873 #endif //#GLIBMM_PROPERTIES_ENABLED
00874
00875 #ifdef GLIBMM_PROPERTIES_ENABLED
00876
00882 Glib::PropertyProxy_ReadOnly<bool> property_clear_background() const;
00883 #endif //#GLIBMM_PROPERTIES_ENABLED
00884
00885
00886 protected:
00887 #ifdef GLIBMM_VFUNCS_ENABLED
00888 virtual Glib::RefPtr<Item> create_item_vfunc(const Glib::RefPtr<ItemModel>& model);
00889 #endif //GLIBMM_VFUNCS_ENABLED
00890
00891
00892 };
00893
00894 }
00895
00896
00897 namespace Glib
00898 {
00907 Goocanvas::Canvas* wrap(GooCanvas* object, bool take_copy = false);
00908 }
00909
00910
00911 #endif
00912