From 869b59fc9114983483acd4d16e86e78997d4faca Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Tue, 8 Aug 2006 14:21:44 +0000 Subject: [PATCH] added wxRect::Inside(wxRect) for testing if a rectangle is completely within another rectangle git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40521 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/rect.tex | 4 ++++ include/wx/gdicmn.h | 2 ++ src/common/gdicmn.cpp | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/docs/latex/wx/rect.tex b/docs/latex/wx/rect.tex index 8e6b9fe02d..f94ab4fc95 100644 --- a/docs/latex/wx/rect.tex +++ b/docs/latex/wx/rect.tex @@ -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} diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h index bc7cd6d114..8462c37eb2 100644 --- a/include/wx/gdicmn.h +++ b/include/wx/gdicmn.h @@ -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; diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index 617a8d344b..d8cb754632 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -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(), -- 2.45.2