]> git.saurik.com Git - wxWidgets.git/commitdiff
add tests for the remaining message box flags (wxNO_DEFAULT and wxCENTRE)
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 9 Sep 2008 17:25:34 +0000 (17:25 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 9 Sep 2008 17:25:34 +0000 (17:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55528 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/dialogs/dialogs.cpp
samples/dialogs/dialogs.h

index 8649cd78574aa04167592ee629fae04527f34c5c..25ac9147169986aab62602ba3b224aefc1a84e91 100644 (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() )
index 481794688f9aa78af410e8372f7f89c457ebca12..0dd71405a5b2c76375706e3551fda0dc8a7a1a25 100644 (file)
@@ -181,6 +181,7 @@ private:
     void OnApply(wxCommandEvent& event);
     void OnClose(wxCommandEvent& event);
     void OnUpdateLabelUI(wxUpdateUIEvent& event);
+    void OnUpdateNoDefaultUI(wxUpdateUIEvent& event);
 
     enum
     {
@@ -207,6 +208,9 @@ private:
 
     wxRadioBox *m_icons;
 
+    wxCheckBox *m_chkNoDefault,
+               *m_chkCentre;
+
     DECLARE_EVENT_TABLE()
     DECLARE_NO_COPY_CLASS(TestMessageBoxDialog)
 };