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
This commit is contained in:
Václav Slavík 2006-08-08 14:21:44 +00:00
parent 6632225c98
commit 869b59fc91
3 changed files with 11 additions and 0 deletions

View 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}

View 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;

View 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(),