[gtkmm] Gdk::Rectangle: Add operator==().
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Gdk::Rectangle: Add operator==().
- Date: Fri, 20 Nov 2015 12:13:50 +0000 (UTC)
commit 4822f6bc25e8981f4ab2a82846f02c99d5e76d7a
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Nov 20 13:13:07 2015 +0100
Gdk::Rectangle: Add operator==().
Using the new gdk_rectangle_equal().
gdk/src/rectangle.ccg | 10 ++++++++++
gdk/src/rectangle.hg | 5 +++++
2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/gdk/src/rectangle.ccg b/gdk/src/rectangle.ccg
index 599e80c..ec563d8 100644
--- a/gdk/src/rectangle.ccg
+++ b/gdk/src/rectangle.ccg
@@ -27,6 +27,16 @@ Rectangle::Rectangle(int x, int y, int width, int height)
gobject_.height = height;
}
+bool Rectangle::operator==(const Rectangle& src) const
+{
+ if(!gobj() && !src.gobj())
+ return true;
+ else if (!gobj() || !src.gobj())
+ return false;
+
+ return gdk_rectangle_equal(gobj(), src.gobj());
+}
+
// gdk_rectangle_union() and gdk_rectangle_intersect() work fine even if
// the destination points to one of the input rectangles. The join() and
// intersect() implementations rely on this ability.
diff --git a/gdk/src/rectangle.hg b/gdk/src/rectangle.hg
index 06772c3..d9fdbcd 100644
--- a/gdk/src/rectangle.hg
+++ b/gdk/src/rectangle.hg
@@ -36,6 +36,11 @@ public:
/** Creates a new rectangle instance with these dimensions.
*/
Rectangle(int x, int y, int width, int height);
+
+ /**
+ * @newin{3,20}
+ */
+ bool operator==(const Rectangle& src) const;
// 'union' is a C and C++ keyword. Can't be a method name.
/** Calculates the union of two rectangles, changing this rectangle.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]