From 5ad24e6dbbb86afb068fd1537c3719298dd1c5ec Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 30 May 2012 03:13:35 +0000 Subject: [PATCH] Adjust the client area origin and the client size of the MSW wxStaticBox according to the guidelines on http://msdn.microsoft.com/en-us/library/aa511279.aspx. This is so widgets that are children of the static box will not overlap the label or box borders. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71595 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/statbox.h | 4 ++++ src/msw/statbox.cpp | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/wx/msw/statbox.h b/include/wx/msw/statbox.h index 27180f2c1e..15b25cb4e2 100644 --- a/include/wx/msw/statbox.h +++ b/include/wx/msw/statbox.h @@ -43,6 +43,10 @@ public: // returns true if the platform should explicitly apply a theme border virtual bool CanApplyThemeBorder() const { return false; } + virtual wxPoint GetClientAreaOrigin() const; + virtual void DoGetClientSize(int *width, int *height) const; + + protected: virtual wxSize DoGetBestSize() const; diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index 75306978e0..213ac65d6a 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -528,4 +528,26 @@ void wxStaticBox::OnPaint(wxPaintEvent& WXUNUSED(event)) #endif // !__WXWINCE__ + +wxPoint wxStaticBox::GetClientAreaOrigin() const +{ + // See: http://msdn.microsoft.com/en-us/library/aa511279.aspx + wxPoint pt = ConvertDialogToPixels(wxPoint(6,11)); + return pt; +} + + +void wxStaticBox::DoGetClientSize(int *width, int *height) const +{ + // See: http://msdn.microsoft.com/en-us/library/aa511279.aspx + wxPoint lr = ConvertDialogToPixels(wxPoint(6,7)); + wxPoint ul = GetClientAreaOrigin(); + wxSize sz = GetSize(); + + if (width) + *width = sz.x - ul.x - lr.x; + if (height) + *height = sz.y - ul.y - lr.x; +} + #endif // wxUSE_STATBOX -- 2.45.2