- // OK and Cancel button should be at the right bottom
- wxButton* okButton = new wxButton(this, wxID_OK, _("OK"));
- buttonsizer->Add( okButton, 0, wxLEFT|wxRIGHT, 10 );
- wxButton* cancelButton = new wxButton(this, wxID_CANCEL, _("Cancel"));
- buttonsizer->Add( cancelButton, 0, wxLEFT|wxRIGHT, 10 );
+ // 1) dir ctrl
+ m_dirCtrl = NULL; // this is necessary, event handler called from
+ // wxGenericDirCtrl would crash otherwise!
+ long dirStyle = wxDIRCTRL_DIR_ONLY | wxDEFAULT_CONTROL_BORDER;
+
+#ifdef __WXMSW__
+ if (!HasFlag(wxDD_DIR_MUST_EXIST))
+ {
+ // Only under Windows do we need the wxTR_EDIT_LABEL tree control style
+ // before we can call EditLabel (required for "New directory")
+ dirStyle |= wxDIRCTRL_EDIT_LABELS;
+ }
+#endif
+
+ m_dirCtrl = new wxGenericDirCtrl(this, ID_DIRCTRL,
+ m_path, wxDefaultPosition,
+ wxSize(300, 200),
+ dirStyle);
+
+ wxSizerFlags flagsBorder2;
+ flagsBorder2.DoubleBorder(wxTOP | wxLEFT | wxRIGHT);
+
+ topsizer->Add(m_dirCtrl, wxSizerFlags(flagsBorder2).Proportion(1).Expand());
+
+#ifndef __SMARTPHONE__
+ // Make the an option depending on a flag?
+ wxCheckBox *
+ check = new wxCheckBox(this, ID_SHOW_HIDDEN, _("Show &hidden directories"));
+ topsizer->Add(check, wxSizerFlags(flagsBorder2).Right());
+#endif // !__SMARTPHONE__
+
+ // 2) text ctrl
+ m_input = new wxTextCtrl( this, ID_TEXTCTRL, m_path, wxDefaultPosition );
+ topsizer->Add(m_input, wxSizerFlags(flagsBorder2).Expand());
+
+ // 3) buttons if any
+ wxSizer *buttonSizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL);
+ if ( buttonSizer )
+ {
+ topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder());
+ }