summaryrefslogtreecommitdiff
path: root/src/rect.cpp
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2009-02-25 22:21:32 +0100
committerDanny Baumann <dannybaumann@web.de>2009-02-25 22:21:32 +0100
commit3bc294c294658a5727f573bd3d3f15465e59fa31 (patch)
tree20a0d5b456bcada8ff979ae09905a120620eddd6 /src/rect.cpp
parentdd4b2a4494860deb253d0cd516b012c8a8307073 (diff)
downloadunity-window-decorator-3bc294c294658a5727f573bd3d3f15465e59fa31.tar.gz
unity-window-decorator-3bc294c294658a5727f573bd3d3f15465e59fa31.tar.bz2
Add contains method that determines if a rect contains a given point.
Diffstat (limited to 'src/rect.cpp')
-rw-r--r--src/rect.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/rect.cpp b/src/rect.cpp
index 38ea292..ee51ffd 100644
--- a/src/rect.cpp
+++ b/src/rect.cpp
@@ -86,6 +86,21 @@ CompRect::setGeometry (int x1, int x2, int y1, int y2)
}
bool
+CompRect::contains (const CompPoint& point) const
+{
+ if (point.x () < x1 ())
+ return false;
+ if (point.x () > x2 ())
+ return false;
+ if (point.y () < y1 ())
+ return false;
+ if (point.y () > y2 ())
+ return false;
+
+ return true;
+}
+
+bool
CompRect::operator== (const CompRect &rect) const
{
if (mRegion.extents.x1 != rect.mRegion.extents.x1)