X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3f5c62f982ff185daf8bed1f87ef7214fbb6d8cc..fa3bd1aaeaa313b190e59acdcf54fe8e72436057:/include/wx/gdicmn.h diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h index d38fe44b93..b6faf8900d 100644 --- a/include/wx/gdicmn.h +++ b/include/wx/gdicmn.h @@ -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; };