gnomemm r1879 - in cluttermm/trunk: . clutter/src



Author: daniel
Date: Thu Dec 18 12:11:58 2008
New Revision: 1879
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1879&view=rev

Log:
* clutter/src/behaviour-path.{ccg,hg} (BehaviourPath): Switch to
the new Clutter::Path interface.

Modified:
   cluttermm/trunk/ChangeLog
   cluttermm/trunk/clutter/src/behaviour-path.ccg
   cluttermm/trunk/clutter/src/behaviour-path.hg

Modified: cluttermm/trunk/clutter/src/behaviour-path.ccg
==============================================================================
--- cluttermm/trunk/clutter/src/behaviour-path.ccg	(original)
+++ cluttermm/trunk/clutter/src/behaviour-path.ccg	Thu Dec 18 12:11:58 2008
@@ -20,21 +20,23 @@
 namespace Clutter
 {
 
-#if 0
-BehaviourPath::BehaviourPath(const Glib::RefPtr<Alpha>& alpha, const Glib::ArrayHandle<Knot>& knots)
-:
-  _CONSTRUCT("alpha", Glib::unwrap(alpha))
+// static
+Glib::RefPtr<BehaviourPath> BehaviourPath::create_with_knots(const Glib::RefPtr<Alpha>& alpha,
+                                                             const Glib::ArrayHandle<Knot>& knots)
 {
-  for(Glib::ArrayHandle<Knot>::const_iterator iter = knots.begin(); iter != knots.end(); ++ iter)
+  const Glib::RefPtr<Path> path = Path::create();
+  const Knot* data  = knots.data();
+  const int n_knots = knots.size();
+
+  if (n_knots > 0)
   {
-    append_knot(*iter);
+    clutter_path_add_move_to(path->gobj(), data[0].gobj()->x, data[0].gobj()->y);
+
+    for (int i = 1; i < n_knots; ++i)
+      clutter_path_add_line_to(path->gobj(), data[i].gobj()->x, data[i].gobj()->y);
   }
-}
 
-BehaviourPath::ListHandle_Knots BehaviourPath::get_knots() const
-{
-  return ListHandle_Knots(clutter_behaviour_path_get_knots(const_cast<ClutterBehaviourPath*>(gobj())), Glib::OWNERSHIP_SHALLOW);
+  return Glib::RefPtr<BehaviourPath>(new BehaviourPath(alpha, path));
 }
-#endif
-} //namespace Clutter
 
+} // namespace Clutter

Modified: cluttermm/trunk/clutter/src/behaviour-path.hg
==============================================================================
--- cluttermm/trunk/clutter/src/behaviour-path.hg	(original)
+++ cluttermm/trunk/clutter/src/behaviour-path.hg	Thu Dec 18 12:11:58 2008
@@ -18,49 +18,34 @@
 #include <cluttermm/behaviour.h>
 #include <cluttermm/scriptable.h>
 #include <cluttermm/alpha.h>
+#include <cluttermm/path.h>
 #include <cluttermm/types.h>
- 
+
 _DEFS(cluttermm,clutter)
 _PINCLUDE(cluttermm/private/behaviour_p.h)
 
 namespace Clutter
 {
 
-class BehaviourPath 
-: public Behaviour, 
+class BehaviourPath
+: public Behaviour,
   public Scriptable
 {
   _CLASS_GOBJECT(BehaviourPath, ClutterBehaviourPath, CLUTTER_BEHAVIOUR_PATH, Behaviour, ClutterBehaviour)
   _IMPLEMENTS_INTERFACE(Scriptable)
 
 protected:
-  // TODO: pass the knots as a C++ container
-  BehaviourPath(const Glib::RefPtr<Alpha>& alpha, const Glib::ArrayHandle<Knot>& knots);
-  _IGNORE(clutter_behaviour_path_new_with_knots)
+  _WRAP_CTOR(BehaviourPath(const Glib::RefPtr<Alpha>& alpha, const Glib::RefPtr<Path>& path),
+             clutter_behaviour_path_new)
 
 public:
-  // TODO: pass the knots as a C++ container
-  _WRAP_CREATE(const Glib::RefPtr<Alpha>& alpha, const Glib::ArrayHandle<Knot>& knots)
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-
-struct KnotTraits
-{
-  typedef Knot CppType;
-  typedef const ClutterKnot* CType;
-  typedef ClutterKnot* CTypeNonConst;
-
-  static CType to_c_type(const CppType& obj) { return obj.gobj(); }
-  static CType to_c_type(const CType& obj) { return obj; }
-  static CppType to_cpp_type(const CType& obj) { return Knot(obj); }
-  static void release_c_type(const CType& ) { }
-};
-
-#endif // DOXYGEN_SHOULD_SKIP_THIS
-
-//  typedef Glib::SListHandle<Knot, KnotTraits> ListHandle_Knots;
-//  _WRAP_METHOD_DOCS_ONLY(clutter_behaviour_path_get_knots)
-//  ListHandle_Knots get_knots() const;
+  _WRAP_CREATE(const Glib::RefPtr<Alpha>& alpha, const Glib::RefPtr<Path>& path)
+  _IGNORE(clutter_behaviour_path_new_with_knots,
+          clutter_behaviour_path_new_with_description)
+  static Glib::RefPtr<BehaviourPath> create_with_knots(const Glib::RefPtr<Alpha>& alpha,
+                                                       const Glib::ArrayHandle<Knot>& knots);
+  static Glib::RefPtr<BehaviourPath> create_with_description(const Glib::RefPtr<Alpha>& alpha,
+                                                             const Glib::ustring& description);
 
   _WRAP_SIGNAL(void knot_reached(guint knot_num), "knot_reached")
 };



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]