+ wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
+
+ wxButton *btn = new wxButton(this, DIALOGS_MODELESS_BTN, "Press me");
+ wxCheckBox *check = new wxCheckBox(this, -1, "Should be disabled");
+ check->Disable();
+
+ sizerTop->Add(btn, 1, wxEXPAND | wxALL, 5);
+ sizerTop->Add(check, 1, wxEXPAND | wxALL, 5);
+
+ SetAutoLayout(TRUE);
+ SetSizer(sizerTop);
+
+ sizerTop->SetSizeHints(this);
+ sizerTop->Fit(this);
+}
+
+void MyModelessDialog::OnClose(wxCloseEvent& event)
+{
+ if ( event.CanVeto() )
+ {
+ wxMessageBox("Use the menu item to close this dialog",
+ "Modeless dialog",
+ wxOK | wxICON_INFORMATION, this);
+
+ event.Veto();
+ }
+}
+
+// ----------------------------------------------------------------------------
+// MyModalDialog
+// ----------------------------------------------------------------------------
+
+MyModalDialog::MyModalDialog(wxWindow *parent)
+ : wxDialog(parent, -1, wxString("Modal dialog"))
+{
+ wxBoxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
+
+ m_btnFocused = new wxButton(this, -1, "Default button");
+ m_btnDelete = new wxButton(this, -1, "&Delete button");
+ sizerTop->Add(m_btnFocused, 0, wxALIGN_CENTER | wxALL, 5);
+ sizerTop->Add(m_btnDelete, 0, wxALIGN_CENTER | wxALL, 5);
+
+ SetAutoLayout(TRUE);
+ SetSizer(sizerTop);
+
+ sizerTop->SetSizeHints(this);
+ sizerTop->Fit(this);
+
+ m_btnFocused->SetFocus();
+ m_btnFocused->SetDefault();
+}
+
+void MyModalDialog::OnButton(wxCommandEvent& event)
+{
+ if ( event.GetEventObject() == m_btnDelete )
+ {
+ delete m_btnFocused;
+ m_btnFocused = NULL;
+
+ m_btnDelete->Disable();
+ }
+ else if ( event.GetEventObject() == m_btnFocused )
+ {
+ wxGetTextFromUser("Dummy prompt", "Modal dialog called from dialog",
+ "", this);
+ }
+ else
+ {
+ event.Skip();
+ }