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:
Vadim Zeitlin
2008-09-09 17:25:34 +00:00
parent 3e7ea45c59
commit 4e2dc7895b
2 changed files with 36 additions and 1 deletions

View File

@@ -2162,7 +2162,7 @@ TestMessageBoxDialog::TestMessageBoxDialog(wxWindow *parent)
wxSizer * const
sizerMsgs = new wxStaticBoxSizer(wxVERTICAL, this, "&Messages");
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,
wxTE_MULTILINE);
sizerMsgs->Add(m_textMsg, wxSizerFlags(1).Expand().Border(wxBOTTOM));
@@ -2215,11 +2215,30 @@ TestMessageBoxDialog::TestMessageBoxDialog(wxWindow *parent)
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
sizerTop->Add(CreateStdDialogButtonSizer(wxAPPLY | wxCLOSE),
wxSizerFlags().Right().Border());
SetSizerAndFit(sizerTop);
m_buttons[Btn_Ok]->SetValue(true);
}
void TestMessageBoxDialog::OnUpdateLabelUI(wxUpdateUIEvent& event)
@@ -2236,6 +2255,11 @@ void TestMessageBoxDialog::OnUpdateLabelUI(wxUpdateUIEvent& event)
wxFAIL_MSG( "called for unknown label" );
}
void TestMessageBoxDialog::OnUpdateNoDefaultUI(wxUpdateUIEvent& event)
{
event.Enable( m_buttons[Btn_No]->IsChecked() );
}
void TestMessageBoxDialog::OnApply(wxCommandEvent& WXUNUSED(event))
{
long style = 0;
@@ -2254,6 +2278,13 @@ void TestMessageBoxDialog::OnApply(wxCommandEvent& WXUNUSED(event))
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",
style);
if ( !m_textExtMsg->IsEmpty() )