[cluttermm] Animatable: Add interpolate_value_value() and use it in the templated method.



commit a953effa4e13d727ac3aee82c1507ca8359b3824
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Mar 19 10:49:58 2014 +0100

    Animatable: Add interpolate_value_value() and use it in the templated method.
    
    Also correct the constness of the Interval.

 clutter/src/animatable.hg     |   20 +++++++++++---------
 clutter/src/animation.hg      |    2 ++
 codegen/m4/convert_clutter.m4 |    2 +-
 3 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/clutter/src/animatable.hg b/clutter/src/animatable.hg
index f89e579..e3afc22 100644
--- a/clutter/src/animatable.hg
+++ b/clutter/src/animatable.hg
@@ -33,6 +33,7 @@ typedef struct _ClutterAnimatableIface ClutterAnimatableIface;
 
 namespace Clutter
 {
+
 class Interval;
 
 class Animatable : public Glib::Interface
@@ -47,7 +48,8 @@ public:
 
   _WRAP_METHOD(void get_initial_state_value(const Glib::ustring& property_name, Glib::ValueBase& value) 
const, clutter_animatable_get_initial_state, constversion)
   _WRAP_METHOD(void set_final_state_value(const Glib::ustring& property_name, const Glib::ValueBase& value), 
clutter_animatable_set_final_state)
-  //_WRAP_METHOD(void interpolate_value(const Glib::ustring& property_name, Glib::RefPtr<Interval>& 
interval, double progress, Glib::ValueBase& value), clutter_animatable_interpolate_value)
+
+  _WRAP_METHOD(void interpolate_value_value(const Glib::ustring& property_name, const Glib::RefPtr<const 
Interval>& interval, double progress, Glib::ValueBase& value), clutter_animatable_interpolate_value)
 
   /**
    * Gets the initial state of an animation
@@ -71,7 +73,7 @@ public:
   //TODO: Documentation
   template <class ValueType>
   bool interpolate(const Glib::ustring& property_name,
-    Glib::RefPtr<Interval>& interval,
+    const Glib::RefPtr<const Interval>& interval,
     double progress,
     ValueType& gvalue);
 
@@ -84,7 +86,7 @@ protected:
   _WRAP_VFUNC(void set_final_state(const Glib::ustring& property_name, const Glib::ValueBase& value), 
set_final_state)
 
   //TODO: this function doesn't wrap.  removed from build for the present.
-  //_WRAP_VFUNC(bool interpolate_value(const Glib::ustring& property_name, Glib::RefPtr<Interval> interval, 
double progress, Glib::ValueBase& value), interpolate_value)
+  //_WRAP_VFUNC(bool interpolate_value(const Glib::ustring& property_name, const Glib::RefPtr<const 
Interval>& interval, double progress, Glib::ValueBase& value), interpolate_value)
 };
 
 
@@ -110,7 +112,7 @@ void Animatable::set_final_state(const Glib::ustring& property_name, const Value
 
 template <class ValueType>
 bool Animatable::interpolate(const Glib::ustring& property_name,
-  Glib::RefPtr<Interval>& interval,
+  const Glib::RefPtr<const Interval>& interval,
   double progress,
   ValueType& gvalue)
 {
@@ -118,12 +120,12 @@ bool Animatable::interpolate(const Glib::ustring& property_name,
   glibmm_g_value.init(Glib::Value<ValueType>::value_type());
   glibmm_g_value.set(gvalue);
 
-  const bool out = clutter_animatable_interpolate_value(
-    const_cast<ClutterAnimatable*>(gobj()),
-    property_name.c_str(),
-    interval->gobj(),
+  const bool out = interpolate_value_value(
+    gobj(),
+    property_name,
+    interval,
     progress,
-    glibmm_g_value.gobj());
+    glibmm_g_value);
 
   gvalue = glibmm_g_value.get();
   return out;
diff --git a/clutter/src/animation.hg b/clutter/src/animation.hg
index 1ea8aaf..b3ea9a3 100644
--- a/clutter/src/animation.hg
+++ b/clutter/src/animation.hg
@@ -65,6 +65,8 @@ public:
   //TODO: Add templated update().
 
   _WRAP_METHOD(void unbind_property(const std::string& property_name), clutter_animation_unbind_property)
+
+  //This needs at least a comment about the constness, though this is deprecated anyway.
   _WRAP_METHOD(Glib::RefPtr<Interval> get_interval(const std::string& property_name) const, 
clutter_animation_get_interval)
 
   _WRAP_SIGNAL(void started(), "started")
diff --git a/codegen/m4/convert_clutter.m4 b/codegen/m4/convert_clutter.m4
index 8e45e36..6c67f43 100644
--- a/codegen/m4/convert_clutter.m4
+++ b/codegen/m4/convert_clutter.m4
@@ -53,7 +53,7 @@ _CONVERSION(`ClutterEffect*',`Glib::RefPtr<Effect>',`Glib::wrap($3)')
 _CONVERSION(`ClutterEffect*',`Glib::RefPtr<const Effect>',`Glib::wrap($3)')
 
 _CONVERSION(`const Glib::RefPtr<Interval>&',`ClutterInterval*',__CONVERT_REFPTR_TO_P)
-_CONVERSION(`Glib::RefPtr<Interval>&',`ClutterInterval*',__CONVERT_REFPTR_TO_P)
+_CONVERSION(`const Glib::RefPtr<const Interval>&',`ClutterInterval*',__CONVERT_CONST_REFPTR_TO_P)
 _CONVERSION(`ClutterInterval*',`Glib::RefPtr<Interval>',`Glib::wrap($3)')
 _CONVERSION(`ClutterInterval*',`Glib::RefPtr<const Interval>',`Glib::wrap($3)')
 


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