]> git.saurik.com Git - wxWidgets.git/commitdiff
added wxRect::Inside(wxRect) for testing if a rectangle is completely within another...
authorVáclav Slavík <vslavik@fastmail.fm>
Tue, 8 Aug 2006 14:21:44 +0000 (14:21 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Tue, 8 Aug 2006 14:21:44 +0000 (14:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40521 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/rect.tex
include/wx/gdicmn.h
src/common/gdicmn.cpp

index 8e6b9fe02d9d988c7acdfa1b585af3b4d7f66594..f94ab4fc958d06f4952577fba6680b2b9c2a9960 100644 (file)
@@ -243,6 +243,10 @@ means:
 Returns {\tt true} if the given point is inside the rectangle (or on its
 boundary) and {\tt false} otherwise.
 
+\constfunc{bool}{Inside}{\param{const wxRect\& }{rect}}
+
+Returns \true if the given rectangle is completely inside this rectangle
+(or touches its boundary) and \false otherwise.
 
 \membersection{wxRect::Intersects}\label{wxrectintersects}
 
index bc7cd6d11464a6b6b25a394751eee5831dc8bf6d..8462c37eb2ffa6ec9766154ba40ca68c3bc4f431 100644 (file)
@@ -417,6 +417,8 @@ public:
     // return true if the point is (not strcitly) inside the rect
     bool Inside(int x, int y) const;
     bool Inside(const wxPoint& pt) const { return Inside(pt.x, pt.y); }
+    // return true if the rectangle is (not strcitly) inside the rect
+    bool Inside(const wxRect& rect) const;
 
     // return true if the rectangles have a non empty intersection
     bool Intersects(const wxRect& rect) const;
index 617a8d344baef341cfa985fdaf16147284a9e7d7..d8cb7546322cd83936f949c88d2e7ede48f9e614 100644 (file)
@@ -186,6 +186,11 @@ bool wxRect::Inside(int cx, int cy) const
           );
 }
 
+bool wxRect::Inside(const wxRect& rect) const
+{
+    return Inside(rect.GetTopLeft()) && Inside(rect.GetBottomRight());
+}
+
 wxRect& wxRect::Intersect(const wxRect& rect)
 {
     int x2 = GetRight(),