X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d2cdad17e38fa530ea9376e1d69c1d2a8df35a08..6177576129c007cbd04f1100d4e8e844a32aa114:/src/generic/dirdlgg.cpp diff --git a/src/generic/dirdlgg.cpp b/src/generic/dirdlgg.cpp index 72ede7a30c..327bcbc81e 100644 --- a/src/generic/dirdlgg.cpp +++ b/src/generic/dirdlgg.cpp @@ -58,7 +58,7 @@ static const int ID_GO_HOME = 1006; // --------------------------------------------------------------------------- /* Macro for avoiding #ifdefs when value have to be different depending on size of - device we display on + device we display on - take it from something like wxDesktopPolicy in the future */ #if defined(__SMARTPHONE__) @@ -100,7 +100,7 @@ wxGenericDirDialog::wxGenericDirDialog(wxWindow* parent, const wxString& title, wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); - // Smartphone does not have buttons + // smart phones does not support or do not waste space for wxButtons #if defined(__SMARTPHONE__) wxMenu *dirMenu = new wxMenu; @@ -190,21 +190,11 @@ wxGenericDirDialog::wxGenericDirDialog(wxWindow* parent, const wxString& title, #endif // 4) Buttons - buttonsizer = new wxBoxSizer( wxHORIZONTAL ); - - // OK and Cancel button should be at the right bottom - wxButton* okButton = new wxButton(this, wxID_OK); - buttonsizer->Add( okButton, 0, wxLEFT|wxRIGHT, 10 ); - wxButton* cancelButton = new wxButton(this, wxID_CANCEL); - buttonsizer->Add( cancelButton, 0, wxLEFT|wxRIGHT, 10 ); - - topsizer->Add( buttonsizer, 0, wxLEFT|wxTOP|wxBOTTOM | wxALIGN_RIGHT, 10 ); - - okButton->SetDefault(); + topsizer->Add( CreateButtonSizer( wxOK|wxCANCEL ), 0, wxEXPAND | wxALL, 10 ); #endif // !__SMARTPHONE__ - m_dirCtrl->SetFocus(); + m_input->SetFocus(); SetAutoLayout( true ); SetSizer( topsizer ); @@ -278,7 +268,13 @@ void wxGenericDirDialog::OnTreeSelected( wxTreeEvent &event ) if (!m_dirCtrl) return; - wxDirItemData *data = (wxDirItemData*)m_dirCtrl->GetTreeCtrl()->GetItemData(event.GetItem()); + wxTreeItemId item = event.GetItem(); + + wxDirItemData *data = NULL; + + if(item.IsOk()) + data = (wxDirItemData*)m_dirCtrl->GetTreeCtrl()->GetItemData(item); + if (data) m_input->SetValue( data->m_path ); };