+ // extract the buttons styles from the dialog one and remove them from it
+ const long styleBtns = styleDlg & (wxOK | wxCANCEL);
+ styleDlg &= ~styleBtns;
+
+ if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg) )
+ return false;
+
+ wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
+
+ // 1) text message
+ topsizer->
+ Add(CreateTextSizer(message), wxSizerFlags().Expand().TripleBorder());
+
+ // 2) list box
+ m_listbox = CreateList(n, choices, styleLbox);
+
+ if ( n > 0 )
+ m_listbox->SetSelection(0);
+
+ topsizer->
+ Add(m_listbox, wxSizerFlags().Expand().Proportion(1).TripleBorder(wxLEFT | wxRIGHT));
+
+ // 3) buttons if any
+ wxSizer *
+ buttonSizer = CreateSeparatedButtonSizer(styleBtns);
+ if ( buttonSizer )
+ {
+ topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder());
+ }
+
+ SetSizer( topsizer );
+
+ topsizer->SetSizeHints( this );
+ topsizer->Fit( this );
+
+ if ( styleDlg & wxCENTRE )
+ Centre(wxBOTH);
+
+ m_listbox->SetFocus();
+
+ return true;
+}
+
+bool wxAnyChoiceDialog::Create(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ const wxArrayString& choices,
+ long styleDlg,
+ const wxPoint& pos,
+ long styleLbox)
+{
+ wxCArrayString chs(choices);
+ return Create(parent, message, caption, chs.GetCount(), chs.GetStrings(),
+ styleDlg, pos, styleLbox);
+}
+
+wxListBoxBase *wxAnyChoiceDialog::CreateList(int n, const wxString *choices, long styleLbox)
+{
+ return new wxListBox( this, wxID_LISTBOX,
+ wxDefaultPosition, wxDefaultSize,
+ n, choices,
+ styleLbox );