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 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 
00028 #include <cluttermm/types.h>
00029 #include <glibmm/object.h>
00030 #include <clutter/clutter.h>
00031 
00032 
00033 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00034 typedef struct _ClutterPath ClutterPath;
00035 typedef struct _ClutterPathClass ClutterPathClass;
00036 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00037 
00038 
00039 namespace Clutter
00040 { class Path_Class; } // namespace Clutter
00041 namespace Clutter
00042 {
00043 
00057 enum PathNodeType
00058 {
00059   PATH_MOVE_TO = 0,
00060   PATH_LINE_TO = 1,
00061   PATH_CURVE_TO = 2,
00062   PATH_CLOSE = 3,
00063   PATH_RELATIVE = 32,
00064   PATH_REL_MOVE_TO = PATH_MOVE_TO | PATH_RELATIVE,
00065   PATH_REL_LINE_TO = PATH_LINE_TO | PATH_RELATIVE,
00066   PATH_REL_CURVE_TO = PATH_CURVE_TO | PATH_RELATIVE
00067 };
00068 
00070 inline PathNodeType operator|(PathNodeType lhs, PathNodeType rhs)
00071   { return static_cast<PathNodeType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
00072 
00074 inline PathNodeType operator&(PathNodeType lhs, PathNodeType rhs)
00075   { return static_cast<PathNodeType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
00076 
00078 inline PathNodeType operator^(PathNodeType lhs, PathNodeType rhs)
00079   { return static_cast<PathNodeType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
00080 
00082 inline PathNodeType operator~(PathNodeType flags)
00083   { return static_cast<PathNodeType>(~static_cast<unsigned>(flags)); }
00084 
00086 inline PathNodeType& operator|=(PathNodeType& lhs, PathNodeType rhs)
00087   { return (lhs = static_cast<PathNodeType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
00088 
00090 inline PathNodeType& operator&=(PathNodeType& lhs, PathNodeType rhs)
00091   { return (lhs = static_cast<PathNodeType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
00092 
00094 inline PathNodeType& operator^=(PathNodeType& lhs, PathNodeType rhs)
00095   { return (lhs = static_cast<PathNodeType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
00096 
00097 } // namespace Clutter
00098 
00099 
00100 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00101 namespace Glib
00102 {
00103 
00104 template <>
00105 class Value<Clutter::PathNodeType> : public Glib::Value_Flags<Clutter::PathNodeType>
00106 {
00107 public:
00108   static GType value_type() G_GNUC_CONST;
00109 };
00110 
00111 } // namespace Glib
00112 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00113 
00114 
00115 namespace Clutter
00116 {
00117 
00118 
00119 class PathNode
00120 {
00121   public:
00122 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00123   typedef PathNode CppObjectType;
00124   typedef ClutterPathNode BaseObjectType;
00125 
00126   static GType get_type() G_GNUC_CONST;
00127 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00128 
00129   PathNode();
00130 
00131   explicit PathNode(const ClutterPathNode* gobject); // always takes a copy
00132 
00134   ClutterPathNode*       gobj()       { return &gobject_; }
00135 
00137   const ClutterPathNode* gobj() const { return &gobject_; }
00138 
00139 protected:
00140   ClutterPathNode gobject_;
00141 
00142 private:
00143   
00144 public:
00145   typedef unsigned int  size_type;
00146   typedef int           difference_type;
00147 
00148   typedef Knot          value_type;
00149   typedef Knot&         reference;
00150   typedef const Knot&   const_reference;
00151 
00152   // Use plain pointers for simplicity.
00153   typedef Knot*         iterator;
00154   typedef const Knot*   const_iterator;
00155 
00156 #ifndef GLIBMM_HAVE_SUN_REVERSE_ITERATOR
00157   typedef std::reverse_iterator<iterator>       reverse_iterator;
00158   typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
00159 #else
00160   typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
00161                                 Knot, Knot&, Knot*, ptrdiff_t> reverse_iterator;
00162 
00163   typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
00164                                 Knot, const Knot&, const Knot*, ptrdiff_t> const_reverse_iterator;
00165 #endif
00166   explicit PathNode(PathNodeType type);
00167 
00168   size_type size() const;
00169   bool empty() const;
00170 
00171   iterator begin();
00172   iterator end();
00173   const_iterator begin() const;
00174   const_iterator end()   const;
00175 
00176   inline reverse_iterator       rbegin()       { return reverse_iterator(end()); }
00177   inline reverse_iterator       rend()         { return reverse_iterator(begin()); }
00178   inline const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
00179   inline const_reverse_iterator rend()   const { return const_reverse_iterator(begin()); }
00180 
00181   inline reference       front()       { return *begin();  }
00182   inline const_reference front() const { return *begin();  }
00183   inline reference       back()        { return *rbegin(); }
00184   inline const_reference back()  const { return *rbegin(); }
00185 
00186   inline reference       operator[](size_type i)       { return begin()[i]; }
00187   inline const_reference operator[](size_type i) const { return begin()[i]; }
00188 
00189 
00190 };
00191 
00192 
00193 class Path : public Glib::Object
00194 {
00195   
00196 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00197 
00198 public:
00199   typedef Path CppObjectType;
00200   typedef Path_Class CppClassType;
00201   typedef ClutterPath BaseObjectType;
00202   typedef ClutterPathClass BaseClassType;
00203 
00204 private:  friend class Path_Class;
00205   static CppClassType path_class_;
00206 
00207 private:
00208   // noncopyable
00209   Path(const Path&);
00210   Path& operator=(const Path&);
00211 
00212 protected:
00213   explicit Path(const Glib::ConstructParams& construct_params);
00214   explicit Path(ClutterPath* castitem);
00215 
00216 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00217 
00218 public:
00219   virtual ~Path();
00220 
00221 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00222   static GType get_type()      G_GNUC_CONST;
00223   static GType get_base_type() G_GNUC_CONST;
00224 #endif
00225 
00227   ClutterPath*       gobj()       { return reinterpret_cast<ClutterPath*>(gobject_); }
00228 
00230   const ClutterPath* gobj() const { return reinterpret_cast<ClutterPath*>(gobject_); }
00231 
00233   ClutterPath* gobj_copy();
00234 
00235 private:
00236 
00237   
00238 protected:
00239   Path();
00240   explicit Path(const Glib::ustring& description);
00241 
00242 public:
00243   class Nodes;
00244 
00245   
00246   static Glib::RefPtr<Path> create();
00247 
00248   
00249   static Glib::RefPtr<Path> create(const Glib::ustring& description);
00250 
00251 
00252   inline Nodes nodes();
00253   inline const Nodes nodes() const;
00254 
00255   
00256   void add_move_to(int x, int y);
00257   
00258   void add_rel_move_to(int x, int y);
00259   
00260   void add_line_to(int x, int y);
00261   
00262   void add_rel_line_to(int x, int y);
00263   
00264   void add_curve_to(int x1, int y1, int x2, int y2, int x3, int y3);
00265   
00266   void add_rel_curve_to(int x1, int y1, int x2, int y2, int x3, int y3);
00267   
00268   void add_close();
00269   
00270   bool add_string(const Glib::ustring& str);
00271 
00272    
00273   Glib::ustring get_description() const;
00274   
00275   void set_description(const Glib::ustring& str);
00276 
00277   
00278   guint get_length() const;
00279 
00280   //gtkmmproc error: description : property defs lookup failed.
00281   //gtkmmproc error: length : property defs lookup failed.
00282 
00283 
00284 public:
00285 
00286 public:
00287   //C++ methods used to invoke GTK+ virtual functions:
00288 #ifdef GLIBMM_VFUNCS_ENABLED
00289 #endif //GLIBMM_VFUNCS_ENABLED
00290 
00291 protected:
00292   //GTK+ Virtual Functions (override these to change behaviour):
00293 #ifdef GLIBMM_VFUNCS_ENABLED
00294 #endif //GLIBMM_VFUNCS_ENABLED
00295 
00296   //Default Signal Handlers::
00297 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00298 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00299 
00300 
00301 };
00302 
00303 class Path::Nodes
00304 {
00305 private:
00306   friend class Clutter::Path;
00307 
00308   ClutterPath* path_;
00309 
00310   inline Nodes(const Path::Nodes& other) : path_ (other.path_) {}
00311   explicit inline Nodes(ClutterPath* path) : path_ (path) {}
00312   Nodes& operator=(const Path::Nodes&);
00313 
00314 public:
00315   typedef unsigned int      size_type;
00316   typedef int               difference_type;
00317   typedef PathNode          value_type;
00318   typedef const value_type  const_reference;
00319 
00320   class const_iterator;
00321   class iterator;
00322 
00323   class reference
00324   {
00325   private:
00326     friend class Path::Nodes;
00327     friend class Path::Nodes::iterator;
00328     friend class Path::Nodes::const_iterator;
00329 
00330     ClutterPath* path_;
00331     unsigned int index_;
00332 
00333     inline reference(ClutterPath* path, unsigned int index)
00334       : path_ (path), index_ (index) {}
00335 
00336     // disallow the address-of operator
00337     reference* operator&();
00338     const reference* operator&() const;
00339 
00340   public:
00341     reference& operator=(const PathNode& node);
00342     operator PathNode() const;
00343   };
00344 
00345   class const_iterator
00346   {
00347 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00348   protected:
00349     Path::Nodes::reference ref_;
00350 #endif
00351   public:
00352     typedef std::random_access_iterator_tag iterator_category;
00353     typedef PathNode                        value_type;
00354     typedef int                             difference_type;
00355     typedef const value_type                reference;
00356     typedef void                            pointer;
00357 
00358     inline const_iterator() : ref_ (0, 0) {}
00359 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00360     inline const_iterator(ClutterPath* path, unsigned int index)
00361       : ref_ (path, index) {}
00362 
00363     inline bool equal(const const_iterator& b) const
00364       { return (ref_.index_ == b.ref_.index_); }
00365 #endif
00366     reference operator*() const;
00367     reference operator[](difference_type i) const;
00368 
00369     inline const_iterator& operator++()    { ++ref_.index_; return *this; }
00370     inline const_iterator  operator++(int) { return const_iterator(ref_.path_, ref_.index_++); }
00371     inline const_iterator& operator--()    { --ref_.index_; return *this; }
00372     inline const_iterator  operator--(int) { return const_iterator(ref_.path_, ref_.index_--); }
00373   };
00374 
00375   class iterator : public const_iterator
00376   {
00377   public:
00378     typedef Path::Nodes::reference reference;
00379 
00380     inline iterator() {}
00381 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00382     inline iterator(ClutterPath* path, unsigned int index)
00383       : const_iterator(path, index) {}
00384 #endif
00385     inline reference operator*() const { return ref_; }
00386     inline reference operator[](difference_type i) const
00387       { return reference(ref_.path_, ref_.index_ + i); }
00388 
00389     inline iterator& operator++()    { ++ref_.index_; return *this; }
00390     inline iterator  operator++(int) { return iterator(ref_.path_, ref_.index_++); }
00391     inline iterator& operator--()    { --ref_.index_; return *this; }
00392     inline iterator  operator--(int) { return iterator(ref_.path_, ref_.index_--); }
00393   };
00394 
00395 #ifndef GLIBMM_HAVE_SUN_REVERSE_ITERATOR
00396   typedef std::reverse_iterator<iterator>       reverse_iterator;
00397   typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
00398 #else
00399   typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
00400                                 value_type, reference, void, ptrdiff_t> reverse_iterator;
00401   typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
00402                                 value_type, const_reference, void, ptrdiff_t> const_reverse_iterator;
00403 #endif
00404   size_type   size() const;
00405   inline bool empty() const { return (size() == 0); }
00406 
00407   inline iterator       begin()       { return iterator(path_, 0); }
00408   inline const_iterator begin() const { return const_iterator(path_, 0); }
00409   inline iterator       end()         { return iterator(path_, size()); }
00410   inline const_iterator end() const   { return const_iterator(path_, size()); }
00411 
00412   inline reverse_iterator       rbegin()       { return reverse_iterator(end()); }
00413   inline reverse_iterator       rend()         { return reverse_iterator(begin()); }
00414   inline const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
00415   inline const_reverse_iterator rend()   const { return const_reverse_iterator(begin()); }
00416 
00417   const_reference  operator[](size_type i) const;
00418   inline reference operator[](size_type i) { return reference(path_, i); }
00419 
00420   inline reference       front()       { return reference(path_, 0); }
00421   inline const_reference front() const { return (*this)[0]; }
00422   inline reference       back()        { return reference(path_, size() - 1); }
00423   inline const_reference back()  const { return (*this)[size() - 1]; }
00424 };
00425 
00427 inline bool operator==(const Path::Nodes::const_iterator& a, const Path::Nodes::const_iterator& b)
00428   { return a.equal(b); }
00429 
00431 inline bool operator!=(const Path::Nodes::const_iterator& a, const Path::Nodes::const_iterator& b)
00432   { return !a.equal(b); }
00433 
00434 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00435 inline Path::Nodes Path::nodes()
00436   { return Path::Nodes(gobj()); }
00437 
00438 inline const Path::Nodes Path::nodes() const
00439   { return Path::Nodes(const_cast<ClutterPath*>(gobj())); }
00440 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00441 
00442 } // namespace Clutter
00443 
00444 
00445 namespace Clutter
00446 {
00447 
00453 bool operator==(const PathNode& lhs, const PathNode& rhs);
00454 
00460 bool operator!=(const PathNode& lhs, const PathNode& rhs);
00461 
00462 
00463 } // namespace Clutter
00464 
00465 
00466 namespace Glib
00467 {
00468 
00473 Clutter::PathNode& wrap(ClutterPathNode* object);
00474 
00479 const Clutter::PathNode& wrap(const ClutterPathNode* object);
00480 
00481 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00482 template <>
00483 class Value<Clutter::PathNode> : public Glib::Value_Boxed<Clutter::PathNode>
00484 {};
00485 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00486 
00487 } // namespace Glib
00488 
00489 
00490 namespace Glib
00491 {
00500   Glib::RefPtr<Clutter::Path> wrap(ClutterPath* object, bool take_copy = false);
00501 }
00502 
00503 
00504 #endif /* _CLUTTERMM_PATH_H */
00505 

Generated on Tue Jan 6 23:01:13 2009 for cluttermm by  doxygen 1.5.6