[cluttermm] Transitions class added.



commit 25f878b7ac1252361951fa898ab97b5500693f4d
Author: Ian Martin <martin_id vodafone co nz>
Date:   Thu Mar 27 13:21:38 2014 +1300

    Transitions class added.
    
    Adds the transitions class, including to the build and the conversions.

 clutter/cluttermm.h                              |    1 +
 clutter/src/filelist.am                          |    1 +
 clutter/src/transition.ccg                       |   26 +++++
 clutter/src/transition.hg                        |  119 ++++++++++++++++++++++
 codegen/extradefs/generate_extra_defs_clutter.cc |    1 +
 codegen/m4/convert_clutter.m4                    |    4 +
 6 files changed, 152 insertions(+), 0 deletions(-)
---
diff --git a/clutter/cluttermm.h b/clutter/cluttermm.h
index 6a63a90..fd8cafd 100644
--- a/clutter/cluttermm.h
+++ b/clutter/cluttermm.h
@@ -110,6 +110,7 @@
 #include <cluttermm/texture.h>
 #include <cluttermm/threads.h>
 #include <cluttermm/timeline.h>
+#include <cluttermm/transition.h>
 #include <cluttermm/types.h>
 
 #endif /* !CLUTTERMM_H_INCLUDED */
diff --git a/clutter/src/filelist.am b/clutter/src/filelist.am
index 148ad8a..af7c549 100644
--- a/clutter/src/filelist.am
+++ b/clutter/src/filelist.am
@@ -66,6 +66,7 @@ files_hg =                    \
        text.hg                 \
        texture.hg              \
        timeline.hg             \
+       transition.hg \
        types.hg
 
 files_ccg = $(files_hg:.hg=.ccg)
diff --git a/clutter/src/transition.ccg b/clutter/src/transition.ccg
new file mode 100644
index 0000000..3c95fc0
--- /dev/null
+++ b/clutter/src/transition.ccg
@@ -0,0 +1,26 @@
+/* Copyright (C) 2009 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>
+#include <cluttermm/interval.h>
+#include <cluttermm/animatable.h>
+
+
+namespace Clutter
+{
+
+} //namespace Clutter
diff --git a/clutter/src/transition.hg b/clutter/src/transition.hg
new file mode 100644
index 0000000..9b262b4
--- /dev/null
+++ b/clutter/src/transition.hg
@@ -0,0 +1,119 @@
+/* Copyright (C) 2014 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/object.h>
+#include <glibmm/ustring.h>
+#include <glibmm/value.h>
+#include <cluttermm/types.h>
+#include <cluttermm/timeline.h>
+#include <cluttermm/animatable.h>
+#include <cluttermm/interval.h>
+
+
+_DEFS(cluttermm,clutter)
+_PINCLUDE(cluttermm/private/timeline_p.h)
+
+namespace Clutter
+{
+
+/** Transition is an abstract subclass of Timeline that computes the
+ * interpolation between two values, stored by an Interval.
+ */
+class Transition
+  : public Timeline,
+    public Animatable
+{
+  _CLASS_GOBJECT(Transition, ClutterTransition, CLUTTER_TRANSITION, Timeline, ClutterTimeline)
+
+protected:
+  _CTOR_DEFAULT()
+
+public:
+  _WRAP_CREATE()
+
+  _WRAP_METHOD(void set_from_value(const Glib::ValueBase& value), clutter_transition_set_from_value)
+  _WRAP_METHOD(void set_to_value(const Glib::ValueBase& value), clutter_transition_set_to_value)
+
+  /**  Set the initial value of the transition.
+   *
+   * This is a convenience function that doesn't require creating a
+   * GValue to hold the value first.
+   * @param value the value to set the initial value to.
+   * @newin{1,12}
+   */
+  template <class ValueType>
+  void set_from(const ValueType& value);
+
+  /** Set the final value of the transition.
+   *
+   * This is a convenience function that doesn't require creating a
+   * GValue to hold the value first.
+   *
+   * @param value the value to set the final value to.
+   * @newin{1,12}
+   */
+  template <class ValueType>
+  void set_to(const ValueType& value);
+
+  _WRAP_METHOD(void set_interval(const Glib::RefPtr<Interval>& interval), clutter_transition_set_interval)
+
+  _WRAP_METHOD(Glib::RefPtr<Interval> get_interval(), clutter_transition_get_interval, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const Interval> get_interval() const, clutter_transition_get_interval, 
refreturn, constversion)
+
+  _WRAP_METHOD(void set_animatable(const Glib::RefPtr<Animatable>& animatable), 
clutter_transition_set_animatable)
+
+  _WRAP_METHOD(Glib::RefPtr<Animatable> get_animatable(), clutter_transition_get_animatable)
+  _WRAP_METHOD(Glib::RefPtr<const Animatable> get_animatable() const, clutter_transition_get_animatable)
+
+  _WRAP_METHOD(void set_remove_on_complete(bool remove_complete = true), 
clutter_transition_set_remove_on_complete)
+  _WRAP_METHOD(bool get_remove_on_complete() const, clutter_transition_get_remove_on_complete)
+
+  //Properties:
+  _WRAP_PROPERTY("animatable", Glib::RefPtr<Animatable>)
+  _WRAP_PROPERTY("interval", Glib::RefPtr<Interval>)
+  _WRAP_PROPERTY("remove-on-complete", bool)
+
+  //vfuncs:
+  _WRAP_VFUNC(void attached(const Glib::RefPtr<Animatable>& animatable), attached)
+  _WRAP_VFUNC(void detached(const Glib::RefPtr<Animatable>& animatable), detached)
+  _WRAP_VFUNC(void compute_value(const Glib::RefPtr<Animatable>& animatable, const Glib::RefPtr<Interval>& 
interval, double progress), compute_value)
+
+
+};
+
+template <class ValueType>
+void Transition::set_from(const ValueType& value)
+{
+  GType gtypeval = Glib::Value<ValueType>::value_type();
+  Glib::Value< ValueType > set_val;
+  set_val.init(gtypeval);
+
+  clutter_transition_set_from_value(gobj(), set_val.gobj());
+}
+
+
+template <class ValueType>
+void Transition::set_to(const ValueType& value)
+{
+  GType gtypeval = Glib::Value<ValueType>::value_type();
+  Glib::Value< ValueType > to_val;
+  to_val.init(gtypeval);
+
+  clutter_transition_set_to_value(this->gobj(), to_val.gobj());
+}
+
+} // namespace Clutter
diff --git a/codegen/extradefs/generate_extra_defs_clutter.cc 
b/codegen/extradefs/generate_extra_defs_clutter.cc
index e26757d..e63f615 100644
--- a/codegen/extradefs/generate_extra_defs_clutter.cc
+++ b/codegen/extradefs/generate_extra_defs_clutter.cc
@@ -69,6 +69,7 @@ int main(int argc, char** argv)
     << get_defs(CLUTTER_TYPE_TEXT)
     << get_defs(CLUTTER_TYPE_TEXTURE)
     << get_defs(CLUTTER_TYPE_TIMELINE)
+    << get_defs(CLUTTER_TYPE_TRANSITION)
     << get_defs(CLUTTER_TYPE_SCORE)
     << get_defs(CLUTTER_TYPE_SHADER)
     << get_defs(CLUTTER_TYPE_SCRIPT)
diff --git a/codegen/m4/convert_clutter.m4 b/codegen/m4/convert_clutter.m4
index 1ab2519..3aee15a 100644
--- a/codegen/m4/convert_clutter.m4
+++ b/codegen/m4/convert_clutter.m4
@@ -22,6 +22,10 @@ _CONVERSION(`const Glib::RefPtr<Alpha>&',`ClutterAlpha*',__CONVERT_REFPTR_TO_P)
 _CONVERSION(`ClutterAlpha*',`Glib::RefPtr<Alpha>',`Glib::wrap($3)')
 _CONVERSION(`ClutterAlpha*',`Glib::RefPtr<const Alpha>',`Glib::wrap($3)')
 
+_CONVERSION(`const Glib::RefPtr<Animatable>&',`ClutterAnimatable*',__CONVERT_REFPTR_TO_P)
+_CONVERSION(`ClutterAnimatable*',`Glib::RefPtr<Animatable>',`Glib::wrap($3)')
+_CONVERSION(`ClutterAnimatable*',`Glib::RefPtr<const Animatable>',`Glib::wrap($3)')
+
 _CONVERSION(`const Glib::RefPtr<Animation>&',`ClutterAnimation*',__CONVERT_REFPTR_TO_P)
 _CONVERSION(`ClutterAnimation*',`Glib::RefPtr<Animation>',`Glib::wrap($3)')
 _CONVERSION(`ClutterAnimation*',`Glib::RefPtr<const Animation>',`Glib::wrap($3)')


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