[cluttermm] Adds animatable class files.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cluttermm] Adds animatable class files.
- Date: Wed, 19 Mar 2014 09:50:37 +0000 (UTC)
commit f02de97e3c440dfaf3751284d9d3ee6e2a69459a
Author: Ian Martin <martin_id vodafone co nz>
Date: Sat Mar 15 12:21:01 2014 +1300
Adds animatable class files.
hg and ccg files added.
clutter/cluttermm.h | 1 +
clutter/src/animatable.ccg | 23 ++++
clutter/src/animatable.hg | 135 ++++++++++++++++++++++
clutter/src/clutter_vfuncs.defs | 39 ++++++
clutter/src/filelist.am | 1 +
codegen/extradefs/generate_extra_defs_clutter.cc | 1 +
codegen/m4/convert_clutter.m4 | 5 +
7 files changed, 205 insertions(+), 0 deletions(-)
---
diff --git a/clutter/cluttermm.h b/clutter/cluttermm.h
index 67731e0..47f8f07 100644
--- a/clutter/cluttermm.h
+++ b/clutter/cluttermm.h
@@ -58,6 +58,7 @@
#include <cluttermm/actor.h>
#include <cluttermm/actor-meta.h>
#include <cluttermm/alpha.h>
+#include <cluttermm/animatable.h>
#include <cluttermm/animation.h>
#include <cluttermm/animator.h>
#include <cluttermm/behaviour.h>
diff --git a/clutter/src/animatable.ccg b/clutter/src/animatable.ccg
new file mode 100644
index 0000000..b7dfc1b
--- /dev/null
+++ b/clutter/src/animatable.ccg
@@ -0,0 +1,23 @@
+/* Copyright (C) 2013 The cluttermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <clutter/clutter.h>
+
+namespace Clutter
+{
+
+} //namespace Clutter
diff --git a/clutter/src/animatable.hg b/clutter/src/animatable.hg
new file mode 100644
index 0000000..307a87e
--- /dev/null
+++ b/clutter/src/animatable.hg
@@ -0,0 +1,135 @@
+/* Copyright (C) 207 The cluttermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/interface.h>
+#include <glibmm/ustring.h>
+#include <glibmm/value.h>
+#include <cluttermm/interval.h>
+
+_DEFS(cluttermm,clutter)
+_PINCLUDE(glibmm/private/interface_p.h)
+
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+extern "C"
+{
+typedef struct _ClutterAnimatableIface ClutterAnimatableIface;
+}
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+namespace Clutter
+{
+class Interval;
+
+class Animatable : public Glib::Interface
+{
+ _CLASS_INTERFACE(Animatable, ClutterAnimatable, CLUTTER_ANIMATABLE, ClutterAnimatableIface)
+
+public:
+ //no constructor- virtual base class.
+
+ _WRAP_METHOD(GParamSpec* find_property(const Glib::ustring& property_name),
clutter_animatable_find_property)
+ _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)
+
+ /**
+ * Gets the initial state of an animation
+ *
+ * @param property_name the name of the animatable property to retrieve
+ * @param value the value of the property.
+ */
+ template <class ValueType>
+ void get_initial_state(const Glib::ustring& property_name, ValueType& value) const;
+
+ /**
+ * Sets the final state for an animation.
+ *
+ * @param property_name the name of the animatable property to set.
+ * @param gvalue a value of the appropriate type.
+ */
+ template <class ValueType>
+ void set_final_state(const Glib::ustring& property_name,
+ const ValueType& gvalue);
+
+
+ template <class ValueType>
+ bool interpolate(const Glib::ustring& property_name,
+ Glib::RefPtr<Interval>& interval,
+ double progress,
+ ValueType& gvalue);
+protected:
+
+ _WRAP_VFUNC(GParamSpec* find_property(const Glib::ustring& property_name), find_property)
+ _WRAP_VFUNC(void get_initial_state(const Glib::ustring& property_name, Glib::ValueBase& value),
get_initial_state)
+ _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)
+
+};
+
+
+template <class ValueType>
+void Animatable::get_initial_state(const Glib::ustring& property_name, ValueType& value) const
+{
+ Glib::Value<ValueType> glibmm_g_value;
+ glibmm_g_value.init(Glib::Value<ValueType>::value_type());
+
+ get_initial_state(property_name, glibmm_g_value);
+ value = glibmm_g_value.get();
+ return;
+}
+
+template <class ValueType>
+ void Animatable::set_final_state(const Glib::ustring& property_name,
+ const ValueType& gvalue)
+{
+ Glib::Value<ValueType> glibmm_g_value;
+ glibmm_g_value.init(Glib::Value<ValueType>::value_type());
+ glibmm_g_value.set(gvalue);
+
+ set_final_state(property_name, glibmm_g_value);
+
+ return;
+}
+
+template <class ValueType>
+bool Animatable::interpolate(const Glib::ustring& property_name,
+ Glib::RefPtr<Interval>& interval,
+ double progress,
+ ValueType& gvalue)
+{
+ //Need to cast away const:
+ ClutterAnimatable* animatable_ptr = const_cast<ClutterAnimatable*>(gobj());
+
+ Glib::Value<ValueType> glibmm_g_value;
+ glibmm_g_value.init(Glib::Value<ValueType>::value_type());
+ glibmm_g_value.set(gvalue);
+
+ bool out = clutter_animatable_interpolate_value(
+ animatable_ptr,
+ property_name.c_str(),
+ interval->gobj(),
+ progress,
+ glibmm_g_value.gobj());
+
+ gvalue = glibmm_g_value.get();
+ return out;
+
+}
+
+} // namespace Clutter
diff --git a/clutter/src/clutter_vfuncs.defs b/clutter/src/clutter_vfuncs.defs
index 8fd0009..eee8a31 100644
--- a/clutter/src/clutter_vfuncs.defs
+++ b/clutter/src/clutter_vfuncs.defs
@@ -1,3 +1,42 @@
+;ClutterAnimatable
+
+(define-vfunc find_property
+ (of-object "ClutterAnimatable")
+ (return-type "GParamSpec*")
+ (parameters
+ '("const-gchar*" "property_name")
+ )
+)
+
+(define-vfunc get_initial_state
+ (of-object "ClutterAnimatable")
+ (return-type "void")
+ (parameters
+ '("const-gchar*" "property_name")
+ '("GValue*" "value")
+ )
+)
+
+(define-vfunc set_final_state
+ (of-object "ClutterAnimatable")
+ (return-type "void")
+ (parameters
+ '("const-gchar*" "property_name")
+ '("const-GValue*" "value")
+ )
+)
+
+(define-vfunc interpolate_value
+ (of-object "ClutterAnimatable")
+ (return-type "gboolean")
+ (parameters
+ '("const gchar*" "property_name")
+ '("ClutterInterval*" "interval")
+ '("gdouble" "progress")
+ '("GValue*" "value")
+ )
+)
+
; ClutterLayout
(define-vfunc get_layout_flags
diff --git a/clutter/src/filelist.am b/clutter/src/filelist.am
index 5c57792..4386a1e 100644
--- a/clutter/src/filelist.am
+++ b/clutter/src/filelist.am
@@ -15,6 +15,7 @@ files_hg = \
actor-meta.hg \
action.hg \
alpha.hg \
+ animatable.hg \
animation.hg \
animator.hg \
backend.hg \
diff --git a/codegen/extradefs/generate_extra_defs_clutter.cc
b/codegen/extradefs/generate_extra_defs_clutter.cc
index 76f1d6e..e26757d 100644
--- a/codegen/extradefs/generate_extra_defs_clutter.cc
+++ b/codegen/extradefs/generate_extra_defs_clutter.cc
@@ -29,6 +29,7 @@ int main(int argc, char** argv)
<< get_defs(CLUTTER_TYPE_ACTOR_META)
<< get_defs(CLUTTER_TYPE_ACTION)
<< get_defs(CLUTTER_TYPE_ALPHA)
+ << get_defs(CLUTTER_TYPE_ANIMATABLE)
<< get_defs(CLUTTER_TYPE_ANIMATION)
<< get_defs(CLUTTER_TYPE_ANIMATOR)
<< get_defs(CLUTTER_TYPE_BACKEND)
diff --git a/codegen/m4/convert_clutter.m4 b/codegen/m4/convert_clutter.m4
index 342c7a7..8e45e36 100644
--- a/codegen/m4/convert_clutter.m4
+++ b/codegen/m4/convert_clutter.m4
@@ -4,6 +4,10 @@ _CONVERSION(`const Glib::RefPtr<const Actor>&',`ClutterActor*',__CONVERT_CONST_R
_CONVERSION(`ClutterActor*',`Glib::RefPtr<Actor>',`Glib::wrap($3)')
_CONVERSION(`ClutterActor*',`Glib::RefPtr<const Actor>',`Glib::wrap($3)')
+dnl ValueBase
+_CONVERSION(`Glib::ValueBase&',`GValue*',`($3).gobj()')
+_CONVERSION(`const Glib::ValueBase&',`const GValue*',`($3).gobj()')
+
_CONVERSION(`const Glib::RefPtr<Action>&',`ClutterAction*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<const Action>&',`ClutterAction*',__CONVERT_CONST_REFPTR_TO_P)
@@ -49,6 +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(`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]