- if ((event.GetLabel().IsEmpty()) ||
- (event.GetLabel() == _(".")) ||
- (event.GetLabel() == _("..")) ||
- (event.GetLabel().First( wxFILE_SEP_PATH ) != wxNOT_FOUND))
- {
- wxMessageDialog dialog(this, _("Illegal directory name."), _("Error"), wxOK | wxICON_ERROR );
- dialog.ShowModal();
- event.Veto();
- return;
- }
-
- wxString new_name( wxPathOnly( fd->GetFilePath() ) );
- new_name += wxFILE_SEP_PATH;
- new_name += event.GetLabel();
-
- wxLogNull log;
-
- if (wxFileExists(new_name))
- {
- wxMessageDialog dialog(this, _("File name exists already."), _("Error"), wxOK | wxICON_ERROR );
- dialog.ShowModal();
- event.Veto();
- }
-
- if (wxRenameFile(fd->GetFilePath(),new_name))
- {
- fd->SetNewName( new_name, event.GetLabel() );
- SetItemState( event.GetItem(), wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
- UpdateItem( event.GetItem() );
- EnsureVisible( event.GetItem() );
- }
- else
- {
- wxMessageDialog dialog(this, _("Operation not permitted."), _("Error"), wxOK | wxICON_ERROR );
- dialog.ShowModal();
- event.Veto();
- }
-}
-
-void wxFileCtrl::OnListColClick( wxListEvent &event )
-{
- int col = event.GetColumn();
-
- switch (col)
- {
- case wxFileData::FileList_Name :
- case wxFileData::FileList_Size :
- case wxFileData::FileList_Type :
- case wxFileData::FileList_Time : break;
- default : return;
- }
-
- if ((wxFileData::fileListFieldType)col == m_sort_field)
- m_sort_foward = !m_sort_foward;
- else
- m_sort_field = (wxFileData::fileListFieldType)col;
-
- SortItems(m_sort_field, m_sort_foward);
-}
-
-void wxFileCtrl::SortItems(wxFileData::fileListFieldType field, bool foward)
-{
- m_sort_field = field;
- m_sort_foward = foward;
- long sort_dir = foward ? 1 : -1;
-
- switch (m_sort_field)
- {
- case wxFileData::FileList_Name :
- {
- wxListCtrl::SortItems((wxListCtrlCompare)wxFileDataNameCompare, sort_dir);
- break;
- }
- case wxFileData::FileList_Size :
- {
- wxListCtrl::SortItems((wxListCtrlCompare)wxFileDataSizeCompare, sort_dir);
- break;
- }
- case wxFileData::FileList_Type :
- {
- wxListCtrl::SortItems((wxListCtrlCompare)wxFileDataTypeCompare, sort_dir);
- break;
- }
- case wxFileData::FileList_Time :
- {
- wxListCtrl::SortItems((wxListCtrlCompare)wxFileDataTimeCompare, sort_dir);
- break;
- }
- default : break;
- }
-}
-
-wxFileCtrl::~wxFileCtrl()
-{
- FreeAllItemsData();
-}
-
-//-----------------------------------------------------------------------------
-// wxGenericFileDialog
-//-----------------------------------------------------------------------------
-
-#define ID_LIST_MODE (wxID_FILEDLGG )
-#define ID_REPORT_MODE (wxID_FILEDLGG + 1)
-#define ID_UP_DIR (wxID_FILEDLGG + 5)
-#define ID_PARENT_DIR (wxID_FILEDLGG + 6)
-#define ID_NEW_DIR (wxID_FILEDLGG + 7)
-#define ID_CHOICE (wxID_FILEDLGG + 8)
-#define ID_TEXT (wxID_FILEDLGG + 9)
-#define ID_LIST_CTRL (wxID_FILEDLGG + 10)
-#define ID_ACTIVATED (wxID_FILEDLGG + 11)
-#define ID_CHECK (wxID_FILEDLGG + 12)
-
-IMPLEMENT_DYNAMIC_CLASS(wxGenericFileDialog, wxFileDialogBase)
-
-BEGIN_EVENT_TABLE(wxGenericFileDialog,wxDialog)
- EVT_BUTTON(ID_LIST_MODE, wxGenericFileDialog::OnList)
- EVT_BUTTON(ID_REPORT_MODE, wxGenericFileDialog::OnReport)
- EVT_BUTTON(ID_UP_DIR, wxGenericFileDialog::OnUp)
- EVT_BUTTON(ID_PARENT_DIR, wxGenericFileDialog::OnHome)
- EVT_BUTTON(ID_NEW_DIR, wxGenericFileDialog::OnNew)
- EVT_BUTTON(wxID_OK, wxGenericFileDialog::OnListOk)
- EVT_LIST_ITEM_SELECTED(ID_LIST_CTRL, wxGenericFileDialog::OnSelected)
- EVT_LIST_ITEM_ACTIVATED(ID_LIST_CTRL, wxGenericFileDialog::OnActivated)
- EVT_CHOICE(ID_CHOICE,wxGenericFileDialog::OnChoiceFilter)
- EVT_TEXT_ENTER(ID_TEXT,wxGenericFileDialog::OnTextEnter)
- EVT_TEXT(ID_TEXT,wxGenericFileDialog::OnTextChange)
- EVT_CHECKBOX(ID_CHECK,wxGenericFileDialog::OnCheck)
-END_EVENT_TABLE()
-
-long wxGenericFileDialog::ms_lastViewStyle = wxLC_LIST;
-bool wxGenericFileDialog::ms_lastShowHidden = FALSE;
-
-wxGenericFileDialog::wxGenericFileDialog()
-{
-}
-
-wxGenericFileDialog::wxGenericFileDialog(wxWindow *parent,
- const wxString& message,
- const wxString& defaultDir,
- const wxString& defaultFile,
- const wxString& wildCard,
- long style,
- const wxPoint& pos )
- :wxFileDialogBase(parent, message, defaultDir, defaultFile, wildCard, style, pos)
-{
- wxDialog::Create( parent, -1, message, pos, wxDefaultSize,
- wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER );
-
- if (wxConfig::Get(FALSE))