added wxRect::CentreIn()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37435 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-02-10 00:01:19 +00:00
parent cae50e6bbd
commit 1bfb73b877
3 changed files with 55 additions and 0 deletions

View File

@@ -428,6 +428,20 @@ public:
}
// centre this rectangle in the given (usually, but not necessarily,
// larger) one
wxRect CentreIn(const wxRect& r, int dir = wxBOTH) const
{
return wxRect(dir & wxHORIZONTAL ? r.x + (r.width - width)/2 : x,
dir & wxVERTICAL ? r.y + (r.height - height)/2 : y,
width, height);
}
wxRect CenterIn(const wxRect& r, int dir = wxBOTH) const
{
return CentreIn(r, dir);
}
public:
int x, y, width, height;
};