]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/dirdlgg.cpp
Compilation fix for old OS/2 compilers.
[wxWidgets.git] / src / generic / dirdlgg.cpp
index 8d27c3320b9fd48b0ee4119f031260e242e8a656..9009fa3757e2387bc8c807ed1c6518ac4905a595 100644 (file)
@@ -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 );
 };
@@ -322,7 +318,7 @@ void wxGenericDirDialog::OnNew( wxCommandEvent& WXUNUSED(event) )
     if (!wxEndsWithPathSeparator(path))
         path += wxFILE_SEP_PATH;
     path += new_name;
-    if (wxFileExists(path))
+    if (wxPathExists(path))
     {
         // try NewName0, NewName1 etc.
         int i = 0;
@@ -337,7 +333,7 @@ void wxGenericDirDialog::OnNew( wxCommandEvent& WXUNUSED(event) )
                 path += wxFILE_SEP_PATH;
             path += new_name;
             i++;
-        } while (wxFileExists(path));
+        } while (wxPathExists(path));
     }
 
     wxLogNull log;