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"
60 #include "wx/tooltip.h"
63 #include <sys/types.h>
79 #if defined(__UNIX__) || defined(__DOS__)
83 // ----------------------------------------------------------------------------
85 // ----------------------------------------------------------------------------
87 // the list ctrl fields in report view
100 //-----------------------------------------------------------------------------
102 //-----------------------------------------------------------------------------
107 wxFileData( const wxString
&name
, const wxString
&fname
);
108 wxString
GetName() const;
109 wxString
GetFullName() const;
110 wxString
GetHint() const;
111 wxString
GetEntry( FileListField num
) const;
113 bool IsDir() const { return m_isDir
; }
114 bool IsLink() const { return m_isLink
; }
115 bool IsExe() const { return m_isExe
; }
116 long GetSize() const { return m_size
; }
118 void MakeItem( wxListItem
&item
);
119 void SetNewName( const wxString
&name
, const wxString
&fname
);
130 wxString m_permissions
;
136 //-----------------------------------------------------------------------------
138 //-----------------------------------------------------------------------------
140 class wxFileCtrl
: public wxListCtrl
144 wxFileCtrl( wxWindow
*win
,
145 wxStaticText
*labelDir
,
147 const wxString
&wild
,
149 const wxPoint
&pos
= wxDefaultPosition
,
150 const wxSize
&size
= wxDefaultSize
,
151 long style
= wxLC_LIST
,
152 const wxValidator
&validator
= wxDefaultValidator
,
153 const wxString
&name
= wxT("filelist") );
154 virtual ~wxFileCtrl();
156 void ChangeToListMode();
157 void ChangeToReportMode();
158 void ChangeToIconMode();
159 void ShowHidden( bool show
= TRUE
);
160 long Add( wxFileData
*fd
, wxListItem
&item
);
162 virtual void StatusbarText( wxChar
*WXUNUSED(text
) ) {};
164 void GoToParentDir();
166 void GoToDir( const wxString
&dir
);
167 void SetWild( const wxString
&wild
);
168 void GetDir( wxString
&dir
);
169 void OnListDeleteItem( wxListEvent
&event
);
170 void OnListEndLabelEdit( wxListEvent
&event
);
172 // Associate commonly used UI controls with wxFileCtrl so that they can be
173 // disabled when they cannot be used (e.g. can't go to parent directory
174 // if wxFileCtrl already is in the root dir):
175 void SetGoToParentControl(wxWindow
*ctrl
) { m_goToParentControl
= ctrl
; }
176 void SetNewDirControl(wxWindow
*ctrl
) { m_newDirControl
= ctrl
; }
179 void FreeItemData(const wxListItem
& item
);
180 void FreeAllItemsData();
186 wxWindow
*m_goToParentControl
;
187 wxWindow
*m_newDirControl
;
189 // the label showing the current directory
190 wxStaticText
*m_labelDir
;
192 DECLARE_DYNAMIC_CLASS(wxFileCtrl
);
193 DECLARE_EVENT_TABLE()
196 // ----------------------------------------------------------------------------
197 // private classes - icons list management
198 // ----------------------------------------------------------------------------
200 class wxFileIconEntry
: public wxObject
203 wxFileIconEntry(int i
) { id
= i
; }
209 class wxFileIconsTable
214 int GetIconID(const wxString
& extension
, const wxString
& mime
= wxEmptyString
);
215 wxImageList
*GetImageList() { return &m_ImageList
; }
218 wxImageList m_ImageList
;
219 wxHashTable m_HashTable
;
222 static wxFileIconsTable
*g_IconsTable
= NULL
;
226 #define FI_EXECUTABLE 2
228 wxFileIconsTable::wxFileIconsTable() :
230 m_HashTable(wxKEY_STRING
)
232 m_HashTable
.DeleteContents(TRUE
);
234 m_ImageList
.Add(wxArtProvider::GetBitmap(wxART_FOLDER
, wxART_CMN_DIALOG
));
236 m_ImageList
.Add(wxArtProvider::GetBitmap(wxART_NORMAL_FILE
, wxART_CMN_DIALOG
));
238 if (GetIconID(wxEmptyString
, _T("application/x-executable")) == FI_UNKNOWN
)
240 m_ImageList
.Add(wxArtProvider::GetBitmap(wxART_EXECUTABLE_FILE
, wxART_CMN_DIALOG
));
241 m_HashTable
.Delete(_T("exe"));
242 m_HashTable
.Put(_T("exe"), new wxFileIconEntry(FI_EXECUTABLE
));
244 /* else put into list by GetIconID
245 (KDE defines application/x-executable for *.exe and has nice icon)
252 // VS: we don't need this function w/o wxMimeTypesManager because we'll only have
253 // one icon and we won't resize it
255 static wxBitmap
CreateAntialiasedBitmap(const wxImage
& img
)
257 wxImage
smallimg (16, 16);
258 unsigned char *p1
, *p2
, *ps
;
259 unsigned char mr
= img
.GetMaskRed(),
260 mg
= img
.GetMaskGreen(),
261 mb
= img
.GetMaskBlue();
264 unsigned sr
, sg
, sb
, smask
;
266 p1
= img
.GetData(), p2
= img
.GetData() + 3 * 32, ps
= smallimg
.GetData();
267 smallimg
.SetMaskColour(mr
, mr
, mr
);
269 for (y
= 0; y
< 16; y
++)
271 for (x
= 0; x
< 16; x
++)
273 sr
= sg
= sb
= smask
= 0;
274 if (p1
[0] != mr
|| p1
[1] != mg
|| p1
[2] != mb
)
275 sr
+= p1
[0], sg
+= p1
[1], sb
+= p1
[2];
278 if (p1
[0] != mr
|| p1
[1] != mg
|| p1
[2] != mb
)
279 sr
+= p1
[0], sg
+= p1
[1], sb
+= p1
[2];
282 if (p2
[0] != mr
|| p2
[1] != mg
|| p2
[2] != mb
)
283 sr
+= p2
[0], sg
+= p2
[1], sb
+= p2
[2];
286 if (p2
[0] != mr
|| p2
[1] != mg
|| p2
[2] != mb
)
287 sr
+= p2
[0], sg
+= p2
[1], sb
+= p2
[2];
292 ps
[0] = ps
[1] = ps
[2] = mr
;
294 ps
[0] = sr
>> 2, ps
[1] = sg
>> 2, ps
[2] = sb
>> 2;
297 p1
+= 32 * 3, p2
+= 32 * 3;
300 return wxBitmap(smallimg
);
303 // finds empty borders and return non-empty area of image:
304 static wxImage
CutEmptyBorders(const wxImage
& img
)
306 unsigned char mr
= img
.GetMaskRed(),
307 mg
= img
.GetMaskGreen(),
308 mb
= img
.GetMaskBlue();
309 unsigned char *dt
= img
.GetData(), *dttmp
;
310 unsigned w
= img
.GetWidth(), h
= img
.GetHeight();
312 unsigned top
, bottom
, left
, right
, i
;
315 #define MK_DTTMP(x,y) dttmp = dt + ((x + y * w) * 3)
316 #define NOEMPTY_PIX(empt) if (dttmp[0] != mr || dttmp[1] != mg || dttmp[2] != mb) {empt = FALSE; break;}
318 for (empt
= TRUE
, top
= 0; empt
&& top
< h
; top
++)
321 for (i
= 0; i
< w
; i
++, dttmp
+=3)
324 for (empt
= TRUE
, bottom
= h
-1; empt
&& bottom
> top
; bottom
--)
327 for (i
= 0; i
< w
; i
++, dttmp
+=3)
330 for (empt
= TRUE
, left
= 0; empt
&& left
< w
; left
++)
333 for (i
= 0; i
< h
; i
++, dttmp
+=3*w
)
336 for (empt
= TRUE
, right
= w
-1; empt
&& right
> left
; right
--)
339 for (i
= 0; i
< h
; i
++, dttmp
+=3*w
)
342 top
--, left
--, bottom
++, right
++;
344 return img
.GetSubImage(wxRect(left
, top
, right
- left
+ 1, bottom
- top
+ 1));
346 #endif // wxUSE_MIMETYPE
350 int wxFileIconsTable::GetIconID(const wxString
& extension
, const wxString
& mime
)
353 if (!extension
.IsEmpty())
355 wxFileIconEntry
*entry
= (wxFileIconEntry
*) m_HashTable
.Get(extension
);
356 if (entry
) return (entry
-> id
);
359 wxFileType
*ft
= (mime
.IsEmpty()) ?
360 wxTheMimeTypesManager
-> GetFileTypeFromExtension(extension
) :
361 wxTheMimeTypesManager
-> GetFileTypeFromMimeType(mime
);
363 if (ft
== NULL
|| (!ft
-> GetIcon(&ic
)) || (!ic
.Ok()))
365 int newid
= FI_UNKNOWN
;
366 m_HashTable
.Put(extension
, new wxFileIconEntry(newid
));
370 wxBitmap
myBitmap (ic
.GetWidth(), ic
.GetHeight() ) ;
372 memDC
.SelectObject( myBitmap
);
373 memDC
.DrawIcon(ic
,0,0);
374 memDC
.SelectObject( wxNullBitmap
);
375 wxImage img
= myBitmap
.ConvertToImage();
377 wxImage img
= ic
.ConvertToImage();
381 int id
= m_ImageList
.GetImageCount();
382 if (img
.GetWidth() == 16 && img
.GetHeight() == 16)
383 m_ImageList
.Add(wxBitmap(img
));
386 if (img
.GetWidth() != 32 || img
.GetHeight() != 32)
387 m_ImageList
.Add(CreateAntialiasedBitmap(CutEmptyBorders(img
).Rescale(32, 32)));
389 m_ImageList
.Add(CreateAntialiasedBitmap(img
));
391 m_HashTable
.Put(extension
, new wxFileIconEntry(id
));
394 #else // !wxUSE_MIMETYPE
396 if (extension
== wxT("exe"))
397 return FI_EXECUTABLE
;
400 #endif // wxUSE_MIMETYPE/!wxUSE_MIMETYPE
405 // ----------------------------------------------------------------------------
407 // ----------------------------------------------------------------------------
410 int ListCompare( long data1
, long data2
, long WXUNUSED(data
))
412 wxFileData
*fd1
= (wxFileData
*)data1
;
413 wxFileData
*fd2
= (wxFileData
*)data2
;
414 if (fd1
->GetName() == wxT("..")) return -1;
415 if (fd2
->GetName() == wxT("..")) return 1;
416 if (fd1
->IsDir() && !fd2
->IsDir()) return -1;
417 if (fd2
->IsDir() && !fd1
->IsDir()) return 1;
418 return wxStrcmp( fd1
->GetName(), fd2
->GetName() );
422 #define IsTopMostDir(dir) (dir == wxT("/"))
425 #if defined(__DOS__) || defined(__WINDOWS__)
426 #define IsTopMostDir(dir) (dir.IsEmpty())
429 #if defined(__DOS__) || defined(__WINDOWS__)
430 extern bool wxIsDriveAvailable(const wxString
& dirName
);
433 //-----------------------------------------------------------------------------
435 //-----------------------------------------------------------------------------
437 wxFileData::wxFileData( const wxString
&name
, const wxString
&fname
)
442 #if defined(__DOS__) || defined(__WINDOWS__)
443 // VS: In case the file is root directory of a volume (e.g. "C:"),
444 // we don't want it stat()ed, since the drive may not be in:
445 if (name
.length() == 2 && name
[1u] == wxT(':'))
453 #endif // __DOS__ || __WINDOWS__
457 #if defined(__UNIX__) && (!defined( __EMX__ ) && !defined(__VMS))
458 lstat( m_fileName
.fn_str(), &buff
);
459 m_isLink
= S_ISLNK( buff
.st_mode
);
461 wxStat( m_fileName
, &buff
);
465 m_isDir
= (buff
.st_mode
& S_IFDIR
) != 0;
466 m_isExe
= (buff
.st_mode
& wxS_IXUSR
) != 0;
468 m_size
= buff
.st_size
;
470 const struct tm
* const t
= localtime( &buff
.st_mtime
);
472 m_minute
= t
->tm_min
;
473 m_month
= t
->tm_mon
+1;
478 m_permissions
.Printf(_T("%c%c%c"),
479 buff
.st_mode
& wxS_IRUSR
? _T('r') : _T('-'),
480 buff
.st_mode
& wxS_IWUSR
? _T('w') : _T('-'),
481 buff
.st_mode
& wxS_IXUSR
? _T('x') : _T('-'));
484 wxString
wxFileData::GetName() const
489 wxString
wxFileData::GetFullName() const
494 wxString
wxFileData::GetHint() const
496 wxString s
= m_fileName
;
498 if (m_isDir
) s
+= wxT("<DIR> ");
499 else if (m_isLink
) s
+= wxT("<LINK> ");
502 s
+= LongToString( m_size
);
505 s
+= IntToString( m_day
);
507 s
+= IntToString( m_month
);
509 s
+= IntToString( m_year
);
511 s
+= IntToString( m_hour
);
513 s
+= IntToString( m_minute
);
519 wxString
wxFileData::GetEntry( FileListField num
) const
534 s
.Printf(_T("%ld"), m_size
);
538 s
.Printf(_T("%02d.%02d.%d"), m_day
, m_month
, m_year
);
542 s
.Printf(_T("%02d:%02d"), m_hour
, m_minute
);
552 wxFAIL_MSG( _T("unexpected field in wxFileData::GetEntry()") );
558 void wxFileData::SetNewName( const wxString
&name
, const wxString
&fname
)
564 void wxFileData::MakeItem( wxListItem
&item
)
566 item
.m_text
= m_name
;
567 item
.ClearAttributes();
569 item
.SetTextColour(*wxRED
);
571 item
.SetTextColour(*wxBLUE
);
574 item
.m_image
= FI_FOLDER
;
576 item
.m_image
= FI_EXECUTABLE
;
577 else if (m_name
.Find(wxT('.')) != wxNOT_FOUND
)
578 item
.m_image
= g_IconsTable
->GetIconID(m_name
.AfterLast(wxT('.')));
580 item
.m_image
= FI_UNKNOWN
;
584 wxColour
*dg
= wxTheColourDatabase
->FindColour( _T("MEDIUM GREY") );
585 item
.SetTextColour(*dg
);
587 item
.m_data
= (long)this;
590 //-----------------------------------------------------------------------------
592 //-----------------------------------------------------------------------------
594 IMPLEMENT_DYNAMIC_CLASS(wxFileCtrl
,wxListCtrl
)
596 BEGIN_EVENT_TABLE(wxFileCtrl
,wxListCtrl
)
597 EVT_LIST_DELETE_ITEM(-1, wxFileCtrl::OnListDeleteItem
)
598 EVT_LIST_END_LABEL_EDIT(-1, wxFileCtrl::OnListEndLabelEdit
)
602 wxFileCtrl::wxFileCtrl()
604 m_showHidden
= FALSE
;
607 wxFileCtrl::wxFileCtrl(wxWindow
*win
,
608 wxStaticText
*labelDir
,
610 const wxString
& wild
,
615 const wxValidator
&validator
,
616 const wxString
&name
)
617 : wxListCtrl(win
, id
, pos
, size
, style
, validator
, name
),
621 g_IconsTable
= new wxFileIconsTable
;
622 wxImageList
*imageList
= g_IconsTable
->GetImageList();
624 SetImageList( imageList
, wxIMAGE_LIST_SMALL
);
626 m_goToParentControl
=
627 m_newDirControl
= NULL
;
629 m_labelDir
= labelDir
;
631 m_showHidden
= showHidden
;
634 void wxFileCtrl::ChangeToListMode()
636 SetSingleStyle( wxLC_LIST
);
640 void wxFileCtrl::ChangeToReportMode()
642 SetSingleStyle( wxLC_REPORT
);
646 void wxFileCtrl::ChangeToIconMode()
648 SetSingleStyle( wxLC_ICON
);
652 void wxFileCtrl::ShowHidden( bool show
)
658 long wxFileCtrl::Add( wxFileData
*fd
, wxListItem
&item
)
661 item
.m_mask
= wxLIST_MASK_TEXT
+ wxLIST_MASK_DATA
+ wxLIST_MASK_IMAGE
;
662 fd
->MakeItem( item
);
663 long my_style
= GetWindowStyleFlag();
664 if (my_style
& wxLC_REPORT
)
666 ret
= InsertItem( item
);
667 for (int i
= 1; i
< FileList_Max
; i
++)
668 SetItem( item
.m_itemId
, i
, fd
->GetEntry((FileListField
)i
) );
670 else if (my_style
& wxLC_LIST
)
672 ret
= InsertItem( item
);
677 void wxFileCtrl::UpdateFiles()
679 // don't do anything before ShowModal() call which sets m_dirName
680 if ( m_dirName
.empty() )
683 wxBusyCursor bcur
; // this may take a while...
685 long my_style
= GetWindowStyleFlag();
686 int name_col_width
= 0;
687 if (my_style
& wxLC_REPORT
)
689 if (GetColumnCount() > 0)
690 name_col_width
= GetColumnWidth( 0 );
696 if (my_style
& wxLC_REPORT
)
698 if (name_col_width
< 140) name_col_width
= 140;
699 InsertColumn( 0, _("Name"), wxLIST_FORMAT_LEFT
, name_col_width
);
700 InsertColumn( 1, _("Size"), wxLIST_FORMAT_LEFT
, 60 );
701 InsertColumn( 2, _("Date"), wxLIST_FORMAT_LEFT
, 65 );
702 InsertColumn( 3, _("Time"), wxLIST_FORMAT_LEFT
, 50 );
704 InsertColumn( 4, _("Permissions"), wxLIST_FORMAT_LEFT
, 120 );
707 wxFileData
*fd
= (wxFileData
*) NULL
;
712 #if defined(__DOS__) || defined(__WINDOWS__)
713 if ( IsTopMostDir(m_dirName
) )
715 // Pseudo-directory with all available drives listed...
716 for (int drive
= 1; drive
<= 26; drive
++)
719 path
.Printf(wxT("%c:\\"), (char)(drive
+ 'A' - 1));
720 if ( wxIsDriveAvailable(path
) )
723 fd
= new wxFileData(path
, path
);
733 if ( !IsTopMostDir(m_dirName
) )
735 wxString
p(wxPathOnly(m_dirName
));
737 if (p
.IsEmpty()) p
= wxT("/");
739 fd
= new wxFileData( wxT(".."), p
);
744 wxString
dirname(m_dirName
);
745 #if defined(__DOS__) || defined(__WINDOWS__)
746 if (dirname
.length() == 2 && dirname
[1u] == wxT(':'))
747 dirname
<< wxT('\\');
751 if ( dir
.IsOpened() )
753 wxString
dirPrefix(dirname
+ wxFILE_SEP_PATH
);
754 int hiddenFlag
= m_showHidden
? wxDIR_HIDDEN
: 0;
759 // Get the directories first (not matched against wildcards):
760 cont
= dir
.GetFirst(&f
, wxEmptyString
, wxDIR_DIRS
| hiddenFlag
);
763 fd
= new wxFileData(f
, dirPrefix
+ f
);
766 cont
= dir
.GetNext(&f
);
769 // Tokenize the wildcard string, so we can handle more than 1
770 // search pattern in a wildcard.
771 wxStringTokenizer
tokenWild(m_wild
, wxT(";"));
772 while ( tokenWild
.HasMoreTokens() )
774 cont
= dir
.GetFirst(&f
, tokenWild
.GetNextToken(),
775 wxDIR_FILES
| hiddenFlag
);
778 fd
= new wxFileData(f
, dirPrefix
+ f
);
781 cont
= dir
.GetNext(&f
);
787 SortItems((wxListCtrlCompare
)ListCompare
, 0);
789 if ( my_style
& wxLC_REPORT
)
791 SetColumnWidth(1, wxLIST_AUTOSIZE
);
792 SetColumnWidth(2, wxLIST_AUTOSIZE
);
793 SetColumnWidth(3, wxLIST_AUTOSIZE
);
796 // Finally, enable/disable context-dependent controls:
797 if ( m_goToParentControl
)
798 m_goToParentControl
->Enable(!IsTopMostDir(m_dirName
));
799 #if defined(__DOS__) || defined(__WINDOWS__)
800 if ( m_newDirControl
)
801 m_newDirControl
->Enable(!IsTopMostDir(m_dirName
));
805 void wxFileCtrl::SetWild( const wxString
&wild
)
811 void wxFileCtrl::MakeDir()
813 wxString
new_name( _("NewName") );
814 wxString
path( m_dirName
);
815 path
+= wxFILE_SEP_PATH
;
817 if (wxFileExists(path
))
819 // try NewName0, NewName1 etc.
822 new_name
= _("NewName");
824 num
.Printf( wxT("%d"), i
);
828 path
+= wxFILE_SEP_PATH
;
831 } while (wxFileExists(path
));
837 wxMessageDialog
dialog(this, _("Operation not permitted."), _("Error"), wxOK
| wxICON_ERROR
);
842 wxFileData
*fd
= new wxFileData( new_name
, path
);
846 long id
= Add( fd
, item
);
850 SortItems( (wxListCtrlCompare
) ListCompare
, 0 );
851 id
= FindItem( 0, (long)fd
);
857 void wxFileCtrl::GoToParentDir()
859 if (!IsTopMostDir(m_dirName
))
861 size_t len
= m_dirName
.Len();
862 if (m_dirName
[len
-1] == wxFILE_SEP_PATH
)
863 m_dirName
.Remove( len
-1, 1 );
864 wxString
fname( wxFileNameFromPath(m_dirName
) );
865 m_dirName
= wxPathOnly( m_dirName
);
867 if (m_dirName
.IsEmpty())
868 m_dirName
= wxT("/");
871 long id
= FindItem( 0, fname
);
874 SetItemState( id
, wxLIST_STATE_SELECTED
, wxLIST_STATE_SELECTED
);
878 m_labelDir
->SetLabel(m_dirName
);
882 void wxFileCtrl::GoToHomeDir()
884 wxString s
= wxGetUserHome( wxString() );
888 void wxFileCtrl::GoToDir( const wxString
&dir
)
892 SetItemState( 0, wxLIST_STATE_SELECTED
, wxLIST_STATE_SELECTED
);
895 m_labelDir
->SetLabel(dir
);
898 void wxFileCtrl::GetDir( wxString
&dir
)
903 void wxFileCtrl::FreeItemData(const wxListItem
& item
)
905 wxFileData
*fd
= (wxFileData
*)item
.m_data
;
909 void wxFileCtrl::OnListDeleteItem( wxListEvent
&event
)
911 FreeItemData(event
.m_item
);
914 void wxFileCtrl::FreeAllItemsData()
917 item
.m_mask
= wxLIST_MASK_DATA
;
919 item
.m_itemId
= GetNextItem( -1, wxLIST_NEXT_ALL
);
920 while ( item
.m_itemId
!= -1 )
924 item
.m_itemId
= GetNextItem( item
.m_itemId
, wxLIST_NEXT_ALL
);
928 void wxFileCtrl::OnListEndLabelEdit( wxListEvent
&event
)
930 wxFileData
*fd
= (wxFileData
*)event
.m_item
.m_data
;
933 if ((event
.GetLabel().IsEmpty()) ||
934 (event
.GetLabel() == _(".")) ||
935 (event
.GetLabel() == _("..")) ||
936 (event
.GetLabel().First( wxFILE_SEP_PATH
) != wxNOT_FOUND
))
938 wxMessageDialog
dialog(this, _("Illegal directory name."), _("Error"), wxOK
| wxICON_ERROR
);
944 wxString
new_name( wxPathOnly( fd
->GetFullName() ) );
945 new_name
+= wxFILE_SEP_PATH
;
946 new_name
+= event
.GetLabel();
950 if (wxFileExists(new_name
))
952 wxMessageDialog
dialog(this, _("File name exists already."), _("Error"), wxOK
| wxICON_ERROR
);
957 if (wxRenameFile(fd
->GetFullName(),new_name
))
959 fd
->SetNewName( new_name
, event
.GetLabel() );
960 SetItemState( event
.GetItem(), wxLIST_STATE_SELECTED
, wxLIST_STATE_SELECTED
);
961 EnsureVisible( event
.GetItem() );
965 wxMessageDialog
dialog(this, _("Operation not permitted."), _("Error"), wxOK
| wxICON_ERROR
);
971 wxFileCtrl::~wxFileCtrl()
976 //-----------------------------------------------------------------------------
978 //-----------------------------------------------------------------------------
980 #define ID_LIST_MODE (wxID_FILEDLGG )
981 #define ID_REPORT_MODE (wxID_FILEDLGG + 1)
982 #define ID_UP_DIR (wxID_FILEDLGG + 5)
983 #define ID_PARENT_DIR (wxID_FILEDLGG + 6)
984 #define ID_NEW_DIR (wxID_FILEDLGG + 7)
985 #define ID_CHOICE (wxID_FILEDLGG + 8)
986 #define ID_TEXT (wxID_FILEDLGG + 9)
987 #define ID_LIST_CTRL (wxID_FILEDLGG + 10)
988 #define ID_ACTIVATED (wxID_FILEDLGG + 11)
989 #define ID_CHECK (wxID_FILEDLGG + 12)
991 IMPLEMENT_DYNAMIC_CLASS(wxFileDialog
,wxDialog
)
993 BEGIN_EVENT_TABLE(wxFileDialog
,wxDialog
)
994 EVT_BUTTON(ID_LIST_MODE
, wxFileDialog::OnList
)
995 EVT_BUTTON(ID_REPORT_MODE
, wxFileDialog::OnReport
)
996 EVT_BUTTON(ID_UP_DIR
, wxFileDialog::OnUp
)
997 EVT_BUTTON(ID_PARENT_DIR
, wxFileDialog::OnHome
)
998 EVT_BUTTON(ID_NEW_DIR
, wxFileDialog::OnNew
)
999 EVT_BUTTON(wxID_OK
, wxFileDialog::OnListOk
)
1000 EVT_LIST_ITEM_SELECTED(ID_LIST_CTRL
, wxFileDialog::OnSelected
)
1001 EVT_LIST_ITEM_ACTIVATED(ID_LIST_CTRL
, wxFileDialog::OnActivated
)
1002 EVT_CHOICE(ID_CHOICE
,wxFileDialog::OnChoiceFilter
)
1003 EVT_TEXT_ENTER(ID_TEXT
,wxFileDialog::OnTextEnter
)
1004 EVT_TEXT(ID_TEXT
,wxFileDialog::OnTextChange
)
1005 EVT_CHECKBOX(ID_CHECK
,wxFileDialog::OnCheck
)
1008 long wxFileDialog::ms_lastViewStyle
= wxLC_LIST
;
1009 bool wxFileDialog::ms_lastShowHidden
= FALSE
;
1011 wxFileDialog::wxFileDialog(wxWindow
*parent
,
1012 const wxString
& message
,
1013 const wxString
& defaultDir
,
1014 const wxString
& defaultFile
,
1015 const wxString
& wildCard
,
1017 const wxPoint
& pos
)
1018 : wxDialog( parent
, -1, message
, pos
, wxDefaultSize
,
1019 wxDEFAULT_DIALOG_STYLE
| wxRESIZE_BORDER
)
1021 if (wxConfig::Get(FALSE
))
1023 wxConfig::Get()->Read(wxT("/wxWindows/wxFileDialog/ViewStyle"),
1025 wxConfig::Get()->Read(wxT("/wxWindows/wxFileDialog/ShowHidden"),
1026 &ms_lastShowHidden
);
1029 m_message
= message
;
1030 m_dialogStyle
= style
;
1032 if (m_dialogStyle
== 0)
1033 m_dialogStyle
= wxOPEN
;
1034 if ((m_dialogStyle
& wxMULTIPLE
) && !(m_dialogStyle
& wxOPEN
))
1035 m_dialogStyle
|= wxOPEN
;
1038 if ((m_dir
.empty()) || (m_dir
== wxT(".")))
1043 size_t len
= m_dir
.Len();
1044 if ((len
> 1) && (m_dir
[len
-1] == wxFILE_SEP_PATH
))
1045 m_dir
.Remove( len
-1, 1 );
1048 m_path
+= wxFILE_SEP_PATH
;
1049 m_path
+= defaultFile
;
1050 m_fileName
= defaultFile
;
1051 m_wildCard
= wildCard
;
1053 m_filterExtension
= wxEmptyString
;
1055 // interpret wildcards
1057 if (m_wildCard
.IsEmpty())
1058 m_wildCard
= _("All files (*)|*");
1060 wxStringTokenizer
tokens( m_wildCard
, wxT("|") );
1062 wxString firstWildText
;
1063 if (tokens
.CountTokens() == 1)
1065 firstWildText
= tokens
.GetNextToken();
1066 firstWild
= firstWildText
;
1070 wxASSERT_MSG( tokens
.CountTokens() % 2 == 0, wxT("Wrong file type descripition") );
1071 firstWildText
= tokens
.GetNextToken();
1072 firstWild
= tokens
.GetNextToken();
1074 if ( firstWild
.Left( 2 ) == wxT("*.") )
1075 m_filterExtension
= firstWild
.Mid( 1 );
1076 if ( m_filterExtension
== wxT(".*") )
1077 m_filterExtension
= wxEmptyString
;
1081 bool is_pda
= (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA
);
1083 wxBoxSizer
*mainsizer
= new wxBoxSizer( wxVERTICAL
);
1085 wxBoxSizer
*buttonsizer
= new wxBoxSizer( wxHORIZONTAL
);
1087 wxBitmapButton
*but
;
1089 but
= new wxBitmapButton(this, ID_LIST_MODE
,
1090 wxArtProvider::GetBitmap(wxART_LIST_VIEW
, wxART_CMN_DIALOG
));
1092 but
->SetToolTip( _("View files as a list view") );
1094 buttonsizer
->Add( but
, 0, wxALL
, 5 );
1096 but
= new wxBitmapButton(this, ID_REPORT_MODE
,
1097 wxArtProvider::GetBitmap(wxART_REPORT_VIEW
, wxART_CMN_DIALOG
));
1099 but
->SetToolTip( _("View files as a detailed view") );
1101 buttonsizer
->Add( but
, 0, wxALL
, 5 );
1103 buttonsizer
->Add( 30, 5, 1 );
1105 wxWindow
*butDirUp
=
1106 new wxBitmapButton(this, ID_UP_DIR
,
1107 wxArtProvider::GetBitmap(wxART_GO_DIR_UP
, wxART_CMN_DIALOG
));
1109 butDirUp
->SetToolTip( _("Go to parent directory") );
1111 buttonsizer
->Add( butDirUp
, 0, wxALL
, 5 );
1113 #ifndef __DOS__ // VS: Home directory is meaningless in MS-DOS...
1114 but
= new wxBitmapButton(this, ID_PARENT_DIR
,
1115 wxArtProvider::GetBitmap(wxART_GO_HOME
, wxART_CMN_DIALOG
));
1117 but
->SetToolTip( _("Go to home directory") );
1119 buttonsizer
->Add( but
, 0, wxALL
, 5);
1121 buttonsizer
->Add( 20, 20 );
1124 wxWindow
*butNewDir
=
1125 new wxBitmapButton(this, ID_NEW_DIR
,
1126 wxArtProvider::GetBitmap(wxART_NEW_DIR
, wxART_CMN_DIALOG
));
1128 butNewDir
->SetToolTip( _("Create new directory") );
1130 buttonsizer
->Add( butNewDir
, 0, wxALL
, 5 );
1133 mainsizer
->Add( buttonsizer
, 0, wxALL
| wxEXPAND
, 0 );
1135 mainsizer
->Add( buttonsizer
, 0, wxALL
| wxEXPAND
, 5 );
1137 wxBoxSizer
*staticsizer
= new wxBoxSizer( wxHORIZONTAL
);
1139 staticsizer
->Add( new wxStaticText( this, -1, _("Current directory:") ), 0, wxRIGHT
, 10 );
1140 m_static
= new wxStaticText( this, -1, m_dir
);
1141 staticsizer
->Add( m_static
, 1 );
1142 mainsizer
->Add( staticsizer
, 0, wxEXPAND
| wxLEFT
|wxRIGHT
|wxBOTTOM
, 10 );
1144 long style2
= ms_lastViewStyle
| wxSUNKEN_BORDER
;
1145 if ( !(m_dialogStyle
& wxMULTIPLE
) )
1146 style2
|= wxLC_SINGLE_SEL
;
1148 m_list
= new wxFileCtrl( this, m_static
, ID_LIST_CTRL
,
1149 firstWild
, ms_lastShowHidden
,
1150 wxDefaultPosition
, wxSize(540,200),
1153 m_list
->SetNewDirControl(butNewDir
);
1154 m_list
->SetGoToParentControl(butDirUp
);
1158 // PDAs have a different screen layout
1159 mainsizer
->Add( m_list
, 1, wxEXPAND
| wxLEFT
|wxRIGHT
, 5 );
1161 wxBoxSizer
*choicesizer
= new wxBoxSizer( wxHORIZONTAL
);
1162 m_choice
= new wxChoice( this, ID_CHOICE
);
1163 choicesizer
->Add( m_choice
, 1, wxCENTER
|wxALL
, 5 );
1164 mainsizer
->Add( choicesizer
, 0, wxEXPAND
);
1166 wxBoxSizer
*textsizer
= new wxBoxSizer( wxHORIZONTAL
);
1167 m_text
= new wxTextCtrl( this, ID_TEXT
, m_fileName
, wxDefaultPosition
, wxDefaultSize
, wxPROCESS_ENTER
);
1168 textsizer
->Add( m_text
, 1, wxCENTER
| wxALL
, 5 );
1169 mainsizer
->Add( textsizer
, 0, wxEXPAND
);
1171 m_check
= new wxCheckBox( this, ID_CHECK
, _("Show hidden files") );
1172 m_check
->SetValue( ms_lastShowHidden
);
1173 textsizer
->Add( m_check
, 0, wxCENTER
|wxALL
, 5 );
1175 buttonsizer
= new wxBoxSizer( wxHORIZONTAL
);
1176 buttonsizer
->Add( new wxButton( this, wxID_OK
, _("OK") ), 0, wxCENTER
| wxALL
, 5 );
1177 buttonsizer
->Add( new wxButton( this, wxID_CANCEL
, _("Cancel") ), 0, wxCENTER
| wxALL
, 5 );
1178 mainsizer
->Add( buttonsizer
, 0, wxALIGN_RIGHT
);
1182 mainsizer
->Add( m_list
, 1, wxEXPAND
| wxLEFT
|wxRIGHT
, 10 );
1184 wxBoxSizer
*textsizer
= new wxBoxSizer( wxHORIZONTAL
);
1185 m_text
= new wxTextCtrl( this, ID_TEXT
, m_fileName
, wxDefaultPosition
, wxDefaultSize
, wxPROCESS_ENTER
);
1186 textsizer
->Add( m_text
, 1, wxCENTER
| wxLEFT
|wxRIGHT
|wxTOP
, 10 );
1187 textsizer
->Add( new wxButton( this, wxID_OK
, _("OK") ), 0, wxCENTER
| wxLEFT
|wxRIGHT
|wxTOP
, 10 );
1188 mainsizer
->Add( textsizer
, 0, wxEXPAND
);
1190 wxBoxSizer
*choicesizer
= new wxBoxSizer( wxHORIZONTAL
);
1191 m_choice
= new wxChoice( this, ID_CHOICE
);
1192 choicesizer
->Add( m_choice
, 1, wxCENTER
|wxALL
, 10 );
1193 m_check
= new wxCheckBox( this, ID_CHECK
, _("Show hidden files") );
1194 m_check
->SetValue( ms_lastShowHidden
);
1195 choicesizer
->Add( m_check
, 0, wxCENTER
|wxALL
, 10 );
1196 choicesizer
->Add( new wxButton( this, wxID_CANCEL
, _("Cancel") ), 0, wxCENTER
| wxALL
, 10 );
1197 mainsizer
->Add( choicesizer
, 0, wxEXPAND
);
1200 m_choice
->Append( firstWildText
, (void*) new wxString( firstWild
) );
1201 while (tokens
.HasMoreTokens())
1203 firstWildText
= tokens
.GetNextToken();
1204 firstWild
= tokens
.GetNextToken();
1205 m_choice
->Append( firstWildText
, (void*) new wxString( firstWild
) );
1207 m_choice
->SetSelection( 0 );
1209 SetAutoLayout( TRUE
);
1210 SetSizer( mainsizer
);
1212 mainsizer
->Fit( this );
1213 mainsizer
->SetSizeHints( this );
1220 wxFileDialog::~wxFileDialog()
1222 if (wxConfig::Get(FALSE
))
1224 wxConfig::Get()->Write(wxT("/wxWindows/wxFileDialog/ViewStyle"),
1226 wxConfig::Get()->Write(wxT("/wxWindows/wxFileDialog/ShowHidden"),
1231 int wxFileDialog::ShowModal()
1233 m_list
->GoToDir(m_dir
);
1234 m_text
->SetValue(m_fileName
);
1236 return wxDialog::ShowModal();
1239 void wxFileDialog::DoSetFilterIndex(int filterindex
)
1241 wxString
*str
= (wxString
*) m_choice
->GetClientData( filterindex
);
1242 m_list
->SetWild( *str
);
1243 m_filterIndex
= filterindex
;
1244 if ( str
->Left(2) == wxT("*.") )
1246 m_filterExtension
= str
->Mid(2);
1247 if (m_filterExtension
== _T("*"))
1248 m_filterExtension
.clear();
1252 m_filterExtension
.clear();
1256 void wxFileDialog::SetFilterIndex( int filterindex
)
1258 m_choice
->SetSelection( filterindex
);
1260 DoSetFilterIndex(filterindex
);
1263 void wxFileDialog::OnChoiceFilter( wxCommandEvent
&event
)
1265 DoSetFilterIndex((int)event
.GetInt());
1268 void wxFileDialog::OnCheck( wxCommandEvent
&event
)
1270 m_list
->ShowHidden( (ms_lastShowHidden
= event
.GetInt() != 0) );
1273 void wxFileDialog::OnActivated( wxListEvent
&event
)
1275 HandleAction( event
.m_item
.m_text
);
1278 void wxFileDialog::OnTextEnter( wxCommandEvent
&WXUNUSED(event
) )
1280 wxCommandEvent
cevent(wxEVT_COMMAND_BUTTON_CLICKED
, wxID_OK
);
1281 cevent
.SetEventObject( this );
1282 GetEventHandler()->ProcessEvent( cevent
);
1285 static bool ignoreChanges
= FALSE
;
1287 void wxFileDialog::OnTextChange( wxCommandEvent
&WXUNUSED(event
) )
1291 // Clear selections. Otherwise when the user types in a value they may
1292 // not get the file whose name they typed.
1293 if (m_list
->GetSelectedItemCount() > 0)
1295 long item
= m_list
->GetNextItem(-1, wxLIST_NEXT_ALL
,
1296 wxLIST_STATE_SELECTED
);
1297 while ( item
!= -1 )
1299 m_list
->SetItemState(item
,0, wxLIST_STATE_SELECTED
);
1300 item
= m_list
->GetNextItem(item
, wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1306 void wxFileDialog::OnSelected( wxListEvent
&event
)
1308 wxString
filename( event
.m_item
.m_text
);
1309 if (filename
== wxT("..")) return;
1312 m_list
->GetDir( dir
);
1313 if (!IsTopMostDir(dir
))
1314 dir
+= wxFILE_SEP_PATH
;
1316 if (wxDirExists(dir
)) return;
1318 ignoreChanges
= TRUE
;
1319 m_text
->SetValue( filename
);
1320 ignoreChanges
= FALSE
;
1323 void wxFileDialog::HandleAction( const wxString
&fn
)
1325 wxString
filename( fn
);
1327 m_list
->GetDir( dir
);
1328 if (filename
.IsEmpty()) return;
1329 if (filename
== wxT(".")) return;
1331 if (filename
== wxT(".."))
1333 m_list
->GoToParentDir();
1339 if (filename
== wxT("~"))
1341 m_list
->GoToHomeDir();
1346 if (filename
[0u] == wxT('~'))
1348 filename
.Remove( 0, 1 );
1349 wxString
tmp( wxGetUserHome() );
1356 if ((filename
.Find(wxT('*')) != wxNOT_FOUND
) ||
1357 (filename
.Find(wxT('?')) != wxNOT_FOUND
))
1359 if (filename
.Find(wxFILE_SEP_PATH
) != wxNOT_FOUND
)
1361 wxMessageBox(_("Illegal file specification."), _("Error"), wxOK
| wxICON_ERROR
);
1364 m_list
->SetWild( filename
);
1368 if (!IsTopMostDir(dir
))
1369 dir
+= wxFILE_SEP_PATH
;
1370 if (!wxIsAbsolutePath(filename
))
1376 if (wxDirExists(filename
))
1378 m_list
->GoToDir( filename
);
1382 // append the default extension to the filename if it doesn't have any
1384 // VZ: the logic of testing for !wxFileExists() only for the open file
1385 // dialog is not entirely clear to me, why don't we allow saving to a
1386 // file without extension as well?
1387 if ( !(m_dialogStyle
& wxOPEN
) || !wxFileExists(filename
) )
1390 wxSplitPath(filename
, NULL
, NULL
, &ext
);
1393 // append the first extension of the filter string
1394 filename
+= m_filterExtension
.BeforeFirst(_T(';'));
1398 // check that the file [doesn't] exist if necessary
1399 if ( (m_dialogStyle
& wxSAVE
) &&
1400 (m_dialogStyle
& wxOVERWRITE_PROMPT
) &&
1401 wxFileExists( filename
) )
1404 msg
.Printf( _("File '%s' already exists, do you really want to "
1405 "overwrite it?"), filename
.c_str() );
1407 if (wxMessageBox(msg
, _("Confirm"), wxYES_NO
) != wxYES
)
1410 else if ( (m_dialogStyle
& wxOPEN
) &&
1411 (m_dialogStyle
& wxFILE_MUST_EXIST
) &&
1412 !wxFileExists(filename
) )
1414 wxMessageBox(_("Please choose an existing file."), _("Error"),
1415 wxOK
| wxICON_ERROR
);
1418 SetPath( filename
);
1420 // change to the directory where the user went if asked
1421 if ( m_dialogStyle
& wxCHANGE_DIR
)
1424 wxSplitPath(filename
, &cwd
, NULL
, NULL
);
1426 if ( cwd
!= wxGetWorkingDirectory() )
1428 wxSetWorkingDirectory(cwd
);
1432 wxCommandEvent event
;
1433 wxDialog::OnOK(event
);
1436 void wxFileDialog::OnListOk( wxCommandEvent
&WXUNUSED(event
) )
1438 HandleAction( m_text
->GetValue() );
1441 void wxFileDialog::OnList( wxCommandEvent
&WXUNUSED(event
) )
1443 m_list
->ChangeToListMode();
1444 ms_lastViewStyle
= wxLC_LIST
;
1448 void wxFileDialog::OnReport( wxCommandEvent
&WXUNUSED(event
) )
1450 m_list
->ChangeToReportMode();
1451 ms_lastViewStyle
= wxLC_REPORT
;
1455 void wxFileDialog::OnUp( wxCommandEvent
&WXUNUSED(event
) )
1457 m_list
->GoToParentDir();
1461 void wxFileDialog::OnHome( wxCommandEvent
&WXUNUSED(event
) )
1463 m_list
->GoToHomeDir();
1467 void wxFileDialog::OnNew( wxCommandEvent
&WXUNUSED(event
) )
1472 void wxFileDialog::SetPath( const wxString
& path
)
1474 // not only set the full path but also update filename and dir
1476 if ( !path
.empty() )
1479 wxSplitPath(path
, &m_dir
, &m_fileName
, &ext
);
1482 m_fileName
+= wxT(".");
1488 void wxFileDialog::GetPaths( wxArrayString
& paths
) const
1491 if (m_list
->GetSelectedItemCount() == 0)
1493 paths
.Add( GetPath() );
1497 paths
.Alloc( m_list
->GetSelectedItemCount() );
1500 m_list
->GetDir( dir
);
1502 if (dir
!= wxT("/"))
1504 dir
+= wxFILE_SEP_PATH
;
1507 item
.m_mask
= wxLIST_MASK_TEXT
;
1509 item
.m_itemId
= m_list
->GetNextItem( -1, wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1510 while ( item
.m_itemId
!= -1 )
1512 m_list
->GetItem( item
);
1513 paths
.Add( dir
+ item
.m_text
);
1514 item
.m_itemId
= m_list
->GetNextItem( item
.m_itemId
,
1515 wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1519 void wxFileDialog::GetFilenames(wxArrayString
& files
) const
1522 if (m_list
->GetSelectedItemCount() == 0)
1524 files
.Add( GetFilename() );
1527 files
.Alloc( m_list
->GetSelectedItemCount() );
1530 item
.m_mask
= wxLIST_MASK_TEXT
;
1532 item
.m_itemId
= m_list
->GetNextItem( -1, wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1533 while ( item
.m_itemId
!= -1 )
1535 m_list
->GetItem( item
);
1536 files
.Add( item
.m_text
);
1537 item
.m_itemId
= m_list
->GetNextItem( item
.m_itemId
,
1538 wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1544 // ----------------------------------------------------------------------------
1546 // ----------------------------------------------------------------------------
1549 wxFileSelectorEx(const wxChar
*message
,
1550 const wxChar
*default_path
,
1551 const wxChar
*default_filename
,
1552 int *WXUNUSED(indexDefaultExtension
),
1553 const wxChar
*wildcard
,
1558 // TODO: implement this somehow
1559 return wxFileSelector(message
, default_path
, default_filename
, wxT(""),
1560 wildcard
, flags
, parent
, x
, y
);
1563 wxString
wxFileSelector( const wxChar
*title
,
1564 const wxChar
*defaultDir
, const wxChar
*defaultFileName
,
1565 const wxChar
*defaultExtension
, const wxChar
*filter
, int flags
,
1566 wxWindow
*parent
, int x
, int y
)
1569 if ( defaultExtension
&& !filter
)
1570 filter2
= wxString(wxT("*.")) + wxString(defaultExtension
) ;
1574 wxString defaultDirString
;
1576 defaultDirString
= defaultDir
;
1578 wxString defaultFilenameString
;
1579 if (defaultFileName
)
1580 defaultFilenameString
= defaultFileName
;
1582 wxFileDialog
fileDialog( parent
, title
, defaultDirString
, defaultFilenameString
, filter2
, flags
, wxPoint(x
, y
) );
1584 if ( fileDialog
.ShowModal() == wxID_OK
)
1586 return fileDialog
.GetPath();
1590 return wxEmptyString
;
1594 static wxString
GetWildcardString(const wxChar
*ext
)
1599 if ( *ext
== wxT('.') )
1602 wild
<< _T("*.") << ext
;
1604 else // no extension specified
1606 wild
= wxFileSelectorDefaultWildcardStr
;
1612 wxString
wxLoadFileSelector(const wxChar
*what
,
1614 const wxChar
*nameDef
,
1618 if ( what
&& *what
)
1619 prompt
= wxString::Format(_("Load %s file"), what
);
1621 prompt
= _("Load file");
1623 return wxFileSelector(prompt
, NULL
, nameDef
, ext
,
1624 GetWildcardString(ext
), 0, parent
);
1627 wxString
wxSaveFileSelector(const wxChar
*what
,
1629 const wxChar
*nameDef
,
1633 if ( what
&& *what
)
1634 prompt
= wxString::Format(_("Save %s file"), what
);
1636 prompt
= _("Save file");
1638 return wxFileSelector(prompt
, NULL
, nameDef
, ext
,
1639 GetWildcardString(ext
), 0, parent
);
1642 // A module to allow icons table cleanup
1644 class wxFileDialogGenericModule
: public wxModule
1646 DECLARE_DYNAMIC_CLASS(wxFileDialogGenericModule
)
1648 wxFileDialogGenericModule() {}
1649 bool OnInit() { return TRUE
; }
1650 void OnExit() { if (g_IconsTable
) {delete g_IconsTable
; g_IconsTable
= NULL
;} }
1653 IMPLEMENT_DYNAMIC_CLASS(wxFileDialogGenericModule
, wxModule
)
1655 #endif // wxUSE_FILEDLG