[cluttermm] Adds Size class.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cluttermm] Adds Size class.
- Date: Fri, 21 Mar 2014 09:47:24 +0000 (UTC)
commit 8a6cf44c1e7072fc8b9d6bd392dd6b19941db3d1
Author: Ian Martin <martin_id vodafone co nz>
Date: Thu Mar 20 21:35:29 2014 +1300
Adds Size class.
clutter/src/types.ccg | 18 ++++++++++++++++++
clutter/src/types.hg | 29 +++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 0 deletions(-)
---
diff --git a/clutter/src/types.ccg b/clutter/src/types.ccg
index 733a640..b2b988e 100644
--- a/clutter/src/types.ccg
+++ b/clutter/src/types.ccg
@@ -116,4 +116,22 @@ Point::Point(double x, double y)
gobject_ = clutter_point_copy(point);
}
+Size::Size(float width, float height)
+{
+ gobject_.width = width;
+ gobject_.height = height;
+}
+
+Size::Size(int width, int height)
+{
+ gobject_.width = width;
+ gobject_.height = height;
+}
+
+Size::Size(double width, double height)
+{
+ gobject_.width = width;
+ gobject_.height = height;
+}
+
} // namespace Clutter
diff --git a/clutter/src/types.hg b/clutter/src/types.hg
index 2ce1e15..6e889e3 100644
--- a/clutter/src/types.hg
+++ b/clutter/src/types.hg
@@ -118,6 +118,35 @@ public:
_MEMBER_SET(y, y, float, gfloat)
};
+/**
+ * A size in 2D space.
+ */
+class Size
+{
+ _CLASS_BOXEDTYPE_STATIC(Size, ClutterSize, clutter_size_alloc, clutter_size_copy, clutter_size_free)
+public:
+ explicit Size(float width = 0, float height = 0);
+
+ //Prevents ambiguous calls to Size(ClutterSize*, bool)
+ Size(int width, int height);
+
+ /**
+ * Prevents calls to Size(double, double) being ambiguous.
+ * N.B. this will convert the input to floats, and rounding
+ * errors are possible.
+ */
+ Size(double width, double height);
+
+ _IGNORE(clutter_size_init, clutter_size_alloc, clutter_size_copy, clutter_size_free)
+
+ _WRAP_EQUAL(clutter_size_equals)
+ _MEMBER_GET(width, width, float, float)
+ _MEMBER_GET(height, height, float, float)
+ _MEMBER_SET(width, width, float, float)
+ _MEMBER_SET(height, height, float, float)
+
+};
+
class Knot
{
_CLASS_BOXEDTYPE(Knot, ClutterKnot, NONE, clutter_knot_copy, clutter_knot_free)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]