add tests for the remaining message box flags (wxNO_DEFAULT and wxCENTRE)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55528 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2162,7 +2162,7 @@ TestMessageBoxDialog::TestMessageBoxDialog(wxWindow *parent)
|
|||||||
wxSizer * const
|
wxSizer * const
|
||||||
sizerMsgs = new wxStaticBoxSizer(wxVERTICAL, this, "&Messages");
|
sizerMsgs = new wxStaticBoxSizer(wxVERTICAL, this, "&Messages");
|
||||||
sizerMsgs->Add(new wxStaticText(this, wxID_ANY, "&Main message:"));
|
sizerMsgs->Add(new wxStaticText(this, wxID_ANY, "&Main message:"));
|
||||||
m_textMsg = new wxTextCtrl(this, wxID_ANY, "",
|
m_textMsg = new wxTextCtrl(this, wxID_ANY, "Hello from a box!",
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxTE_MULTILINE);
|
wxTE_MULTILINE);
|
||||||
sizerMsgs->Add(m_textMsg, wxSizerFlags(1).Expand().Border(wxBOTTOM));
|
sizerMsgs->Add(m_textMsg, wxSizerFlags(1).Expand().Border(wxBOTTOM));
|
||||||
@@ -2215,11 +2215,30 @@ TestMessageBoxDialog::TestMessageBoxDialog(wxWindow *parent)
|
|||||||
sizerTop->Add(m_icons, wxSizerFlags().Expand().Border());
|
sizerTop->Add(m_icons, wxSizerFlags().Expand().Border());
|
||||||
|
|
||||||
|
|
||||||
|
// miscellaneous other stuff
|
||||||
|
wxSizer * const
|
||||||
|
sizerFlags = new wxStaticBoxSizer(wxHORIZONTAL, this, "&Other flags");
|
||||||
|
|
||||||
|
m_chkNoDefault = new wxCheckBox(this, wxID_ANY, "Make \"No\" &default");
|
||||||
|
m_chkNoDefault->Connect(wxEVT_UPDATE_UI,
|
||||||
|
wxUpdateUIEventHandler(
|
||||||
|
TestMessageBoxDialog::OnUpdateNoDefaultUI),
|
||||||
|
NULL,
|
||||||
|
this);
|
||||||
|
sizerFlags->Add(m_chkNoDefault, wxSizerFlags(1).Border());
|
||||||
|
|
||||||
|
m_chkCentre = new wxCheckBox(this, wxID_ANY, "Centre on &parent");
|
||||||
|
sizerFlags->Add(m_chkCentre, wxSizerFlags(1).Border());
|
||||||
|
|
||||||
|
sizerTop->Add(sizerFlags, wxSizerFlags().Expand().Border());
|
||||||
|
|
||||||
// finally buttons to show the resulting message box and close this dialog
|
// finally buttons to show the resulting message box and close this dialog
|
||||||
sizerTop->Add(CreateStdDialogButtonSizer(wxAPPLY | wxCLOSE),
|
sizerTop->Add(CreateStdDialogButtonSizer(wxAPPLY | wxCLOSE),
|
||||||
wxSizerFlags().Right().Border());
|
wxSizerFlags().Right().Border());
|
||||||
|
|
||||||
SetSizerAndFit(sizerTop);
|
SetSizerAndFit(sizerTop);
|
||||||
|
|
||||||
|
m_buttons[Btn_Ok]->SetValue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestMessageBoxDialog::OnUpdateLabelUI(wxUpdateUIEvent& event)
|
void TestMessageBoxDialog::OnUpdateLabelUI(wxUpdateUIEvent& event)
|
||||||
@@ -2236,6 +2255,11 @@ void TestMessageBoxDialog::OnUpdateLabelUI(wxUpdateUIEvent& event)
|
|||||||
wxFAIL_MSG( "called for unknown label" );
|
wxFAIL_MSG( "called for unknown label" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestMessageBoxDialog::OnUpdateNoDefaultUI(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable( m_buttons[Btn_No]->IsChecked() );
|
||||||
|
}
|
||||||
|
|
||||||
void TestMessageBoxDialog::OnApply(wxCommandEvent& WXUNUSED(event))
|
void TestMessageBoxDialog::OnApply(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
long style = 0;
|
long style = 0;
|
||||||
@@ -2254,6 +2278,13 @@ void TestMessageBoxDialog::OnApply(wxCommandEvent& WXUNUSED(event))
|
|||||||
case 3: style |= wxICON_ERROR; break;
|
case 3: style |= wxICON_ERROR; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( m_chkCentre->IsChecked() )
|
||||||
|
style |= wxCENTRE;
|
||||||
|
|
||||||
|
if ( m_chkNoDefault->IsEnabled() && m_chkNoDefault->IsChecked() )
|
||||||
|
style |= wxNO_DEFAULT;
|
||||||
|
|
||||||
|
|
||||||
wxMessageDialog dlg(this, m_textMsg->GetValue(), "Test Message Box",
|
wxMessageDialog dlg(this, m_textMsg->GetValue(), "Test Message Box",
|
||||||
style);
|
style);
|
||||||
if ( !m_textExtMsg->IsEmpty() )
|
if ( !m_textExtMsg->IsEmpty() )
|
||||||
|
@@ -181,6 +181,7 @@ private:
|
|||||||
void OnApply(wxCommandEvent& event);
|
void OnApply(wxCommandEvent& event);
|
||||||
void OnClose(wxCommandEvent& event);
|
void OnClose(wxCommandEvent& event);
|
||||||
void OnUpdateLabelUI(wxUpdateUIEvent& event);
|
void OnUpdateLabelUI(wxUpdateUIEvent& event);
|
||||||
|
void OnUpdateNoDefaultUI(wxUpdateUIEvent& event);
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@@ -207,6 +208,9 @@ private:
|
|||||||
|
|
||||||
wxRadioBox *m_icons;
|
wxRadioBox *m_icons;
|
||||||
|
|
||||||
|
wxCheckBox *m_chkNoDefault,
|
||||||
|
*m_chkCentre;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
DECLARE_NO_COPY_CLASS(TestMessageBoxDialog)
|
DECLARE_NO_COPY_CLASS(TestMessageBoxDialog)
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user