+// ----------------------------------------------------------------------------
+// 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();
+ }
+}