path.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 // Generated by gtkmmproc -- DO NOT MODIFY!
00003 #ifndef _CLUTTERMM_PATH_H
00004 #define _CLUTTERMM_PATH_H
00005 
00006 
00007 #include <glibmm.h>
00008 
00009 /*
00010  * Copyright (c) 2008  The cluttermm Development Team
00011  *
00012  * This library is free software; you can redistribute it and/or
00013  * modify it under the terms of the GNU Lesser General Public
00014  * License as published by the Free Software Foundation; either
00015  * version 2.1 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  * Lesser General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU Lesser 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 
00028 #include <cluttermm/types.h>
00029 #include <glibmm/object.h>
00030 #include <cairomm/context.h>
00031 #include <clutter/clutter.h>
00032 
00033 
00034 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00035 typedef struct _ClutterPath ClutterPath;
00036 typedef struct _ClutterPathClass ClutterPathClass;
00037 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00038 
00039 
00040 namespace Clutter
00041 { class Path_Class; } // namespace Clutter
00042 namespace Clutter
00043 {
00044 
00045 enum PathNodeType
00046 {
00047   PATH_MOVE_TO,
00048   PATH_LINE_TO,
00049   PATH_CURVE_TO,
00050   PATH_CLOSE,
00051   PATH_REL_MOVE_TO = PATH_MOVE_TO | CLUTTER_PATH_RELATIVE,
00052   PATH_REL_LINE_TO = PATH_LINE_TO | CLUTTER_PATH_RELATIVE,
00053   PATH_REL_CURVE_TO = PATH_CURVE_TO | CLUTTER_PATH_RELATIVE
00054 };
00055 
00056 class PathNode
00057 {
00058   public:
00059 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00060   typedef PathNode CppObjectType;
00061   typedef ClutterPathNode BaseObjectType;
00062 
00063   static GType get_type() G_GNUC_CONST;
00064 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00065 
00066   PathNode();
00067 
00068   explicit PathNode(const ClutterPathNode* gobject); // always takes a copy
00069 
00071   ClutterPathNode*       gobj()       { return &gobject_; }
00072 
00074   const ClutterPathNode* gobj() const { return &gobject_; }
00075 
00076 protected:
00077   ClutterPathNode gobject_;
00078 
00079 private:
00080   
00081 public:
00082   typedef unsigned int  size_type;
00083   typedef int           difference_type;
00084 
00085   typedef Knot          value_type;
00086   typedef Knot&         reference;
00087   typedef const Knot&   const_reference;
00088 
00089   // Use plain pointers for simplicity.
00090   typedef Knot*         iterator;
00091   typedef const Knot*   const_iterator;
00092 
00093 #ifndef GLIBMM_HAVE_SUN_REVERSE_ITERATOR
00094   typedef std::reverse_iterator<iterator>       reverse_iterator;
00095   typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
00096 #else
00097   typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
00098                                 Knot, Knot&, Knot*, ptrdiff_t> reverse_iterator;
00099 
00100   typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
00101                                 Knot, const Knot&, const Knot*, ptrdiff_t> const_reverse_iterator;
00102 #endif
00103   explicit PathNode(PathNodeType type);
00104 
00105   size_type size() const;
00106   bool empty() const;
00107 
00108   iterator begin();
00109   iterator end();
00110   const_iterator begin() const;
00111   const_iterator end()   const;
00112 
00113   inline reverse_iterator       rbegin()       { return reverse_iterator(end()); }
00114   inline reverse_iterator       rend()         { return reverse_iterator(begin()); }
00115   inline const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
00116   inline const_reverse_iterator rend()   const { return const_reverse_iterator(begin()); }
00117 
00118   inline reference       front()       { return *begin();  }
00119   inline const_reference front() const { return *begin();  }
00120   inline reference       back()        { return *rbegin(); }
00121   inline const_reference back()  const { return *rbegin(); }
00122 
00123   inline reference       operator[](size_type i)       { return begin()[i]; }
00124   inline const_reference operator[](size_type i) const { return begin()[i]; }
00125 
00126 
00127 };
00128 
00129 
00130 class Path : public Glib::Object
00131 {
00132   
00133 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00134 
00135 public:
00136   typedef Path CppObjectType;
00137   typedef Path_Class CppClassType;
00138   typedef ClutterPath BaseObjectType;
00139   typedef ClutterPathClass BaseClassType;
00140 
00141 private:  friend class Path_Class;
00142   static CppClassType path_class_;
00143 
00144 private:
00145   // noncopyable
00146   Path(const Path&);
00147   Path& operator=(const Path&);
00148 
00149 protected:
00150   explicit Path(const Glib::ConstructParams& construct_params);
00151   explicit Path(ClutterPath* castitem);
00152 
00153 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00154 
00155 public:
00156   virtual ~Path();
00157 
00158 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00159   static GType get_type()      G_GNUC_CONST;
00160   static GType get_base_type() G_GNUC_CONST;
00161 #endif
00162 
00164   ClutterPath*       gobj()       { return reinterpret_cast<ClutterPath*>(gobject_); }
00165 
00167   const ClutterPath* gobj() const { return reinterpret_cast<ClutterPath*>(gobject_); }
00168 
00170   ClutterPath* gobj_copy();
00171 
00172 private:
00173 
00174   
00175 protected:
00176   Path();
00177   explicit Path(const Glib::ustring& description);
00178 
00179 public:
00180   class Nodes;
00181 
00182   
00183   static Glib::RefPtr<Path> create();
00184 
00185   
00186   static Glib::RefPtr<Path> create(const Glib::ustring& description);
00187 
00188 
00189   inline Nodes nodes();
00190   inline const Nodes nodes() const;
00191 
00192   
00201   void add_move_to(int x, int y);
00202   
00210   void add_rel_move_to(int x, int y);
00211   
00219   void add_line_to(int x, int y);
00220   
00228   void add_rel_line_to(int x, int y);
00229   
00242   void add_curve_to(int x1, int y1, int x2, int y2, int x3, int y3);
00243   
00255   void add_rel_curve_to(int x1, int y1, int x2, int y2, int x3, int y3);
00256   
00263   void add_close();
00264   
00310   bool add_string(const Glib::ustring& str);
00311 
00312    
00318   Glib::ustring get_description() const;
00319   
00330   void set_description(const Glib::ustring& str);
00331 
00332   
00338   void add_cairo_path(const Glib::RefPtr<Cairo::Path>& path);
00339   
00345   void to_cairo_path(Glib::RefPtr<Cairo::Context>& context) const;
00346 
00347   
00352   void clear();
00353   
00363   guint get_position(double progress, Knot& position);
00364   
00370   guint get_length() const;
00371 
00372   #ifdef GLIBMM_PROPERTIES_ENABLED
00373 
00379   Glib::PropertyProxy<Glib::ustring> property_description() ;
00380 #endif //#GLIBMM_PROPERTIES_ENABLED
00381 
00382 #ifdef GLIBMM_PROPERTIES_ENABLED
00383 
00389   Glib::PropertyProxy_ReadOnly<Glib::ustring> property_description() const;
00390 #endif //#GLIBMM_PROPERTIES_ENABLED
00391 
00392   #ifdef GLIBMM_PROPERTIES_ENABLED
00393 
00399   Glib::PropertyProxy_ReadOnly<guint> property_length() const;
00400 #endif //#GLIBMM_PROPERTIES_ENABLED
00401 
00402 
00403 public:
00404 
00405 public:
00406   //C++ methods used to invoke GTK+ virtual functions:
00407 #ifdef GLIBMM_VFUNCS_ENABLED
00408 #endif //GLIBMM_VFUNCS_ENABLED
00409 
00410 protected:
00411   //GTK+ Virtual Functions (override these to change behaviour):
00412 #ifdef GLIBMM_VFUNCS_ENABLED
00413 #endif //GLIBMM_VFUNCS_ENABLED
00414 
00415   //Default Signal Handlers::
00416 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00417 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00418 
00419 
00420 };
00421 
00422 class Path::Nodes
00423 {
00424 private:
00425   friend class Clutter::Path;
00426 
00427   ClutterPath* path_;
00428 
00429   inline Nodes(const Path::Nodes& other) : path_ (other.path_) {}
00430   explicit inline Nodes(ClutterPath* path) : path_ (path) {}
00431   Nodes& operator=(const Path::Nodes&);
00432 
00433 public:
00434   typedef unsigned int      size_type;
00435   typedef int               difference_type;
00436   typedef PathNode          value_type;
00437   typedef const value_type  const_reference;
00438 
00439   class const_iterator;
00440   class iterator;
00441 
00442   class reference
00443   {
00444   private:
00445     friend class Path::Nodes;
00446     friend class Path::Nodes::iterator;
00447     friend class Path::Nodes::const_iterator;
00448 
00449     ClutterPath* path_;
00450     unsigned int index_;
00451 
00452     inline reference(ClutterPath* path, unsigned int index)
00453       : path_ (path), index_ (index) {}
00454 
00455     // disallow the address-of operator
00456     reference* operator&();
00457     const reference* operator&() const;
00458 
00459   public:
00460     reference& operator=(const PathNode& node);
00461     operator PathNode() const;
00462   };
00463 
00464   class const_iterator
00465   {
00466 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00467   protected:
00468     Path::Nodes::reference ref_;
00469 #endif
00470   public:
00471     typedef std::random_access_iterator_tag iterator_category;
00472     typedef PathNode                        value_type;
00473     typedef int                             difference_type;
00474     typedef const value_type                reference;
00475     typedef void                            pointer;
00476 
00477     inline const_iterator() : ref_ (0, 0) {}
00478 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00479     inline const_iterator(ClutterPath* path, unsigned int index)
00480       : ref_ (path, index) {}
00481 
00482     inline bool equal(const const_iterator& b) const
00483       { return (ref_.index_ == b.ref_.index_); }
00484 #endif
00485     reference operator*() const;
00486     reference operator[](difference_type i) const;
00487 
00488     inline const_iterator& operator++()    { ++ref_.index_; return *this; }
00489     inline const_iterator  operator++(int) { return const_iterator(ref_.path_, ref_.index_++); }
00490     inline const_iterator& operator--()    { --ref_.index_; return *this; }
00491     inline const_iterator  operator--(int) { return const_iterator(ref_.path_, ref_.index_--); }
00492   };
00493 
00494   class iterator : public const_iterator
00495   {
00496   public:
00497     typedef Path::Nodes::reference reference;
00498 
00499     inline iterator() {}
00500 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00501     inline iterator(ClutterPath* path, unsigned int index)
00502       : const_iterator(path, index) {}
00503 #endif
00504     inline reference operator*() const { return ref_; }
00505     inline reference operator[](difference_type i) const
00506       { return reference(ref_.path_, ref_.index_ + i); }
00507 
00508     inline iterator& operator++()    { ++ref_.index_; return *this; }
00509     inline iterator  operator++(int) { return iterator(ref_.path_, ref_.index_++); }
00510     inline iterator& operator--()    { --ref_.index_; return *this; }
00511     inline iterator  operator--(int) { return iterator(ref_.path_, ref_.index_--); }
00512   };
00513 
00514 #ifndef GLIBMM_HAVE_SUN_REVERSE_ITERATOR
00515   typedef std::reverse_iterator<iterator>       reverse_iterator;
00516   typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
00517 #else
00518   typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
00519                                 value_type, reference, void, ptrdiff_t> reverse_iterator;
00520   typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
00521                                 value_type, const_reference, void, ptrdiff_t> const_reverse_iterator;
00522 #endif
00523   size_type   size() const;
00524   inline bool empty() const { return (size() == 0); }
00525 
00526   inline iterator       begin()       { return iterator(path_, 0); }
00527   inline const_iterator begin() const { return const_iterator(path_, 0); }
00528   inline iterator       end()         { return iterator(path_, size()); }
00529   inline const_iterator end() const   { return const_iterator(path_, size()); }
00530 
00531   inline reverse_iterator       rbegin()       { return reverse_iterator(end()); }
00532   inline reverse_iterator       rend()         { return reverse_iterator(begin()); }
00533   inline const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
00534   inline const_reverse_iterator rend()   const { return const_reverse_iterator(begin()); }
00535 
00536   const_reference  operator[](size_type i) const;
00537   inline reference operator[](size_type i) { return reference(path_, i); }
00538 
00539   inline reference       front()       { return reference(path_, 0); }
00540   inline const_reference front() const { return (*this)[0]; }
00541   inline reference       back()        { return reference(path_, size() - 1); }
00542   inline const_reference back()  const { return (*this)[size() - 1]; }
00543 };
00544 
00546 inline bool operator==(const Path::Nodes::const_iterator& a, const Path::Nodes::const_iterator& b)
00547   { return a.equal(b); }
00548 
00550 inline bool operator!=(const Path::Nodes::const_iterator& a, const Path::Nodes::const_iterator& b)
00551   { return !a.equal(b); }
00552 
00553 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00554 inline Path::Nodes Path::nodes()
00555   { return Path::Nodes(gobj()); }
00556 
00557 inline const Path::Nodes Path::nodes() const
00558   { return Path::Nodes(const_cast<ClutterPath*>(gobj())); }
00559 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00560 
00561 } // namespace Clutter
00562 
00563 
00564 namespace Clutter
00565 {
00566 
00572 bool operator==(const PathNode& lhs, const PathNode& rhs);
00573 
00579 bool operator!=(const PathNode& lhs, const PathNode& rhs);
00580 
00581 
00582 } // namespace Clutter
00583 
00584 
00585 namespace Glib
00586 {
00587 
00592 Clutter::PathNode& wrap(ClutterPathNode* object);
00593 
00598 const Clutter::PathNode& wrap(const ClutterPathNode* object);
00599 
00600 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00601 template <>
00602 class Value<Clutter::PathNode> : public Glib::Value_Boxed<Clutter::PathNode>
00603 {};
00604 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00605 
00606 } // namespace Glib
00607 
00608 
00609 namespace Glib
00610 {
00619   Glib::RefPtr<Clutter::Path> wrap(ClutterPath* object, bool take_copy = false);
00620 }
00621 
00622 
00623 #endif /* _CLUTTERMM_PATH_H */
00624 

Generated on 7 Sep 2009 for cluttermm by  doxygen 1.6.1