#include "../sample.xpm"
+#include "wx/apptrait.h"
#include "wx/datetime.h"
#include "wx/image.h"
#include "wx/bookctrl.h"
#include "wx/fdrepdlg.h"
#endif // wxUSE_FINDREPLDLG
-#if wxUSE_SPINCTRL
#include "wx/spinctrl.h"
-#endif
-
#include "wx/propdlg.h"
#include "dialogs.h"
"A long, long string to test out the message box "
"layout properly.",
"Message box text",
- wxVSCROLL | wxCENTER |
+ wxCENTER |
wxNO_DEFAULT | wxYES_NO | wxCANCEL |
wxICON_INFORMATION);
// TestMessageBoxDialog
// ----------------------------------------------------------------------------
-TestMessageBoxDialog::BtnInfo TestMessageBoxDialog::ms_btnInfo[] =
+/* static */
+const TestMessageBoxDialog::BtnInfo TestMessageBoxDialog::ms_btnInfo[] =
{
{ wxYES, "&Yes" },
{ wxNO, "&No" },
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));
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)
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;
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() )
}
#endif // USE_SETTINGS_DIALOG
+
+#if wxUSE_LOG
+
+// ----------------------------------------------------------------------------
+// custom log target
+// ----------------------------------------------------------------------------
+
+class MyLogGui : public wxLogGui
+{
+private:
+ virtual void DoShowSingleLogMessage(const wxString& message,
+ const wxString& title,
+ int style)
+ {
+ wxMessageDialog dlg(NULL, message, title,
+ wxOK | wxCANCEL | wxCANCEL_DEFAULT | style);
+ dlg.SetOKCancelLabels(wxID_COPY, wxID_OK);
+ dlg.SetExtendedMessage("Note that this is a custom log dialog.");
+ dlg.ShowModal();
+ }
+};
+
+wxLog *MyAppTraits::CreateLogTarget()
+{
+ return new MyLogGui;
+}
+
+#endif // wxUSE_LOG