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
));
371 tmpBmp
.CopyFromIcon(ic
);
372 wxImage img
= tmpBmp
.ConvertToImage();
376 int id
= m_ImageList
.GetImageCount();
377 if (img
.GetWidth() == 16 && img
.GetHeight() == 16)
378 m_ImageList
.Add(wxBitmap(img
));
381 if (img
.GetWidth() != 32 || img
.GetHeight() != 32)
382 m_ImageList
.Add(CreateAntialiasedBitmap(CutEmptyBorders(img
).Rescale(32, 32)));
384 m_ImageList
.Add(CreateAntialiasedBitmap(img
));
386 m_HashTable
.Put(extension
, new wxFileIconEntry(id
));
389 #else // !wxUSE_MIMETYPE
391 if (extension
== wxT("exe"))
392 return FI_EXECUTABLE
;
395 #endif // wxUSE_MIMETYPE/!wxUSE_MIMETYPE
400 // ----------------------------------------------------------------------------
402 // ----------------------------------------------------------------------------
405 int ListCompare( long data1
, long data2
, long WXUNUSED(data
))
407 wxFileData
*fd1
= (wxFileData
*)data1
;
408 wxFileData
*fd2
= (wxFileData
*)data2
;
409 if (fd1
->GetName() == wxT("..")) return -1;
410 if (fd2
->GetName() == wxT("..")) return 1;
411 if (fd1
->IsDir() && !fd2
->IsDir()) return -1;
412 if (fd2
->IsDir() && !fd1
->IsDir()) return 1;
413 return wxStrcmp( fd1
->GetName(), fd2
->GetName() );
417 #define IsTopMostDir(dir) (dir == wxT("/"))
420 #if defined(__DOS__) || defined(__WINDOWS__)
421 #define IsTopMostDir(dir) (dir.IsEmpty())
424 #if defined(__DOS__) || defined(__WINDOWS__)
425 extern bool wxIsDriveAvailable(const wxString
& dirName
);
428 //-----------------------------------------------------------------------------
430 //-----------------------------------------------------------------------------
432 wxFileData::wxFileData( const wxString
&name
, const wxString
&fname
)
437 #if defined(__DOS__) || defined(__WINDOWS__)
438 // VS: In case the file is root directory of a volume (e.g. "C:"),
439 // we don't want it stat()ed, since the drive may not be in:
440 if (name
.length() == 2 && name
[1u] == wxT(':'))
448 #endif // __DOS__ || __WINDOWS__
452 #if defined(__UNIX__) && (!defined( __EMX__ ) && !defined(__VMS))
453 lstat( m_fileName
.fn_str(), &buff
);
454 m_isLink
= S_ISLNK( buff
.st_mode
);
456 wxStat( m_fileName
, &buff
);
460 m_isDir
= (buff
.st_mode
& S_IFDIR
) != 0;
461 m_isExe
= (buff
.st_mode
& wxS_IXUSR
) != 0;
463 m_size
= buff
.st_size
;
465 const struct tm
* const t
= localtime( &buff
.st_mtime
);
467 m_minute
= t
->tm_min
;
468 m_month
= t
->tm_mon
+1;
473 m_permissions
.Printf(_T("%c%c%c"),
474 buff
.st_mode
& wxS_IRUSR
? _T('r') : _T('-'),
475 buff
.st_mode
& wxS_IWUSR
? _T('w') : _T('-'),
476 buff
.st_mode
& wxS_IXUSR
? _T('x') : _T('-'));
479 wxString
wxFileData::GetName() const
484 wxString
wxFileData::GetFullName() const
489 wxString
wxFileData::GetHint() const
491 wxString s
= m_fileName
;
493 if (m_isDir
) s
+= wxT("<DIR> ");
494 else if (m_isLink
) s
+= wxT("<LINK> ");
497 s
+= LongToString( m_size
);
500 s
+= IntToString( m_day
);
502 s
+= IntToString( m_month
);
504 s
+= IntToString( m_year
);
506 s
+= IntToString( m_hour
);
508 s
+= IntToString( m_minute
);
514 wxString
wxFileData::GetEntry( FileListField num
) const
529 s
.Printf(_T("%ld"), m_size
);
533 s
.Printf(_T("%02d.%02d.%d"), m_day
, m_month
, m_year
);
537 s
.Printf(_T("%02d:%02d"), m_hour
, m_minute
);
547 wxFAIL_MSG( _T("unexpected field in wxFileData::GetEntry()") );
553 void wxFileData::SetNewName( const wxString
&name
, const wxString
&fname
)
559 void wxFileData::MakeItem( wxListItem
&item
)
561 item
.m_text
= m_name
;
562 item
.ClearAttributes();
564 item
.SetTextColour(*wxRED
);
566 item
.SetTextColour(*wxBLUE
);
569 item
.m_image
= FI_FOLDER
;
571 item
.m_image
= FI_EXECUTABLE
;
572 else if (m_name
.Find(wxT('.')) != wxNOT_FOUND
)
573 item
.m_image
= g_IconsTable
->GetIconID(m_name
.AfterLast(wxT('.')));
575 item
.m_image
= FI_UNKNOWN
;
579 wxColour
*dg
= wxTheColourDatabase
->FindColour( _T("MEDIUM GREY") );
580 item
.SetTextColour(*dg
);
582 item
.m_data
= (long)this;
585 //-----------------------------------------------------------------------------
587 //-----------------------------------------------------------------------------
589 IMPLEMENT_DYNAMIC_CLASS(wxFileCtrl
,wxListCtrl
)
591 BEGIN_EVENT_TABLE(wxFileCtrl
,wxListCtrl
)
592 EVT_LIST_DELETE_ITEM(-1, wxFileCtrl::OnListDeleteItem
)
593 EVT_LIST_END_LABEL_EDIT(-1, wxFileCtrl::OnListEndLabelEdit
)
597 wxFileCtrl::wxFileCtrl()
599 m_showHidden
= FALSE
;
602 wxFileCtrl::wxFileCtrl(wxWindow
*win
,
603 wxStaticText
*labelDir
,
605 const wxString
& wild
,
610 const wxValidator
&validator
,
611 const wxString
&name
)
612 : wxListCtrl(win
, id
, pos
, size
, style
, validator
, name
),
616 g_IconsTable
= new wxFileIconsTable
;
617 wxImageList
*imageList
= g_IconsTable
->GetImageList();
619 SetImageList( imageList
, wxIMAGE_LIST_SMALL
);
621 m_goToParentControl
=
622 m_newDirControl
= NULL
;
624 m_labelDir
= labelDir
;
626 m_showHidden
= showHidden
;
629 void wxFileCtrl::ChangeToListMode()
631 SetSingleStyle( wxLC_LIST
);
635 void wxFileCtrl::ChangeToReportMode()
637 SetSingleStyle( wxLC_REPORT
);
641 void wxFileCtrl::ChangeToIconMode()
643 SetSingleStyle( wxLC_ICON
);
647 void wxFileCtrl::ShowHidden( bool show
)
653 long wxFileCtrl::Add( wxFileData
*fd
, wxListItem
&item
)
656 item
.m_mask
= wxLIST_MASK_TEXT
+ wxLIST_MASK_DATA
+ wxLIST_MASK_IMAGE
;
657 fd
->MakeItem( item
);
658 long my_style
= GetWindowStyleFlag();
659 if (my_style
& wxLC_REPORT
)
661 ret
= InsertItem( item
);
662 for (int i
= 1; i
< FileList_Max
; i
++)
663 SetItem( item
.m_itemId
, i
, fd
->GetEntry((FileListField
)i
) );
665 else if (my_style
& wxLC_LIST
)
667 ret
= InsertItem( item
);
672 void wxFileCtrl::UpdateFiles()
674 // don't do anything before ShowModal() call which sets m_dirName
675 if ( m_dirName
.empty() )
678 wxBusyCursor bcur
; // this may take a while...
680 long my_style
= GetWindowStyleFlag();
681 int name_col_width
= 0;
682 if (my_style
& wxLC_REPORT
)
684 if (GetColumnCount() > 0)
685 name_col_width
= GetColumnWidth( 0 );
691 if (my_style
& wxLC_REPORT
)
693 if (name_col_width
< 140) name_col_width
= 140;
694 InsertColumn( 0, _("Name"), wxLIST_FORMAT_LEFT
, name_col_width
);
695 InsertColumn( 1, _("Size"), wxLIST_FORMAT_LEFT
, 60 );
696 InsertColumn( 2, _("Date"), wxLIST_FORMAT_LEFT
, 65 );
697 InsertColumn( 3, _("Time"), wxLIST_FORMAT_LEFT
, 50 );
699 InsertColumn( 4, _("Permissions"), wxLIST_FORMAT_LEFT
, 120 );
702 wxFileData
*fd
= (wxFileData
*) NULL
;
707 #if defined(__DOS__) || defined(__WINDOWS__)
708 if ( IsTopMostDir(m_dirName
) )
710 // Pseudo-directory with all available drives listed...
711 for (int drive
= 1; drive
<= 26; drive
++)
714 path
.Printf(wxT("%c:\\"), (char)(drive
+ 'A' - 1));
715 if ( wxIsDriveAvailable(path
) )
718 fd
= new wxFileData(path
, path
);
728 if ( !IsTopMostDir(m_dirName
) )
730 wxString
p(wxPathOnly(m_dirName
));
732 if (p
.IsEmpty()) p
= wxT("/");
734 fd
= new wxFileData( wxT(".."), p
);
739 wxString
dirname(m_dirName
);
740 #if defined(__DOS__) || defined(__WINDOWS__)
741 if (dirname
.length() == 2 && dirname
[1u] == wxT(':'))
742 dirname
<< wxT('\\');
746 if ( dir
.IsOpened() )
748 wxString
dirPrefix(dirname
+ wxFILE_SEP_PATH
);
749 int hiddenFlag
= m_showHidden
? wxDIR_HIDDEN
: 0;
754 // Get the directories first (not matched against wildcards):
755 cont
= dir
.GetFirst(&f
, wxEmptyString
, wxDIR_DIRS
| hiddenFlag
);
758 fd
= new wxFileData(f
, dirPrefix
+ f
);
761 cont
= dir
.GetNext(&f
);
764 // Tokenize the wildcard string, so we can handle more than 1
765 // search pattern in a wildcard.
766 wxStringTokenizer
tokenWild(m_wild
, wxT(";"));
767 while ( tokenWild
.HasMoreTokens() )
769 cont
= dir
.GetFirst(&f
, tokenWild
.GetNextToken(),
770 wxDIR_FILES
| hiddenFlag
);
773 fd
= new wxFileData(f
, dirPrefix
+ f
);
776 cont
= dir
.GetNext(&f
);
782 SortItems((wxListCtrlCompare
)ListCompare
, 0);
784 if ( my_style
& wxLC_REPORT
)
786 SetColumnWidth(1, wxLIST_AUTOSIZE
);
787 SetColumnWidth(2, wxLIST_AUTOSIZE
);
788 SetColumnWidth(3, wxLIST_AUTOSIZE
);
791 // Finally, enable/disable context-dependent controls:
792 if ( m_goToParentControl
)
793 m_goToParentControl
->Enable(!IsTopMostDir(m_dirName
));
794 #if defined(__DOS__) || defined(__WINDOWS__)
795 if ( m_newDirControl
)
796 m_newDirControl
->Enable(!IsTopMostDir(m_dirName
));
800 void wxFileCtrl::SetWild( const wxString
&wild
)
806 void wxFileCtrl::MakeDir()
808 wxString
new_name( _("NewName") );
809 wxString
path( m_dirName
);
810 path
+= wxFILE_SEP_PATH
;
812 if (wxFileExists(path
))
814 // try NewName0, NewName1 etc.
817 new_name
= _("NewName");
819 num
.Printf( wxT("%d"), i
);
823 path
+= wxFILE_SEP_PATH
;
826 } while (wxFileExists(path
));
832 wxMessageDialog
dialog(this, _("Operation not permitted."), _("Error"), wxOK
| wxICON_ERROR
);
837 wxFileData
*fd
= new wxFileData( new_name
, path
);
841 long id
= Add( fd
, item
);
845 SortItems( (wxListCtrlCompare
) ListCompare
, 0 );
846 id
= FindItem( 0, (long)fd
);
852 void wxFileCtrl::GoToParentDir()
854 if (!IsTopMostDir(m_dirName
))
856 size_t len
= m_dirName
.Len();
857 if (m_dirName
[len
-1] == wxFILE_SEP_PATH
)
858 m_dirName
.Remove( len
-1, 1 );
859 wxString
fname( wxFileNameFromPath(m_dirName
) );
860 m_dirName
= wxPathOnly( m_dirName
);
862 if (m_dirName
.IsEmpty())
863 m_dirName
= wxT("/");
866 long id
= FindItem( 0, fname
);
869 SetItemState( id
, wxLIST_STATE_SELECTED
, wxLIST_STATE_SELECTED
);
873 m_labelDir
->SetLabel(m_dirName
);
877 void wxFileCtrl::GoToHomeDir()
879 wxString s
= wxGetUserHome( wxString() );
883 void wxFileCtrl::GoToDir( const wxString
&dir
)
887 SetItemState( 0, wxLIST_STATE_SELECTED
, wxLIST_STATE_SELECTED
);
890 m_labelDir
->SetLabel(dir
);
893 void wxFileCtrl::GetDir( wxString
&dir
)
898 void wxFileCtrl::FreeItemData(const wxListItem
& item
)
900 wxFileData
*fd
= (wxFileData
*)item
.m_data
;
904 void wxFileCtrl::OnListDeleteItem( wxListEvent
&event
)
906 FreeItemData(event
.m_item
);
909 void wxFileCtrl::FreeAllItemsData()
912 item
.m_mask
= wxLIST_MASK_DATA
;
914 item
.m_itemId
= GetNextItem( -1, wxLIST_NEXT_ALL
);
915 while ( item
.m_itemId
!= -1 )
919 item
.m_itemId
= GetNextItem( item
.m_itemId
, wxLIST_NEXT_ALL
);
923 void wxFileCtrl::OnListEndLabelEdit( wxListEvent
&event
)
925 wxFileData
*fd
= (wxFileData
*)event
.m_item
.m_data
;
928 if ((event
.GetLabel().IsEmpty()) ||
929 (event
.GetLabel() == _(".")) ||
930 (event
.GetLabel() == _("..")) ||
931 (event
.GetLabel().First( wxFILE_SEP_PATH
) != wxNOT_FOUND
))
933 wxMessageDialog
dialog(this, _("Illegal directory name."), _("Error"), wxOK
| wxICON_ERROR
);
939 wxString
new_name( wxPathOnly( fd
->GetFullName() ) );
940 new_name
+= wxFILE_SEP_PATH
;
941 new_name
+= event
.GetLabel();
945 if (wxFileExists(new_name
))
947 wxMessageDialog
dialog(this, _("File name exists already."), _("Error"), wxOK
| wxICON_ERROR
);
952 if (wxRenameFile(fd
->GetFullName(),new_name
))
954 fd
->SetNewName( new_name
, event
.GetLabel() );
955 SetItemState( event
.GetItem(), wxLIST_STATE_SELECTED
, wxLIST_STATE_SELECTED
);
956 EnsureVisible( event
.GetItem() );
960 wxMessageDialog
dialog(this, _("Operation not permitted."), _("Error"), wxOK
| wxICON_ERROR
);
966 wxFileCtrl::~wxFileCtrl()
971 //-----------------------------------------------------------------------------
973 //-----------------------------------------------------------------------------
975 #define ID_LIST_MODE (wxID_FILEDLGG )
976 #define ID_REPORT_MODE (wxID_FILEDLGG + 1)
977 #define ID_UP_DIR (wxID_FILEDLGG + 5)
978 #define ID_PARENT_DIR (wxID_FILEDLGG + 6)
979 #define ID_NEW_DIR (wxID_FILEDLGG + 7)
980 #define ID_CHOICE (wxID_FILEDLGG + 8)
981 #define ID_TEXT (wxID_FILEDLGG + 9)
982 #define ID_LIST_CTRL (wxID_FILEDLGG + 10)
983 #define ID_ACTIVATED (wxID_FILEDLGG + 11)
984 #define ID_CHECK (wxID_FILEDLGG + 12)
986 IMPLEMENT_DYNAMIC_CLASS(wxFileDialog
,wxDialog
)
988 BEGIN_EVENT_TABLE(wxFileDialog
,wxDialog
)
989 EVT_BUTTON(ID_LIST_MODE
, wxFileDialog::OnList
)
990 EVT_BUTTON(ID_REPORT_MODE
, wxFileDialog::OnReport
)
991 EVT_BUTTON(ID_UP_DIR
, wxFileDialog::OnUp
)
992 EVT_BUTTON(ID_PARENT_DIR
, wxFileDialog::OnHome
)
993 EVT_BUTTON(ID_NEW_DIR
, wxFileDialog::OnNew
)
994 EVT_BUTTON(wxID_OK
, wxFileDialog::OnListOk
)
995 EVT_LIST_ITEM_SELECTED(ID_LIST_CTRL
, wxFileDialog::OnSelected
)
996 EVT_LIST_ITEM_ACTIVATED(ID_LIST_CTRL
, wxFileDialog::OnActivated
)
997 EVT_CHOICE(ID_CHOICE
,wxFileDialog::OnChoiceFilter
)
998 EVT_TEXT_ENTER(ID_TEXT
,wxFileDialog::OnTextEnter
)
999 EVT_TEXT(ID_TEXT
,wxFileDialog::OnTextChange
)
1000 EVT_CHECKBOX(ID_CHECK
,wxFileDialog::OnCheck
)
1003 long wxFileDialog::ms_lastViewStyle
= wxLC_LIST
;
1004 bool wxFileDialog::ms_lastShowHidden
= FALSE
;
1006 wxFileDialog::wxFileDialog(wxWindow
*parent
,
1007 const wxString
& message
,
1008 const wxString
& defaultDir
,
1009 const wxString
& defaultFile
,
1010 const wxString
& wildCard
,
1012 const wxPoint
& pos
)
1013 : wxDialog( parent
, -1, message
, pos
, wxDefaultSize
,
1014 wxDEFAULT_DIALOG_STYLE
| wxRESIZE_BORDER
)
1016 if (wxConfig::Get(FALSE
))
1018 wxConfig::Get()->Read(wxT("/wxWindows/wxFileDialog/ViewStyle"),
1020 wxConfig::Get()->Read(wxT("/wxWindows/wxFileDialog/ShowHidden"),
1021 &ms_lastShowHidden
);
1024 m_message
= message
;
1025 m_dialogStyle
= style
;
1027 if (m_dialogStyle
== 0)
1028 m_dialogStyle
= wxOPEN
;
1029 if ((m_dialogStyle
& wxMULTIPLE
) && !(m_dialogStyle
& wxOPEN
))
1030 m_dialogStyle
|= wxOPEN
;
1033 if ((m_dir
.empty()) || (m_dir
== wxT(".")))
1038 size_t len
= m_dir
.Len();
1039 if ((len
> 1) && (m_dir
[len
-1] == wxFILE_SEP_PATH
))
1040 m_dir
.Remove( len
-1, 1 );
1043 m_path
+= wxFILE_SEP_PATH
;
1044 m_path
+= defaultFile
;
1045 m_fileName
= defaultFile
;
1046 m_wildCard
= wildCard
;
1048 m_filterExtension
= wxEmptyString
;
1050 // interpret wildcards
1052 if (m_wildCard
.IsEmpty())
1053 m_wildCard
= _("All files (*)|*");
1055 wxStringTokenizer
tokens( m_wildCard
, wxT("|") );
1057 wxString firstWildText
;
1058 if (tokens
.CountTokens() == 1)
1060 firstWildText
= tokens
.GetNextToken();
1061 firstWild
= firstWildText
;
1065 wxASSERT_MSG( tokens
.CountTokens() % 2 == 0, wxT("Wrong file type descripition") );
1066 firstWildText
= tokens
.GetNextToken();
1067 firstWild
= tokens
.GetNextToken();
1069 if ( firstWild
.Left( 2 ) == wxT("*.") )
1070 m_filterExtension
= firstWild
.Mid( 1 );
1071 if ( m_filterExtension
== wxT(".*") )
1072 m_filterExtension
= wxEmptyString
;
1076 bool is_pda
= (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA
);
1078 wxBoxSizer
*mainsizer
= new wxBoxSizer( wxVERTICAL
);
1080 wxBoxSizer
*buttonsizer
= new wxBoxSizer( wxHORIZONTAL
);
1082 wxBitmapButton
*but
;
1084 but
= new wxBitmapButton(this, ID_LIST_MODE
,
1085 wxArtProvider::GetBitmap(wxART_LIST_VIEW
, wxART_CMN_DIALOG
));
1087 but
->SetToolTip( _("View files as a list view") );
1089 buttonsizer
->Add( but
, 0, wxALL
, 5 );
1091 but
= new wxBitmapButton(this, ID_REPORT_MODE
,
1092 wxArtProvider::GetBitmap(wxART_REPORT_VIEW
, wxART_CMN_DIALOG
));
1094 but
->SetToolTip( _("View files as a detailed view") );
1096 buttonsizer
->Add( but
, 0, wxALL
, 5 );
1098 buttonsizer
->Add( 30, 5, 1 );
1100 wxWindow
*butDirUp
=
1101 new wxBitmapButton(this, ID_UP_DIR
,
1102 wxArtProvider::GetBitmap(wxART_GO_DIR_UP
, wxART_CMN_DIALOG
));
1104 butDirUp
->SetToolTip( _("Go to parent directory") );
1106 buttonsizer
->Add( butDirUp
, 0, wxALL
, 5 );
1108 #ifndef __DOS__ // VS: Home directory is meaningless in MS-DOS...
1109 but
= new wxBitmapButton(this, ID_PARENT_DIR
,
1110 wxArtProvider::GetBitmap(wxART_GO_HOME
, wxART_CMN_DIALOG
));
1112 but
->SetToolTip( _("Go to home directory") );
1114 buttonsizer
->Add( but
, 0, wxALL
, 5);
1116 buttonsizer
->Add( 20, 20 );
1119 wxWindow
*butNewDir
=
1120 new wxBitmapButton(this, ID_NEW_DIR
,
1121 wxArtProvider::GetBitmap(wxART_NEW_DIR
, wxART_CMN_DIALOG
));
1123 butNewDir
->SetToolTip( _("Create new directory") );
1125 buttonsizer
->Add( butNewDir
, 0, wxALL
, 5 );
1128 mainsizer
->Add( buttonsizer
, 0, wxALL
| wxEXPAND
, 0 );
1130 mainsizer
->Add( buttonsizer
, 0, wxALL
| wxEXPAND
, 5 );
1132 wxBoxSizer
*staticsizer
= new wxBoxSizer( wxHORIZONTAL
);
1134 staticsizer
->Add( new wxStaticText( this, -1, _("Current directory:") ), 0, wxRIGHT
, 10 );
1135 m_static
= new wxStaticText( this, -1, m_dir
);
1136 staticsizer
->Add( m_static
, 1 );
1137 mainsizer
->Add( staticsizer
, 0, wxEXPAND
| wxLEFT
|wxRIGHT
|wxBOTTOM
, 10 );
1139 long style2
= ms_lastViewStyle
| wxSUNKEN_BORDER
;
1140 if ( !(m_dialogStyle
& wxMULTIPLE
) )
1141 style2
|= wxLC_SINGLE_SEL
;
1143 m_list
= new wxFileCtrl( this, m_static
, ID_LIST_CTRL
,
1144 firstWild
, ms_lastShowHidden
,
1145 wxDefaultPosition
, wxSize(540,200),
1148 m_list
->SetNewDirControl(butNewDir
);
1149 m_list
->SetGoToParentControl(butDirUp
);
1153 // PDAs have a different screen layout
1154 mainsizer
->Add( m_list
, 1, wxEXPAND
| wxLEFT
|wxRIGHT
, 5 );
1156 wxBoxSizer
*choicesizer
= new wxBoxSizer( wxHORIZONTAL
);
1157 m_choice
= new wxChoice( this, ID_CHOICE
);
1158 choicesizer
->Add( m_choice
, 1, wxCENTER
|wxALL
, 5 );
1159 mainsizer
->Add( choicesizer
, 0, wxEXPAND
);
1161 wxBoxSizer
*textsizer
= new wxBoxSizer( wxHORIZONTAL
);
1162 m_text
= new wxTextCtrl( this, ID_TEXT
, m_fileName
, wxDefaultPosition
, wxDefaultSize
, wxPROCESS_ENTER
);
1163 textsizer
->Add( m_text
, 1, wxCENTER
| wxALL
, 5 );
1164 mainsizer
->Add( textsizer
, 0, wxEXPAND
);
1166 m_check
= new wxCheckBox( this, ID_CHECK
, _("Show hidden files") );
1167 m_check
->SetValue( ms_lastShowHidden
);
1168 textsizer
->Add( m_check
, 0, wxCENTER
|wxALL
, 5 );
1170 buttonsizer
= new wxBoxSizer( wxHORIZONTAL
);
1171 buttonsizer
->Add( new wxButton( this, wxID_OK
, _("OK") ), 0, wxCENTER
| wxALL
, 5 );
1172 buttonsizer
->Add( new wxButton( this, wxID_CANCEL
, _("Cancel") ), 0, wxCENTER
| wxALL
, 5 );
1173 mainsizer
->Add( buttonsizer
, 0, wxALIGN_RIGHT
);
1177 mainsizer
->Add( m_list
, 1, wxEXPAND
| wxLEFT
|wxRIGHT
, 10 );
1179 wxBoxSizer
*textsizer
= new wxBoxSizer( wxHORIZONTAL
);
1180 m_text
= new wxTextCtrl( this, ID_TEXT
, m_fileName
, wxDefaultPosition
, wxDefaultSize
, wxPROCESS_ENTER
);
1181 textsizer
->Add( m_text
, 1, wxCENTER
| wxLEFT
|wxRIGHT
|wxTOP
, 10 );
1182 textsizer
->Add( new wxButton( this, wxID_OK
, _("OK") ), 0, wxCENTER
| wxLEFT
|wxRIGHT
|wxTOP
, 10 );
1183 mainsizer
->Add( textsizer
, 0, wxEXPAND
);
1185 wxBoxSizer
*choicesizer
= new wxBoxSizer( wxHORIZONTAL
);
1186 m_choice
= new wxChoice( this, ID_CHOICE
);
1187 choicesizer
->Add( m_choice
, 1, wxCENTER
|wxALL
, 10 );
1188 m_check
= new wxCheckBox( this, ID_CHECK
, _("Show hidden files") );
1189 m_check
->SetValue( ms_lastShowHidden
);
1190 choicesizer
->Add( m_check
, 0, wxCENTER
|wxALL
, 10 );
1191 choicesizer
->Add( new wxButton( this, wxID_CANCEL
, _("Cancel") ), 0, wxCENTER
| wxALL
, 10 );
1192 mainsizer
->Add( choicesizer
, 0, wxEXPAND
);
1195 m_choice
->Append( firstWildText
, (void*) new wxString( firstWild
) );
1196 while (tokens
.HasMoreTokens())
1198 firstWildText
= tokens
.GetNextToken();
1199 firstWild
= tokens
.GetNextToken();
1200 m_choice
->Append( firstWildText
, (void*) new wxString( firstWild
) );
1202 m_choice
->SetSelection( 0 );
1204 SetAutoLayout( TRUE
);
1205 SetSizer( mainsizer
);
1207 mainsizer
->Fit( this );
1208 mainsizer
->SetSizeHints( this );
1215 wxFileDialog::~wxFileDialog()
1217 if (wxConfig::Get(FALSE
))
1219 wxConfig::Get()->Write(wxT("/wxWindows/wxFileDialog/ViewStyle"),
1221 wxConfig::Get()->Write(wxT("/wxWindows/wxFileDialog/ShowHidden"),
1226 int wxFileDialog::ShowModal()
1228 m_list
->GoToDir(m_dir
);
1229 m_text
->SetValue(m_fileName
);
1231 return wxDialog::ShowModal();
1234 void wxFileDialog::DoSetFilterIndex(int filterindex
)
1236 wxString
*str
= (wxString
*) m_choice
->GetClientData( filterindex
);
1237 m_list
->SetWild( *str
);
1238 m_filterIndex
= filterindex
;
1239 if ( str
->Left(2) == wxT("*.") )
1241 m_filterExtension
= str
->Mid(2);
1242 if (m_filterExtension
== _T("*"))
1243 m_filterExtension
.clear();
1247 m_filterExtension
.clear();
1251 void wxFileDialog::SetFilterIndex( int filterindex
)
1253 m_choice
->SetSelection( filterindex
);
1255 DoSetFilterIndex(filterindex
);
1258 void wxFileDialog::OnChoiceFilter( wxCommandEvent
&event
)
1260 DoSetFilterIndex((int)event
.GetInt());
1263 void wxFileDialog::OnCheck( wxCommandEvent
&event
)
1265 m_list
->ShowHidden( (ms_lastShowHidden
= event
.GetInt() != 0) );
1268 void wxFileDialog::OnActivated( wxListEvent
&event
)
1270 HandleAction( event
.m_item
.m_text
);
1273 void wxFileDialog::OnTextEnter( wxCommandEvent
&WXUNUSED(event
) )
1275 wxCommandEvent
cevent(wxEVT_COMMAND_BUTTON_CLICKED
, wxID_OK
);
1276 cevent
.SetEventObject( this );
1277 GetEventHandler()->ProcessEvent( cevent
);
1280 static bool ignoreChanges
= FALSE
;
1282 void wxFileDialog::OnTextChange( wxCommandEvent
&WXUNUSED(event
) )
1286 // Clear selections. Otherwise when the user types in a value they may
1287 // not get the file whose name they typed.
1288 if (m_list
->GetSelectedItemCount() > 0)
1290 long item
= m_list
->GetNextItem(-1, wxLIST_NEXT_ALL
,
1291 wxLIST_STATE_SELECTED
);
1292 while ( item
!= -1 )
1294 m_list
->SetItemState(item
,0, wxLIST_STATE_SELECTED
);
1295 item
= m_list
->GetNextItem(item
, wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1301 void wxFileDialog::OnSelected( wxListEvent
&event
)
1303 wxString
filename( event
.m_item
.m_text
);
1304 if (filename
== wxT("..")) return;
1307 m_list
->GetDir( dir
);
1308 if (!IsTopMostDir(dir
))
1309 dir
+= wxFILE_SEP_PATH
;
1311 if (wxDirExists(dir
)) return;
1313 ignoreChanges
= TRUE
;
1314 m_text
->SetValue( filename
);
1315 ignoreChanges
= FALSE
;
1318 void wxFileDialog::HandleAction( const wxString
&fn
)
1320 wxString
filename( fn
);
1322 m_list
->GetDir( dir
);
1323 if (filename
.IsEmpty()) return;
1324 if (filename
== wxT(".")) return;
1326 if (filename
== wxT(".."))
1328 m_list
->GoToParentDir();
1334 if (filename
== wxT("~"))
1336 m_list
->GoToHomeDir();
1341 if (filename
[0u] == wxT('~'))
1343 filename
.Remove( 0, 1 );
1344 wxString
tmp( wxGetUserHome() );
1351 if ((filename
.Find(wxT('*')) != wxNOT_FOUND
) ||
1352 (filename
.Find(wxT('?')) != wxNOT_FOUND
))
1354 if (filename
.Find(wxFILE_SEP_PATH
) != wxNOT_FOUND
)
1356 wxMessageBox(_("Illegal file specification."), _("Error"), wxOK
| wxICON_ERROR
);
1359 m_list
->SetWild( filename
);
1363 if (!IsTopMostDir(dir
))
1364 dir
+= wxFILE_SEP_PATH
;
1365 if (!wxIsAbsolutePath(filename
))
1371 if (wxDirExists(filename
))
1373 m_list
->GoToDir( filename
);
1377 // append the default extension to the filename if it doesn't have any
1379 // VZ: the logic of testing for !wxFileExists() only for the open file
1380 // dialog is not entirely clear to me, why don't we allow saving to a
1381 // file without extension as well?
1382 if ( !(m_dialogStyle
& wxOPEN
) || !wxFileExists(filename
) )
1385 wxSplitPath(filename
, NULL
, NULL
, &ext
);
1388 // append the first extension of the filter string
1389 filename
+= m_filterExtension
.BeforeFirst(_T(';'));
1393 // check that the file [doesn't] exist if necessary
1394 if ( (m_dialogStyle
& wxSAVE
) &&
1395 (m_dialogStyle
& wxOVERWRITE_PROMPT
) &&
1396 wxFileExists( filename
) )
1399 msg
.Printf( _("File '%s' already exists, do you really want to "
1400 "overwrite it?"), filename
.c_str() );
1402 if (wxMessageBox(msg
, _("Confirm"), wxYES_NO
) != wxYES
)
1405 else if ( (m_dialogStyle
& wxOPEN
) &&
1406 (m_dialogStyle
& wxFILE_MUST_EXIST
) &&
1407 !wxFileExists(filename
) )
1409 wxMessageBox(_("Please choose an existing file."), _("Error"),
1410 wxOK
| wxICON_ERROR
);
1413 SetPath( filename
);
1415 // change to the directory where the user went if asked
1416 if ( m_dialogStyle
& wxCHANGE_DIR
)
1419 wxSplitPath(filename
, &cwd
, NULL
, NULL
);
1421 if ( cwd
!= wxGetWorkingDirectory() )
1423 wxSetWorkingDirectory(cwd
);
1427 wxCommandEvent event
;
1428 wxDialog::OnOK(event
);
1431 void wxFileDialog::OnListOk( wxCommandEvent
&WXUNUSED(event
) )
1433 HandleAction( m_text
->GetValue() );
1436 void wxFileDialog::OnList( wxCommandEvent
&WXUNUSED(event
) )
1438 m_list
->ChangeToListMode();
1439 ms_lastViewStyle
= wxLC_LIST
;
1443 void wxFileDialog::OnReport( wxCommandEvent
&WXUNUSED(event
) )
1445 m_list
->ChangeToReportMode();
1446 ms_lastViewStyle
= wxLC_REPORT
;
1450 void wxFileDialog::OnUp( wxCommandEvent
&WXUNUSED(event
) )
1452 m_list
->GoToParentDir();
1456 void wxFileDialog::OnHome( wxCommandEvent
&WXUNUSED(event
) )
1458 m_list
->GoToHomeDir();
1462 void wxFileDialog::OnNew( wxCommandEvent
&WXUNUSED(event
) )
1467 void wxFileDialog::SetPath( const wxString
& path
)
1469 // not only set the full path but also update filename and dir
1471 if ( !path
.empty() )
1474 wxSplitPath(path
, &m_dir
, &m_fileName
, &ext
);
1477 m_fileName
+= wxT(".");
1483 void wxFileDialog::GetPaths( wxArrayString
& paths
) const
1486 if (m_list
->GetSelectedItemCount() == 0)
1488 paths
.Add( GetPath() );
1492 paths
.Alloc( m_list
->GetSelectedItemCount() );
1495 m_list
->GetDir( dir
);
1497 if (dir
!= wxT("/"))
1499 dir
+= wxFILE_SEP_PATH
;
1502 item
.m_mask
= wxLIST_MASK_TEXT
;
1504 item
.m_itemId
= m_list
->GetNextItem( -1, wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1505 while ( item
.m_itemId
!= -1 )
1507 m_list
->GetItem( item
);
1508 paths
.Add( dir
+ item
.m_text
);
1509 item
.m_itemId
= m_list
->GetNextItem( item
.m_itemId
,
1510 wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1514 void wxFileDialog::GetFilenames(wxArrayString
& files
) const
1517 if (m_list
->GetSelectedItemCount() == 0)
1519 files
.Add( GetFilename() );
1522 files
.Alloc( m_list
->GetSelectedItemCount() );
1525 item
.m_mask
= wxLIST_MASK_TEXT
;
1527 item
.m_itemId
= m_list
->GetNextItem( -1, wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1528 while ( item
.m_itemId
!= -1 )
1530 m_list
->GetItem( item
);
1531 files
.Add( item
.m_text
);
1532 item
.m_itemId
= m_list
->GetNextItem( item
.m_itemId
,
1533 wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1539 // ----------------------------------------------------------------------------
1541 // ----------------------------------------------------------------------------
1543 // common part of both wxFileSelectorEx() and wxFileSelector()
1545 DoSelectFile(const wxChar
*title
,
1546 const wxChar
*defaultDir
,
1547 const wxChar
*defaultFileName
,
1548 const wxChar
*defaultExtension
,
1549 int *indexDefaultExtension
,
1550 const wxChar
*filter
,
1556 // the filter may be either given explicitly or created automatically from
1557 // the default extension
1558 wxString filterReal
;
1561 // the user has specified the filter explicitly, use it
1562 filterReal
= filter
;
1564 else if ( !wxIsEmpty(defaultExtension
) )
1566 // create the filter to match the given extension
1567 filterReal
<< wxT("*.") << defaultExtension
;
1570 wxFileDialog
fileDialog(parent
,
1579 if ( fileDialog
.ShowModal() == wxID_OK
)
1581 path
= fileDialog
.GetPath();
1582 if ( indexDefaultExtension
)
1584 *indexDefaultExtension
= fileDialog
.GetFilterIndex();
1592 wxFileSelectorEx(const wxChar
*title
,
1593 const wxChar
*defaultDir
,
1594 const wxChar
*defaultFileName
,
1595 int *indexDefaultExtension
,
1596 const wxChar
*filter
,
1602 return DoSelectFile(title
,
1605 wxT(""), // def ext determined by index
1606 indexDefaultExtension
,
1615 wxFileSelector(const wxChar
*title
,
1616 const wxChar
*defaultDir
,
1617 const wxChar
*defaultFileName
,
1618 const wxChar
*defaultExtension
,
1619 const wxChar
*filter
,
1625 return DoSelectFile(title
,
1629 NULL
, // not interested in filter index
1637 static wxString
GetWildcardString(const wxChar
*ext
)
1642 if ( *ext
== wxT('.') )
1645 wild
<< _T("*.") << ext
;
1647 else // no extension specified
1649 wild
= wxFileSelectorDefaultWildcardStr
;
1655 wxString
wxLoadFileSelector(const wxChar
*what
,
1657 const wxChar
*nameDef
,
1661 if ( what
&& *what
)
1662 prompt
= wxString::Format(_("Load %s file"), what
);
1664 prompt
= _("Load file");
1666 return wxFileSelector(prompt
, NULL
, nameDef
, ext
,
1667 GetWildcardString(ext
), 0, parent
);
1670 wxString
wxSaveFileSelector(const wxChar
*what
,
1672 const wxChar
*nameDef
,
1676 if ( what
&& *what
)
1677 prompt
= wxString::Format(_("Save %s file"), what
);
1679 prompt
= _("Save file");
1681 return wxFileSelector(prompt
, NULL
, nameDef
, ext
,
1682 GetWildcardString(ext
), 0, parent
);
1685 // A module to allow icons table cleanup
1687 class wxFileDialogGenericModule
: public wxModule
1689 DECLARE_DYNAMIC_CLASS(wxFileDialogGenericModule
)
1691 wxFileDialogGenericModule() {}
1692 bool OnInit() { return TRUE
; }
1693 void OnExit() { if (g_IconsTable
) {delete g_IconsTable
; g_IconsTable
= NULL
;} }
1696 IMPLEMENT_DYNAMIC_CLASS(wxFileDialogGenericModule
, wxModule
)
1698 #endif // wxUSE_FILEDLG