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/style.h>
00029 #include <cairomm/cairomm.h>
00030 #include <goocanvasitem.h>
00031 
00032 
00033 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00034 extern "C" { typedef union _GooCanvasPathCommand GooCanvasPathCommand; }
00035 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00036 
00037 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00038 typedef struct _GooCanvasItem GooCanvasItem;
00039 typedef struct _GooCanvasItemClass GooCanvasItemClass;
00040 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00041 
00042 
00043 namespace Goocanvas
00044 { class Item_Class; } // namespace Goocanvas
00045 namespace Goocanvas
00046 {
00047 
00048 //TODO: Somehow make the enum values be ITEM_VISIBLE instead of CANVAS_ITEM_VISIBLE. It seems to just find the first _.
00062 enum PointerEvents
00063 {
00064   CANVAS_EVENTS_VISIBLE_MASK = 1 << 0,
00065   CANVAS_EVENTS_PAINTED_MASK = 1 << 1,
00066   CANVAS_EVENTS_FILL_MASK = 1 << 2,
00067   CANVAS_EVENTS_STROKE_MASK = 1 << 3,
00068   CANVAS_EVENTS_NONE = 0,
00069   CANVAS_EVENTS_VISIBLE_PAINTED = 0x1,
00070   CANVAS_EVENTS_VISIBLE_FILL = 0x1,
00071   CANVAS_EVENTS_VISIBLE_STROKE = 0x1,
00072   CANVAS_EVENTS_VISIBLE = 0x1,
00073   CANVAS_EVENTS_PAINTED = 0x2,
00074   CANVAS_EVENTS_FILL = 0x4,
00075   CANVAS_EVENTS_STROKE = 0x8,
00076   CANVAS_EVENTS_ALL = 0x4
00077 };
00078 
00080 inline PointerEvents operator|(PointerEvents lhs, PointerEvents rhs)
00081   { return static_cast<PointerEvents>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
00082 
00084 inline PointerEvents operator&(PointerEvents lhs, PointerEvents rhs)
00085   { return static_cast<PointerEvents>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
00086 
00088 inline PointerEvents operator^(PointerEvents lhs, PointerEvents rhs)
00089   { return static_cast<PointerEvents>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
00090 
00092 inline PointerEvents operator~(PointerEvents flags)
00093   { return static_cast<PointerEvents>(~static_cast<unsigned>(flags)); }
00094 
00096 inline PointerEvents& operator|=(PointerEvents& lhs, PointerEvents rhs)
00097   { return (lhs = static_cast<PointerEvents>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
00098 
00100 inline PointerEvents& operator&=(PointerEvents& lhs, PointerEvents rhs)
00101   { return (lhs = static_cast<PointerEvents>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
00102 
00104 inline PointerEvents& operator^=(PointerEvents& lhs, PointerEvents rhs)
00105   { return (lhs = static_cast<PointerEvents>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
00106 
00107 } // namespace Goocanvas
00108 
00109 
00110 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00111 namespace Glib
00112 {
00113 
00114 template <>
00115 class Value<Goocanvas::PointerEvents> : public Glib::Value_Flags<Goocanvas::PointerEvents>
00116 {
00117 public:
00118   static GType value_type() G_GNUC_CONST;
00119 };
00120 
00121 } // namespace Glib
00122 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00123 
00124 
00125 namespace Goocanvas
00126 {
00127 
00131 enum ItemVisibility
00132 {
00133   CANVAS_ITEM_HIDDEN,
00134   CANVAS_ITEM_INVISIBLE,
00135   CANVAS_ITEM_VISIBLE,
00136   CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD
00137 };
00138 
00139 } // namespace Goocanvas
00140 
00141 
00142 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00143 namespace Glib
00144 {
00145 
00146 template <>
00147 class Value<Goocanvas::ItemVisibility> : public Glib::Value_Enum<Goocanvas::ItemVisibility>
00148 {
00149 public:
00150   static GType value_type() G_GNUC_CONST;
00151 };
00152 
00153 } // namespace Glib
00154 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00155 
00156 
00157 namespace Goocanvas
00158 {
00159 
00160 
00161 class Canvas ;
00162 class ItemModel ;
00163 
00164 
00165 class Item : public Glib::Interface
00166 {
00167   
00168 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00169 
00170 public:
00171   typedef Item CppObjectType;
00172   typedef Item_Class CppClassType;
00173   typedef GooCanvasItem BaseObjectType;
00174   typedef GooCanvasItemIface BaseClassType;
00175 
00176 private:
00177   friend class Item_Class;
00178   static CppClassType item_class_;
00179 
00180   // noncopyable
00181   Item(const Item&);
00182   Item& operator=(const Item&);
00183 
00184 protected:
00185   Item(); // you must derive from this class
00186 
00187 public:
00188   // This is public so that C++ wrapper instances can be
00189   // created for C instances of unwrapped types.
00190   // For instance, if an unexpected C type implements the C interface. 
00191   explicit Item(GooCanvasItem* castitem);
00192 
00193 protected:
00194 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00195 
00196 public:
00197   virtual ~Item();
00198 
00199   static void add_interface(GType gtype_implementer);
00200 
00201 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00202   static GType get_type()      G_GNUC_CONST;
00203   static GType get_base_type() G_GNUC_CONST;
00204 #endif
00205 
00207   GooCanvasItem*       gobj()       { return reinterpret_cast<GooCanvasItem*>(gobject_); }
00208 
00210   const GooCanvasItem* gobj() const { return reinterpret_cast<GooCanvasItem*>(gobject_); }
00211 
00212 private:
00213 
00214 
00215 public:
00216 
00217   
00218   Canvas* get_canvas();
00219   
00220   const Canvas* get_canvas() const;
00221   
00222   void set_canvas(Canvas* canvas);
00223 
00224   
00225   bool is_visible() const;
00226 
00227   
00228   Glib::RefPtr<ItemModel> get_model();
00229   
00230   Glib::RefPtr<const ItemModel> get_model() const;
00231   
00232   void set_model(const Glib::RefPtr<ItemModel>& model);
00233 
00234   
00235   Glib::RefPtr<Item> get_parent();
00236   
00237   Glib::RefPtr<const Item> get_parent() const;
00238   
00239   void set_parent(const Glib::RefPtr<Item>& parent);
00240   
00241   void remove();
00242 
00243   
00244   bool is_container() const;
00245   
00246   int get_n_children() const;
00247   
00248   Glib::RefPtr<Item> get_child(int child_num);
00249   
00250   Glib::RefPtr<const Item> get_child(int child_num) const;
00251   
00252   int find_child(const Glib::RefPtr<Item>& child);
00253   
00254   void add_child(const Glib::RefPtr<Item>& child, int pos);
00255   void add_child(const Glib::RefPtr<Item>& child);
00256 
00257   
00258   void move_child(int old_position, int new_position);
00259   
00260   void remove_child(int child_num);
00261 
00262   
00263   void raise(const Glib::RefPtr<Item>& above);
00264 
00267   void raise();
00268 
00269   
00270   void lower(const Glib::RefPtr<Item>& below);
00271 
00274   void lower();
00275 
00276   Bounds get_bounds() const;
00277   
00278 
00279   void request_update();
00280   
00281   void ensure_upated();
00282   
00283   void update(bool entire_tree, const Cairo::RefPtr<Cairo::Context>& context, Bounds& bounds);
00284   
00285   void paint(const Cairo::RefPtr<Cairo::Context>& context, const Bounds& bounds, double scale);
00286   
00287   bool get_requested_area(const Cairo::RefPtr<Cairo::Context>& context, Bounds& bounds) const;
00288   
00289   double get_requested_height(const Cairo::RefPtr<Cairo::Context>& context, double width) const;
00290   
00291   void allocate_area(const Cairo::RefPtr<Cairo::Context>& context, const Bounds& requested_area, const Bounds& allocated_area, double x_offset, double y_offset);
00292 
00293  
00294   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);
00295 
00296   //TODO: Use Cairo::RefPtr?
00297   
00298   bool get_transform(Cairo::Matrix* matrix);
00299   
00300   void set_transform(const Cairo::Matrix* matrix);
00301 
00302   
00303   void set_simple_transform(double x, double y, double scale, double rotation);
00304   
00305   void translate(double tx, double ty);
00306   
00307   void scale(double sx, double sy);
00308   
00309   void rotate(double degrees, double cx, double cy);
00310   
00311   void skew_x(double degrees, double cx, double cy);
00312   
00313   void skew_y(double degrees, double cx, double cy);
00314 
00315   
00316   bool get_transform_for_child(const Glib::RefPtr<Item>& child, Cairo::Matrix* transform);
00317 
00318   
00319   Glib::RefPtr<Style> get_style();
00320   
00321   Glib::RefPtr<const Style> get_style() const;
00322   
00323   void set_style(const Glib::RefPtr<Style>& style);
00324 
00325   
00326   void animate(double x, double y, double scale, double degrees, bool absolute, int duration, int step_time, GooCanvasAnimateType type);
00327   
00328   void stop_animation();
00329 
00330 
00331   //_WRAP_SIGNAL(void child_added(int child_num), "child_added")
00332   //_WRAP_SIGNAL(void child_moved(int old_position, int new_position), "child_moved")
00333   //_WRAP_SIGNAL(void child_removed(int child_num), "child_removed")
00334   //_WRAP_SIGNAL(void changed(bool recompute_bounds), "changed")
00335 
00336  
00342   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventCrossing* > signal_enter_notify_event();
00343 
00344   
00350   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventCrossing* > signal_leave_notify_event();
00351 
00352   
00358   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventMotion* > signal_motion_notify_event();
00359 
00360   
00366   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventButton* > signal_button_press_event();
00367 
00368   
00374   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventButton* > signal_button_release_event();
00375 
00376   
00382   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventFocus* > signal_focus_in_event();
00383 
00384   
00390   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventFocus* > signal_focus_out_event();
00391 
00392   
00398   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventKey* > signal_key_press_event();
00399 
00400   
00406   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventKey* > signal_key_release_event();
00407 
00408   
00414   Glib::SignalProxy2< bool,const Glib::RefPtr<Item>&,GdkEventGrabBroken* > signal_grab_broken_event();
00415 
00416   
00422   Glib::SignalProxy1< void,GParamSpec* > signal_child_notify();
00423 
00424 
00425   #ifdef GLIBMM_PROPERTIES_ENABLED
00426 
00432   Glib::PropertyProxy<bool> property_can_focus() ;
00433 #endif //#GLIBMM_PROPERTIES_ENABLED
00434 
00435 #ifdef GLIBMM_PROPERTIES_ENABLED
00436 
00442   Glib::PropertyProxy_ReadOnly<bool> property_can_focus() const;
00443 #endif //#GLIBMM_PROPERTIES_ENABLED
00444 
00445   #ifdef GLIBMM_PROPERTIES_ENABLED
00446 
00452   Glib::PropertyProxy<ItemVisibility> property_visibility() ;
00453 #endif //#GLIBMM_PROPERTIES_ENABLED
00454 
00455 #ifdef GLIBMM_PROPERTIES_ENABLED
00456 
00462   Glib::PropertyProxy_ReadOnly<ItemVisibility> property_visibility() const;
00463 #endif //#GLIBMM_PROPERTIES_ENABLED
00464 
00465   #ifdef GLIBMM_PROPERTIES_ENABLED
00466 
00472   Glib::PropertyProxy<Glib::ustring> property_description() ;
00473 #endif //#GLIBMM_PROPERTIES_ENABLED
00474 
00475 #ifdef GLIBMM_PROPERTIES_ENABLED
00476 
00482   Glib::PropertyProxy_ReadOnly<Glib::ustring> property_description() const;
00483 #endif //#GLIBMM_PROPERTIES_ENABLED
00484 
00485   #ifdef GLIBMM_PROPERTIES_ENABLED
00486 
00492   Glib::PropertyProxy<double> property_visibility_threshold() ;
00493 #endif //#GLIBMM_PROPERTIES_ENABLED
00494 
00495 #ifdef GLIBMM_PROPERTIES_ENABLED
00496 
00502   Glib::PropertyProxy_ReadOnly<double> property_visibility_threshold() const;
00503 #endif //#GLIBMM_PROPERTIES_ENABLED
00504 
00505   #ifdef GLIBMM_PROPERTIES_ENABLED
00506 
00512   Glib::PropertyProxy<PointerEvents> property_pointer_events() ;
00513 #endif //#GLIBMM_PROPERTIES_ENABLED
00514 
00515 #ifdef GLIBMM_PROPERTIES_ENABLED
00516 
00522   Glib::PropertyProxy_ReadOnly<PointerEvents> property_pointer_events() const;
00523 #endif //#GLIBMM_PROPERTIES_ENABLED
00524 
00525 
00526 protected:
00527 
00528 /*
00529 
00530   //_WRAP_VFUNC(Cairo::Matrix* get_transform(), get_transform)
00531   _WRAP_VFUNC(void set_transform(Cairo::Matrix* matrix), set_transform)
00532   //_WRAP_VFUNC(Glib::RefPtr<ItemView> create_view(const Glib::RefPtr<View>& canvas_view, const Glib::RefPtr<ItemView>& parent_view), create_view)
00533 */
00534 
00535 
00536 /* Virtual methods that group items must implement. */
00537 /*
00538   GooCanvas*            (* get_canvas)                  (GooCanvasItem          *item);
00539   void                  (* set_canvas(
00540                                                          GooCanvas              *canvas);
00541   gint                  (* get_n_children)              (GooCanvasItem          *item);
00542   GooCanvasItem*        (* get_child(
00543                                                          gint                    child_num);
00544   void                  (* request_update)              (GooCanvasItem          *item);
00545 */
00546   /* Virtual methods that group items may implement. */
00547 
00548 /*
00549   void                  (* add_child(
00550                                                          GooCanvasItem          *child,
00551                                                          gint                    position);
00552   void                  (* move_child(
00553                                                          gint                    old_position,
00554                                                          gint                    new_position);
00555   void                  (* remove_child(
00556                                                          gint                    child_num);
00557   void                  (* get_child_property(
00558                                                          GooCanvasItem          *child,
00559                                                          guint                   property_id,
00560                                                          GValue                 *value,
00561                                                          GParamSpec             *pspec);
00562   void                  (* set_child_property(
00563                                                          GooCanvasItem          *child,
00564                                                          guint                   property_id,
00565                                                          const GValue           *value,
00566                                                          GParamSpec             *pspec);
00567   gboolean              (* get_transform_for_child)     (GooCanvasItem          *item,
00568                                                          GooCanvasItem          *child,
00569                                                          cairo_matrix_t         *transform);
00570 */
00571 
00572   /* Virtual methods that all canvas items must implement. */
00573 
00574  
00575 ;
00576   #ifdef GLIBMM_VFUNCS_ENABLED
00577   virtual Glib::RefPtr<Item> get_parent_vfunc();
00578 #endif //GLIBMM_VFUNCS_ENABLED
00579 
00580   #ifdef GLIBMM_VFUNCS_ENABLED
00581   virtual void set_parent_vfunc(const Glib::RefPtr<Item>& parent);
00582 #endif //GLIBMM_VFUNCS_ENABLED
00583 
00584 
00585   #ifdef GLIBMM_VFUNCS_ENABLED
00586   virtual void get_bounds_vfunc(GooCanvasBounds* bounds);
00587 #endif //GLIBMM_VFUNCS_ENABLED
00588 
00589 
00590   //gtkmmproc error: get_items_at :  vfunc defs lookup failed
00591   #ifdef GLIBMM_VFUNCS_ENABLED
00592   virtual void update_vfunc(bool entire_tree, const Cairo::RefPtr<Cairo::Context>& cr, GooCanvasBounds* bounds);
00593 #endif //GLIBMM_VFUNCS_ENABLED
00594 
00595 
00596 ;
00597   #ifdef GLIBMM_VFUNCS_ENABLED
00598   virtual void paint_vfunc(const Cairo::RefPtr<Cairo::Context>& cr, const Bounds& bounds, double scale);
00599 #endif //GLIBMM_VFUNCS_ENABLED
00600 
00601 
00602   #ifdef GLIBMM_VFUNCS_ENABLED
00603   virtual bool get_requested_area_vfunc(const Cairo::RefPtr<Cairo::Context>& cr, GooCanvasBounds* requested_area);
00604 #endif //GLIBMM_VFUNCS_ENABLED
00605 
00606   #ifdef GLIBMM_VFUNCS_ENABLED
00607   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);
00608 #endif //GLIBMM_VFUNCS_ENABLED
00609 
00610 
00611   /* Virtual methods that canvas items may implement. */
00612 
00613   #ifdef GLIBMM_VFUNCS_ENABLED
00614   virtual bool get_transform_vfunc(cairo_matrix_t* transform);
00615 #endif //GLIBMM_VFUNCS_ENABLED
00616 
00617   //gtkmmproc error: set_transform :  vfunc defs lookup failed
00618   //gtkmmproc error: get_style :  vfunc defs lookup failed
00619   //gtkmmproc error: set_style :  vfunc defs lookup failed
00620   //gtkmmproc error: is_visible :  vfunc defs lookup failed
00621   //gtkmmproc error: get_requested_height :  vfunc defs lookup failed
00622 
00623   /* Virtual methods that model/view items must implement. */
00624 /*
00625   GooCanvasItemModel*   (* get_model)                   (GooCanvasItem          *item);
00626   void                  (* set_model(
00627                                                          GooCanvasItemModel     *model);
00628 */
00629 
00630 
00631 public:
00632 
00633 public:
00634   //C++ methods used to invoke GTK+ virtual functions:
00635 #ifdef GLIBMM_VFUNCS_ENABLED
00636 #endif //GLIBMM_VFUNCS_ENABLED
00637 
00638 protected:
00639   //GTK+ Virtual Functions (override these to change behaviour):
00640 #ifdef GLIBMM_VFUNCS_ENABLED
00641 #endif //GLIBMM_VFUNCS_ENABLED
00642 
00643   //Default Signal Handlers::
00644 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00645   virtual bool on_enter_notify_event(const Glib::RefPtr<Item>& target, GdkEventCrossing* event);
00646   virtual bool on_leave_notify_event(const Glib::RefPtr<Item>& target, GdkEventCrossing* event);
00647   virtual bool on_motion_notify_event(const Glib::RefPtr<Item>& target, GdkEventMotion* event);
00648   virtual bool on_button_press_event(const Glib::RefPtr<Item>& target, GdkEventButton* event);
00649   virtual bool on_button_release_event(const Glib::RefPtr<Item>& target, GdkEventButton* event);
00650   virtual bool on_focus_in_event(const Glib::RefPtr<Item>& target, GdkEventFocus* event);
00651   virtual bool on_focus_out_event(const Glib::RefPtr<Item>& target, GdkEventFocus* event);
00652   virtual bool on_key_press_event(const Glib::RefPtr<Item>& target, GdkEventKey* event);
00653   virtual bool on_key_release_event(const Glib::RefPtr<Item>& target, GdkEventKey* event);
00654   virtual bool on_grab_broken_event(const Glib::RefPtr<Item>& target, GdkEventGrabBroken* event);
00655   virtual void on_child_notify(GParamSpec* pspec);
00656 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00657 
00658 
00659 };
00660 
00661 } //namespace Goocanvas
00662 
00663 
00664 namespace Glib
00665 {
00674   Glib::RefPtr<Goocanvas::Item> wrap(GooCanvasItem* object, bool take_copy = false);
00675 
00676 } // namespace Glib
00677 
00678 
00679 #endif /* _GOOCANVASMM_ITEM_H */
00680 

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