1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFileDialog
4 // Author: Robert Roebling
8 // Copyright: (c) Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "filedlgg.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
33 #if !defined(__UNIX__) && !defined(__DOS__) && !defined(__WIN32__)
34 #error wxFileDialog currently only supports Unix, win32 and DOS
37 #include "wx/checkbox.h"
38 #include "wx/textctrl.h"
39 #include "wx/choice.h"
40 #include "wx/checkbox.h"
41 #include "wx/stattext.h"
42 #include "wx/filedlg.h"
46 #include "wx/listctrl.h"
47 #include "wx/msgdlg.h"
49 #include "wx/bmpbuttn.h"
50 #include "wx/tokenzr.h"
51 #include "wx/mimetype.h"
53 #include "wx/module.h"
54 #include "wx/config.h"
55 #include "wx/imaglist.h"
57 #include "wx/artprov.h"
61 #include "wx/tooltip.h"
64 #include <sys/types.h>
80 #if defined(__UNIX__) || defined(__DOS__)
84 // ----------------------------------------------------------------------------
86 // ----------------------------------------------------------------------------
88 // the list ctrl fields in report view
101 //-----------------------------------------------------------------------------
103 //-----------------------------------------------------------------------------
108 wxFileData( const wxString
&name
, const wxString
&fname
);
109 wxString
GetName() const;
110 wxString
GetFullName() const;
111 wxString
GetHint() const;
112 wxString
GetEntry( FileListField num
) const;
114 bool IsDir() const { return m_isDir
; }
115 bool IsLink() const { return m_isLink
; }
116 bool IsExe() const { return m_isExe
; }
117 long GetSize() const { return m_size
; }
119 void MakeItem( wxListItem
&item
);
120 void SetNewName( const wxString
&name
, const wxString
&fname
);
131 wxString m_permissions
;
137 //-----------------------------------------------------------------------------
139 //-----------------------------------------------------------------------------
141 class wxFileCtrl
: public wxListCtrl
145 wxFileCtrl( wxWindow
*win
,
146 wxStaticText
*labelDir
,
148 const wxString
&wild
,
150 const wxPoint
&pos
= wxDefaultPosition
,
151 const wxSize
&size
= wxDefaultSize
,
152 long style
= wxLC_LIST
,
153 const wxValidator
&validator
= wxDefaultValidator
,
154 const wxString
&name
= wxT("filelist") );
155 virtual ~wxFileCtrl();
157 void ChangeToListMode();
158 void ChangeToReportMode();
159 void ChangeToIconMode();
160 void ShowHidden( bool show
= TRUE
);
161 long Add( wxFileData
*fd
, wxListItem
&item
);
163 virtual void StatusbarText( wxChar
*WXUNUSED(text
) ) {};
165 void GoToParentDir();
167 void GoToDir( const wxString
&dir
);
168 void SetWild( const wxString
&wild
);
169 void GetDir( wxString
&dir
);
170 void OnListDeleteItem( wxListEvent
&event
);
171 void OnListEndLabelEdit( wxListEvent
&event
);
173 // Associate commonly used UI controls with wxFileCtrl so that they can be
174 // disabled when they cannot be used (e.g. can't go to parent directory
175 // if wxFileCtrl already is in the root dir):
176 void SetGoToParentControl(wxWindow
*ctrl
) { m_goToParentControl
= ctrl
; }
177 void SetNewDirControl(wxWindow
*ctrl
) { m_newDirControl
= ctrl
; }
180 void FreeItemData(const wxListItem
& item
);
181 void FreeAllItemsData();
187 wxWindow
*m_goToParentControl
;
188 wxWindow
*m_newDirControl
;
190 // the label showing the current directory
191 wxStaticText
*m_labelDir
;
193 DECLARE_DYNAMIC_CLASS(wxFileCtrl
);
194 DECLARE_EVENT_TABLE()
197 // ----------------------------------------------------------------------------
198 // private classes - icons list management
199 // ----------------------------------------------------------------------------
201 class wxFileIconEntry
: public wxObject
204 wxFileIconEntry(int i
) { id
= i
; }
210 class wxFileIconsTable
215 int GetIconID(const wxString
& extension
, const wxString
& mime
= wxEmptyString
);
216 wxImageList
*GetImageList() { return &m_ImageList
; }
219 wxImageList m_ImageList
;
220 wxHashTable m_HashTable
;
223 static wxFileIconsTable
*g_IconsTable
= NULL
;
227 #define FI_EXECUTABLE 2
229 wxFileIconsTable::wxFileIconsTable() :
231 m_HashTable(wxKEY_STRING
)
233 m_HashTable
.DeleteContents(TRUE
);
235 m_ImageList
.Add(wxArtProvider::GetBitmap(wxART_FOLDER
, wxART_CMN_DIALOG
));
237 m_ImageList
.Add(wxArtProvider::GetBitmap(wxART_NORMAL_FILE
, wxART_CMN_DIALOG
));
239 if (GetIconID(wxEmptyString
, _T("application/x-executable")) == FI_UNKNOWN
)
241 m_ImageList
.Add(wxArtProvider::GetBitmap(wxART_EXECUTABLE_FILE
, wxART_CMN_DIALOG
));
242 m_HashTable
.Delete(_T("exe"));
243 m_HashTable
.Put(_T("exe"), new wxFileIconEntry(FI_EXECUTABLE
));
245 /* else put into list by GetIconID
246 (KDE defines application/x-executable for *.exe and has nice icon)
253 // VS: we don't need this function w/o wxMimeTypesManager because we'll only have
254 // one icon and we won't resize it
256 static wxBitmap
CreateAntialiasedBitmap(const wxImage
& img
)
258 wxImage
smallimg (16, 16);
259 unsigned char *p1
, *p2
, *ps
;
260 unsigned char mr
= img
.GetMaskRed(),
261 mg
= img
.GetMaskGreen(),
262 mb
= img
.GetMaskBlue();
265 unsigned sr
, sg
, sb
, smask
;
267 p1
= img
.GetData(), p2
= img
.GetData() + 3 * 32, ps
= smallimg
.GetData();
268 smallimg
.SetMaskColour(mr
, mr
, mr
);
270 for (y
= 0; y
< 16; y
++)
272 for (x
= 0; x
< 16; x
++)
274 sr
= sg
= sb
= smask
= 0;
275 if (p1
[0] != mr
|| p1
[1] != mg
|| p1
[2] != mb
)
276 sr
+= p1
[0], sg
+= p1
[1], sb
+= p1
[2];
279 if (p1
[0] != mr
|| p1
[1] != mg
|| p1
[2] != mb
)
280 sr
+= p1
[0], sg
+= p1
[1], sb
+= p1
[2];
283 if (p2
[0] != mr
|| p2
[1] != mg
|| p2
[2] != mb
)
284 sr
+= p2
[0], sg
+= p2
[1], sb
+= p2
[2];
287 if (p2
[0] != mr
|| p2
[1] != mg
|| p2
[2] != mb
)
288 sr
+= p2
[0], sg
+= p2
[1], sb
+= p2
[2];
293 ps
[0] = ps
[1] = ps
[2] = mr
;
295 ps
[0] = sr
>> 2, ps
[1] = sg
>> 2, ps
[2] = sb
>> 2;
298 p1
+= 32 * 3, p2
+= 32 * 3;
301 return wxBitmap(smallimg
);
304 // finds empty borders and return non-empty area of image:
305 static wxImage
CutEmptyBorders(const wxImage
& img
)
307 unsigned char mr
= img
.GetMaskRed(),
308 mg
= img
.GetMaskGreen(),
309 mb
= img
.GetMaskBlue();
310 unsigned char *dt
= img
.GetData(), *dttmp
;
311 unsigned w
= img
.GetWidth(), h
= img
.GetHeight();
313 unsigned top
, bottom
, left
, right
, i
;
316 #define MK_DTTMP(x,y) dttmp = dt + ((x + y * w) * 3)
317 #define NOEMPTY_PIX(empt) if (dttmp[0] != mr || dttmp[1] != mg || dttmp[2] != mb) {empt = FALSE; break;}
319 for (empt
= TRUE
, top
= 0; empt
&& top
< h
; top
++)
322 for (i
= 0; i
< w
; i
++, dttmp
+=3)
325 for (empt
= TRUE
, bottom
= h
-1; empt
&& bottom
> top
; bottom
--)
328 for (i
= 0; i
< w
; i
++, dttmp
+=3)
331 for (empt
= TRUE
, left
= 0; empt
&& left
< w
; left
++)
334 for (i
= 0; i
< h
; i
++, dttmp
+=3*w
)
337 for (empt
= TRUE
, right
= w
-1; empt
&& right
> left
; right
--)
340 for (i
= 0; i
< h
; i
++, dttmp
+=3*w
)
343 top
--, left
--, bottom
++, right
++;
345 return img
.GetSubImage(wxRect(left
, top
, right
- left
+ 1, bottom
- top
+ 1));
347 #endif // wxUSE_MIMETYPE
351 int wxFileIconsTable::GetIconID(const wxString
& extension
, const wxString
& mime
)
354 if (!extension
.IsEmpty())
356 wxFileIconEntry
*entry
= (wxFileIconEntry
*) m_HashTable
.Get(extension
);
357 if (entry
) return (entry
-> id
);
360 wxFileType
*ft
= (mime
.IsEmpty()) ?
361 wxTheMimeTypesManager
-> GetFileTypeFromExtension(extension
) :
362 wxTheMimeTypesManager
-> GetFileTypeFromMimeType(mime
);
364 if (ft
== NULL
|| (!ft
-> GetIcon(&ic
)) || (!ic
.Ok()))
366 int newid
= FI_UNKNOWN
;
367 m_HashTable
.Put(extension
, new wxFileIconEntry(newid
));
372 tmpBmp
.CopyFromIcon(ic
);
373 wxImage img
= tmpBmp
.ConvertToImage();
377 int id
= m_ImageList
.GetImageCount();
378 if (img
.GetWidth() == 16 && img
.GetHeight() == 16)
379 m_ImageList
.Add(wxBitmap(img
));
382 if (img
.GetWidth() != 32 || img
.GetHeight() != 32)
383 m_ImageList
.Add(CreateAntialiasedBitmap(CutEmptyBorders(img
).Rescale(32, 32)));
385 m_ImageList
.Add(CreateAntialiasedBitmap(img
));
387 m_HashTable
.Put(extension
, new wxFileIconEntry(id
));
390 #else // !wxUSE_MIMETYPE
392 if (extension
== wxT("exe"))
393 return FI_EXECUTABLE
;
396 #endif // wxUSE_MIMETYPE/!wxUSE_MIMETYPE
401 // ----------------------------------------------------------------------------
403 // ----------------------------------------------------------------------------
406 int ListCompare( long data1
, long data2
, long WXUNUSED(data
))
408 wxFileData
*fd1
= (wxFileData
*)data1
;
409 wxFileData
*fd2
= (wxFileData
*)data2
;
410 if (fd1
->GetName() == wxT("..")) return -1;
411 if (fd2
->GetName() == wxT("..")) return 1;
412 if (fd1
->IsDir() && !fd2
->IsDir()) return -1;
413 if (fd2
->IsDir() && !fd1
->IsDir()) return 1;
414 return wxStrcmp( fd1
->GetName(), fd2
->GetName() );
418 #define IsTopMostDir(dir) (dir == wxT("/"))
421 #if defined(__DOS__) || defined(__WINDOWS__)
422 #define IsTopMostDir(dir) (dir.IsEmpty())
425 #if defined(__DOS__) || defined(__WINDOWS__)
426 extern bool wxIsDriveAvailable(const wxString
& dirName
);
429 //-----------------------------------------------------------------------------
431 //-----------------------------------------------------------------------------
433 wxFileData::wxFileData( const wxString
&name
, const wxString
&fname
)
438 #if defined(__DOS__) || defined(__WINDOWS__)
439 // VS: In case the file is root directory of a volume (e.g. "C:"),
440 // we don't want it stat()ed, since the drive may not be in:
441 if (name
.length() == 2 && name
[1u] == wxT(':'))
449 #endif // __DOS__ || __WINDOWS__
453 #if defined(__UNIX__) && (!defined( __EMX__ ) && !defined(__VMS))
454 lstat( m_fileName
.fn_str(), &buff
);
455 m_isLink
= S_ISLNK( buff
.st_mode
);
457 wxStat( m_fileName
, &buff
);
461 m_isDir
= (buff
.st_mode
& S_IFDIR
) != 0;
462 m_isExe
= (buff
.st_mode
& wxS_IXUSR
) != 0;
464 m_size
= buff
.st_size
;
466 const struct tm
* const t
= localtime( &buff
.st_mtime
);
468 m_minute
= t
->tm_min
;
469 m_month
= t
->tm_mon
+1;
474 m_permissions
.Printf(_T("%c%c%c"),
475 buff
.st_mode
& wxS_IRUSR
? _T('r') : _T('-'),
476 buff
.st_mode
& wxS_IWUSR
? _T('w') : _T('-'),
477 buff
.st_mode
& wxS_IXUSR
? _T('x') : _T('-'));
480 wxString
wxFileData::GetName() const
485 wxString
wxFileData::GetFullName() const
490 wxString
wxFileData::GetHint() const
492 wxString s
= m_fileName
;
494 if (m_isDir
) s
+= wxT("<DIR> ");
495 else if (m_isLink
) s
+= wxT("<LINK> ");
498 s
+= LongToString( m_size
);
501 s
+= IntToString( m_day
);
503 s
+= IntToString( m_month
);
505 s
+= IntToString( m_year
);
507 s
+= IntToString( m_hour
);
509 s
+= IntToString( m_minute
);
515 wxString
wxFileData::GetEntry( FileListField num
) const
530 s
.Printf(_T("%ld"), m_size
);
534 s
.Printf(_T("%02d.%02d.%d"), m_day
, m_month
, m_year
);
538 s
.Printf(_T("%02d:%02d"), m_hour
, m_minute
);
548 wxFAIL_MSG( _T("unexpected field in wxFileData::GetEntry()") );
554 void wxFileData::SetNewName( const wxString
&name
, const wxString
&fname
)
560 void wxFileData::MakeItem( wxListItem
&item
)
562 item
.m_text
= m_name
;
563 item
.ClearAttributes();
565 item
.SetTextColour(*wxRED
);
567 item
.SetTextColour(*wxBLUE
);
570 item
.m_image
= FI_FOLDER
;
572 item
.m_image
= FI_EXECUTABLE
;
573 else if (m_name
.Find(wxT('.')) != wxNOT_FOUND
)
574 item
.m_image
= g_IconsTable
->GetIconID(m_name
.AfterLast(wxT('.')));
576 item
.m_image
= FI_UNKNOWN
;
580 wxColour
*dg
= wxTheColourDatabase
->FindColour( _T("MEDIUM GREY") );
581 item
.SetTextColour(*dg
);
583 item
.m_data
= (long)this;
586 //-----------------------------------------------------------------------------
588 //-----------------------------------------------------------------------------
590 IMPLEMENT_DYNAMIC_CLASS(wxFileCtrl
,wxListCtrl
)
592 BEGIN_EVENT_TABLE(wxFileCtrl
,wxListCtrl
)
593 EVT_LIST_DELETE_ITEM(-1, wxFileCtrl::OnListDeleteItem
)
594 EVT_LIST_END_LABEL_EDIT(-1, wxFileCtrl::OnListEndLabelEdit
)
598 wxFileCtrl::wxFileCtrl()
600 m_showHidden
= FALSE
;
603 wxFileCtrl::wxFileCtrl(wxWindow
*win
,
604 wxStaticText
*labelDir
,
606 const wxString
& wild
,
611 const wxValidator
&validator
,
612 const wxString
&name
)
613 : wxListCtrl(win
, id
, pos
, size
, style
, validator
, name
),
617 g_IconsTable
= new wxFileIconsTable
;
618 wxImageList
*imageList
= g_IconsTable
->GetImageList();
620 SetImageList( imageList
, wxIMAGE_LIST_SMALL
);
622 m_goToParentControl
=
623 m_newDirControl
= NULL
;
625 m_labelDir
= labelDir
;
627 m_showHidden
= showHidden
;
630 void wxFileCtrl::ChangeToListMode()
632 SetSingleStyle( wxLC_LIST
);
636 void wxFileCtrl::ChangeToReportMode()
638 SetSingleStyle( wxLC_REPORT
);
642 void wxFileCtrl::ChangeToIconMode()
644 SetSingleStyle( wxLC_ICON
);
648 void wxFileCtrl::ShowHidden( bool show
)
654 long wxFileCtrl::Add( wxFileData
*fd
, wxListItem
&item
)
657 item
.m_mask
= wxLIST_MASK_TEXT
+ wxLIST_MASK_DATA
+ wxLIST_MASK_IMAGE
;
658 fd
->MakeItem( item
);
659 long my_style
= GetWindowStyleFlag();
660 if (my_style
& wxLC_REPORT
)
662 ret
= InsertItem( item
);
663 for (int i
= 1; i
< FileList_Max
; i
++)
664 SetItem( item
.m_itemId
, i
, fd
->GetEntry((FileListField
)i
) );
666 else if (my_style
& wxLC_LIST
)
668 ret
= InsertItem( item
);
673 void wxFileCtrl::UpdateFiles()
675 // don't do anything before ShowModal() call which sets m_dirName
676 if ( m_dirName
.empty() )
679 wxBusyCursor bcur
; // this may take a while...
681 long my_style
= GetWindowStyleFlag();
682 int name_col_width
= 0;
683 if (my_style
& wxLC_REPORT
)
685 if (GetColumnCount() > 0)
686 name_col_width
= GetColumnWidth( 0 );
692 if (my_style
& wxLC_REPORT
)
694 if (name_col_width
< 140) name_col_width
= 140;
695 InsertColumn( 0, _("Name"), wxLIST_FORMAT_LEFT
, name_col_width
);
696 InsertColumn( 1, _("Size"), wxLIST_FORMAT_LEFT
, 60 );
697 InsertColumn( 2, _("Date"), wxLIST_FORMAT_LEFT
, 65 );
698 InsertColumn( 3, _("Time"), wxLIST_FORMAT_LEFT
, 50 );
700 InsertColumn( 4, _("Permissions"), wxLIST_FORMAT_LEFT
, 120 );
703 wxFileData
*fd
= (wxFileData
*) NULL
;
708 #if defined(__DOS__) || defined(__WINDOWS__)
709 if ( IsTopMostDir(m_dirName
) )
711 // Pseudo-directory with all available drives listed...
712 for (int drive
= 1; drive
<= 26; drive
++)
715 path
.Printf(wxT("%c:\\"), (char)(drive
+ 'A' - 1));
716 if ( wxIsDriveAvailable(path
) )
719 fd
= new wxFileData(path
, path
);
729 if ( !IsTopMostDir(m_dirName
) )
731 wxString
p(wxPathOnly(m_dirName
));
733 if (p
.IsEmpty()) p
= wxT("/");
735 fd
= new wxFileData( wxT(".."), p
);
740 wxString
dirname(m_dirName
);
741 #if defined(__DOS__) || defined(__WINDOWS__)
742 if (dirname
.length() == 2 && dirname
[1u] == wxT(':'))
743 dirname
<< wxT('\\');
747 if ( dir
.IsOpened() )
749 wxString
dirPrefix(dirname
+ wxFILE_SEP_PATH
);
750 int hiddenFlag
= m_showHidden
? wxDIR_HIDDEN
: 0;
755 // Get the directories first (not matched against wildcards):
756 cont
= dir
.GetFirst(&f
, wxEmptyString
, wxDIR_DIRS
| hiddenFlag
);
759 fd
= new wxFileData(f
, dirPrefix
+ f
);
762 cont
= dir
.GetNext(&f
);
765 // Tokenize the wildcard string, so we can handle more than 1
766 // search pattern in a wildcard.
767 wxStringTokenizer
tokenWild(m_wild
, wxT(";"));
768 while ( tokenWild
.HasMoreTokens() )
770 cont
= dir
.GetFirst(&f
, tokenWild
.GetNextToken(),
771 wxDIR_FILES
| hiddenFlag
);
774 fd
= new wxFileData(f
, dirPrefix
+ f
);
777 cont
= dir
.GetNext(&f
);
783 SortItems((wxListCtrlCompare
)ListCompare
, 0);
785 if ( my_style
& wxLC_REPORT
)
787 SetColumnWidth(1, wxLIST_AUTOSIZE
);
788 SetColumnWidth(2, wxLIST_AUTOSIZE
);
789 SetColumnWidth(3, wxLIST_AUTOSIZE
);
792 // Finally, enable/disable context-dependent controls:
793 if ( m_goToParentControl
)
794 m_goToParentControl
->Enable(!IsTopMostDir(m_dirName
));
795 #if defined(__DOS__) || defined(__WINDOWS__)
796 if ( m_newDirControl
)
797 m_newDirControl
->Enable(!IsTopMostDir(m_dirName
));
801 void wxFileCtrl::SetWild( const wxString
&wild
)
807 void wxFileCtrl::MakeDir()
809 wxString
new_name( _("NewName") );
810 wxString
path( m_dirName
);
811 path
+= wxFILE_SEP_PATH
;
813 if (wxFileExists(path
))
815 // try NewName0, NewName1 etc.
818 new_name
= _("NewName");
820 num
.Printf( wxT("%d"), i
);
824 path
+= wxFILE_SEP_PATH
;
827 } while (wxFileExists(path
));
833 wxMessageDialog
dialog(this, _("Operation not permitted."), _("Error"), wxOK
| wxICON_ERROR
);
838 wxFileData
*fd
= new wxFileData( new_name
, path
);
842 long id
= Add( fd
, item
);
846 SortItems( (wxListCtrlCompare
) ListCompare
, 0 );
847 id
= FindItem( 0, (long)fd
);
853 void wxFileCtrl::GoToParentDir()
855 if (!IsTopMostDir(m_dirName
))
857 size_t len
= m_dirName
.Len();
858 if (m_dirName
[len
-1] == wxFILE_SEP_PATH
)
859 m_dirName
.Remove( len
-1, 1 );
860 wxString
fname( wxFileNameFromPath(m_dirName
) );
861 m_dirName
= wxPathOnly( m_dirName
);
863 if (m_dirName
.IsEmpty())
864 m_dirName
= wxT("/");
867 long id
= FindItem( 0, fname
);
870 SetItemState( id
, wxLIST_STATE_SELECTED
, wxLIST_STATE_SELECTED
);
874 m_labelDir
->SetLabel(m_dirName
);
878 void wxFileCtrl::GoToHomeDir()
880 wxString s
= wxGetUserHome( wxString() );
884 void wxFileCtrl::GoToDir( const wxString
&dir
)
888 SetItemState( 0, wxLIST_STATE_SELECTED
, wxLIST_STATE_SELECTED
);
891 m_labelDir
->SetLabel(dir
);
894 void wxFileCtrl::GetDir( wxString
&dir
)
899 void wxFileCtrl::FreeItemData(const wxListItem
& item
)
901 wxFileData
*fd
= (wxFileData
*)item
.m_data
;
905 void wxFileCtrl::OnListDeleteItem( wxListEvent
&event
)
907 FreeItemData(event
.m_item
);
910 void wxFileCtrl::FreeAllItemsData()
913 item
.m_mask
= wxLIST_MASK_DATA
;
915 item
.m_itemId
= GetNextItem( -1, wxLIST_NEXT_ALL
);
916 while ( item
.m_itemId
!= -1 )
920 item
.m_itemId
= GetNextItem( item
.m_itemId
, wxLIST_NEXT_ALL
);
924 void wxFileCtrl::OnListEndLabelEdit( wxListEvent
&event
)
926 wxFileData
*fd
= (wxFileData
*)event
.m_item
.m_data
;
929 if ((event
.GetLabel().IsEmpty()) ||
930 (event
.GetLabel() == _(".")) ||
931 (event
.GetLabel() == _("..")) ||
932 (event
.GetLabel().First( wxFILE_SEP_PATH
) != wxNOT_FOUND
))
934 wxMessageDialog
dialog(this, _("Illegal directory name."), _("Error"), wxOK
| wxICON_ERROR
);
940 wxString
new_name( wxPathOnly( fd
->GetFullName() ) );
941 new_name
+= wxFILE_SEP_PATH
;
942 new_name
+= event
.GetLabel();
946 if (wxFileExists(new_name
))
948 wxMessageDialog
dialog(this, _("File name exists already."), _("Error"), wxOK
| wxICON_ERROR
);
953 if (wxRenameFile(fd
->GetFullName(),new_name
))
955 fd
->SetNewName( new_name
, event
.GetLabel() );
956 SetItemState( event
.GetItem(), wxLIST_STATE_SELECTED
, wxLIST_STATE_SELECTED
);
957 EnsureVisible( event
.GetItem() );
961 wxMessageDialog
dialog(this, _("Operation not permitted."), _("Error"), wxOK
| wxICON_ERROR
);
967 wxFileCtrl::~wxFileCtrl()
972 //-----------------------------------------------------------------------------
974 //-----------------------------------------------------------------------------
976 #define ID_LIST_MODE (wxID_FILEDLGG )
977 #define ID_REPORT_MODE (wxID_FILEDLGG + 1)
978 #define ID_UP_DIR (wxID_FILEDLGG + 5)
979 #define ID_PARENT_DIR (wxID_FILEDLGG + 6)
980 #define ID_NEW_DIR (wxID_FILEDLGG + 7)
981 #define ID_CHOICE (wxID_FILEDLGG + 8)
982 #define ID_TEXT (wxID_FILEDLGG + 9)
983 #define ID_LIST_CTRL (wxID_FILEDLGG + 10)
984 #define ID_ACTIVATED (wxID_FILEDLGG + 11)
985 #define ID_CHECK (wxID_FILEDLGG + 12)
987 IMPLEMENT_DYNAMIC_CLASS(wxFileDialog
,wxDialog
)
989 BEGIN_EVENT_TABLE(wxFileDialog
,wxDialog
)
990 EVT_BUTTON(ID_LIST_MODE
, wxFileDialog::OnList
)
991 EVT_BUTTON(ID_REPORT_MODE
, wxFileDialog::OnReport
)
992 EVT_BUTTON(ID_UP_DIR
, wxFileDialog::OnUp
)
993 EVT_BUTTON(ID_PARENT_DIR
, wxFileDialog::OnHome
)
994 EVT_BUTTON(ID_NEW_DIR
, wxFileDialog::OnNew
)
995 EVT_BUTTON(wxID_OK
, wxFileDialog::OnListOk
)
996 EVT_LIST_ITEM_SELECTED(ID_LIST_CTRL
, wxFileDialog::OnSelected
)
997 EVT_LIST_ITEM_ACTIVATED(ID_LIST_CTRL
, wxFileDialog::OnActivated
)
998 EVT_CHOICE(ID_CHOICE
,wxFileDialog::OnChoiceFilter
)
999 EVT_TEXT_ENTER(ID_TEXT
,wxFileDialog::OnTextEnter
)
1000 EVT_TEXT(ID_TEXT
,wxFileDialog::OnTextChange
)
1001 EVT_CHECKBOX(ID_CHECK
,wxFileDialog::OnCheck
)
1004 long wxFileDialog::ms_lastViewStyle
= wxLC_LIST
;
1005 bool wxFileDialog::ms_lastShowHidden
= FALSE
;
1007 wxFileDialog::wxFileDialog(wxWindow
*parent
,
1008 const wxString
& message
,
1009 const wxString
& defaultDir
,
1010 const wxString
& defaultFile
,
1011 const wxString
& wildCard
,
1013 const wxPoint
& pos
)
1014 : wxDialog( parent
, -1, message
, pos
, wxDefaultSize
,
1015 wxDEFAULT_DIALOG_STYLE
| wxRESIZE_BORDER
)
1017 if (wxConfig::Get(FALSE
))
1019 wxConfig::Get()->Read(wxT("/wxWindows/wxFileDialog/ViewStyle"),
1021 wxConfig::Get()->Read(wxT("/wxWindows/wxFileDialog/ShowHidden"),
1022 &ms_lastShowHidden
);
1025 m_message
= message
;
1026 m_dialogStyle
= style
;
1028 if (m_dialogStyle
== 0)
1029 m_dialogStyle
= wxOPEN
;
1030 if ((m_dialogStyle
& wxMULTIPLE
) && !(m_dialogStyle
& wxOPEN
))
1031 m_dialogStyle
|= wxOPEN
;
1034 if ((m_dir
.empty()) || (m_dir
== wxT(".")))
1039 size_t len
= m_dir
.Len();
1040 if ((len
> 1) && (m_dir
[len
-1] == wxFILE_SEP_PATH
))
1041 m_dir
.Remove( len
-1, 1 );
1044 m_path
+= wxFILE_SEP_PATH
;
1045 m_path
+= defaultFile
;
1046 m_fileName
= defaultFile
;
1047 m_wildCard
= wildCard
;
1049 m_filterExtension
= wxEmptyString
;
1051 // interpret wildcards
1053 if (m_wildCard
.IsEmpty())
1054 m_wildCard
= _("All files (*)|*");
1056 wxStringTokenizer
tokens( m_wildCard
, wxT("|") );
1058 wxString firstWildText
;
1059 if (tokens
.CountTokens() == 1)
1061 firstWildText
= tokens
.GetNextToken();
1062 firstWild
= firstWildText
;
1066 wxASSERT_MSG( tokens
.CountTokens() % 2 == 0, wxT("Wrong file type descripition") );
1067 firstWildText
= tokens
.GetNextToken();
1068 firstWild
= tokens
.GetNextToken();
1070 if ( firstWild
.Left( 2 ) == wxT("*.") )
1071 m_filterExtension
= firstWild
.Mid( 1 );
1072 if ( m_filterExtension
== wxT(".*") )
1073 m_filterExtension
= wxEmptyString
;
1077 bool is_pda
= (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA
);
1079 wxBoxSizer
*mainsizer
= new wxBoxSizer( wxVERTICAL
);
1081 wxBoxSizer
*buttonsizer
= new wxBoxSizer( wxHORIZONTAL
);
1083 wxBitmapButton
*but
;
1085 but
= new wxBitmapButton(this, ID_LIST_MODE
,
1086 wxArtProvider::GetBitmap(wxART_LIST_VIEW
, wxART_CMN_DIALOG
));
1088 but
->SetToolTip( _("View files as a list view") );
1090 buttonsizer
->Add( but
, 0, wxALL
, 5 );
1092 but
= new wxBitmapButton(this, ID_REPORT_MODE
,
1093 wxArtProvider::GetBitmap(wxART_REPORT_VIEW
, wxART_CMN_DIALOG
));
1095 but
->SetToolTip( _("View files as a detailed view") );
1097 buttonsizer
->Add( but
, 0, wxALL
, 5 );
1099 buttonsizer
->Add( 30, 5, 1 );
1101 wxWindow
*butDirUp
=
1102 new wxBitmapButton(this, ID_UP_DIR
,
1103 wxArtProvider::GetBitmap(wxART_GO_DIR_UP
, wxART_CMN_DIALOG
));
1105 butDirUp
->SetToolTip( _("Go to parent directory") );
1107 buttonsizer
->Add( butDirUp
, 0, wxALL
, 5 );
1109 #ifndef __DOS__ // VS: Home directory is meaningless in MS-DOS...
1110 but
= new wxBitmapButton(this, ID_PARENT_DIR
,
1111 wxArtProvider::GetBitmap(wxART_GO_HOME
, wxART_CMN_DIALOG
));
1113 but
->SetToolTip( _("Go to home directory") );
1115 buttonsizer
->Add( but
, 0, wxALL
, 5);
1117 buttonsizer
->Add( 20, 20 );
1120 wxWindow
*butNewDir
=
1121 new wxBitmapButton(this, ID_NEW_DIR
,
1122 wxArtProvider::GetBitmap(wxART_NEW_DIR
, wxART_CMN_DIALOG
));
1124 butNewDir
->SetToolTip( _("Create new directory") );
1126 buttonsizer
->Add( butNewDir
, 0, wxALL
, 5 );
1129 mainsizer
->Add( buttonsizer
, 0, wxALL
| wxEXPAND
, 0 );
1131 mainsizer
->Add( buttonsizer
, 0, wxALL
| wxEXPAND
, 5 );
1133 wxBoxSizer
*staticsizer
= new wxBoxSizer( wxHORIZONTAL
);
1135 staticsizer
->Add( new wxStaticText( this, -1, _("Current directory:") ), 0, wxRIGHT
, 10 );
1136 m_static
= new wxStaticText( this, -1, m_dir
);
1137 staticsizer
->Add( m_static
, 1 );
1138 mainsizer
->Add( staticsizer
, 0, wxEXPAND
| wxLEFT
|wxRIGHT
|wxBOTTOM
, 10 );
1140 long style2
= ms_lastViewStyle
| wxSUNKEN_BORDER
;
1141 if ( !(m_dialogStyle
& wxMULTIPLE
) )
1142 style2
|= wxLC_SINGLE_SEL
;
1144 m_list
= new wxFileCtrl( this, m_static
, ID_LIST_CTRL
,
1145 firstWild
, ms_lastShowHidden
,
1146 wxDefaultPosition
, wxSize(540,200),
1149 m_list
->SetNewDirControl(butNewDir
);
1150 m_list
->SetGoToParentControl(butDirUp
);
1154 // PDAs have a different screen layout
1155 mainsizer
->Add( m_list
, 1, wxEXPAND
| wxLEFT
|wxRIGHT
, 5 );
1157 wxBoxSizer
*choicesizer
= new wxBoxSizer( wxHORIZONTAL
);
1158 m_choice
= new wxChoice( this, ID_CHOICE
);
1159 choicesizer
->Add( m_choice
, 1, wxCENTER
|wxALL
, 5 );
1160 mainsizer
->Add( choicesizer
, 0, wxEXPAND
);
1162 wxBoxSizer
*textsizer
= new wxBoxSizer( wxHORIZONTAL
);
1163 m_text
= new wxTextCtrl( this, ID_TEXT
, m_fileName
, wxDefaultPosition
, wxDefaultSize
, wxPROCESS_ENTER
);
1164 textsizer
->Add( m_text
, 1, wxCENTER
| wxALL
, 5 );
1165 mainsizer
->Add( textsizer
, 0, wxEXPAND
);
1167 m_check
= new wxCheckBox( this, ID_CHECK
, _("Show hidden files") );
1168 m_check
->SetValue( ms_lastShowHidden
);
1169 textsizer
->Add( m_check
, 0, wxCENTER
|wxALL
, 5 );
1171 buttonsizer
= new wxBoxSizer( wxHORIZONTAL
);
1172 buttonsizer
->Add( new wxButton( this, wxID_OK
, _("OK") ), 0, wxCENTER
| wxALL
, 5 );
1173 buttonsizer
->Add( new wxButton( this, wxID_CANCEL
, _("Cancel") ), 0, wxCENTER
| wxALL
, 5 );
1174 mainsizer
->Add( buttonsizer
, 0, wxALIGN_RIGHT
);
1178 mainsizer
->Add( m_list
, 1, wxEXPAND
| wxLEFT
|wxRIGHT
, 10 );
1180 wxBoxSizer
*textsizer
= new wxBoxSizer( wxHORIZONTAL
);
1181 m_text
= new wxTextCtrl( this, ID_TEXT
, m_fileName
, wxDefaultPosition
, wxDefaultSize
, wxPROCESS_ENTER
);
1182 textsizer
->Add( m_text
, 1, wxCENTER
| wxLEFT
|wxRIGHT
|wxTOP
, 10 );
1183 textsizer
->Add( new wxButton( this, wxID_OK
, _("OK") ), 0, wxCENTER
| wxLEFT
|wxRIGHT
|wxTOP
, 10 );
1184 mainsizer
->Add( textsizer
, 0, wxEXPAND
);
1186 wxBoxSizer
*choicesizer
= new wxBoxSizer( wxHORIZONTAL
);
1187 m_choice
= new wxChoice( this, ID_CHOICE
);
1188 choicesizer
->Add( m_choice
, 1, wxCENTER
|wxALL
, 10 );
1189 m_check
= new wxCheckBox( this, ID_CHECK
, _("Show hidden files") );
1190 m_check
->SetValue( ms_lastShowHidden
);
1191 choicesizer
->Add( m_check
, 0, wxCENTER
|wxALL
, 10 );
1192 choicesizer
->Add( new wxButton( this, wxID_CANCEL
, _("Cancel") ), 0, wxCENTER
| wxALL
, 10 );
1193 mainsizer
->Add( choicesizer
, 0, wxEXPAND
);
1196 m_choice
->Append( firstWildText
, (void*) new wxString( firstWild
) );
1197 while (tokens
.HasMoreTokens())
1199 firstWildText
= tokens
.GetNextToken();
1200 firstWild
= tokens
.GetNextToken();
1201 m_choice
->Append( firstWildText
, (void*) new wxString( firstWild
) );
1203 m_choice
->SetSelection( 0 );
1205 SetAutoLayout( TRUE
);
1206 SetSizer( mainsizer
);
1208 mainsizer
->Fit( this );
1209 mainsizer
->SetSizeHints( this );
1216 wxFileDialog::~wxFileDialog()
1218 if (wxConfig::Get(FALSE
))
1220 wxConfig::Get()->Write(wxT("/wxWindows/wxFileDialog/ViewStyle"),
1222 wxConfig::Get()->Write(wxT("/wxWindows/wxFileDialog/ShowHidden"),
1227 int wxFileDialog::ShowModal()
1229 m_list
->GoToDir(m_dir
);
1230 m_text
->SetValue(m_fileName
);
1232 return wxDialog::ShowModal();
1235 void wxFileDialog::DoSetFilterIndex(int filterindex
)
1237 wxString
*str
= (wxString
*) m_choice
->GetClientData( filterindex
);
1238 m_list
->SetWild( *str
);
1239 m_filterIndex
= filterindex
;
1240 if ( str
->Left(2) == wxT("*.") )
1242 m_filterExtension
= str
->Mid(1);
1243 if (m_filterExtension
== _T(".*"))
1244 m_filterExtension
.clear();
1248 m_filterExtension
.clear();
1252 void wxFileDialog::SetFilterIndex( int filterindex
)
1254 m_choice
->SetSelection( filterindex
);
1256 DoSetFilterIndex(filterindex
);
1259 void wxFileDialog::OnChoiceFilter( wxCommandEvent
&event
)
1261 DoSetFilterIndex((int)event
.GetInt());
1264 void wxFileDialog::OnCheck( wxCommandEvent
&event
)
1266 m_list
->ShowHidden( (ms_lastShowHidden
= event
.GetInt() != 0) );
1269 void wxFileDialog::OnActivated( wxListEvent
&event
)
1271 HandleAction( event
.m_item
.m_text
);
1274 void wxFileDialog::OnTextEnter( wxCommandEvent
&WXUNUSED(event
) )
1276 wxCommandEvent
cevent(wxEVT_COMMAND_BUTTON_CLICKED
, wxID_OK
);
1277 cevent
.SetEventObject( this );
1278 GetEventHandler()->ProcessEvent( cevent
);
1281 static bool ignoreChanges
= FALSE
;
1283 void wxFileDialog::OnTextChange( wxCommandEvent
&WXUNUSED(event
) )
1287 // Clear selections. Otherwise when the user types in a value they may
1288 // not get the file whose name they typed.
1289 if (m_list
->GetSelectedItemCount() > 0)
1291 long item
= m_list
->GetNextItem(-1, wxLIST_NEXT_ALL
,
1292 wxLIST_STATE_SELECTED
);
1293 while ( item
!= -1 )
1295 m_list
->SetItemState(item
,0, wxLIST_STATE_SELECTED
);
1296 item
= m_list
->GetNextItem(item
, wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1302 void wxFileDialog::OnSelected( wxListEvent
&event
)
1304 wxString
filename( event
.m_item
.m_text
);
1305 if (filename
== wxT("..")) return;
1308 m_list
->GetDir( dir
);
1309 if (!IsTopMostDir(dir
))
1310 dir
+= wxFILE_SEP_PATH
;
1312 if (wxDirExists(dir
)) return;
1314 ignoreChanges
= TRUE
;
1315 m_text
->SetValue( filename
);
1316 ignoreChanges
= FALSE
;
1319 void wxFileDialog::HandleAction( const wxString
&fn
)
1321 wxString
filename( fn
);
1323 m_list
->GetDir( dir
);
1324 if (filename
.IsEmpty()) return;
1325 if (filename
== wxT(".")) return;
1327 if (filename
== wxT(".."))
1329 m_list
->GoToParentDir();
1335 if (filename
== wxT("~"))
1337 m_list
->GoToHomeDir();
1342 if (filename
[0u] == wxT('~'))
1344 filename
.Remove( 0, 1 );
1345 wxString
tmp( wxGetUserHome() );
1352 if ((filename
.Find(wxT('*')) != wxNOT_FOUND
) ||
1353 (filename
.Find(wxT('?')) != wxNOT_FOUND
))
1355 if (filename
.Find(wxFILE_SEP_PATH
) != wxNOT_FOUND
)
1357 wxMessageBox(_("Illegal file specification."), _("Error"), wxOK
| wxICON_ERROR
);
1360 m_list
->SetWild( filename
);
1364 if (!IsTopMostDir(dir
))
1365 dir
+= wxFILE_SEP_PATH
;
1366 if (!wxIsAbsolutePath(filename
))
1372 if (wxDirExists(filename
))
1374 m_list
->GoToDir( filename
);
1378 // append the default extension to the filename if it doesn't have any
1380 // VZ: the logic of testing for !wxFileExists() only for the open file
1381 // dialog is not entirely clear to me, why don't we allow saving to a
1382 // file without extension as well?
1383 if ( !(m_dialogStyle
& wxOPEN
) || !wxFileExists(filename
) )
1386 wxSplitPath(filename
, NULL
, NULL
, &ext
);
1389 // append the first extension of the filter string
1390 filename
+= m_filterExtension
.BeforeFirst(_T(';'));
1394 // check that the file [doesn't] exist if necessary
1395 if ( (m_dialogStyle
& wxSAVE
) &&
1396 (m_dialogStyle
& wxOVERWRITE_PROMPT
) &&
1397 wxFileExists( filename
) )
1400 msg
.Printf( _("File '%s' already exists, do you really want to "
1401 "overwrite it?"), filename
.c_str() );
1403 if (wxMessageBox(msg
, _("Confirm"), wxYES_NO
) != wxYES
)
1406 else if ( (m_dialogStyle
& wxOPEN
) &&
1407 (m_dialogStyle
& wxFILE_MUST_EXIST
) &&
1408 !wxFileExists(filename
) )
1410 wxMessageBox(_("Please choose an existing file."), _("Error"),
1411 wxOK
| wxICON_ERROR
);
1414 SetPath( filename
);
1416 // change to the directory where the user went if asked
1417 if ( m_dialogStyle
& wxCHANGE_DIR
)
1420 wxSplitPath(filename
, &cwd
, NULL
, NULL
);
1422 if ( cwd
!= wxGetWorkingDirectory() )
1424 wxSetWorkingDirectory(cwd
);
1428 wxCommandEvent event
;
1429 wxDialog::OnOK(event
);
1432 void wxFileDialog::OnListOk( wxCommandEvent
&WXUNUSED(event
) )
1434 HandleAction( m_text
->GetValue() );
1437 void wxFileDialog::OnList( wxCommandEvent
&WXUNUSED(event
) )
1439 m_list
->ChangeToListMode();
1440 ms_lastViewStyle
= wxLC_LIST
;
1444 void wxFileDialog::OnReport( wxCommandEvent
&WXUNUSED(event
) )
1446 m_list
->ChangeToReportMode();
1447 ms_lastViewStyle
= wxLC_REPORT
;
1451 void wxFileDialog::OnUp( wxCommandEvent
&WXUNUSED(event
) )
1453 m_list
->GoToParentDir();
1457 void wxFileDialog::OnHome( wxCommandEvent
&WXUNUSED(event
) )
1459 m_list
->GoToHomeDir();
1463 void wxFileDialog::OnNew( wxCommandEvent
&WXUNUSED(event
) )
1468 void wxFileDialog::SetPath( const wxString
& path
)
1470 // not only set the full path but also update filename and dir
1472 if ( !path
.empty() )
1475 wxSplitPath(path
, &m_dir
, &m_fileName
, &ext
);
1478 m_fileName
+= wxT(".");
1484 void wxFileDialog::GetPaths( wxArrayString
& paths
) const
1487 if (m_list
->GetSelectedItemCount() == 0)
1489 paths
.Add( GetPath() );
1493 paths
.Alloc( m_list
->GetSelectedItemCount() );
1496 m_list
->GetDir( dir
);
1498 if (dir
!= wxT("/"))
1500 dir
+= wxFILE_SEP_PATH
;
1503 item
.m_mask
= wxLIST_MASK_TEXT
;
1505 item
.m_itemId
= m_list
->GetNextItem( -1, wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1506 while ( item
.m_itemId
!= -1 )
1508 m_list
->GetItem( item
);
1509 paths
.Add( dir
+ item
.m_text
);
1510 item
.m_itemId
= m_list
->GetNextItem( item
.m_itemId
,
1511 wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1515 void wxFileDialog::GetFilenames(wxArrayString
& files
) const
1518 if (m_list
->GetSelectedItemCount() == 0)
1520 files
.Add( GetFilename() );
1523 files
.Alloc( m_list
->GetSelectedItemCount() );
1526 item
.m_mask
= wxLIST_MASK_TEXT
;
1528 item
.m_itemId
= m_list
->GetNextItem( -1, wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1529 while ( item
.m_itemId
!= -1 )
1531 m_list
->GetItem( item
);
1532 files
.Add( item
.m_text
);
1533 item
.m_itemId
= m_list
->GetNextItem( item
.m_itemId
,
1534 wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1540 // ----------------------------------------------------------------------------
1542 // ----------------------------------------------------------------------------
1544 // common part of both wxFileSelectorEx() and wxFileSelector()
1546 DoSelectFile(const wxChar
*title
,
1547 const wxChar
*defaultDir
,
1548 const wxChar
*defaultFileName
,
1549 const wxChar
*defaultExtension
,
1550 int *indexDefaultExtension
,
1551 const wxChar
*filter
,
1557 // the filter may be either given explicitly or created automatically from
1558 // the default extension
1559 wxString filterReal
;
1562 // the user has specified the filter explicitly, use it
1563 filterReal
= filter
;
1565 else if ( !wxIsEmpty(defaultExtension
) )
1567 // create the filter to match the given extension
1568 filterReal
<< wxT("*.") << defaultExtension
;
1571 wxFileDialog
fileDialog(parent
,
1580 if ( fileDialog
.ShowModal() == wxID_OK
)
1582 path
= fileDialog
.GetPath();
1583 if ( indexDefaultExtension
)
1585 *indexDefaultExtension
= fileDialog
.GetFilterIndex();
1593 wxFileSelectorEx(const wxChar
*title
,
1594 const wxChar
*defaultDir
,
1595 const wxChar
*defaultFileName
,
1596 int *indexDefaultExtension
,
1597 const wxChar
*filter
,
1603 return DoSelectFile(title
,
1606 wxT(""), // def ext determined by index
1607 indexDefaultExtension
,
1616 wxFileSelector(const wxChar
*title
,
1617 const wxChar
*defaultDir
,
1618 const wxChar
*defaultFileName
,
1619 const wxChar
*defaultExtension
,
1620 const wxChar
*filter
,
1626 return DoSelectFile(title
,
1630 NULL
, // not interested in filter index
1638 static wxString
GetWildcardString(const wxChar
*ext
)
1643 if ( *ext
== wxT('.') )
1646 wild
<< _T("*.") << ext
;
1648 else // no extension specified
1650 wild
= wxFileSelectorDefaultWildcardStr
;
1656 wxString
wxLoadFileSelector(const wxChar
*what
,
1658 const wxChar
*nameDef
,
1662 if ( what
&& *what
)
1663 prompt
= wxString::Format(_("Load %s file"), what
);
1665 prompt
= _("Load file");
1667 return wxFileSelector(prompt
, NULL
, nameDef
, ext
,
1668 GetWildcardString(ext
), 0, parent
);
1671 wxString
wxSaveFileSelector(const wxChar
*what
,
1673 const wxChar
*nameDef
,
1677 if ( what
&& *what
)
1678 prompt
= wxString::Format(_("Save %s file"), what
);
1680 prompt
= _("Save file");
1682 return wxFileSelector(prompt
, NULL
, nameDef
, ext
,
1683 GetWildcardString(ext
), 0, parent
);
1686 // A module to allow icons table cleanup
1688 class wxFileDialogGenericModule
: public wxModule
1690 DECLARE_DYNAMIC_CLASS(wxFileDialogGenericModule
)
1692 wxFileDialogGenericModule() {}
1693 bool OnInit() { return TRUE
; }
1694 void OnExit() { if (g_IconsTable
) {delete g_IconsTable
; g_IconsTable
= NULL
;} }
1697 IMPLEMENT_DYNAMIC_CLASS(wxFileDialogGenericModule
, wxModule
)
1699 #endif // wxUSE_FILEDLG