X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/619111b9aa66549dd55fec55c07be63d5b19ae88..bb2955b339a83d043ed94cdbed982ea77f93d95c:/src/generic/filedlgg.cpp?ds=sidebyside diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index efbe7253ed..6ca8f2ade2 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -250,7 +250,7 @@ void wxFileData::ReadData() NULL); if (fileHandle != INVALID_HANDLE_VALUE) - { + { m_size = GetFileSize(fileHandle, 0); CloseHandle(fileHandle); } @@ -284,7 +284,7 @@ void wxFileData::ReadData() m_dateTime = buff.st_mtime; #endif // __WXWINCE__ - + #if defined(__UNIX__) m_permissions.Printf(_T("%c%c%c%c%c%c%c%c%c"), buff.st_mode & wxS_IRUSR ? _T('r') : _T('-'), @@ -297,7 +297,7 @@ void wxFileData::ReadData() buff.st_mode & wxS_IWOTH ? _T('w') : _T('-'), buff.st_mode & wxS_IXOTH ? _T('x') : _T('-')); #elif defined(__WIN32__) - DWORD attribs = GetFileAttributes(m_filePath.fn_str()); + DWORD attribs = ::GetFileAttributes(m_filePath.c_str()); if (attribs != (DWORD)-1) { m_permissions.Printf(_T("%c%c%c%c"), @@ -998,7 +998,11 @@ bool wxGenericFileDialog::Create( wxWindow *parent, return true; if (!wxDialog::Create( parent, wxID_ANY, message, pos, wxDefaultSize, - wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )) + wxDEFAULT_DIALOG_STYLE +#if !(defined(__PDA__) || defined(__SMARTPHONE__)) + | wxRESIZE_BORDER +#endif + )) { return false; } @@ -1126,10 +1130,15 @@ bool wxGenericFileDialog::Create( wxWindow *parent, m_choice = new wxChoice( this, ID_CHOICE ); textsizer->Add( m_choice, 1, wxCENTER|wxALL, 5 ); - buttonsizer = new wxBoxSizer( wxHORIZONTAL ); - buttonsizer->Add( new wxButton( this, wxID_OK ), 0, wxCENTER | wxALL, 5 ); - buttonsizer->Add( new wxButton( this, wxID_CANCEL ), 0, wxCENTER | wxALL, 5 ); - mainsizer->Add( buttonsizer, 0, wxALIGN_RIGHT ); + wxSizer *bsizer = CreateButtonSizer( wxOK|wxCANCEL , false, 5 ); + if(bsizer->GetChildren().GetCount() > 0 ) + { + mainsizer->Add( bsizer, 0, wxEXPAND | wxALL, 5 ); + } + else + { + delete bsizer; + } } else { @@ -1163,9 +1172,9 @@ bool wxGenericFileDialog::Create( wxWindow *parent, Centre( wxBOTH ); } - + m_text->SetFocus(); - + ignoreChanges = false; return true; @@ -1287,9 +1296,7 @@ void wxGenericFileDialog::OnActivated( wxListEvent &event ) void wxGenericFileDialog::OnTextEnter( wxCommandEvent &WXUNUSED(event) ) { - wxCommandEvent cevent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK); - cevent.SetEventObject( this ); - GetEventHandler()->ProcessEvent( cevent ); + HandleAction( m_text->GetValue() ); } void wxGenericFileDialog::OnTextChange( wxCommandEvent &WXUNUSED(event) ) @@ -1346,10 +1353,17 @@ void wxGenericFileDialog::HandleAction( const wxString &fn ) return; wxString filename( fn ); - wxString dir = m_list->GetDir(); - if (filename.empty()) return; + if (filename.empty()) + { +#ifdef __WXWINCE__ + EndModal(wxID_CANCEL); +#endif + return; + } if (filename == wxT(".")) return; + wxString dir = m_list->GetDir(); + // "some/place/" means they want to chdir not try to load "place" bool want_dir = filename.Last() == wxFILE_SEP_PATH; if (want_dir) @@ -1465,8 +1479,7 @@ void wxGenericFileDialog::HandleAction( const wxString &fn ) } } - wxCommandEvent event; - wxDialog::OnOK(event); + EndModal(wxID_OK); } void wxGenericFileDialog::OnListOk( wxCommandEvent &WXUNUSED(event) )