Add support for arbitrary window labels in wxStaticBox to wxMSW

Just reparent the label window and position it accordingly and, also,
avoid painting over it in MSW-specific code.
This commit is contained in:
Vadim Zeitlin
2017-12-24 20:07:05 +01:00
parent 36c4b7651e
commit 687192d86a
3 changed files with 83 additions and 5 deletions

View File

@@ -27,6 +27,16 @@ public:
Create(parent, id, label, pos, size, style, name);
}
wxStaticBox(wxWindow* parent, wxWindowID id,
wxWindow* label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString &name = wxStaticBoxNameStr)
{
Create(parent, id, label, pos, size, style, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
@@ -34,6 +44,13 @@ public:
long style = 0,
const wxString& name = wxStaticBoxNameStr);
bool Create(wxWindow *parent, wxWindowID id,
wxWindow* label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxStaticBoxNameStr);
/// Implementation only
virtual void GetBordersForSizer(int *borderTop, int *borderOther) const wxOVERRIDE;
@@ -66,5 +83,8 @@ protected:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticBox);
};
// Indicate that we have the ctor overload taking wxWindow as label.
#define wxHAS_WINDOW_LABEL_IN_STATIC_BOX
#endif // _WX_MSW_STATBOX_H_