item.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 // Generated by gtkmmproc -- DO NOT MODIFY!
00003 #ifndef _GOOCANVASMM_ITEM_H
00004 #define _GOOCANVASMM_ITEM_H
00005 
00006 
00007 #include <glibmm.h>
00008 
00009 
00010 /* Copyright (C) 1998-2006 The gtkmm Development Team
00011  *
00012  * This library is free software; you can redistribute it and/or
00013  * modify it under the terms of the GNU Library General Public
00014  * License as published by the Free Software Foundation; either
00015  * version 2 of the License, or (at your option) any later version.
00016  *
00017  * This library is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020  * Library General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU Library General Public
00023  * License along with this library; if not, write to the Free
00024  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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 /* DOXYGEN_SHOULD_SKIP_THIS */
00037 
00038 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00039 typedef struct _GooCanvasItem GooCanvasItem;
00040 typedef struct _GooCanvasItemClass GooCanvasItemClass;
00041 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00042 
00043 
00044 namespace Goocanvas
00045 { class Item_Class; } // namespace Goocanvas
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   // noncopyable
00069   Item(const Item&);
00070   Item& operator=(const Item&);
00071 
00072 protected:
00073   Item(); // you must derive from this class
00074 
00081   explicit Item(const Glib::Interface_Class& interface_class);
00082 
00083 public:
00084   // This is public so that C++ wrapper instances can be
00085   // created for C instances of unwrapped types.
00086   // For instance, if an unexpected C type implements the C interface. 
00087   explicit Item(GooCanvasItem* castitem);
00088 
00089 protected:
00090 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
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   // TODO: should this be passed by reference instead of by pointer?
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   
00183   void set_parent(const Glib::RefPtr<Item>& parent);
00184   
00190   void remove();
00191 
00192   
00196   bool is_container() const;
00197   
00201   int get_n_children() const;
00202   
00208   Glib::RefPtr<Item> get_child(int child_num);
00209   
00215   Glib::RefPtr<const Item> get_child(int child_num) const;
00216   
00221   int find_child(const Glib::RefPtr<Item>& child);
00222   
00228   void add_child(const Glib::RefPtr<Item>& child, int pos);
00229   void add_child(const Glib::RefPtr<Item>& child);
00230   
00236   void get_child_property(const Glib::RefPtr<Item>& child, const Glib::ustring& property_name, Glib::ValueBase& value) const;
00237   
00243   void set_child_property(const Glib::RefPtr<Item>& child, const Glib::ustring& property_name, const Glib::ValueBase& value);
00244 
00245   
00250   void move_child(int old_position, int new_position);
00251   
00255   void remove_child(int child_num);
00256 
00257   
00262   void raise(const Glib::RefPtr<Item>& above);
00263 
00266   void raise();
00267 
00268   
00273   void lower(const Glib::RefPtr<Item>& below);
00274 
00277   void lower();
00278 
00279   Bounds get_bounds() const;
00280   
00281 
00288   void request_update();
00289   
00296   void ensure_upated();
00297   
00306   void update(bool entire_tree, const Cairo::RefPtr<Cairo::Context>& context, Bounds& bounds);
00307   
00320   void paint(const Cairo::RefPtr<Cairo::Context>& context, const Bounds& bounds, double scale);
00321   
00331   bool get_requested_area(const Cairo::RefPtr<Cairo::Context>& context, Bounds& bounds) const;
00332   
00345   double get_requested_height(const Cairo::RefPtr<Cairo::Context>& context, double width) const;
00346   
00369   void allocate_area(const Cairo::RefPtr<Cairo::Context>& context, const Bounds& requested_area, const Bounds& allocated_area, double x_offset, double y_offset);
00370 
00371 
00372   // Note the semantics of the C version: The returned list is the same as the
00373   // one fed into the function, with possibly some elements added to the head.
00374  
00375 
00391   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);
00392   
00408   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;
00409 
00410   // Use this if you don't have a list already:
00411   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);
00412   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;
00413 
00414   //TODO: Use Cairo::RefPtr?
00415   
00420   bool get_transform(Cairo::Matrix* matrix);
00421   
00426   void set_transform(const Cairo::Matrix* matrix);
00427 
00428   
00435   void set_simple_transform(double x, double y, double scale, double rotation);
00436   
00448   bool get_simple_transform(double& x, double& y, double& scale, double& rotation) const;
00449   
00454   void translate(double tx, double ty);
00455   
00460   void scale(double sx, double sy);
00461   
00468   void rotate(double degrees, double cx, double cy);
00469   
00476   void skew_x(double degrees, double cx, double cy);
00477   
00484   void skew_y(double degrees, double cx, double cy);
00485 
00486   
00494   bool get_transform_for_child(const Glib::RefPtr<Item>& child, Cairo::Matrix* transform);
00495 
00496   
00501   Glib::RefPtr<Style> get_style();
00502   
00507   Glib::RefPtr<const Style> get_style() const;
00508   
00512   void set_style(const Glib::RefPtr<Style>& style);
00513 
00514   
00531   void animate(double x, double y, double scale, double degrees, bool absolute, int duration, int step_time, GooCanvasAnimateType type);
00532   
00536   void stop_animation();
00537 
00538 
00539   //_WRAP_SIGNAL(void child_added(int child_num), "child_added")
00540   //_WRAP_SIGNAL(void child_moved(int old_position, int new_position), "child_moved")
00541   //_WRAP_SIGNAL(void child_removed(int child_num), "child_removed")
00542   //_WRAP_SIGNAL(void changed(bool recompute_bounds), "changed")
00543 
00544  
00550   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventCrossing* > signal_enter_notify_event();
00551 
00552   
00558   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventCrossing* > signal_leave_notify_event();
00559 
00560   
00566   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventMotion* > signal_motion_notify_event();
00567 
00568   
00574   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventButton* > signal_button_press_event();
00575 
00576   
00582   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventButton* > signal_button_release_event();
00583 
00584   
00590   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventFocus* > signal_focus_in_event();
00591 
00592   
00598   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventFocus* > signal_focus_out_event();
00599 
00600   
00606   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventKey* > signal_key_press_event();
00607 
00608   
00614   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventKey* > signal_key_release_event();
00615 
00616   
00622   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventGrabBroken* > signal_grab_broken_event();
00623 
00624   
00630   Glib::SignalProxy1< void,GParamSpec* > signal_child_notify();
00631 
00632 
00633   #ifdef GLIBMM_PROPERTIES_ENABLED
00634 
00640   Glib::PropertyProxy< Glib::RefPtr<Item> > property_parent() ;
00641 #endif //#GLIBMM_PROPERTIES_ENABLED
00642 
00643 #ifdef GLIBMM_PROPERTIES_ENABLED
00644 
00650   Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Item> > property_parent() const;
00651 #endif //#GLIBMM_PROPERTIES_ENABLED
00652 
00653   #ifdef GLIBMM_PROPERTIES_ENABLED
00654 
00660   Glib::PropertyProxy<ItemVisibility> property_visibility() ;
00661 #endif //#GLIBMM_PROPERTIES_ENABLED
00662 
00663 #ifdef GLIBMM_PROPERTIES_ENABLED
00664 
00670   Glib::PropertyProxy_ReadOnly<ItemVisibility> property_visibility() const;
00671 #endif //#GLIBMM_PROPERTIES_ENABLED
00672 
00673   #ifdef GLIBMM_PROPERTIES_ENABLED
00674 
00680   Glib::PropertyProxy<double> property_visibility_threshold() ;
00681 #endif //#GLIBMM_PROPERTIES_ENABLED
00682 
00683 #ifdef GLIBMM_PROPERTIES_ENABLED
00684 
00690   Glib::PropertyProxy_ReadOnly<double> property_visibility_threshold() const;
00691 #endif //#GLIBMM_PROPERTIES_ENABLED
00692 
00693   #ifdef GLIBMM_PROPERTIES_ENABLED
00694 
00700   Glib::PropertyProxy<Cairo::Matrix*> property_transform() ;
00701 #endif //#GLIBMM_PROPERTIES_ENABLED
00702 
00703 #ifdef GLIBMM_PROPERTIES_ENABLED
00704 
00710   Glib::PropertyProxy_ReadOnly<Cairo::Matrix*> property_transform() const;
00711 #endif //#GLIBMM_PROPERTIES_ENABLED
00712 
00713   #ifdef GLIBMM_PROPERTIES_ENABLED
00714 
00720   Glib::PropertyProxy<PointerEvents> property_pointer_events() ;
00721 #endif //#GLIBMM_PROPERTIES_ENABLED
00722 
00723 #ifdef GLIBMM_PROPERTIES_ENABLED
00724 
00730   Glib::PropertyProxy_ReadOnly<PointerEvents> property_pointer_events() const;
00731 #endif //#GLIBMM_PROPERTIES_ENABLED
00732 
00733   #ifdef GLIBMM_PROPERTIES_ENABLED
00734 
00740   Glib::PropertyProxy<Glib::ustring> property_title() ;
00741 #endif //#GLIBMM_PROPERTIES_ENABLED
00742 
00743 #ifdef GLIBMM_PROPERTIES_ENABLED
00744 
00750   Glib::PropertyProxy_ReadOnly<Glib::ustring> property_title() const;
00751 #endif //#GLIBMM_PROPERTIES_ENABLED
00752 
00753   #ifdef GLIBMM_PROPERTIES_ENABLED
00754 
00760   Glib::PropertyProxy<Glib::ustring> property_description() ;
00761 #endif //#GLIBMM_PROPERTIES_ENABLED
00762 
00763 #ifdef GLIBMM_PROPERTIES_ENABLED
00764 
00770   Glib::PropertyProxy_ReadOnly<Glib::ustring> property_description() const;
00771 #endif //#GLIBMM_PROPERTIES_ENABLED
00772 
00773   #ifdef GLIBMM_PROPERTIES_ENABLED
00774 
00780   Glib::PropertyProxy<bool> property_can_focus() ;
00781 #endif //#GLIBMM_PROPERTIES_ENABLED
00782 
00783 #ifdef GLIBMM_PROPERTIES_ENABLED
00784 
00790   Glib::PropertyProxy_ReadOnly<bool> property_can_focus() const;
00791 #endif //#GLIBMM_PROPERTIES_ENABLED
00792 
00793 
00794 protected:
00795 
00796  
00797 /* Virtual methods that group items must implement. */
00798   #ifdef GLIBMM_VFUNCS_ENABLED
00799   virtual int get_n_children_vfunc() const;
00800 #endif //GLIBMM_VFUNCS_ENABLED
00801 
00802   #ifdef GLIBMM_VFUNCS_ENABLED
00803   virtual Glib::RefPtr<Item> get_child_vfunc(int child_num) const;
00804 #endif //GLIBMM_VFUNCS_ENABLED
00805 
00806   #ifdef GLIBMM_VFUNCS_ENABLED
00807   virtual void request_update_vfunc();
00808 #endif //GLIBMM_VFUNCS_ENABLED
00809 
00810   #ifdef GLIBMM_VFUNCS_ENABLED
00811   virtual Canvas* get_canvas_vfunc() const;
00812 #endif //GLIBMM_VFUNCS_ENABLED
00813 
00814   #ifdef GLIBMM_VFUNCS_ENABLED
00815   virtual void set_canvas_vfunc(Canvas* canvas);
00816 #endif //GLIBMM_VFUNCS_ENABLED
00817 
00818 
00819   /* Virtual methods that group items may implement. */
00820 
00821   #ifdef GLIBMM_VFUNCS_ENABLED
00822   virtual void add_child_vfunc(const Glib::RefPtr<Item>& child, int position);
00823 #endif //GLIBMM_VFUNCS_ENABLED
00824 
00825   #ifdef GLIBMM_VFUNCS_ENABLED
00826   virtual void move_child_vfunc(int old_position, int new_position);
00827 #endif //GLIBMM_VFUNCS_ENABLED
00828 
00829   #ifdef GLIBMM_VFUNCS_ENABLED
00830   virtual void remove_child_vfunc(int child_num);
00831 #endif //GLIBMM_VFUNCS_ENABLED
00832 
00833   #ifdef GLIBMM_VFUNCS_ENABLED
00834   virtual void get_child_property_vfunc(const Glib::RefPtr<Item>& child, guint property_id, Glib::ValueBase& value, GParamSpec* pspec) const;
00835 #endif //GLIBMM_VFUNCS_ENABLED
00836 
00837   #ifdef GLIBMM_VFUNCS_ENABLED
00838   virtual void set_child_property_vfunc(const Glib::RefPtr<Item>& child, guint property_id, const Glib::ValueBase& value, GParamSpec* pspec);
00839 #endif //GLIBMM_VFUNCS_ENABLED
00840 
00841   #ifdef GLIBMM_VFUNCS_ENABLED
00842   virtual bool get_transform_for_child_vfunc(const Glib::RefPtr<Item>& child, Cairo::Matrix* transform) const;
00843 #endif //GLIBMM_VFUNCS_ENABLED
00844 
00845 
00846   /* Virtual methods that all canvas items must implement. */
00847 
00848   #ifdef GLIBMM_VFUNCS_ENABLED
00849   virtual Glib::RefPtr<Item> get_parent_vfunc() const;
00850 #endif //GLIBMM_VFUNCS_ENABLED
00851 
00852   #ifdef GLIBMM_VFUNCS_ENABLED
00853   virtual void set_parent_vfunc(const Glib::RefPtr<Item>& parent);
00854 #endif //GLIBMM_VFUNCS_ENABLED
00855 
00856 
00857 #ifdef GLIBMM_VFUNCS_ENABLED
00858   // Hand code, since Bounds can only copy a GooCanvasBounds* but not ref one.
00859   virtual void get_bounds_vfunc(Bounds& bounds) const;
00860   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;
00861 #endif
00862 
00863 
00864   #ifdef GLIBMM_VFUNCS_ENABLED
00865   virtual void update_vfunc(bool entire_tree, const Cairo::RefPtr<Cairo::Context>& cr, Bounds& bounds);
00866 #endif //GLIBMM_VFUNCS_ENABLED
00867 
00868 
00869   #ifdef GLIBMM_VFUNCS_ENABLED
00870   virtual void paint_vfunc(const Cairo::RefPtr<Cairo::Context>& cr, const Bounds& bounds, double scale);
00871 #endif //GLIBMM_VFUNCS_ENABLED
00872 
00873 
00874   #ifdef GLIBMM_VFUNCS_ENABLED
00875   virtual bool get_requested_area_vfunc(const Cairo::RefPtr<Cairo::Context>& cr, GooCanvasBounds* requested_area) const;
00876 #endif //GLIBMM_VFUNCS_ENABLED
00877 
00878   #ifdef GLIBMM_VFUNCS_ENABLED
00879   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);
00880 #endif //GLIBMM_VFUNCS_ENABLED
00881 
00882 
00883   /* Virtual methods that canvas items may implement. */
00884 
00885   #ifdef GLIBMM_VFUNCS_ENABLED
00886   virtual bool get_transform_vfunc(Cairo::Matrix* transform) const;
00887 #endif //GLIBMM_VFUNCS_ENABLED
00888 
00889   #ifdef GLIBMM_VFUNCS_ENABLED
00890   virtual void set_transform_vfunc(const Cairo::Matrix* transform);
00891 #endif //GLIBMM_VFUNCS_ENABLED
00892 
00893 
00894   #ifdef GLIBMM_VFUNCS_ENABLED
00895   virtual Glib::RefPtr<Style> get_style_vfunc() const;
00896 #endif //GLIBMM_VFUNCS_ENABLED
00897 
00898   #ifdef GLIBMM_VFUNCS_ENABLED
00899   virtual void set_style_vfunc(const Glib::RefPtr<Style>& style);
00900 #endif //GLIBMM_VFUNCS_ENABLED
00901 
00902   #ifdef GLIBMM_VFUNCS_ENABLED
00903   virtual bool is_visible_vfunc() const;
00904 #endif //GLIBMM_VFUNCS_ENABLED
00905 
00906   #ifdef GLIBMM_VFUNCS_ENABLED
00907   virtual double get_requested_height_vfunc(const Cairo::RefPtr<Cairo::Context>& cr, double width);
00908 #endif //GLIBMM_VFUNCS_ENABLED
00909 
00910 
00911   /* Virtual methods that model/view items must implement. */
00912  
00913 
00914   #ifdef GLIBMM_VFUNCS_ENABLED
00915   virtual Glib::RefPtr<ItemModel> get_model_vfunc() const;
00916 #endif //GLIBMM_VFUNCS_ENABLED
00917 
00918   #ifdef GLIBMM_VFUNCS_ENABLED
00919   virtual void set_model_vfunc(const Glib::RefPtr<ItemModel>& model);
00920 #endif //GLIBMM_VFUNCS_ENABLED
00921 
00922 
00923 public:
00924 
00925 public:
00926   //C++ methods used to invoke GTK+ virtual functions:
00927 #ifdef GLIBMM_VFUNCS_ENABLED
00928 #endif //GLIBMM_VFUNCS_ENABLED
00929 
00930 protected:
00931   //GTK+ Virtual Functions (override these to change behaviour):
00932 #ifdef GLIBMM_VFUNCS_ENABLED
00933 #endif //GLIBMM_VFUNCS_ENABLED
00934 
00935   //Default Signal Handlers::
00936 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00937   virtual bool on_enter_notify_event(const Glib::RefPtr<Item>& target, GdkEventCrossing* event);
00938   virtual bool on_leave_notify_event(const Glib::RefPtr<Item>& target, GdkEventCrossing* event);
00939   virtual bool on_motion_notify_event(const Glib::RefPtr<Item>& target, GdkEventMotion* event);
00940   virtual bool on_button_press_event(const Glib::RefPtr<Item>& target, GdkEventButton* event);
00941   virtual bool on_button_release_event(const Glib::RefPtr<Item>& target, GdkEventButton* event);
00942   virtual bool on_focus_in_event(const Glib::RefPtr<Item>& target, GdkEventFocus* event);
00943   virtual bool on_focus_out_event(const Glib::RefPtr<Item>& target, GdkEventFocus* event);
00944   virtual bool on_key_press_event(const Glib::RefPtr<Item>& target, GdkEventKey* event);
00945   virtual bool on_key_release_event(const Glib::RefPtr<Item>& target, GdkEventKey* event);
00946   virtual bool on_grab_broken_event(const Glib::RefPtr<Item>& target, GdkEventGrabBroken* event);
00947   virtual void on_child_notify(GParamSpec* pspec);
00948 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00949 
00950 
00951 };
00952 
00953 } //namespace Goocanvas
00954 
00955 
00956 namespace Glib
00957 {
00966   Glib::RefPtr<Goocanvas::Item> wrap(GooCanvasItem* object, bool take_copy = false);
00967 
00968 } // namespace Glib
00969 
00970 
00971 #endif /* _GOOCANVASMM_ITEM_H */
00972 

Generated on Wed Sep 3 02:56:11 2008 for goocanvasmm by  doxygen 1.5.6