00001
00002
00003 #ifndef _GOOCANVASMM_ITEM_H
00004 #define _GOOCANVASMM_ITEM_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
00027 #include <goocanvasmm/bounds.h>
00028 #include <goocanvasmm/enums.h>
00029 #include <goocanvasmm/style.h>
00030 #include <cairomm/cairomm.h>
00031 #include <goocanvasitem.h>
00032
00033
00034 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00035 extern "C" { typedef union _GooCanvasPathCommand GooCanvasPathCommand; }
00036 #endif
00037
00038 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00039 typedef struct _GooCanvasItem GooCanvasItem;
00040 typedef struct _GooCanvasItemClass GooCanvasItemClass;
00041 #endif
00042
00043
00044 namespace Goocanvas
00045 { class Item_Class; }
00046 namespace Goocanvas
00047 {
00048
00049 class Canvas ;
00050 class ItemModel ;
00051
00052
00053 class Item : public Glib::Interface
00054 {
00055
00056 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00057
00058 public:
00059 typedef Item CppObjectType;
00060 typedef Item_Class CppClassType;
00061 typedef GooCanvasItem BaseObjectType;
00062 typedef GooCanvasItemIface BaseClassType;
00063
00064 private:
00065 friend class Item_Class;
00066 static CppClassType item_class_;
00067
00068
00069 Item(const Item&);
00070 Item& operator=(const Item&);
00071
00072 protected:
00073 Item();
00074
00081 explicit Item(const Glib::Interface_Class& interface_class);
00082
00083 public:
00084
00085
00086
00087 explicit Item(GooCanvasItem* castitem);
00088
00089 protected:
00090 #endif
00091
00092 public:
00093 virtual ~Item();
00094
00095 static void add_interface(GType gtype_implementer);
00096
00097 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00098 static GType get_type() G_GNUC_CONST;
00099 static GType get_base_type() G_GNUC_CONST;
00100 #endif
00101
00103 GooCanvasItem* gobj() { return reinterpret_cast<GooCanvasItem*>(gobject_); }
00104
00106 const GooCanvasItem* gobj() const { return reinterpret_cast<GooCanvasItem*>(gobject_); }
00107
00108 private:
00109
00110
00111 public:
00112
00113
00117 Canvas* get_canvas();
00118
00122 const Canvas* get_canvas() const;
00123
00124
00131 void set_canvas(Canvas* canvas);
00132
00133
00143 bool is_visible() const;
00144
00145
00149 Glib::RefPtr<ItemModel> get_model();
00150
00154 Glib::RefPtr<const ItemModel> get_model() const;
00155
00159 void set_model(const Glib::RefPtr<ItemModel>& model);
00160
00161
00165 Glib::RefPtr<Item> get_parent();
00166
00170 Glib::RefPtr<const Item> get_parent() const;
00171
00178 void set_parent(const Glib::RefPtr<Item>& parent);
00179
00185 void remove();
00186
00187
00191 bool is_container() const;
00192
00196 int get_n_children() const;
00197
00202 Glib::RefPtr<Item> get_child(int child_num);
00203
00208 Glib::RefPtr<const Item> get_child(int child_num) const;
00209
00214 int find_child(const Glib::RefPtr<Item>& child);
00215
00221 void add_child(const Glib::RefPtr<Item>& child, int pos);
00222 void add_child(const Glib::RefPtr<Item>& child);
00223
00229 void get_child_property(const Glib::RefPtr<Item>& child, const Glib::ustring& property_name, Glib::ValueBase& value) const;
00230
00236 void set_child_property(const Glib::RefPtr<Item>& child, const Glib::ustring& property_name, const Glib::ValueBase& value);
00237
00238
00243 void move_child(int old_position, int new_position);
00244
00248 void remove_child(int child_num);
00249
00250
00255 void raise(const Glib::RefPtr<Item>& above);
00256
00259 void raise();
00260
00261
00266 void lower(const Glib::RefPtr<Item>& below);
00267
00270 void lower();
00271
00272 Bounds get_bounds() const;
00273
00274
00281 void request_update();
00282
00289 void ensure_upated();
00290
00299 void update(bool entire_tree, const Cairo::RefPtr<Cairo::Context>& context, Bounds& bounds);
00300
00313 void paint(const Cairo::RefPtr<Cairo::Context>& context, const Bounds& bounds, double scale);
00314
00324 bool get_requested_area(const Cairo::RefPtr<Cairo::Context>& context, Bounds& bounds) const;
00325
00338 double get_requested_height(const Cairo::RefPtr<Cairo::Context>& context, double width) const;
00339
00362 void allocate_area(const Cairo::RefPtr<Cairo::Context>& context, const Bounds& requested_area, const Bounds& allocated_area, double x_offset, double y_offset);
00363
00364
00365
00366
00367
00368
00384 Glib::ListHandle< Glib::RefPtr<Item> > get_items_at(double x, double y, const Cairo::RefPtr<Cairo::Context>& context, bool is_pointer_event, bool parent_is_visible, const Glib::ListHandle< Glib::RefPtr<Item> >& found_items);
00385
00401 Glib::ListHandle< Glib::RefPtr<const Item> > get_items_at(double x, double y, const Cairo::RefPtr<Cairo::Context>& context, bool is_pointer_event, bool parent_is_visible, const Glib::ListHandle< Glib::RefPtr<const Item> >& found_items) const;
00402
00403
00404 Glib::ListHandle< Glib::RefPtr<Item> > get_items_at(double x, double y, const Cairo::RefPtr<Cairo::Context>& context, bool is_pointer_event, bool parent_is_visible);
00405 Glib::ListHandle< Glib::RefPtr<const Item> > get_items_at(double x, double y, const Cairo::RefPtr<Cairo::Context>& context, bool is_pointer_event, bool parent_is_visible) const;
00406
00407
00408
00413 bool get_transform(Cairo::Matrix* matrix);
00414
00419 void set_transform(const Cairo::Matrix* matrix);
00420
00421
00428 void set_simple_transform(double x, double y, double scale, double rotation);
00429
00430 bool get_simple_transform(double& x, double& y, double& scale, double& rotation) const;
00431
00436 void translate(double tx, double ty);
00437
00442 void scale(double sx, double sy);
00443
00450 void rotate(double degrees, double cx, double cy);
00451
00458 void skew_x(double degrees, double cx, double cy);
00459
00466 void skew_y(double degrees, double cx, double cy);
00467
00468
00476 bool get_transform_for_child(const Glib::RefPtr<Item>& child, Cairo::Matrix* transform);
00477
00478
00483 Glib::RefPtr<Style> get_style();
00484
00489 Glib::RefPtr<const Style> get_style() const;
00490
00494 void set_style(const Glib::RefPtr<Style>& style);
00495
00496
00513 void animate(double x, double y, double scale, double degrees, bool absolute, int duration, int step_time, GooCanvasAnimateType type);
00514
00518 void stop_animation();
00519
00520
00521
00522
00523
00524
00525
00526
00532 Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventCrossing* > signal_enter_notify_event();
00533
00534
00540 Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventCrossing* > signal_leave_notify_event();
00541
00542
00548 Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventMotion* > signal_motion_notify_event();
00549
00550
00556 Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventButton* > signal_button_press_event();
00557
00558
00564 Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventButton* > signal_button_release_event();
00565
00566
00572 Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventFocus* > signal_focus_in_event();
00573
00574
00580 Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventFocus* > signal_focus_out_event();
00581
00582
00588 Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventKey* > signal_key_press_event();
00589
00590
00596 Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventKey* > signal_key_release_event();
00597
00598
00604 Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventGrabBroken* > signal_grab_broken_event();
00605
00606
00612 Glib::SignalProxy1< void,GParamSpec* > signal_child_notify();
00613
00614
00615 #ifdef GLIBMM_PROPERTIES_ENABLED
00616
00622 Glib::PropertyProxy< Glib::RefPtr<Item> > property_parent() ;
00623 #endif //#GLIBMM_PROPERTIES_ENABLED
00624
00625 #ifdef GLIBMM_PROPERTIES_ENABLED
00626
00632 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Item> > property_parent() const;
00633 #endif //#GLIBMM_PROPERTIES_ENABLED
00634 ;
00635 #ifdef GLIBMM_PROPERTIES_ENABLED
00636
00642 Glib::PropertyProxy<ItemVisibility> property_visibility() ;
00643 #endif //#GLIBMM_PROPERTIES_ENABLED
00644
00645 #ifdef GLIBMM_PROPERTIES_ENABLED
00646
00652 Glib::PropertyProxy_ReadOnly<ItemVisibility> property_visibility() const;
00653 #endif //#GLIBMM_PROPERTIES_ENABLED
00654
00655 #ifdef GLIBMM_PROPERTIES_ENABLED
00656
00662 Glib::PropertyProxy<double> property_visibility_threshold() ;
00663 #endif //#GLIBMM_PROPERTIES_ENABLED
00664
00665 #ifdef GLIBMM_PROPERTIES_ENABLED
00666
00672 Glib::PropertyProxy_ReadOnly<double> property_visibility_threshold() const;
00673 #endif //#GLIBMM_PROPERTIES_ENABLED
00674
00675 #ifdef GLIBMM_PROPERTIES_ENABLED
00676
00682 Glib::PropertyProxy<Cairo::Matrix*> property_transform() ;
00683 #endif //#GLIBMM_PROPERTIES_ENABLED
00684
00685 #ifdef GLIBMM_PROPERTIES_ENABLED
00686
00692 Glib::PropertyProxy_ReadOnly<Cairo::Matrix*> property_transform() const;
00693 #endif //#GLIBMM_PROPERTIES_ENABLED
00694 ;
00695 #ifdef GLIBMM_PROPERTIES_ENABLED
00696
00702 Glib::PropertyProxy<PointerEvents> property_pointer_events() ;
00703 #endif //#GLIBMM_PROPERTIES_ENABLED
00704
00705 #ifdef GLIBMM_PROPERTIES_ENABLED
00706
00712 Glib::PropertyProxy_ReadOnly<PointerEvents> property_pointer_events() const;
00713 #endif //#GLIBMM_PROPERTIES_ENABLED
00714
00715 #ifdef GLIBMM_PROPERTIES_ENABLED
00716
00722 Glib::PropertyProxy<Glib::ustring> property_title() ;
00723 #endif //#GLIBMM_PROPERTIES_ENABLED
00724
00725 #ifdef GLIBMM_PROPERTIES_ENABLED
00726
00732 Glib::PropertyProxy_ReadOnly<Glib::ustring> property_title() const;
00733 #endif //#GLIBMM_PROPERTIES_ENABLED
00734
00735 #ifdef GLIBMM_PROPERTIES_ENABLED
00736
00742 Glib::PropertyProxy<Glib::ustring> property_description() ;
00743 #endif //#GLIBMM_PROPERTIES_ENABLED
00744
00745 #ifdef GLIBMM_PROPERTIES_ENABLED
00746
00752 Glib::PropertyProxy_ReadOnly<Glib::ustring> property_description() const;
00753 #endif //#GLIBMM_PROPERTIES_ENABLED
00754
00755 #ifdef GLIBMM_PROPERTIES_ENABLED
00756
00762 Glib::PropertyProxy<bool> property_can_focus() ;
00763 #endif //#GLIBMM_PROPERTIES_ENABLED
00764
00765 #ifdef GLIBMM_PROPERTIES_ENABLED
00766
00772 Glib::PropertyProxy_ReadOnly<bool> property_can_focus() const;
00773 #endif //#GLIBMM_PROPERTIES_ENABLED
00774
00775
00776 protected:
00777
00778
00779 ;
00780
00781
00782
00783 #ifdef GLIBMM_VFUNCS_ENABLED
00784 virtual int get_n_children_vfunc() const;
00785 #endif //GLIBMM_VFUNCS_ENABLED
00786
00787 #ifdef GLIBMM_VFUNCS_ENABLED
00788 virtual Glib::RefPtr<Item> get_child_vfunc(int child_num) const;
00789 #endif //GLIBMM_VFUNCS_ENABLED
00790
00791 #ifdef GLIBMM_VFUNCS_ENABLED
00792 virtual void request_update_vfunc();
00793 #endif //GLIBMM_VFUNCS_ENABLED
00794
00795 #ifdef GLIBMM_VFUNCS_ENABLED
00796 virtual Canvas* get_canvas_vfunc() const;
00797 #endif //GLIBMM_VFUNCS_ENABLED
00798
00799 #ifdef GLIBMM_VFUNCS_ENABLED
00800 virtual void set_canvas_vfunc(Canvas* canvas);
00801 #endif //GLIBMM_VFUNCS_ENABLED
00802
00803
00804
00805
00806 #ifdef GLIBMM_VFUNCS_ENABLED
00807 virtual void add_child_vfunc(const Glib::RefPtr<Item>& child, int position);
00808 #endif //GLIBMM_VFUNCS_ENABLED
00809
00810 #ifdef GLIBMM_VFUNCS_ENABLED
00811 virtual void move_child_vfunc(int old_position, int new_position);
00812 #endif //GLIBMM_VFUNCS_ENABLED
00813
00814 #ifdef GLIBMM_VFUNCS_ENABLED
00815 virtual void remove_child_vfunc(int child_num);
00816 #endif //GLIBMM_VFUNCS_ENABLED
00817
00818 #ifdef GLIBMM_VFUNCS_ENABLED
00819 virtual void get_child_property_vfunc(const Glib::RefPtr<Item>& child, guint property_id, Glib::ValueBase& value, GParamSpec* pspec) const;
00820 #endif //GLIBMM_VFUNCS_ENABLED
00821
00822 #ifdef GLIBMM_VFUNCS_ENABLED
00823 virtual void set_child_property_vfunc(const Glib::RefPtr<Item>& child, guint property_id, const Glib::ValueBase& value, GParamSpec* pspec);
00824 #endif //GLIBMM_VFUNCS_ENABLED
00825
00826 #ifdef GLIBMM_VFUNCS_ENABLED
00827 virtual bool get_transform_for_child_vfunc(const Glib::RefPtr<Item>& child, Cairo::Matrix* transform) const;
00828 #endif //GLIBMM_VFUNCS_ENABLED
00829
00830
00831
00832
00833 #ifdef GLIBMM_VFUNCS_ENABLED
00834 virtual Glib::RefPtr<Item> get_parent_vfunc() const;
00835 #endif //GLIBMM_VFUNCS_ENABLED
00836
00837 #ifdef GLIBMM_VFUNCS_ENABLED
00838 virtual void set_parent_vfunc(const Glib::RefPtr<Item>& parent);
00839 #endif //GLIBMM_VFUNCS_ENABLED
00840
00841
00842 #ifdef GLIBMM_VFUNCS_ENABLED
00843
00844 virtual void get_bounds_vfunc(Bounds& bounds) const;
00845 virtual Glib::ListHandle<Glib::RefPtr<Item> > get_items_at_vfunc(double x, double y, const Cairo::RefPtr<Cairo::Context>& context, bool is_pointer_event, bool is_parent_visible, const Glib::ListHandle<Glib::RefPtr<Item> >& found_items) const;
00846 #endif
00847
00848
00849 #ifdef GLIBMM_VFUNCS_ENABLED
00850 virtual void update_vfunc(bool entire_tree, const Cairo::RefPtr<Cairo::Context>& cr, Bounds& bounds);
00851 #endif //GLIBMM_VFUNCS_ENABLED
00852
00853
00854 ;
00855 #ifdef GLIBMM_VFUNCS_ENABLED
00856 virtual void paint_vfunc(const Cairo::RefPtr<Cairo::Context>& cr, const Bounds& bounds, double scale);
00857 #endif //GLIBMM_VFUNCS_ENABLED
00858
00859
00860 #ifdef GLIBMM_VFUNCS_ENABLED
00861 virtual bool get_requested_area_vfunc(const Cairo::RefPtr<Cairo::Context>& cr, GooCanvasBounds* requested_area) const;
00862 #endif //GLIBMM_VFUNCS_ENABLED
00863
00864 #ifdef GLIBMM_VFUNCS_ENABLED
00865 virtual void allocate_area_vfunc(const Cairo::RefPtr<Cairo::Context>& cr, const Bounds& requested_area, const Bounds& allocated_area, double x_offset, double y_offset);
00866 #endif //GLIBMM_VFUNCS_ENABLED
00867
00868
00869
00870
00871 #ifdef GLIBMM_VFUNCS_ENABLED
00872 virtual bool get_transform_vfunc(Cairo::Matrix* transform) const;
00873 #endif //GLIBMM_VFUNCS_ENABLED
00874
00875 #ifdef GLIBMM_VFUNCS_ENABLED
00876 virtual void set_transform_vfunc(const Cairo::Matrix* transform);
00877 #endif //GLIBMM_VFUNCS_ENABLED
00878
00879
00880 #ifdef GLIBMM_VFUNCS_ENABLED
00881 virtual Glib::RefPtr<Style> get_style_vfunc() const;
00882 #endif //GLIBMM_VFUNCS_ENABLED
00883
00884 #ifdef GLIBMM_VFUNCS_ENABLED
00885 virtual void set_style_vfunc(const Glib::RefPtr<Style>& style);
00886 #endif //GLIBMM_VFUNCS_ENABLED
00887
00888 #ifdef GLIBMM_VFUNCS_ENABLED
00889 virtual bool is_visible_vfunc() const;
00890 #endif //GLIBMM_VFUNCS_ENABLED
00891
00892 #ifdef GLIBMM_VFUNCS_ENABLED
00893 virtual double get_requested_height_vfunc(const Cairo::RefPtr<Cairo::Context>& cr, double width);
00894 #endif //GLIBMM_VFUNCS_ENABLED
00895
00896
00897
00898
00899
00900 ;
00901
00902
00903 #ifdef GLIBMM_VFUNCS_ENABLED
00904 virtual Glib::RefPtr<ItemModel> get_model_vfunc() const;
00905 #endif //GLIBMM_VFUNCS_ENABLED
00906
00907 #ifdef GLIBMM_VFUNCS_ENABLED
00908 virtual void set_model_vfunc(const Glib::RefPtr<ItemModel>& model);
00909 #endif //GLIBMM_VFUNCS_ENABLED
00910
00911
00912 public:
00913
00914 public:
00915
00916 #ifdef GLIBMM_VFUNCS_ENABLED
00917 #endif //GLIBMM_VFUNCS_ENABLED
00918
00919 protected:
00920
00921 #ifdef GLIBMM_VFUNCS_ENABLED
00922 #endif //GLIBMM_VFUNCS_ENABLED
00923
00924
00925 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00926 virtual bool on_enter_notify_event(const Glib::RefPtr<Item>& target, GdkEventCrossing* event);
00927 virtual bool on_leave_notify_event(const Glib::RefPtr<Item>& target, GdkEventCrossing* event);
00928 virtual bool on_motion_notify_event(const Glib::RefPtr<Item>& target, GdkEventMotion* event);
00929 virtual bool on_button_press_event(const Glib::RefPtr<Item>& target, GdkEventButton* event);
00930 virtual bool on_button_release_event(const Glib::RefPtr<Item>& target, GdkEventButton* event);
00931 virtual bool on_focus_in_event(const Glib::RefPtr<Item>& target, GdkEventFocus* event);
00932 virtual bool on_focus_out_event(const Glib::RefPtr<Item>& target, GdkEventFocus* event);
00933 virtual bool on_key_press_event(const Glib::RefPtr<Item>& target, GdkEventKey* event);
00934 virtual bool on_key_release_event(const Glib::RefPtr<Item>& target, GdkEventKey* event);
00935 virtual bool on_grab_broken_event(const Glib::RefPtr<Item>& target, GdkEventGrabBroken* event);
00936 virtual void on_child_notify(GParamSpec* pspec);
00937 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00938
00939
00940 };
00941
00942 }
00943
00944
00945 namespace Glib
00946 {
00955 Glib::RefPtr<Goocanvas::Item> wrap(GooCanvasItem* object, bool take_copy = false);
00956
00957 }
00958
00959
00960 #endif
00961