X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/63ec432bd7b9c93961e85e871bcb31758364a634..1191c93ebc356c379a6c20c0214b3a14562cfbdf:/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;
 };