[cluttermm] SnapConstraint class added



commit d0cfff5b1c0f2a4e33fcf06a5be2789b301f1a0f
Author: Ian Martin <martin_id vodafone co nz>
Date:   Thu Mar 27 21:45:21 2014 +1300

    SnapConstraint class added
    
    Adds the SnapConstraint class and updates the build files.

 clutter/cluttermm.h                              |    1 +
 clutter/src/clutter_methods.defs                 |   18 ++++--
 clutter/src/filelist.am                          |    1 +
 clutter/src/snap-constraint.ccg                  |   24 +++++++
 clutter/src/snap-constraint.hg                   |   75 ++++++++++++++++++++++
 codegen/extradefs/generate_extra_defs_clutter.cc |    1 +
 codegen/m4/convert_clutter.m4                    |    1 +
 7 files changed, 115 insertions(+), 6 deletions(-)
---
diff --git a/clutter/cluttermm.h b/clutter/cluttermm.h
index 2de695d..7ba6d93 100644
--- a/clutter/cluttermm.h
+++ b/clutter/cluttermm.h
@@ -110,6 +110,7 @@
 #include <cluttermm/shader.h>
 #include <cluttermm/shader-effect.h>
 #include <cluttermm/size.h>
+#include <cluttermm/snap-constraint.h>
 #include <cluttermm/stage.h>
 #include <cluttermm/text.h>
 #include <cluttermm/texture.h>
diff --git a/clutter/src/clutter_methods.defs b/clutter/src/clutter_methods.defs
index 9a3e19f..f1c09d4 100644
--- a/clutter/src/clutter_methods.defs
+++ b/clutter/src/clutter_methods.defs
@@ -8191,7 +8191,8 @@
   )
 )
 
-(define-function clutter_snap_constraint_set_source
+(define-method set_source
+  (of-object "ClutterSnapConstraint")
   (c-name "clutter_snap_constraint_set_source")
   (return-type "none")
   (parameters
@@ -8199,14 +8200,16 @@
   )
 )
 
-(define-function clutter_snap_constraint_get_source
+(define-method get_source
+  (of-object "ClutterSnapConstraint")
   (c-name "clutter_snap_constraint_get_source")
   (return-type "ClutterActor*")
   (parameters
   )
 )
 
-(define-function clutter_snap_constraint_set_edges
+(define-method set_edges
+  (of-object "ClutterSnapConstraint")
   (c-name "clutter_snap_constraint_set_edges")
   (return-type "none")
   (parameters
@@ -8215,7 +8218,8 @@
   )
 )
 
-(define-function clutter_snap_constraint_get_edges
+(define-method get_edges
+  (of-object "ClutterSnapConstraint")
   (c-name "clutter_snap_constraint_get_edges")
   (return-type "none")
   (parameters
@@ -8224,7 +8228,8 @@
   )
 )
 
-(define-function clutter_snap_constraint_set_offset
+(define-method set_offset
+  (of-object "ClutterSnapConstraint")
   (c-name "clutter_snap_constraint_set_offset")
   (return-type "none")
   (parameters
@@ -8232,7 +8237,8 @@
   )
 )
 
-(define-function clutter_snap_constraint_get_offset
+(define-method get_offset
+  (of-object "ClutterSnapConstraint")
   (c-name "clutter_snap_constraint_get_offset")
   (return-type "gfloat")
   (parameters
diff --git a/clutter/src/filelist.am b/clutter/src/filelist.am
index 80949ce..25c2c1e 100644
--- a/clutter/src/filelist.am
+++ b/clutter/src/filelist.am
@@ -66,6 +66,7 @@ files_hg =                    \
        shader.hg               \
        shader-effect.hg \
        size.hg                 \
+  snap-constraint.hg \
        stage.hg                \
        text.hg                 \
        texture.hg              \
diff --git a/clutter/src/snap-constraint.ccg b/clutter/src/snap-constraint.ccg
new file mode 100644
index 0000000..760c017
--- /dev/null
+++ b/clutter/src/snap-constraint.ccg
@@ -0,0 +1,24 @@
+/* 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 <clutter/clutter.h>
+#include <cluttermm/actor.h>
+
+namespace Clutter
+{
+
+} //namespace Clutter
diff --git a/clutter/src/snap-constraint.hg b/clutter/src/snap-constraint.hg
new file mode 100644
index 0000000..3f3e5d5
--- /dev/null
+++ b/clutter/src/snap-constraint.hg
@@ -0,0 +1,75 @@
+/* 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 <cluttermm/types.h>
+#include <cluttermm/constraint.h>
+
+_DEFS(cluttermm,clutter)
+_PINCLUDE(cluttermm/private/constraint_p.h)
+
+
+namespace Clutter
+{
+
+class Actor;
+class Constraint;
+
+_WRAP_ENUM(SnapEdge, ClutterSnapEdge)
+
+/** SnapConstraint is a constraint the snaps the edges of two actors
+ * together, expanding the actor's allocation if necessary.
+ *
+ * An offset can be applied to the constraint, to provide spacing.
+ *
+ * @newin{1,6}
+ */
+class SnapConstraint : public Constraint
+{
+  _CLASS_GOBJECT(SnapConstraint, ClutterSnapConstraint, CLUTTER_SNAP_CONSTRAINT, Constraint, 
ClutterConstraint)
+  _DERIVES_INITIALLY_UNOWNED()
+
+protected:
+  _WRAP_CTOR(SnapConstraint(const Glib::RefPtr<Actor>& source, SnapEdge from_edge, SnapEdge to_edge, float 
offset), clutter_snap_constraint_new)
+
+public:
+
+  _WRAP_CREATE(const Glib::RefPtr<Actor>& source, SnapEdge from_edge, SnapEdge to_edge, float offset)
+
+  _WRAP_METHOD(void set_source(const Glib::RefPtr<Actor>& source), clutter_snap_constraint_set_source)
+
+  _WRAP_METHOD(Glib::RefPtr<Actor> get_source(), clutter_snap_constraint_get_source, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const Actor> get_source() const, clutter_snap_constraint_get_source, refreturn, 
constversion)
+
+  _WRAP_METHOD(void set_edges(SnapEdge from_edge, SnapEdge to_edge), clutter_snap_constraint_set_edges)
+
+  //TODO : using two enum return parameters.
+  //~ _WRAP_METHOD_DOCS_ONLY(clutter_snap_constraint_get_edges)
+  //~ void get_edges(SnapEdge* from_edge, SnapEdge* to_edge) const;
+
+  _WRAP_METHOD(void set_offset(float offset), clutter_snap_constraint_set_offset)
+
+  _WRAP_METHOD(float get_offset() const, clutter_snap_constraint_get_offset)
+
+  _WRAP_PROPERTY("from-edge", SnapEdge)
+  _WRAP_PROPERTY("offset", float)
+  _WRAP_PROPERTY("source", Glib::RefPtr<Actor>)
+  _WRAP_PROPERTY("to-edge", SnapEdge)
+
+};
+
+} // namespace Clutter
diff --git a/codegen/extradefs/generate_extra_defs_clutter.cc 
b/codegen/extradefs/generate_extra_defs_clutter.cc
index 65ab619..83b3b05 100644
--- a/codegen/extradefs/generate_extra_defs_clutter.cc
+++ b/codegen/extradefs/generate_extra_defs_clutter.cc
@@ -70,6 +70,7 @@ int main(int argc, char** argv)
     << get_defs(CLUTTER_TYPE_RECTANGLE)
     << get_defs(CLUTTER_TYPE_SCORE)
     << get_defs(CLUTTER_TYPE_SCRIPT)
+    << get_defs(CLUTTER_TYPE_SNAP_CONSTRAINT)
     << get_defs(CLUTTER_TYPE_STAGE)
     << get_defs(CLUTTER_TYPE_TEXT)
     << get_defs(CLUTTER_TYPE_TEXTURE)
diff --git a/codegen/m4/convert_clutter.m4 b/codegen/m4/convert_clutter.m4
index dbedd66..66c1f92 100644
--- a/codegen/m4/convert_clutter.m4
+++ b/codegen/m4/convert_clutter.m4
@@ -187,6 +187,7 @@ _CONV_ENUM(Clutter,RotateAxis)
 _CONV_ENUM(Clutter,RotateDirection)
 _CONV_ENUM(Clutter,ScalingFilter)
 _CONV_ENUM(Clutter,ShaderType)
+_CONV_ENUM(Clutter,SnapEdge)
 _CONV_ENUM(Clutter,StaticColor)
 _CONV_ENUM(Clutter,TextDirection)
 _CONV_ENUM(Clutter,TextureFlags)


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