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"
59 #include "wx/file.h" // for wxS_IXXX constants only
62 #include "wx/tooltip.h"
65 #include <sys/types.h>
81 #if defined(__UNIX__) || defined(__DOS__)
85 // ----------------------------------------------------------------------------
87 // ----------------------------------------------------------------------------
89 // the list ctrl fields in report view
102 //-----------------------------------------------------------------------------
104 //-----------------------------------------------------------------------------
109 wxFileData( const wxString
&name
, const wxString
&fname
);
110 wxString
GetName() const;
111 wxString
GetFullName() const;
112 wxString
GetHint() const;
113 wxString
GetEntry( FileListField num
) const;
115 bool IsDir() const { return m_isDir
; }
116 bool IsLink() const { return m_isLink
; }
117 bool IsExe() const { return m_isExe
; }
118 long GetSize() const { return m_size
; }
120 void MakeItem( wxListItem
&item
);
121 void SetNewName( const wxString
&name
, const wxString
&fname
);
132 wxString m_permissions
;
138 //-----------------------------------------------------------------------------
140 //-----------------------------------------------------------------------------
142 class wxFileCtrl
: public wxListCtrl
146 wxFileCtrl( wxWindow
*win
,
147 wxStaticText
*labelDir
,
149 const wxString
&wild
,
151 const wxPoint
&pos
= wxDefaultPosition
,
152 const wxSize
&size
= wxDefaultSize
,
153 long style
= wxLC_LIST
,
154 const wxValidator
&validator
= wxDefaultValidator
,
155 const wxString
&name
= wxT("filelist") );
156 virtual ~wxFileCtrl();
158 void ChangeToListMode();
159 void ChangeToReportMode();
160 void ChangeToIconMode();
161 void ShowHidden( bool show
= TRUE
);
162 long Add( wxFileData
*fd
, wxListItem
&item
);
164 virtual void StatusbarText( wxChar
*WXUNUSED(text
) ) {};
166 void GoToParentDir();
168 void GoToDir( const wxString
&dir
);
169 void SetWild( const wxString
&wild
);
170 void GetDir( wxString
&dir
);
171 void OnListDeleteItem( wxListEvent
&event
);
172 void OnListEndLabelEdit( wxListEvent
&event
);
174 // Associate commonly used UI controls with wxFileCtrl so that they can be
175 // disabled when they cannot be used (e.g. can't go to parent directory
176 // if wxFileCtrl already is in the root dir):
177 void SetGoToParentControl(wxWindow
*ctrl
) { m_goToParentControl
= ctrl
; }
178 void SetNewDirControl(wxWindow
*ctrl
) { m_newDirControl
= ctrl
; }
181 void FreeItemData(const wxListItem
& item
);
182 void FreeAllItemsData();
188 wxWindow
*m_goToParentControl
;
189 wxWindow
*m_newDirControl
;
191 // the label showing the current directory
192 wxStaticText
*m_labelDir
;
194 DECLARE_DYNAMIC_CLASS(wxFileCtrl
);
195 DECLARE_EVENT_TABLE()
198 // ----------------------------------------------------------------------------
199 // private classes - icons list management
200 // ----------------------------------------------------------------------------
202 class wxFileIconEntry
: public wxObject
205 wxFileIconEntry(int i
) { id
= i
; }
211 class wxFileIconsTable
216 int GetIconID(const wxString
& extension
, const wxString
& mime
= wxEmptyString
);
217 wxImageList
*GetImageList() { return &m_ImageList
; }
220 wxImageList m_ImageList
;
221 wxHashTable m_HashTable
;
224 static wxFileIconsTable
*g_IconsTable
= NULL
;
228 #define FI_EXECUTABLE 2
230 wxFileIconsTable::wxFileIconsTable() :
232 m_HashTable(wxKEY_STRING
)
234 m_HashTable
.DeleteContents(TRUE
);
236 m_ImageList
.Add(wxArtProvider::GetBitmap(wxART_FOLDER
, wxART_CMN_DIALOG
));
238 m_ImageList
.Add(wxArtProvider::GetBitmap(wxART_NORMAL_FILE
, wxART_CMN_DIALOG
));
240 if (GetIconID(wxEmptyString
, _T("application/x-executable")) == FI_UNKNOWN
)
242 m_ImageList
.Add(wxArtProvider::GetBitmap(wxART_EXECUTABLE_FILE
, wxART_CMN_DIALOG
));
243 m_HashTable
.Delete(_T("exe"));
244 m_HashTable
.Put(_T("exe"), new wxFileIconEntry(FI_EXECUTABLE
));
246 /* else put into list by GetIconID
247 (KDE defines application/x-executable for *.exe and has nice icon)
254 // VS: we don't need this function w/o wxMimeTypesManager because we'll only have
255 // one icon and we won't resize it
257 static wxBitmap
CreateAntialiasedBitmap(const wxImage
& img
)
259 wxImage
smallimg (16, 16);
260 unsigned char *p1
, *p2
, *ps
;
261 unsigned char mr
= img
.GetMaskRed(),
262 mg
= img
.GetMaskGreen(),
263 mb
= img
.GetMaskBlue();
266 unsigned sr
, sg
, sb
, smask
;
268 p1
= img
.GetData(), p2
= img
.GetData() + 3 * 32, ps
= smallimg
.GetData();
269 smallimg
.SetMaskColour(mr
, mr
, mr
);
271 for (y
= 0; y
< 16; y
++)
273 for (x
= 0; x
< 16; x
++)
275 sr
= sg
= sb
= smask
= 0;
276 if (p1
[0] != mr
|| p1
[1] != mg
|| p1
[2] != mb
)
277 sr
+= p1
[0], sg
+= p1
[1], sb
+= p1
[2];
280 if (p1
[0] != mr
|| p1
[1] != mg
|| p1
[2] != mb
)
281 sr
+= p1
[0], sg
+= p1
[1], sb
+= p1
[2];
284 if (p2
[0] != mr
|| p2
[1] != mg
|| p2
[2] != mb
)
285 sr
+= p2
[0], sg
+= p2
[1], sb
+= p2
[2];
288 if (p2
[0] != mr
|| p2
[1] != mg
|| p2
[2] != mb
)
289 sr
+= p2
[0], sg
+= p2
[1], sb
+= p2
[2];
294 ps
[0] = ps
[1] = ps
[2] = mr
;
296 ps
[0] = sr
>> 2, ps
[1] = sg
>> 2, ps
[2] = sb
>> 2;
299 p1
+= 32 * 3, p2
+= 32 * 3;
302 return wxBitmap(smallimg
);
305 // finds empty borders and return non-empty area of image:
306 static wxImage
CutEmptyBorders(const wxImage
& img
)
308 unsigned char mr
= img
.GetMaskRed(),
309 mg
= img
.GetMaskGreen(),
310 mb
= img
.GetMaskBlue();
311 unsigned char *dt
= img
.GetData(), *dttmp
;
312 unsigned w
= img
.GetWidth(), h
= img
.GetHeight();
314 unsigned top
, bottom
, left
, right
, i
;
317 #define MK_DTTMP(x,y) dttmp = dt + ((x + y * w) * 3)
318 #define NOEMPTY_PIX(empt) if (dttmp[0] != mr || dttmp[1] != mg || dttmp[2] != mb) {empt = FALSE; break;}
320 for (empt
= TRUE
, top
= 0; empt
&& top
< h
; top
++)
323 for (i
= 0; i
< w
; i
++, dttmp
+=3)
326 for (empt
= TRUE
, bottom
= h
-1; empt
&& bottom
> top
; bottom
--)
329 for (i
= 0; i
< w
; i
++, dttmp
+=3)
332 for (empt
= TRUE
, left
= 0; empt
&& left
< w
; left
++)
335 for (i
= 0; i
< h
; i
++, dttmp
+=3*w
)
338 for (empt
= TRUE
, right
= w
-1; empt
&& right
> left
; right
--)
341 for (i
= 0; i
< h
; i
++, dttmp
+=3*w
)
344 top
--, left
--, bottom
++, right
++;
346 return img
.GetSubImage(wxRect(left
, top
, right
- left
+ 1, bottom
- top
+ 1));
348 #endif // wxUSE_MIMETYPE
352 int wxFileIconsTable::GetIconID(const wxString
& extension
, const wxString
& mime
)
355 if (!extension
.IsEmpty())
357 wxFileIconEntry
*entry
= (wxFileIconEntry
*) m_HashTable
.Get(extension
);
358 if (entry
) return (entry
-> id
);
361 wxFileType
*ft
= (mime
.IsEmpty()) ?
362 wxTheMimeTypesManager
-> GetFileTypeFromExtension(extension
) :
363 wxTheMimeTypesManager
-> GetFileTypeFromMimeType(mime
);
365 if (ft
== NULL
|| (!ft
-> GetIcon(&ic
)) || (!ic
.Ok()))
367 int newid
= FI_UNKNOWN
;
368 m_HashTable
.Put(extension
, new wxFileIconEntry(newid
));
373 tmpBmp
.CopyFromIcon(ic
);
374 wxImage img
= tmpBmp
.ConvertToImage();
378 int id
= m_ImageList
.GetImageCount();
379 if (img
.GetWidth() == 16 && img
.GetHeight() == 16)
380 m_ImageList
.Add(wxBitmap(img
));
383 if (img
.GetWidth() != 32 || img
.GetHeight() != 32)
384 m_ImageList
.Add(CreateAntialiasedBitmap(CutEmptyBorders(img
).Rescale(32, 32)));
386 m_ImageList
.Add(CreateAntialiasedBitmap(img
));
388 m_HashTable
.Put(extension
, new wxFileIconEntry(id
));
391 #else // !wxUSE_MIMETYPE
393 if (extension
== wxT("exe"))
394 return FI_EXECUTABLE
;
397 #endif // wxUSE_MIMETYPE/!wxUSE_MIMETYPE
402 // ----------------------------------------------------------------------------
404 // ----------------------------------------------------------------------------
407 int ListCompare( long data1
, long data2
, long WXUNUSED(data
))
409 wxFileData
*fd1
= (wxFileData
*)data1
;
410 wxFileData
*fd2
= (wxFileData
*)data2
;
411 if (fd1
->GetName() == wxT("..")) return -1;
412 if (fd2
->GetName() == wxT("..")) return 1;
413 if (fd1
->IsDir() && !fd2
->IsDir()) return -1;
414 if (fd2
->IsDir() && !fd1
->IsDir()) return 1;
415 return wxStrcmp( fd1
->GetName(), fd2
->GetName() );
419 #define IsTopMostDir(dir) (dir == wxT("/"))
422 #if defined(__DOS__) || defined(__WINDOWS__)
423 #define IsTopMostDir(dir) (dir.IsEmpty())
426 #if defined(__DOS__) || defined(__WINDOWS__)
427 extern bool wxIsDriveAvailable(const wxString
& dirName
);
430 //-----------------------------------------------------------------------------
432 //-----------------------------------------------------------------------------
434 wxFileData::wxFileData( const wxString
&name
, const wxString
&fname
)
439 #if defined(__DOS__) || defined(__WINDOWS__)
440 // VS: In case the file is root directory of a volume (e.g. "C:"),
441 // we don't want it stat()ed, since the drive may not be in:
442 if (name
.length() == 2 && name
[1u] == wxT(':'))
450 #endif // __DOS__ || __WINDOWS__
454 #if defined(__UNIX__) && (!defined( __EMX__ ) && !defined(__VMS))
455 lstat( m_fileName
.fn_str(), &buff
);
456 m_isLink
= S_ISLNK( buff
.st_mode
);
458 wxStat( m_fileName
, &buff
);
462 m_isDir
= (buff
.st_mode
& S_IFDIR
) != 0;
463 m_isExe
= (buff
.st_mode
& wxS_IXUSR
) != 0;
465 m_size
= buff
.st_size
;
467 const struct tm
* const t
= localtime( &buff
.st_mtime
);
469 m_minute
= t
->tm_min
;
470 m_month
= t
->tm_mon
+1;
475 m_permissions
.Printf(_T("%c%c%c"),
476 buff
.st_mode
& wxS_IRUSR
? _T('r') : _T('-'),
477 buff
.st_mode
& wxS_IWUSR
? _T('w') : _T('-'),
478 buff
.st_mode
& wxS_IXUSR
? _T('x') : _T('-'));
481 wxString
wxFileData::GetName() const
486 wxString
wxFileData::GetFullName() const
491 wxString
wxFileData::GetHint() const
493 wxString s
= m_fileName
;
495 if (m_isDir
) s
+= wxT("<DIR> ");
496 else if (m_isLink
) s
+= wxT("<LINK> ");
499 s
+= LongToString( m_size
);
502 s
+= IntToString( m_day
);
504 s
+= IntToString( m_month
);
506 s
+= IntToString( m_year
);
508 s
+= IntToString( m_hour
);
510 s
+= IntToString( m_minute
);
516 wxString
wxFileData::GetEntry( FileListField num
) const
531 s
.Printf(_T("%ld"), m_size
);
535 s
.Printf(_T("%02d.%02d.%d"), m_day
, m_month
, m_year
);
539 s
.Printf(_T("%02d:%02d"), m_hour
, m_minute
);
549 wxFAIL_MSG( _T("unexpected field in wxFileData::GetEntry()") );
555 void wxFileData::SetNewName( const wxString
&name
, const wxString
&fname
)
561 void wxFileData::MakeItem( wxListItem
&item
)
563 item
.m_text
= m_name
;
564 item
.ClearAttributes();
566 item
.SetTextColour(*wxRED
);
568 item
.SetTextColour(*wxBLUE
);
571 item
.m_image
= FI_FOLDER
;
573 item
.m_image
= FI_EXECUTABLE
;
574 else if (m_name
.Find(wxT('.')) != wxNOT_FOUND
)
575 item
.m_image
= g_IconsTable
->GetIconID(m_name
.AfterLast(wxT('.')));
577 item
.m_image
= FI_UNKNOWN
;
581 wxColour
*dg
= wxTheColourDatabase
->FindColour( _T("MEDIUM GREY") );
582 item
.SetTextColour(*dg
);
584 item
.m_data
= (long)this;
587 //-----------------------------------------------------------------------------
589 //-----------------------------------------------------------------------------
591 IMPLEMENT_DYNAMIC_CLASS(wxFileCtrl
,wxListCtrl
)
593 BEGIN_EVENT_TABLE(wxFileCtrl
,wxListCtrl
)
594 EVT_LIST_DELETE_ITEM(-1, wxFileCtrl::OnListDeleteItem
)
595 EVT_LIST_END_LABEL_EDIT(-1, wxFileCtrl::OnListEndLabelEdit
)
599 wxFileCtrl::wxFileCtrl()
601 m_showHidden
= FALSE
;
604 wxFileCtrl::wxFileCtrl(wxWindow
*win
,
605 wxStaticText
*labelDir
,
607 const wxString
& wild
,
612 const wxValidator
&validator
,
613 const wxString
&name
)
614 : wxListCtrl(win
, id
, pos
, size
, style
, validator
, name
),
618 g_IconsTable
= new wxFileIconsTable
;
619 wxImageList
*imageList
= g_IconsTable
->GetImageList();
621 SetImageList( imageList
, wxIMAGE_LIST_SMALL
);
623 m_goToParentControl
=
624 m_newDirControl
= NULL
;
626 m_labelDir
= labelDir
;
628 m_showHidden
= showHidden
;
631 void wxFileCtrl::ChangeToListMode()
633 SetSingleStyle( wxLC_LIST
);
637 void wxFileCtrl::ChangeToReportMode()
639 SetSingleStyle( wxLC_REPORT
);
643 void wxFileCtrl::ChangeToIconMode()
645 SetSingleStyle( wxLC_ICON
);
649 void wxFileCtrl::ShowHidden( bool show
)
655 long wxFileCtrl::Add( wxFileData
*fd
, wxListItem
&item
)
658 item
.m_mask
= wxLIST_MASK_TEXT
+ wxLIST_MASK_DATA
+ wxLIST_MASK_IMAGE
;
659 fd
->MakeItem( item
);
660 long my_style
= GetWindowStyleFlag();
661 if (my_style
& wxLC_REPORT
)
663 ret
= InsertItem( item
);
664 for (int i
= 1; i
< FileList_Max
; i
++)
665 SetItem( item
.m_itemId
, i
, fd
->GetEntry((FileListField
)i
) );
667 else if (my_style
& wxLC_LIST
)
669 ret
= InsertItem( item
);
674 void wxFileCtrl::UpdateFiles()
676 // don't do anything before ShowModal() call which sets m_dirName
677 if ( m_dirName
.empty() )
680 wxBusyCursor bcur
; // this may take a while...
682 long my_style
= GetWindowStyleFlag();
683 int name_col_width
= 0;
684 if (my_style
& wxLC_REPORT
)
686 if (GetColumnCount() > 0)
687 name_col_width
= GetColumnWidth( 0 );
693 if (my_style
& wxLC_REPORT
)
695 if (name_col_width
< 140) name_col_width
= 140;
696 InsertColumn( 0, _("Name"), wxLIST_FORMAT_LEFT
, name_col_width
);
697 InsertColumn( 1, _("Size"), wxLIST_FORMAT_LEFT
, 60 );
698 InsertColumn( 2, _("Date"), wxLIST_FORMAT_LEFT
, 65 );
699 InsertColumn( 3, _("Time"), wxLIST_FORMAT_LEFT
, 50 );
701 InsertColumn( 4, _("Permissions"), wxLIST_FORMAT_LEFT
, 120 );
704 wxFileData
*fd
= (wxFileData
*) NULL
;
709 #if defined(__DOS__) || defined(__WINDOWS__)
710 if ( IsTopMostDir(m_dirName
) )
712 // Pseudo-directory with all available drives listed...
713 for (int drive
= 1; drive
<= 26; drive
++)
716 path
.Printf(wxT("%c:\\"), (char)(drive
+ 'A' - 1));
717 if ( wxIsDriveAvailable(path
) )
720 fd
= new wxFileData(path
, path
);
730 if ( !IsTopMostDir(m_dirName
) )
732 wxString
p(wxPathOnly(m_dirName
));
734 if (p
.IsEmpty()) p
= wxT("/");
736 fd
= new wxFileData( wxT(".."), p
);
741 wxString
dirname(m_dirName
);
742 #if defined(__DOS__) || defined(__WINDOWS__)
743 if (dirname
.length() == 2 && dirname
[1u] == wxT(':'))
744 dirname
<< wxT('\\');
748 if ( dir
.IsOpened() )
750 wxString
dirPrefix(dirname
+ wxFILE_SEP_PATH
);
751 int hiddenFlag
= m_showHidden
? wxDIR_HIDDEN
: 0;
756 // Get the directories first (not matched against wildcards):
757 cont
= dir
.GetFirst(&f
, wxEmptyString
, wxDIR_DIRS
| hiddenFlag
);
760 fd
= new wxFileData(f
, dirPrefix
+ f
);
763 cont
= dir
.GetNext(&f
);
766 // Tokenize the wildcard string, so we can handle more than 1
767 // search pattern in a wildcard.
768 wxStringTokenizer
tokenWild(m_wild
, wxT(";"));
769 while ( tokenWild
.HasMoreTokens() )
771 cont
= dir
.GetFirst(&f
, tokenWild
.GetNextToken(),
772 wxDIR_FILES
| hiddenFlag
);
775 fd
= new wxFileData(f
, dirPrefix
+ f
);
778 cont
= dir
.GetNext(&f
);
784 SortItems((wxListCtrlCompare
)ListCompare
, 0);
786 if ( my_style
& wxLC_REPORT
)
788 SetColumnWidth(1, wxLIST_AUTOSIZE
);
789 SetColumnWidth(2, wxLIST_AUTOSIZE
);
790 SetColumnWidth(3, wxLIST_AUTOSIZE
);
793 // Finally, enable/disable context-dependent controls:
794 if ( m_goToParentControl
)
795 m_goToParentControl
->Enable(!IsTopMostDir(m_dirName
));
796 #if defined(__DOS__) || defined(__WINDOWS__)
797 if ( m_newDirControl
)
798 m_newDirControl
->Enable(!IsTopMostDir(m_dirName
));
802 void wxFileCtrl::SetWild( const wxString
&wild
)
808 void wxFileCtrl::MakeDir()
810 wxString
new_name( _("NewName") );
811 wxString
path( m_dirName
);
812 path
+= wxFILE_SEP_PATH
;
814 if (wxFileExists(path
))
816 // try NewName0, NewName1 etc.
819 new_name
= _("NewName");
821 num
.Printf( wxT("%d"), i
);
825 path
+= wxFILE_SEP_PATH
;
828 } while (wxFileExists(path
));
834 wxMessageDialog
dialog(this, _("Operation not permitted."), _("Error"), wxOK
| wxICON_ERROR
);
839 wxFileData
*fd
= new wxFileData( new_name
, path
);
843 long id
= Add( fd
, item
);
847 SortItems( (wxListCtrlCompare
) ListCompare
, 0 );
848 id
= FindItem( 0, (long)fd
);
854 void wxFileCtrl::GoToParentDir()
856 if (!IsTopMostDir(m_dirName
))
858 size_t len
= m_dirName
.Len();
859 if (m_dirName
[len
-1] == wxFILE_SEP_PATH
)
860 m_dirName
.Remove( len
-1, 1 );
861 wxString
fname( wxFileNameFromPath(m_dirName
) );
862 m_dirName
= wxPathOnly( m_dirName
);
864 if (m_dirName
.IsEmpty())
865 m_dirName
= wxT("/");
868 long id
= FindItem( 0, fname
);
871 SetItemState( id
, wxLIST_STATE_SELECTED
, wxLIST_STATE_SELECTED
);
875 m_labelDir
->SetLabel(m_dirName
);
879 void wxFileCtrl::GoToHomeDir()
881 wxString s
= wxGetUserHome( wxString() );
885 void wxFileCtrl::GoToDir( const wxString
&dir
)
889 SetItemState( 0, wxLIST_STATE_SELECTED
, wxLIST_STATE_SELECTED
);
892 m_labelDir
->SetLabel(dir
);
895 void wxFileCtrl::GetDir( wxString
&dir
)
900 void wxFileCtrl::FreeItemData(const wxListItem
& item
)
902 wxFileData
*fd
= (wxFileData
*)item
.m_data
;
906 void wxFileCtrl::OnListDeleteItem( wxListEvent
&event
)
908 FreeItemData(event
.m_item
);
911 void wxFileCtrl::FreeAllItemsData()
914 item
.m_mask
= wxLIST_MASK_DATA
;
916 item
.m_itemId
= GetNextItem( -1, wxLIST_NEXT_ALL
);
917 while ( item
.m_itemId
!= -1 )
921 item
.m_itemId
= GetNextItem( item
.m_itemId
, wxLIST_NEXT_ALL
);
925 void wxFileCtrl::OnListEndLabelEdit( wxListEvent
&event
)
927 wxFileData
*fd
= (wxFileData
*)event
.m_item
.m_data
;
930 if ((event
.GetLabel().IsEmpty()) ||
931 (event
.GetLabel() == _(".")) ||
932 (event
.GetLabel() == _("..")) ||
933 (event
.GetLabel().First( wxFILE_SEP_PATH
) != wxNOT_FOUND
))
935 wxMessageDialog
dialog(this, _("Illegal directory name."), _("Error"), wxOK
| wxICON_ERROR
);
941 wxString
new_name( wxPathOnly( fd
->GetFullName() ) );
942 new_name
+= wxFILE_SEP_PATH
;
943 new_name
+= event
.GetLabel();
947 if (wxFileExists(new_name
))
949 wxMessageDialog
dialog(this, _("File name exists already."), _("Error"), wxOK
| wxICON_ERROR
);
954 if (wxRenameFile(fd
->GetFullName(),new_name
))
956 fd
->SetNewName( new_name
, event
.GetLabel() );
957 SetItemState( event
.GetItem(), wxLIST_STATE_SELECTED
, wxLIST_STATE_SELECTED
);
958 EnsureVisible( event
.GetItem() );
962 wxMessageDialog
dialog(this, _("Operation not permitted."), _("Error"), wxOK
| wxICON_ERROR
);
968 wxFileCtrl::~wxFileCtrl()
973 //-----------------------------------------------------------------------------
975 //-----------------------------------------------------------------------------
977 #define ID_LIST_MODE (wxID_FILEDLGG )
978 #define ID_REPORT_MODE (wxID_FILEDLGG + 1)
979 #define ID_UP_DIR (wxID_FILEDLGG + 5)
980 #define ID_PARENT_DIR (wxID_FILEDLGG + 6)
981 #define ID_NEW_DIR (wxID_FILEDLGG + 7)
982 #define ID_CHOICE (wxID_FILEDLGG + 8)
983 #define ID_TEXT (wxID_FILEDLGG + 9)
984 #define ID_LIST_CTRL (wxID_FILEDLGG + 10)
985 #define ID_ACTIVATED (wxID_FILEDLGG + 11)
986 #define ID_CHECK (wxID_FILEDLGG + 12)
988 IMPLEMENT_DYNAMIC_CLASS(wxFileDialog
,wxDialog
)
990 BEGIN_EVENT_TABLE(wxFileDialog
,wxDialog
)
991 EVT_BUTTON(ID_LIST_MODE
, wxFileDialog::OnList
)
992 EVT_BUTTON(ID_REPORT_MODE
, wxFileDialog::OnReport
)
993 EVT_BUTTON(ID_UP_DIR
, wxFileDialog::OnUp
)
994 EVT_BUTTON(ID_PARENT_DIR
, wxFileDialog::OnHome
)
995 EVT_BUTTON(ID_NEW_DIR
, wxFileDialog::OnNew
)
996 EVT_BUTTON(wxID_OK
, wxFileDialog::OnListOk
)
997 EVT_LIST_ITEM_SELECTED(ID_LIST_CTRL
, wxFileDialog::OnSelected
)
998 EVT_LIST_ITEM_ACTIVATED(ID_LIST_CTRL
, wxFileDialog::OnActivated
)
999 EVT_CHOICE(ID_CHOICE
,wxFileDialog::OnChoiceFilter
)
1000 EVT_TEXT_ENTER(ID_TEXT
,wxFileDialog::OnTextEnter
)
1001 EVT_TEXT(ID_TEXT
,wxFileDialog::OnTextChange
)
1002 EVT_CHECKBOX(ID_CHECK
,wxFileDialog::OnCheck
)
1005 long wxFileDialog::ms_lastViewStyle
= wxLC_LIST
;
1006 bool wxFileDialog::ms_lastShowHidden
= FALSE
;
1008 wxFileDialog::wxFileDialog(wxWindow
*parent
,
1009 const wxString
& message
,
1010 const wxString
& defaultDir
,
1011 const wxString
& defaultFile
,
1012 const wxString
& wildCard
,
1014 const wxPoint
& pos
)
1015 : wxDialog( parent
, -1, message
, pos
, wxDefaultSize
,
1016 wxDEFAULT_DIALOG_STYLE
| wxRESIZE_BORDER
)
1018 if (wxConfig::Get(FALSE
))
1020 wxConfig::Get()->Read(wxT("/wxWindows/wxFileDialog/ViewStyle"),
1022 wxConfig::Get()->Read(wxT("/wxWindows/wxFileDialog/ShowHidden"),
1023 &ms_lastShowHidden
);
1026 m_message
= message
;
1027 m_dialogStyle
= style
;
1029 if (m_dialogStyle
== 0)
1030 m_dialogStyle
= wxOPEN
;
1031 if ((m_dialogStyle
& wxMULTIPLE
) && !(m_dialogStyle
& wxOPEN
))
1032 m_dialogStyle
|= wxOPEN
;
1035 if ((m_dir
.empty()) || (m_dir
== wxT(".")))
1040 size_t len
= m_dir
.Len();
1041 if ((len
> 1) && (m_dir
[len
-1] == wxFILE_SEP_PATH
))
1042 m_dir
.Remove( len
-1, 1 );
1045 m_path
+= wxFILE_SEP_PATH
;
1046 m_path
+= defaultFile
;
1047 m_fileName
= defaultFile
;
1048 m_wildCard
= wildCard
;
1050 m_filterExtension
= wxEmptyString
;
1052 // interpret wildcards
1054 if (m_wildCard
.IsEmpty())
1055 m_wildCard
= _("All files (*)|*");
1057 wxStringTokenizer
tokens( m_wildCard
, wxT("|") );
1059 wxString firstWildText
;
1060 if (tokens
.CountTokens() == 1)
1062 firstWildText
= tokens
.GetNextToken();
1063 firstWild
= firstWildText
;
1067 wxASSERT_MSG( tokens
.CountTokens() % 2 == 0, wxT("Wrong file type descripition") );
1068 firstWildText
= tokens
.GetNextToken();
1069 firstWild
= tokens
.GetNextToken();
1071 if ( firstWild
.Left( 2 ) == wxT("*.") )
1072 m_filterExtension
= firstWild
.Mid( 1 );
1073 if ( m_filterExtension
== wxT(".*") )
1074 m_filterExtension
= wxEmptyString
;
1078 bool is_pda
= (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA
);
1080 wxBoxSizer
*mainsizer
= new wxBoxSizer( wxVERTICAL
);
1082 wxBoxSizer
*buttonsizer
= new wxBoxSizer( wxHORIZONTAL
);
1084 wxBitmapButton
*but
;
1086 but
= new wxBitmapButton(this, ID_LIST_MODE
,
1087 wxArtProvider::GetBitmap(wxART_LIST_VIEW
, wxART_CMN_DIALOG
));
1089 but
->SetToolTip( _("View files as a list view") );
1091 buttonsizer
->Add( but
, 0, wxALL
, 5 );
1093 but
= new wxBitmapButton(this, ID_REPORT_MODE
,
1094 wxArtProvider::GetBitmap(wxART_REPORT_VIEW
, wxART_CMN_DIALOG
));
1096 but
->SetToolTip( _("View files as a detailed view") );
1098 buttonsizer
->Add( but
, 0, wxALL
, 5 );
1100 buttonsizer
->Add( 30, 5, 1 );
1102 wxWindow
*butDirUp
=
1103 new wxBitmapButton(this, ID_UP_DIR
,
1104 wxArtProvider::GetBitmap(wxART_GO_DIR_UP
, wxART_CMN_DIALOG
));
1106 butDirUp
->SetToolTip( _("Go to parent directory") );
1108 buttonsizer
->Add( butDirUp
, 0, wxALL
, 5 );
1110 #ifndef __DOS__ // VS: Home directory is meaningless in MS-DOS...
1111 but
= new wxBitmapButton(this, ID_PARENT_DIR
,
1112 wxArtProvider::GetBitmap(wxART_GO_HOME
, wxART_CMN_DIALOG
));
1114 but
->SetToolTip( _("Go to home directory") );
1116 buttonsizer
->Add( but
, 0, wxALL
, 5);
1118 buttonsizer
->Add( 20, 20 );
1121 wxWindow
*butNewDir
=
1122 new wxBitmapButton(this, ID_NEW_DIR
,
1123 wxArtProvider::GetBitmap(wxART_NEW_DIR
, wxART_CMN_DIALOG
));
1125 butNewDir
->SetToolTip( _("Create new directory") );
1127 buttonsizer
->Add( butNewDir
, 0, wxALL
, 5 );
1130 mainsizer
->Add( buttonsizer
, 0, wxALL
| wxEXPAND
, 0 );
1132 mainsizer
->Add( buttonsizer
, 0, wxALL
| wxEXPAND
, 5 );
1134 wxBoxSizer
*staticsizer
= new wxBoxSizer( wxHORIZONTAL
);
1136 staticsizer
->Add( new wxStaticText( this, -1, _("Current directory:") ), 0, wxRIGHT
, 10 );
1137 m_static
= new wxStaticText( this, -1, m_dir
);
1138 staticsizer
->Add( m_static
, 1 );
1139 mainsizer
->Add( staticsizer
, 0, wxEXPAND
| wxLEFT
|wxRIGHT
|wxBOTTOM
, 10 );
1141 long style2
= ms_lastViewStyle
| wxSUNKEN_BORDER
;
1142 if ( !(m_dialogStyle
& wxMULTIPLE
) )
1143 style2
|= wxLC_SINGLE_SEL
;
1145 m_list
= new wxFileCtrl( this, m_static
, ID_LIST_CTRL
,
1146 firstWild
, ms_lastShowHidden
,
1147 wxDefaultPosition
, wxSize(540,200),
1150 m_list
->SetNewDirControl(butNewDir
);
1151 m_list
->SetGoToParentControl(butDirUp
);
1155 // PDAs have a different screen layout
1156 mainsizer
->Add( m_list
, 1, wxEXPAND
| wxLEFT
|wxRIGHT
, 5 );
1158 wxBoxSizer
*choicesizer
= new wxBoxSizer( wxHORIZONTAL
);
1159 m_choice
= new wxChoice( this, ID_CHOICE
);
1160 choicesizer
->Add( m_choice
, 1, wxCENTER
|wxALL
, 5 );
1161 mainsizer
->Add( choicesizer
, 0, wxEXPAND
);
1163 wxBoxSizer
*textsizer
= new wxBoxSizer( wxHORIZONTAL
);
1164 m_text
= new wxTextCtrl( this, ID_TEXT
, m_fileName
, wxDefaultPosition
, wxDefaultSize
, wxPROCESS_ENTER
);
1165 textsizer
->Add( m_text
, 1, wxCENTER
| wxALL
, 5 );
1166 mainsizer
->Add( textsizer
, 0, wxEXPAND
);
1168 m_check
= new wxCheckBox( this, ID_CHECK
, _("Show hidden files") );
1169 m_check
->SetValue( ms_lastShowHidden
);
1170 textsizer
->Add( m_check
, 0, wxCENTER
|wxALL
, 5 );
1172 buttonsizer
= new wxBoxSizer( wxHORIZONTAL
);
1173 buttonsizer
->Add( new wxButton( this, wxID_OK
, _("OK") ), 0, wxCENTER
| wxALL
, 5 );
1174 buttonsizer
->Add( new wxButton( this, wxID_CANCEL
, _("Cancel") ), 0, wxCENTER
| wxALL
, 5 );
1175 mainsizer
->Add( buttonsizer
, 0, wxALIGN_RIGHT
);
1179 mainsizer
->Add( m_list
, 1, wxEXPAND
| wxLEFT
|wxRIGHT
, 10 );
1181 wxBoxSizer
*textsizer
= new wxBoxSizer( wxHORIZONTAL
);
1182 m_text
= new wxTextCtrl( this, ID_TEXT
, m_fileName
, wxDefaultPosition
, wxDefaultSize
, wxPROCESS_ENTER
);
1183 textsizer
->Add( m_text
, 1, wxCENTER
| wxLEFT
|wxRIGHT
|wxTOP
, 10 );
1184 textsizer
->Add( new wxButton( this, wxID_OK
, _("OK") ), 0, wxCENTER
| wxLEFT
|wxRIGHT
|wxTOP
, 10 );
1185 mainsizer
->Add( textsizer
, 0, wxEXPAND
);
1187 wxBoxSizer
*choicesizer
= new wxBoxSizer( wxHORIZONTAL
);
1188 m_choice
= new wxChoice( this, ID_CHOICE
);
1189 choicesizer
->Add( m_choice
, 1, wxCENTER
|wxALL
, 10 );
1190 m_check
= new wxCheckBox( this, ID_CHECK
, _("Show hidden files") );
1191 m_check
->SetValue( ms_lastShowHidden
);
1192 choicesizer
->Add( m_check
, 0, wxCENTER
|wxALL
, 10 );
1193 choicesizer
->Add( new wxButton( this, wxID_CANCEL
, _("Cancel") ), 0, wxCENTER
| wxALL
, 10 );
1194 mainsizer
->Add( choicesizer
, 0, wxEXPAND
);
1197 m_choice
->Append( firstWildText
, (void*) new wxString( firstWild
) );
1198 while (tokens
.HasMoreTokens())
1200 firstWildText
= tokens
.GetNextToken();
1201 firstWild
= tokens
.GetNextToken();
1202 m_choice
->Append( firstWildText
, (void*) new wxString( firstWild
) );
1204 m_choice
->SetSelection( 0 );
1206 SetAutoLayout( TRUE
);
1207 SetSizer( mainsizer
);
1209 mainsizer
->Fit( this );
1210 mainsizer
->SetSizeHints( this );
1217 wxFileDialog::~wxFileDialog()
1219 if (wxConfig::Get(FALSE
))
1221 wxConfig::Get()->Write(wxT("/wxWindows/wxFileDialog/ViewStyle"),
1223 wxConfig::Get()->Write(wxT("/wxWindows/wxFileDialog/ShowHidden"),
1227 const int count
= m_choice
->GetCount();
1228 for ( int i
= 0; i
< count
; i
++ )
1230 delete (wxString
*)m_choice
->GetClientData(i
);
1234 int wxFileDialog::ShowModal()
1236 m_list
->GoToDir(m_dir
);
1237 m_text
->SetValue(m_fileName
);
1239 return wxDialog::ShowModal();
1242 void wxFileDialog::DoSetFilterIndex(int filterindex
)
1244 wxString
*str
= (wxString
*) m_choice
->GetClientData( filterindex
);
1245 m_list
->SetWild( *str
);
1246 m_filterIndex
= filterindex
;
1247 if ( str
->Left(2) == wxT("*.") )
1249 m_filterExtension
= str
->Mid(1);
1250 if (m_filterExtension
== _T(".*"))
1251 m_filterExtension
.clear();
1255 m_filterExtension
.clear();
1259 void wxFileDialog::SetFilterIndex( int filterindex
)
1261 m_choice
->SetSelection( filterindex
);
1263 DoSetFilterIndex(filterindex
);
1266 void wxFileDialog::OnChoiceFilter( wxCommandEvent
&event
)
1268 DoSetFilterIndex((int)event
.GetInt());
1271 void wxFileDialog::OnCheck( wxCommandEvent
&event
)
1273 m_list
->ShowHidden( (ms_lastShowHidden
= event
.GetInt() != 0) );
1276 void wxFileDialog::OnActivated( wxListEvent
&event
)
1278 HandleAction( event
.m_item
.m_text
);
1281 void wxFileDialog::OnTextEnter( wxCommandEvent
&WXUNUSED(event
) )
1283 wxCommandEvent
cevent(wxEVT_COMMAND_BUTTON_CLICKED
, wxID_OK
);
1284 cevent
.SetEventObject( this );
1285 GetEventHandler()->ProcessEvent( cevent
);
1288 static bool ignoreChanges
= FALSE
;
1290 void wxFileDialog::OnTextChange( wxCommandEvent
&WXUNUSED(event
) )
1294 // Clear selections. Otherwise when the user types in a value they may
1295 // not get the file whose name they typed.
1296 if (m_list
->GetSelectedItemCount() > 0)
1298 long item
= m_list
->GetNextItem(-1, wxLIST_NEXT_ALL
,
1299 wxLIST_STATE_SELECTED
);
1300 while ( item
!= -1 )
1302 m_list
->SetItemState(item
,0, wxLIST_STATE_SELECTED
);
1303 item
= m_list
->GetNextItem(item
, wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1309 void wxFileDialog::OnSelected( wxListEvent
&event
)
1311 wxString
filename( event
.m_item
.m_text
);
1312 if (filename
== wxT("..")) return;
1315 m_list
->GetDir( dir
);
1316 if (!IsTopMostDir(dir
))
1317 dir
+= wxFILE_SEP_PATH
;
1319 if (wxDirExists(dir
)) return;
1321 ignoreChanges
= TRUE
;
1322 m_text
->SetValue( filename
);
1323 ignoreChanges
= FALSE
;
1326 void wxFileDialog::HandleAction( const wxString
&fn
)
1328 wxString
filename( fn
);
1330 m_list
->GetDir( dir
);
1331 if (filename
.IsEmpty()) return;
1332 if (filename
== wxT(".")) return;
1334 if (filename
== wxT(".."))
1336 m_list
->GoToParentDir();
1342 if (filename
== wxT("~"))
1344 m_list
->GoToHomeDir();
1349 if (filename
[0u] == wxT('~'))
1351 filename
.Remove( 0, 1 );
1352 wxString
tmp( wxGetUserHome() );
1359 if ((filename
.Find(wxT('*')) != wxNOT_FOUND
) ||
1360 (filename
.Find(wxT('?')) != wxNOT_FOUND
))
1362 if (filename
.Find(wxFILE_SEP_PATH
) != wxNOT_FOUND
)
1364 wxMessageBox(_("Illegal file specification."), _("Error"), wxOK
| wxICON_ERROR
);
1367 m_list
->SetWild( filename
);
1371 if (!IsTopMostDir(dir
))
1372 dir
+= wxFILE_SEP_PATH
;
1373 if (!wxIsAbsolutePath(filename
))
1379 if (wxDirExists(filename
))
1381 m_list
->GoToDir( filename
);
1385 // append the default extension to the filename if it doesn't have any
1387 // VZ: the logic of testing for !wxFileExists() only for the open file
1388 // dialog is not entirely clear to me, why don't we allow saving to a
1389 // file without extension as well?
1390 if ( !(m_dialogStyle
& wxOPEN
) || !wxFileExists(filename
) )
1393 wxSplitPath(filename
, NULL
, NULL
, &ext
);
1396 // append the first extension of the filter string
1397 filename
+= m_filterExtension
.BeforeFirst(_T(';'));
1401 // check that the file [doesn't] exist if necessary
1402 if ( (m_dialogStyle
& wxSAVE
) &&
1403 (m_dialogStyle
& wxOVERWRITE_PROMPT
) &&
1404 wxFileExists( filename
) )
1407 msg
.Printf( _("File '%s' already exists, do you really want to "
1408 "overwrite it?"), filename
.c_str() );
1410 if (wxMessageBox(msg
, _("Confirm"), wxYES_NO
) != wxYES
)
1413 else if ( (m_dialogStyle
& wxOPEN
) &&
1414 (m_dialogStyle
& wxFILE_MUST_EXIST
) &&
1415 !wxFileExists(filename
) )
1417 wxMessageBox(_("Please choose an existing file."), _("Error"),
1418 wxOK
| wxICON_ERROR
);
1421 SetPath( filename
);
1423 // change to the directory where the user went if asked
1424 if ( m_dialogStyle
& wxCHANGE_DIR
)
1427 wxSplitPath(filename
, &cwd
, NULL
, NULL
);
1429 if ( cwd
!= wxGetWorkingDirectory() )
1431 wxSetWorkingDirectory(cwd
);
1435 wxCommandEvent event
;
1436 wxDialog::OnOK(event
);
1439 void wxFileDialog::OnListOk( wxCommandEvent
&WXUNUSED(event
) )
1441 HandleAction( m_text
->GetValue() );
1444 void wxFileDialog::OnList( wxCommandEvent
&WXUNUSED(event
) )
1446 m_list
->ChangeToListMode();
1447 ms_lastViewStyle
= wxLC_LIST
;
1451 void wxFileDialog::OnReport( wxCommandEvent
&WXUNUSED(event
) )
1453 m_list
->ChangeToReportMode();
1454 ms_lastViewStyle
= wxLC_REPORT
;
1458 void wxFileDialog::OnUp( wxCommandEvent
&WXUNUSED(event
) )
1460 m_list
->GoToParentDir();
1464 void wxFileDialog::OnHome( wxCommandEvent
&WXUNUSED(event
) )
1466 m_list
->GoToHomeDir();
1470 void wxFileDialog::OnNew( wxCommandEvent
&WXUNUSED(event
) )
1475 void wxFileDialog::SetPath( const wxString
& path
)
1477 // not only set the full path but also update filename and dir
1479 if ( !path
.empty() )
1482 wxSplitPath(path
, &m_dir
, &m_fileName
, &ext
);
1485 m_fileName
+= wxT(".");
1491 void wxFileDialog::GetPaths( wxArrayString
& paths
) const
1494 if (m_list
->GetSelectedItemCount() == 0)
1496 paths
.Add( GetPath() );
1500 paths
.Alloc( m_list
->GetSelectedItemCount() );
1503 m_list
->GetDir( dir
);
1505 if (dir
!= wxT("/"))
1507 dir
+= wxFILE_SEP_PATH
;
1510 item
.m_mask
= wxLIST_MASK_TEXT
;
1512 item
.m_itemId
= m_list
->GetNextItem( -1, wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1513 while ( item
.m_itemId
!= -1 )
1515 m_list
->GetItem( item
);
1516 paths
.Add( dir
+ item
.m_text
);
1517 item
.m_itemId
= m_list
->GetNextItem( item
.m_itemId
,
1518 wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1522 void wxFileDialog::GetFilenames(wxArrayString
& files
) const
1525 if (m_list
->GetSelectedItemCount() == 0)
1527 files
.Add( GetFilename() );
1530 files
.Alloc( m_list
->GetSelectedItemCount() );
1533 item
.m_mask
= wxLIST_MASK_TEXT
;
1535 item
.m_itemId
= m_list
->GetNextItem( -1, wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1536 while ( item
.m_itemId
!= -1 )
1538 m_list
->GetItem( item
);
1539 files
.Add( item
.m_text
);
1540 item
.m_itemId
= m_list
->GetNextItem( item
.m_itemId
,
1541 wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
);
1547 // ----------------------------------------------------------------------------
1549 // ----------------------------------------------------------------------------
1551 // common part of both wxFileSelectorEx() and wxFileSelector()
1553 DoSelectFile(const wxChar
*title
,
1554 const wxChar
*defaultDir
,
1555 const wxChar
*defaultFileName
,
1556 const wxChar
*defaultExtension
,
1557 int *indexDefaultExtension
,
1558 const wxChar
*filter
,
1564 // the filter may be either given explicitly or created automatically from
1565 // the default extension
1566 wxString filterReal
;
1569 // the user has specified the filter explicitly, use it
1570 filterReal
= filter
;
1572 else if ( !wxIsEmpty(defaultExtension
) )
1574 // create the filter to match the given extension
1575 filterReal
<< wxT("*.") << defaultExtension
;
1578 wxFileDialog
fileDialog(parent
,
1587 if ( fileDialog
.ShowModal() == wxID_OK
)
1589 path
= fileDialog
.GetPath();
1590 if ( indexDefaultExtension
)
1592 *indexDefaultExtension
= fileDialog
.GetFilterIndex();
1600 wxFileSelectorEx(const wxChar
*title
,
1601 const wxChar
*defaultDir
,
1602 const wxChar
*defaultFileName
,
1603 int *indexDefaultExtension
,
1604 const wxChar
*filter
,
1610 return DoSelectFile(title
,
1613 wxT(""), // def ext determined by index
1614 indexDefaultExtension
,
1623 wxFileSelector(const wxChar
*title
,
1624 const wxChar
*defaultDir
,
1625 const wxChar
*defaultFileName
,
1626 const wxChar
*defaultExtension
,
1627 const wxChar
*filter
,
1633 return DoSelectFile(title
,
1637 NULL
, // not interested in filter index
1645 static wxString
GetWildcardString(const wxChar
*ext
)
1650 if ( *ext
== wxT('.') )
1653 wild
<< _T("*.") << ext
;
1655 else // no extension specified
1657 wild
= wxFileSelectorDefaultWildcardStr
;
1663 wxString
wxLoadFileSelector(const wxChar
*what
,
1665 const wxChar
*nameDef
,
1669 if ( what
&& *what
)
1670 prompt
= wxString::Format(_("Load %s file"), what
);
1672 prompt
= _("Load file");
1674 return wxFileSelector(prompt
, NULL
, nameDef
, ext
,
1675 GetWildcardString(ext
), 0, parent
);
1678 wxString
wxSaveFileSelector(const wxChar
*what
,
1680 const wxChar
*nameDef
,
1684 if ( what
&& *what
)
1685 prompt
= wxString::Format(_("Save %s file"), what
);
1687 prompt
= _("Save file");
1689 return wxFileSelector(prompt
, NULL
, nameDef
, ext
,
1690 GetWildcardString(ext
), 0, parent
);
1693 // A module to allow icons table cleanup
1695 class wxFileDialogGenericModule
: public wxModule
1697 DECLARE_DYNAMIC_CLASS(wxFileDialogGenericModule
)
1699 wxFileDialogGenericModule() {}
1700 bool OnInit() { return TRUE
; }
1701 void OnExit() { if (g_IconsTable
) {delete g_IconsTable
; g_IconsTable
= NULL
;} }
1704 IMPLEMENT_DYNAMIC_CLASS(wxFileDialogGenericModule
, wxModule
)
1706 #endif // wxUSE_FILEDLG