Bind user options to recreate static page in widgets sample
Make the various options on this page actually work. Closes https://github.com/wxWidgets/wxWidgets/pull/1930
This commit is contained in:
@@ -105,6 +105,11 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// event handlers
|
// event handlers
|
||||||
|
void OnRecreate(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
CreateStatic();
|
||||||
|
}
|
||||||
|
|
||||||
void OnCheckEllipsize(wxCommandEvent& event);
|
void OnCheckEllipsize(wxCommandEvent& event);
|
||||||
#ifdef wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
#ifdef wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
||||||
void OnBoxCheckBox(wxCommandEvent& event);
|
void OnBoxCheckBox(wxCommandEvent& event);
|
||||||
@@ -225,11 +230,19 @@ void StaticWidgetsPage::CreateContent()
|
|||||||
|
|
||||||
m_chkGeneric = CreateCheckBoxAndAddToSizer(sizerLeft,
|
m_chkGeneric = CreateCheckBoxAndAddToSizer(sizerLeft,
|
||||||
"&Generic wxStaticText");
|
"&Generic wxStaticText");
|
||||||
|
m_chkGeneric->Bind(wxEVT_CHECKBOX, &StaticWidgetsPage::OnRecreate, this);
|
||||||
|
|
||||||
#ifdef wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
#ifdef wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
||||||
m_chkBoxWithCheck = CreateCheckBoxAndAddToSizer(sizerLeft, "Checkable &box");
|
m_chkBoxWithCheck = CreateCheckBoxAndAddToSizer(sizerLeft, "Checkable &box");
|
||||||
|
m_chkBoxWithCheck->Bind(wxEVT_CHECKBOX, &StaticWidgetsPage::OnRecreate, this);
|
||||||
#endif // wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
#endif // wxHAS_WINDOW_LABEL_IN_STATIC_BOX
|
||||||
|
|
||||||
m_chkVert = CreateCheckBoxAndAddToSizer(sizerLeft, "&Vertical line");
|
m_chkVert = CreateCheckBoxAndAddToSizer(sizerLeft, "&Vertical line");
|
||||||
|
m_chkVert->Bind(wxEVT_CHECKBOX, &StaticWidgetsPage::OnRecreate, this);
|
||||||
|
|
||||||
m_chkAutoResize = CreateCheckBoxAndAddToSizer(sizerLeft, "&Fit to text");
|
m_chkAutoResize = CreateCheckBoxAndAddToSizer(sizerLeft, "&Fit to text");
|
||||||
|
m_chkAutoResize->Bind(wxEVT_CHECKBOX, &StaticWidgetsPage::OnRecreate, this);
|
||||||
|
|
||||||
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
|
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
|
||||||
|
|
||||||
static const wxString halign[] =
|
static const wxString halign[] =
|
||||||
@@ -249,9 +262,13 @@ void StaticWidgetsPage::CreateContent()
|
|||||||
m_radioHAlign = new wxRadioBox(this, wxID_ANY, "&Horz alignment",
|
m_radioHAlign = new wxRadioBox(this, wxID_ANY, "&Horz alignment",
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
WXSIZEOF(halign), halign, 3);
|
WXSIZEOF(halign), halign, 3);
|
||||||
|
m_radioHAlign->Bind(wxEVT_RADIOBOX, &StaticWidgetsPage::OnRecreate, this);
|
||||||
|
|
||||||
m_radioVAlign = new wxRadioBox(this, wxID_ANY, "&Vert alignment",
|
m_radioVAlign = new wxRadioBox(this, wxID_ANY, "&Vert alignment",
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
WXSIZEOF(valign), valign, 3);
|
WXSIZEOF(valign), valign, 3);
|
||||||
|
m_radioVAlign->SetToolTip("Relevant for Generic wxStaticText only");
|
||||||
|
m_radioVAlign->Bind(wxEVT_RADIOBOX, &StaticWidgetsPage::OnRecreate, this);
|
||||||
|
|
||||||
sizerLeft->Add(m_radioHAlign, 0, wxGROW | wxALL, 5);
|
sizerLeft->Add(m_radioHAlign, 0, wxGROW | wxALL, 5);
|
||||||
sizerLeft->Add(m_radioVAlign, 0, wxGROW | wxALL, 5);
|
sizerLeft->Add(m_radioVAlign, 0, wxGROW | wxALL, 5);
|
||||||
@@ -274,6 +291,7 @@ void StaticWidgetsPage::CreateContent()
|
|||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
WXSIZEOF(ellipsizeMode), ellipsizeMode,
|
WXSIZEOF(ellipsizeMode), ellipsizeMode,
|
||||||
3);
|
3);
|
||||||
|
m_radioEllipsize->Bind(wxEVT_RADIOBOX, &StaticWidgetsPage::OnRecreate, this);
|
||||||
|
|
||||||
sizerLeft->Add(m_radioEllipsize, 0, wxGROW | wxALL, 5);
|
sizerLeft->Add(m_radioEllipsize, 0, wxGROW | wxALL, 5);
|
||||||
|
|
||||||
@@ -311,6 +329,7 @@ void StaticWidgetsPage::CreateContent()
|
|||||||
|
|
||||||
m_chkGreen = CreateCheckBoxAndAddToSizer(sizerMiddle,
|
m_chkGreen = CreateCheckBoxAndAddToSizer(sizerMiddle,
|
||||||
"Decorated label on g&reen");
|
"Decorated label on g&reen");
|
||||||
|
m_chkGreen->Bind(wxEVT_CHECKBOX, &StaticWidgetsPage::OnRecreate, this);
|
||||||
#endif // wxUSE_MARKUP
|
#endif // wxUSE_MARKUP
|
||||||
|
|
||||||
// final initializations
|
// final initializations
|
||||||
|
Reference in New Issue
Block a user