[cluttermm] Point class added
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cluttermm] Point class added
- Date: Thu, 13 Mar 2014 10:10:49 +0000 (UTC)
commit f64556be80ac59867408cecb661bf8edb9b0388d
Author: Ian Martin <martin_id vodafone co nz>
Date: Tue Mar 11 23:09:24 2014 +1300
Point class added
clutter/src/types.ccg | 21 +++++++++++++++++++++
clutter/src/types.hg | 32 ++++++++++++++++++++++++++++++++
codegen/m4/convert_clutter.m4 | 7 +++++++
3 files changed, 60 insertions(+), 0 deletions(-)
---
diff --git a/clutter/src/types.ccg b/clutter/src/types.ccg
index a3cca94..733a640 100644
--- a/clutter/src/types.ccg
+++ b/clutter/src/types.ccg
@@ -95,4 +95,25 @@ void Geometry::set_size(guint width, guint height)
gobject_.height = height;
}
+Point::Point(float x, float y)
+{
+ ClutterPoint* point = clutter_point_alloc();
+ point = clutter_point_init(point, x, y);
+ gobject_ = clutter_point_copy(point);
+}
+
+Point::Point(int x, int y)
+{
+ ClutterPoint* point = clutter_point_alloc();
+ point = clutter_point_init(point, x, y);
+ gobject_ = clutter_point_copy(point);
+}
+
+Point::Point(double x, double y)
+{
+ ClutterPoint* point = clutter_point_alloc();
+ point = clutter_point_init(point, x, y);
+ gobject_ = clutter_point_copy(point);
+}
+
} // namespace Clutter
diff --git a/clutter/src/types.hg b/clutter/src/types.hg
index 63b4a48..095af73 100644
--- a/clutter/src/types.hg
+++ b/clutter/src/types.hg
@@ -80,6 +80,38 @@ public:
void set_size(guint width, guint height);
};
+class Point
+/** A Clutter::Point is a 2D point in space.
+ *
+ * It is used to return points, either in absolute coordinates or relative,
+ * depending on the method.
+ */
+{
+ _CLASS_BOXEDTYPE(Point, ClutterPoint, NONE, clutter_point_copy, clutter_point_free)
+ _IGNORE(clutter_point_init, clutter_point_copy, clutter_point_free)
+
+public:
+ /** Constructor.
+ */
+ explicit Point(float x, float y);
+ /**
+ * Overloaded constructor to prevent collision with Point(ClutterPoint*, bool)
+ * constructor
+ */
+ explicit Point(int x, int y);
+ explicit Point(double x, double y);
+
+ _WRAP_EQUAL(clutter_point_equals)
+
+ _WRAP_METHOD(float distance(const Point& b, float& x_distance, float& y_distance) const,
clutter_point_distance)
+
+ _MEMBER_GET(x, x, float, gfloat)
+ _MEMBER_GET(y, y, float, gfloat)
+ _MEMBER_SET(x, x, float, gfloat)
+ _MEMBER_SET(y, y, float, gfloat)
+
+};
+
class Knot
{
_CLASS_BOXEDTYPE(Knot, ClutterKnot, NONE, clutter_knot_copy, clutter_knot_free)
diff --git a/codegen/m4/convert_clutter.m4 b/codegen/m4/convert_clutter.m4
index c473dc3..342c7a7 100644
--- a/codegen/m4/convert_clutter.m4
+++ b/codegen/m4/convert_clutter.m4
@@ -105,6 +105,8 @@ _CONVERSION(`const Geometry&',`const ClutterGeometry*',`($3).gobj()')
_CONVERSION(`ClutterGeometry*',`const Geometry&',`Geometry($3)')
_CONVERSION(`const ClutterGeometry*',`const Geometry&',`Geometry($3)')
+_CONVERSION(`const Point&',`const ClutterPoint*',`($3).gobj()')
+
_EQUAL(`guint8',`guchar')
_EQUAL(`guint8*',`guchar*')
_EQUAL(`const guint8*',`const guchar*')
@@ -112,6 +114,11 @@ _EQUAL(`const guint8*',`const guchar*')
_CONVERSION(`guint8&',`guint8*',`&($3)')
_CONVERSION(`guint8*',`guint8&',`*($3)')
+_EQUAL(`float&',`gfloat')
+
+_CONVERSION(`float&', `gfloat*', `&($3)')
+_CONVERSION(`float&', `float*', `&($3)')
+
_EQUAL(ClutterUnit,Unit)
_CONVERSION(`Unit&',`ClutterUnit*',`&($3)')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]