]> git.saurik.com Git - wxWidgets.git/blame - src/generic/filedlgg.cpp
Added Set/GetQuickBestSize
[wxWidgets.git] / src / generic / filedlgg.cpp
CommitLineData
81169710 1//////////////////////////////////////////////////////////////////////////////
812a5849 2// Name: src/generic/filedlgg.cpp
23254b13 3// Purpose: wxGenericFileDialog
8b17ba72
RR
4// Author: Robert Roebling
5// Modified by:
6// Created: 12/12/98
7// RCS-ID: $Id$
8// Copyright: (c) Robert Roebling
65571936 9// Licence: wxWindows licence
8b17ba72
RR
10/////////////////////////////////////////////////////////////////////////////
11
8b17ba72
RR
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
15#ifdef __BORLANDC__
16#pragma hdrstop
17#endif
18
4e1901b7 19#if wxUSE_FILEDLG
1e6feb95 20
06cc1fb9 21// NOTE : it probably also supports MAC, untested
144cf6da 22#if !defined(__UNIX__) && !defined(__DOS__) && !defined(__WIN32__) && !defined(__OS2__)
23254b13 23#error wxGenericFileDialog currently only supports Unix, win32 and DOS
8b17ba72
RR
24#endif
25
88a7a4e1
WS
26#ifndef WX_PRECOMP
27 #include "wx/hash.h"
28 #include "wx/intl.h"
29#endif
30
04dbb646
VZ
31#include "wx/checkbox.h"
32#include "wx/textctrl.h"
33#include "wx/choice.h"
34#include "wx/checkbox.h"
35#include "wx/stattext.h"
8b17ba72
RR
36#include "wx/debug.h"
37#include "wx/log.h"
ec524671 38#include "wx/longlong.h"
8b17ba72
RR
39#include "wx/msgdlg.h"
40#include "wx/sizer.h"
0b855868 41#include "wx/bmpbuttn.h"
cae5359f 42#include "wx/tokenzr.h"
eaf40b23 43#include "wx/config.h"
48fe8374 44#include "wx/imaglist.h"
5e673a6a 45#include "wx/dir.h"
60d2cc25 46#include "wx/artprov.h"
1142c837 47#include "wx/settings.h"
619111b9 48#include "wx/filefn.h"
1265e13d 49#include "wx/file.h" // for wxS_IXXX constants only
23254b13 50#include "wx/filedlg.h" // wxOPEN, wxSAVE...
94c47543 51#include "wx/generic/filedlgg.h"
06cc1fb9 52#include "wx/generic/dirctrlg.h" // for wxFileIconsTable
8b17ba72 53
e6daf794
RR
54#if wxUSE_TOOLTIPS
55 #include "wx/tooltip.h"
56#endif
57
619111b9 58#ifndef __WXWINCE__
ac2def68
RR
59#include <sys/types.h>
60#include <sys/stat.h>
619111b9 61#endif
4894ae18
VS
62
63#ifdef __UNIX__
64 #include <dirent.h>
65 #include <pwd.h>
66 #ifndef __VMS
67 # include <grp.h>
68 #endif
69#endif
70
6a8c7c70
VS
71#ifdef __WINDOWS__
72 #include "wx/msw/wrapwin.h"
73 #include "wx/msw/mslu.h"
74#endif
75
4894ae18
VS
76#ifdef __WATCOMC__
77 #include <direct.h>
27df579a 78#endif
4894ae18 79
619111b9 80#ifndef __WXWINCE__
7a82dabc 81#include <time.h>
619111b9
JS
82#endif
83
099d4217 84#if defined(__UNIX__) || defined(__DOS__)
ac2def68 85#include <unistd.h>
099d4217 86#endif
8b17ba72 87
655cf310 88// ----------------------------------------------------------------------------
06cc1fb9 89// private functions
655cf310
VS
90// ----------------------------------------------------------------------------
91
06cc1fb9 92static
ec524671 93int wxCALLBACK wxFileDataNameCompare( long data1, long data2, long sortOrder)
655cf310 94{
ec524671
VZ
95 wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
96 wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
97
98 if (fd1->GetFileName() == wxT(".."))
99 return -sortOrder;
100 if (fd2->GetFileName() == wxT(".."))
101 return sortOrder;
102 if (fd1->IsDir() && !fd2->IsDir())
103 return -sortOrder;
104 if (fd2->IsDir() && !fd1->IsDir())
105 return sortOrder;
106
107 return sortOrder*wxStrcmp( fd1->GetFileName(), fd2->GetFileName() );
655cf310
VS
108}
109
c8c0e54c 110static
ec524671 111int wxCALLBACK wxFileDataSizeCompare(long data1, long data2, long sortOrder)
23254b13 112{
ec524671
VZ
113 wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
114 wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
115
116 if (fd1->GetFileName() == wxT(".."))
117 return -sortOrder;
118 if (fd2->GetFileName() == wxT(".."))
119 return sortOrder;
120 if (fd1->IsDir() && !fd2->IsDir())
121 return -sortOrder;
122 if (fd2->IsDir() && !fd1->IsDir())
123 return sortOrder;
124 if (fd1->IsLink() && !fd2->IsLink())
125 return -sortOrder;
126 if (fd2->IsLink() && !fd1->IsLink())
127 return sortOrder;
128
129 return fd1->GetSize() > fd2->GetSize() ? sortOrder : -sortOrder;
23254b13
JS
130}
131
132static
ec524671 133int wxCALLBACK wxFileDataTypeCompare(long data1, long data2, long sortOrder)
23254b13 134{
ec524671
VZ
135 wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
136 wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
137
138 if (fd1->GetFileName() == wxT(".."))
139 return -sortOrder;
140 if (fd2->GetFileName() == wxT(".."))
141 return sortOrder;
142 if (fd1->IsDir() && !fd2->IsDir())
143 return -sortOrder;
144 if (fd2->IsDir() && !fd1->IsDir())
145 return sortOrder;
146 if (fd1->IsLink() && !fd2->IsLink())
147 return -sortOrder;
148 if (fd2->IsLink() && !fd1->IsLink())
149 return sortOrder;
150
151 return sortOrder*wxStrcmp( fd1->GetFileType(), fd2->GetFileType() );
23254b13
JS
152}
153
154static
ec524671 155int wxCALLBACK wxFileDataTimeCompare(long data1, long data2, long sortOrder)
23254b13 156{
ec524671
VZ
157 wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
158 wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
159
160 if (fd1->GetFileName() == wxT(".."))
161 return -sortOrder;
162 if (fd2->GetFileName() == wxT(".."))
163 return sortOrder;
164 if (fd1->IsDir() && !fd2->IsDir())
165 return -sortOrder;
166 if (fd2->IsDir() && !fd1->IsDir())
167 return sortOrder;
23254b13 168
ec524671 169 return fd1->GetDateTime().IsLaterThan(fd2->GetDateTime()) ? sortOrder : -sortOrder;
c8c0e54c
VZ
170}
171
619111b9
JS
172#if defined(__WXWINCE__)
173#define IsTopMostDir(dir) (dir == wxT("\\") || dir == wxT("/"))
174#elif (defined(__DOS__) || defined(__WINDOWS__) || defined (__OS2__))
abc2a4cc 175#define IsTopMostDir(dir) (dir.empty())
70a7eb07
MW
176#else
177#define IsTopMostDir(dir) (dir == wxT("/"))
5e673a6a
VS
178#endif
179
06cc1fb9
JS
180// defined in src/generic/dirctrlg.cpp
181extern size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayInt &icon_ids);
182
8b17ba72
RR
183//-----------------------------------------------------------------------------
184// wxFileData
185//-----------------------------------------------------------------------------
186
06cc1fb9 187wxFileData::wxFileData( const wxString &filePath, const wxString &fileName, fileType type, int image_id )
8b17ba72 188{
ca9fb418 189 Init();
06cc1fb9
JS
190 m_fileName = fileName;
191 m_filePath = filePath;
23254b13 192 m_type = type;
06cc1fb9 193 m_image = image_id;
7a82dabc 194
b600ed13
VZ
195 ReadData();
196}
197
ca9fb418
VZ
198void wxFileData::Init()
199{
200 m_size = 0;
201 m_type = wxFileData::is_file;
202 m_image = wxFileIconsTable::file;
203}
204
81169710
VZ
205void wxFileData::Copy( const wxFileData& fileData )
206{
207 m_fileName = fileData.GetFileName();
208 m_filePath = fileData.GetFilePath();
209 m_size = fileData.GetSize();
210 m_dateTime = fileData.GetDateTime();
211 m_permissions = fileData.GetPermissions();
212 m_type = fileData.GetType();
ca9fb418 213 m_image = fileData.GetImageId();
81169710
VZ
214}
215
b600ed13
VZ
216void wxFileData::ReadData()
217{
06cc1fb9 218 if (IsDrive())
37fd1c97 219 {
23254b13
JS
220 m_size = 0;
221 return;
222 }
223
619111b9 224#if defined(__DOS__) || (defined(__WINDOWS__) && !defined(__WXWINCE__)) || defined(__OS2__)
06cc1fb9 225 // c:\.. is a drive don't stat it
567be187 226 if ((m_fileName == wxT("..")) && (m_filePath.length() <= 5))
23254b13
JS
227 {
228 m_type = is_drive;
37fd1c97
VS
229 m_size = 0;
230 return;
231 }
7f04165e 232#endif // __DOS__ || __WINDOWS__
c8c0e54c 233
619111b9
JS
234#ifdef __WXWINCE__
235
236 // WinCE
237
238 DWORD fileAttribs = GetFileAttributes(m_filePath.fn_str());
239 m_type |= (fileAttribs & FILE_ATTRIBUTE_DIRECTORY) != 0 ? is_dir : 0;
240
241 wxString p, f, ext;
242 wxSplitPath(m_filePath, & p, & f, & ext);
243 if (wxStricmp(ext, wxT("exe")) == 0)
244 m_type |= is_exe;
245
246 // Find out size
247 m_size = 0;
248 HANDLE fileHandle = CreateFile(m_filePath.fn_str(),
249 GENERIC_READ,
250 FILE_SHARE_READ,
251 NULL,
252 OPEN_EXISTING,
253 FILE_ATTRIBUTE_NORMAL,
254 NULL);
255
256 if (fileHandle != INVALID_HANDLE_VALUE)
c81c9392 257 {
619111b9
JS
258 m_size = GetFileSize(fileHandle, 0);
259 CloseHandle(fileHandle);
260 }
261
262 m_dateTime = wxFileModificationTime(m_filePath);
263
264#else
265
266 // OTHER PLATFORMS
267
8115f9e7 268 wxStructStat buff;
479cd5de 269
144cf6da 270#if defined(__UNIX__) && (!defined( __OS2__ ) && !defined(__VMS))
06cc1fb9 271 lstat( m_filePath.fn_str(), &buff );
23254b13 272 m_type |= S_ISLNK( buff.st_mode ) != 0 ? is_link : 0;
7f04165e 273#else // no lstat()
f3660dcb
SC
274 // only translate to file charset if we don't go by our
275 // wxStat implementation
276#ifndef wxNEED_WX_UNISTD_H
277 wxStat( m_filePath.fn_str() , &buff );
278#else
06cc1fb9 279 wxStat( m_filePath, &buff );
f3660dcb 280#endif
9f2d09aa
RR
281#endif
282
23254b13
JS
283 m_type |= (buff.st_mode & S_IFDIR) != 0 ? is_dir : 0;
284 m_type |= (buff.st_mode & wxS_IXUSR) != 0 ? is_exe : 0;
8b17ba72 285
ec524671 286 m_size = buff.st_size;
8b17ba72 287
06cc1fb9 288 m_dateTime = buff.st_mtime;
619111b9
JS
289#endif
290 // __WXWINCE__
c81c9392 291
06cc1fb9
JS
292#if defined(__UNIX__)
293 m_permissions.Printf(_T("%c%c%c%c%c%c%c%c%c"),
7f04165e
VZ
294 buff.st_mode & wxS_IRUSR ? _T('r') : _T('-'),
295 buff.st_mode & wxS_IWUSR ? _T('w') : _T('-'),
06cc1fb9
JS
296 buff.st_mode & wxS_IXUSR ? _T('x') : _T('-'),
297 buff.st_mode & wxS_IRGRP ? _T('r') : _T('-'),
298 buff.st_mode & wxS_IWGRP ? _T('w') : _T('-'),
299 buff.st_mode & wxS_IXGRP ? _T('x') : _T('-'),
300 buff.st_mode & wxS_IROTH ? _T('r') : _T('-'),
301 buff.st_mode & wxS_IWOTH ? _T('w') : _T('-'),
302 buff.st_mode & wxS_IXOTH ? _T('x') : _T('-'));
303#elif defined(__WIN32__)
0e4e783c 304 DWORD attribs = ::GetFileAttributes(m_filePath.c_str());
06cc1fb9
JS
305 if (attribs != (DWORD)-1)
306 {
307 m_permissions.Printf(_T("%c%c%c%c"),
308 attribs & FILE_ATTRIBUTE_ARCHIVE ? _T('A') : _T(' '),
309 attribs & FILE_ATTRIBUTE_READONLY ? _T('R') : _T(' '),
310 attribs & FILE_ATTRIBUTE_HIDDEN ? _T('H') : _T(' '),
311 attribs & FILE_ATTRIBUTE_SYSTEM ? _T('S') : _T(' '));
312 }
313#endif
619111b9
JS
314
315 // try to get a better icon
316 if (m_image == wxFileIconsTable::file)
317 {
318 if (m_fileName.Find(wxT('.'), true) != wxNOT_FOUND)
319 {
320 m_image = wxTheFileIconsTable->GetIconID( m_fileName.AfterLast(wxT('.')));
321 } else if (IsExe())
322 {
323 m_image = wxFileIconsTable::executable;
324 }
325 }
8b17ba72
RR
326}
327
b600ed13 328wxString wxFileData::GetFileType() const
8b17ba72 329{
06cc1fb9
JS
330 if (IsDir())
331 return _("<DIR>");
332 else if (IsLink())
333 return _("<LINK>");
334 else if (IsDrive())
335 return _("<DRIVE>");
7448de8d 336 else if (m_fileName.Find(wxT('.'), true) != wxNOT_FOUND)
06cc1fb9 337 return m_fileName.AfterLast(wxT('.'));
8b17ba72 338
06cc1fb9 339 return wxEmptyString;
8b17ba72
RR
340}
341
06cc1fb9 342wxString wxFileData::GetModificationTime() const
23254b13 343{
06cc1fb9
JS
344 // want time as 01:02 so they line up nicely, no %r in WIN32
345 return m_dateTime.FormatDate() + wxT(" ") + m_dateTime.Format(wxT("%I:%M:%S %p"));
23254b13
JS
346}
347
8b17ba72
RR
348wxString wxFileData::GetHint() const
349{
06cc1fb9 350 wxString s = m_filePath;
2b5f62a0 351 s += wxT(" ");
b8985048 352
23254b13 353 if (IsDir())
b8985048 354 s += _("<DIR>");
23254b13 355 else if (IsLink())
b8985048 356 s += _("<LINK>");
23254b13 357 else if (IsDrive())
b8985048
VZ
358 s += _("<DRIVE>");
359 else // plain file
ec524671
VZ
360 s += wxString::Format(_("%ld bytes"),
361 wxLongLong(m_size).ToString().c_str());
b8985048
VZ
362
363 s += wxT(' ');
364
365 if ( !IsDrive() )
23254b13 366 {
b8985048
VZ
367 s << GetModificationTime()
368 << wxT(" ")
369 << m_permissions;
8b17ba72 370 }
23254b13 371
8b17ba72 372 return s;
17a1ebd1 373}
8b17ba72 374
23254b13 375wxString wxFileData::GetEntry( fileListFieldType num ) const
8b17ba72
RR
376{
377 wxString s;
9cedab37 378 switch ( num )
8b17ba72 379 {
9cedab37 380 case FileList_Name:
06cc1fb9 381 s = m_fileName;
8b17ba72 382 break;
9cedab37 383
06cc1fb9
JS
384 case FileList_Size:
385 if (!IsDir() && !IsLink() && !IsDrive())
ec524671 386 s = wxLongLong(m_size).ToString();
8b17ba72 387 break;
9cedab37 388
06cc1fb9 389 case FileList_Type:
b600ed13 390 s = GetFileType();
8b17ba72 391 break;
8b17ba72 392
9cedab37 393 case FileList_Time:
7448de8d 394 if (!IsDrive())
06cc1fb9 395 s = GetModificationTime();
9cedab37 396 break;
8b17ba72 397
06cc1fb9 398#if defined(__UNIX__) || defined(__WIN32__)
9cedab37
VZ
399 case FileList_Perm:
400 s = m_permissions;
401 break;
06cc1fb9 402#endif // defined(__UNIX__) || defined(__WIN32__)
8b17ba72 403
9cedab37
VZ
404 default:
405 wxFAIL_MSG( _T("unexpected field in wxFileData::GetEntry()") );
406 }
8b17ba72 407
9cedab37 408 return s;
8b17ba72
RR
409}
410
06cc1fb9 411void wxFileData::SetNewName( const wxString &filePath, const wxString &fileName )
8b17ba72 412{
06cc1fb9
JS
413 m_fileName = fileName;
414 m_filePath = filePath;
8b17ba72
RR
415}
416
417void wxFileData::MakeItem( wxListItem &item )
418{
06cc1fb9 419 item.m_text = m_fileName;
9b00bb16 420 item.ClearAttributes();
9cedab37
VZ
421 if (IsExe())
422 item.SetTextColour(*wxRED);
423 if (IsDir())
424 item.SetTextColour(*wxBLUE);
48fe8374 425
06cc1fb9 426 item.m_image = m_image;
655cf310 427
8b17ba72
RR
428 if (IsLink())
429 {
564a150b
VZ
430 wxColour dg = wxTheColourDatabase->Find( _T("MEDIUM GREY") );
431 if ( dg.Ok() )
432 item.SetTextColour(dg);
8b17ba72 433 }
9f542367 434 item.m_data = wxPtrToUInt(this);
8b17ba72 435}
c8c0e54c 436
8b17ba72
RR
437//-----------------------------------------------------------------------------
438// wxFileCtrl
439//-----------------------------------------------------------------------------
440
619111b9
JS
441static bool ignoreChanges = false;
442
d84afea9 443IMPLEMENT_DYNAMIC_CLASS(wxFileCtrl,wxListCtrl)
8b17ba72
RR
444
445BEGIN_EVENT_TABLE(wxFileCtrl,wxListCtrl)
ca65c044
WS
446 EVT_LIST_DELETE_ITEM(wxID_ANY, wxFileCtrl::OnListDeleteItem)
447 EVT_LIST_DELETE_ALL_ITEMS(wxID_ANY, wxFileCtrl::OnListDeleteAllItems)
448 EVT_LIST_END_LABEL_EDIT(wxID_ANY, wxFileCtrl::OnListEndLabelEdit)
449 EVT_LIST_COL_CLICK(wxID_ANY, wxFileCtrl::OnListColClick)
8b17ba72
RR
450END_EVENT_TABLE()
451
655cf310 452
8b17ba72
RR
453wxFileCtrl::wxFileCtrl()
454{
ca65c044 455 m_showHidden = false;
23254b13
JS
456 m_sort_foward = 1;
457 m_sort_field = wxFileData::FileList_Name;
8b17ba72
RR
458}
459
9cedab37
VZ
460wxFileCtrl::wxFileCtrl(wxWindow *win,
461 wxWindowID id,
462 const wxString& wild,
463 bool showHidden,
464 const wxPoint& pos,
465 const wxSize& size,
466 long style,
467 const wxValidator &validator,
5e673a6a 468 const wxString &name)
9cedab37
VZ
469 : wxListCtrl(win, id, pos, size, style, validator, name),
470 m_wild(wild)
8b17ba72 471{
06cc1fb9 472 wxImageList *imageList = wxTheFileIconsTable->GetSmallImageList();
655cf310 473
0b855868 474 SetImageList( imageList, wxIMAGE_LIST_SMALL );
c8c0e54c 475
9cedab37 476 m_showHidden = showHidden;
23254b13
JS
477
478 m_sort_foward = 1;
479 m_sort_field = wxFileData::FileList_Name;
480
481 m_dirName = wxT("*");
482
483 if (style & wxLC_REPORT)
484 ChangeToReportMode();
8b17ba72
RR
485}
486
487void wxFileCtrl::ChangeToListMode()
488{
23254b13 489 ClearAll();
8b17ba72 490 SetSingleStyle( wxLC_LIST );
8f4fcc4e 491 UpdateFiles();
8b17ba72
RR
492}
493
494void wxFileCtrl::ChangeToReportMode()
495{
23254b13 496 ClearAll();
8b17ba72 497 SetSingleStyle( wxLC_REPORT );
23254b13 498
06cc1fb9
JS
499 // do this since WIN32 does mm/dd/yy UNIX does mm/dd/yyyy
500 // don't hardcode since mm/dd is dd/mm elsewhere
23254b13 501 int w, h;
06cc1fb9
JS
502 wxDateTime dt(22, wxDateTime::Dec, 2002, 22, 22, 22);
503 wxString txt = dt.FormatDate() + wxT("22") + dt.Format(wxT("%I:%M:%S %p"));
504 GetTextExtent(txt, &w, &h);
505
506 InsertColumn( 0, _("Name"), wxLIST_FORMAT_LEFT, w );
507 InsertColumn( 1, _("Size"), wxLIST_FORMAT_LEFT, w/2 );
508 InsertColumn( 2, _("Type"), wxLIST_FORMAT_LEFT, w/2 );
509 InsertColumn( 3, _("Modified"), wxLIST_FORMAT_LEFT, w );
510#if defined(__UNIX__)
511 GetTextExtent(wxT("Permissions 2"), &w, &h);
512 InsertColumn( 4, _("Permissions"), wxLIST_FORMAT_LEFT, w );
513#elif defined(__WIN32__)
514 GetTextExtent(wxT("Attributes 2"), &w, &h);
515 InsertColumn( 4, _("Attributes"), wxLIST_FORMAT_LEFT, w );
23254b13
JS
516#endif
517
8f4fcc4e 518 UpdateFiles();
8b17ba72
RR
519}
520
06cc1fb9 521void wxFileCtrl::ChangeToSmallIconMode()
8b17ba72 522{
23254b13 523 ClearAll();
06cc1fb9 524 SetSingleStyle( wxLC_SMALL_ICON );
8f4fcc4e 525 UpdateFiles();
8b17ba72
RR
526}
527
528void wxFileCtrl::ShowHidden( bool show )
529{
530 m_showHidden = show;
8f4fcc4e 531 UpdateFiles();
8b17ba72
RR
532}
533
0b855868
RR
534long wxFileCtrl::Add( wxFileData *fd, wxListItem &item )
535{
536 long ret = -1;
537 item.m_mask = wxLIST_MASK_TEXT + wxLIST_MASK_DATA + wxLIST_MASK_IMAGE;
538 fd->MakeItem( item );
539 long my_style = GetWindowStyleFlag();
540 if (my_style & wxLC_REPORT)
541 {
542 ret = InsertItem( item );
23254b13
JS
543 for (int i = 1; i < wxFileData::FileList_Max; i++)
544 SetItem( item.m_itemId, i, fd->GetEntry((wxFileData::fileListFieldType)i) );
0b855868 545 }
06cc1fb9 546 else if ((my_style & wxLC_LIST) || (my_style & wxLC_SMALL_ICON))
0b855868
RR
547 {
548 ret = InsertItem( item );
c8c0e54c 549 }
0b855868
RR
550 return ret;
551}
552
b600ed13
VZ
553void wxFileCtrl::UpdateItem(const wxListItem &item)
554{
555 wxFileData *fd = (wxFileData*)GetItemData(item);
556 wxCHECK_RET(fd, wxT("invalid filedata"));
557
558 fd->ReadData();
559
560 SetItemText(item, fd->GetFileName());
c3627a00 561 SetItemImage(item, fd->GetImageId());
b600ed13
VZ
562
563 if (GetWindowStyleFlag() & wxLC_REPORT)
564 {
565 for (int i = 1; i < wxFileData::FileList_Max; i++)
566 SetItem( item.m_itemId, i, fd->GetEntry((wxFileData::fileListFieldType)i) );
567 }
568}
569
8f4fcc4e 570void wxFileCtrl::UpdateFiles()
c8c0e54c 571{
2b5f62a0 572 // don't do anything before ShowModal() call which sets m_dirName
23254b13 573 if ( m_dirName == wxT("*") )
2b5f62a0
VZ
574 return;
575
37fd1c97 576 wxBusyCursor bcur; // this may take a while...
7a82dabc 577
23254b13 578 DeleteAllItems();
7a82dabc 579
8b17ba72 580 wxListItem item;
8b17ba72
RR
581 item.m_itemId = 0;
582 item.m_col = 0;
0b855868 583
619111b9 584#if (defined(__WINDOWS__) || defined(__DOS__) || defined(__WXMAC__) || defined(__OS2__)) && !defined(__WXWINCE__)
37fd1c97 585 if ( IsTopMostDir(m_dirName) )
abc2a4cc 586 {
06cc1fb9
JS
587 wxArrayString names, paths;
588 wxArrayInt icons;
589 size_t n, count = wxGetAvailableDrives(paths, names, icons);
590
591 for (n=0; n<count; n++)
abc2a4cc 592 {
999836aa 593 wxFileData *fd = new wxFileData(paths[n], names[n], wxFileData::is_drive, icons[n]);
81169710 594 if (Add(fd, item) != -1)
37fd1c97 595 item.m_itemId++;
81169710
VZ
596 else
597 delete fd;
37fd1c97 598 }
abc2a4cc 599 }
5e673a6a 600 else
06cc1fb9 601#endif // defined(__DOS__) || defined(__WINDOWS__)
8b17ba72 602 {
5e673a6a 603 // Real directory...
619111b9 604 if ( !IsTopMostDir(m_dirName) && !m_dirName.empty() )
8b17ba72 605 {
5e673a6a 606 wxString p(wxPathOnly(m_dirName));
619111b9 607#if (defined(__UNIX__) || defined(__WXWINCE__)) && !defined(__OS2__)
abc2a4cc 608 if (p.empty()) p = wxT("/");
06cc1fb9 609#endif // __UNIX__
999836aa 610 wxFileData *fd = new wxFileData(p, wxT(".."), wxFileData::is_dir, wxFileIconsTable::folder);
81169710 611 if (Add(fd, item) != -1)
7448de8d 612 item.m_itemId++;
81169710
VZ
613 else
614 delete fd;
8b17ba72 615 }
c8c0e54c 616
5e673a6a 617 wxString dirname(m_dirName);
144cf6da 618#if defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__)
5e673a6a
VS
619 if (dirname.length() == 2 && dirname[1u] == wxT(':'))
620 dirname << wxT('\\');
144cf6da 621#endif // defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__)
619111b9
JS
622
623 if (dirname.empty())
624 dirname = wxFILE_SEP_PATH;
625
626 wxLogNull logNull;
5e673a6a
VS
627 wxDir dir(dirname);
628
629 if ( dir.IsOpened() )
cae5359f 630 {
23254b13
JS
631 wxString dirPrefix(dirname);
632 if (dirPrefix.Last() != wxFILE_SEP_PATH)
633 dirPrefix += wxFILE_SEP_PATH;
634
5e673a6a 635 int hiddenFlag = m_showHidden ? wxDIR_HIDDEN : 0;
7a82dabc 636
5e673a6a
VS
637 bool cont;
638 wxString f;
639
640 // Get the directories first (not matched against wildcards):
641 cont = dir.GetFirst(&f, wxEmptyString, wxDIR_DIRS | hiddenFlag);
642 while (cont)
551adc4b 643 {
999836aa 644 wxFileData *fd = new wxFileData(dirPrefix + f, f, wxFileData::is_dir, wxFileIconsTable::folder);
81169710 645 if (Add(fd, item) != -1)
7448de8d 646 item.m_itemId++;
81169710
VZ
647 else
648 delete fd;
649
5e673a6a
VS
650 cont = dir.GetNext(&f);
651 }
652
7a82dabc 653 // Tokenize the wildcard string, so we can handle more than 1
5e673a6a
VS
654 // search pattern in a wildcard.
655 wxStringTokenizer tokenWild(m_wild, wxT(";"));
656 while ( tokenWild.HasMoreTokens() )
657 {
7a82dabc 658 cont = dir.GetFirst(&f, tokenWild.GetNextToken(),
5e673a6a
VS
659 wxDIR_FILES | hiddenFlag);
660 while (cont)
661 {
999836aa 662 wxFileData *fd = new wxFileData(dirPrefix + f, f, wxFileData::is_file, wxFileIconsTable::file);
81169710 663 if (Add(fd, item) != -1)
7448de8d 664 item.m_itemId++;
81169710
VZ
665 else
666 delete fd;
667
5e673a6a
VS
668 cont = dir.GetNext(&f);
669 }
551adc4b 670 }
cae5359f 671 }
cae5359f 672 }
c8c0e54c 673
06cc1fb9 674 SortItems(m_sort_field, m_sort_foward);
8b17ba72
RR
675}
676
0b855868 677void wxFileCtrl::SetWild( const wxString &wild )
8b17ba72 678{
06cc1fb9
JS
679 if (wild.Find(wxT('|')) != wxNOT_FOUND)
680 return;
681
0b855868 682 m_wild = wild;
8f4fcc4e 683 UpdateFiles();
0b855868
RR
684}
685
686void wxFileCtrl::MakeDir()
687{
5e673a6a 688 wxString new_name( _("NewName") );
0b855868 689 wxString path( m_dirName );
75ec8bd4 690 path += wxFILE_SEP_PATH;
0b855868
RR
691 path += new_name;
692 if (wxFileExists(path))
8b17ba72 693 {
0b855868
RR
694 // try NewName0, NewName1 etc.
695 int i = 0;
c8c0e54c 696 do {
0b855868 697 new_name = _("NewName");
c8c0e54c 698 wxString num;
223d09f6 699 num.Printf( wxT("%d"), i );
c8c0e54c
VZ
700 new_name += num;
701
0b855868 702 path = m_dirName;
75ec8bd4 703 path += wxFILE_SEP_PATH;
0b855868 704 path += new_name;
c8c0e54c
VZ
705 i++;
706 } while (wxFileExists(path));
8b17ba72 707 }
c8c0e54c 708
0b855868 709 wxLogNull log;
c8c0e54c 710 if (!wxMkdir(path))
8b17ba72 711 {
0b855868 712 wxMessageDialog dialog(this, _("Operation not permitted."), _("Error"), wxOK | wxICON_ERROR );
c8c0e54c 713 dialog.ShowModal();
0b855868 714 return;
8b17ba72 715 }
8b17ba72 716
06cc1fb9 717 wxFileData *fd = new wxFileData( path, new_name, wxFileData::is_dir, wxFileIconsTable::folder );
0b855868
RR
718 wxListItem item;
719 item.m_itemId = 0;
720 item.m_col = 0;
13111b2a 721 long id = Add( fd, item );
c8c0e54c 722
0b855868
RR
723 if (id != -1)
724 {
06cc1fb9 725 SortItems(m_sort_field, m_sort_foward);
9f542367 726 id = FindItem( 0, wxPtrToUInt(fd) );
0b855868
RR
727 EnsureVisible( id );
728 EditLabel( id );
729 }
81169710
VZ
730 else
731 delete fd;
8b17ba72
RR
732}
733
734void wxFileCtrl::GoToParentDir()
735{
5e673a6a 736 if (!IsTopMostDir(m_dirName))
8b17ba72 737 {
353f41cb 738 size_t len = m_dirName.Len();
083f7497 739 if (wxEndsWithPathSeparator(m_dirName))
353f41cb 740 m_dirName.Remove( len-1, 1 );
c8c0e54c 741 wxString fname( wxFileNameFromPath(m_dirName) );
0b855868 742 m_dirName = wxPathOnly( m_dirName );
144cf6da 743#if defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__)
abc2a4cc 744 if (!m_dirName.empty())
23254b13
JS
745 {
746 if (m_dirName.Last() == wxT('.'))
ca65c044 747 m_dirName = wxEmptyString;
23254b13
JS
748 }
749#elif defined(__UNIX__)
abc2a4cc 750 if (m_dirName.empty())
5e673a6a
VS
751 m_dirName = wxT("/");
752#endif
8f4fcc4e 753 UpdateFiles();
13111b2a 754 long id = FindItem( 0, fname );
abc2a4cc 755 if (id != wxNOT_FOUND)
c8c0e54c 756 {
619111b9 757 ignoreChanges = true;
c8c0e54c
VZ
758 SetItemState( id, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
759 EnsureVisible( id );
619111b9 760 ignoreChanges = false;
c8c0e54c 761 }
8b17ba72
RR
762 }
763}
764
765void wxFileCtrl::GoToHomeDir()
766{
767 wxString s = wxGetUserHome( wxString() );
5e673a6a 768 GoToDir(s);
8b17ba72
RR
769}
770
771void wxFileCtrl::GoToDir( const wxString &dir )
772{
da865fdd 773 if (!wxDirExists(dir)) return;
06cc1fb9 774
8b17ba72 775 m_dirName = dir;
8f4fcc4e 776 UpdateFiles();
619111b9
JS
777
778 ignoreChanges = true;
e6daf794 779 SetItemState( 0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
619111b9
JS
780 ignoreChanges = false;
781
e6daf794 782 EnsureVisible( 0 );
8b17ba72
RR
783}
784
81169710 785void wxFileCtrl::FreeItemData(wxListItem& item)
8b17ba72 786{
81169710
VZ
787 if ( item.m_data )
788 {
789 wxFileData *fd = (wxFileData*)item.m_data;
790 delete fd;
791
792 item.m_data = 0;
793 }
8b17ba72
RR
794}
795
7a82dabc
VZ
796void wxFileCtrl::OnListDeleteItem( wxListEvent &event )
797{
798 FreeItemData(event.m_item);
799}
800
a3a363f6 801void wxFileCtrl::OnListDeleteAllItems( wxListEvent & WXUNUSED(event) )
81169710
VZ
802{
803 FreeAllItemsData();
804}
805
7a82dabc 806void wxFileCtrl::FreeAllItemsData()
12c1b46a
RR
807{
808 wxListItem item;
809 item.m_mask = wxLIST_MASK_DATA;
810
811 item.m_itemId = GetNextItem( -1, wxLIST_NEXT_ALL );
92da8bde 812 while ( item.m_itemId != -1 )
12c1b46a
RR
813 {
814 GetItem( item );
7a82dabc 815 FreeItemData(item);
12c1b46a
RR
816 item.m_itemId = GetNextItem( item.m_itemId, wxLIST_NEXT_ALL );
817 }
818}
819
0b855868 820void wxFileCtrl::OnListEndLabelEdit( wxListEvent &event )
8b17ba72
RR
821{
822 wxFileData *fd = (wxFileData*)event.m_item.m_data;
0b855868 823 wxASSERT( fd );
c8c0e54c 824
abc2a4cc 825 if ((event.GetLabel().empty()) ||
0b855868
RR
826 (event.GetLabel() == _(".")) ||
827 (event.GetLabel() == _("..")) ||
75ec8bd4 828 (event.GetLabel().First( wxFILE_SEP_PATH ) != wxNOT_FOUND))
8b17ba72 829 {
0b855868 830 wxMessageDialog dialog(this, _("Illegal directory name."), _("Error"), wxOK | wxICON_ERROR );
c8c0e54c 831 dialog.ShowModal();
0b855868 832 event.Veto();
c8c0e54c 833 return;
8b17ba72 834 }
c8c0e54c 835
06cc1fb9 836 wxString new_name( wxPathOnly( fd->GetFilePath() ) );
75ec8bd4 837 new_name += wxFILE_SEP_PATH;
0b855868 838 new_name += event.GetLabel();
c8c0e54c 839
0b855868 840 wxLogNull log;
c8c0e54c 841
0b855868 842 if (wxFileExists(new_name))
8b17ba72 843 {
0b855868 844 wxMessageDialog dialog(this, _("File name exists already."), _("Error"), wxOK | wxICON_ERROR );
c8c0e54c 845 dialog.ShowModal();
0b855868 846 event.Veto();
8b17ba72 847 }
c8c0e54c 848
06cc1fb9 849 if (wxRenameFile(fd->GetFilePath(),new_name))
8b17ba72 850 {
0b855868 851 fd->SetNewName( new_name, event.GetLabel() );
619111b9
JS
852
853 ignoreChanges = true;
c8c0e54c 854 SetItemState( event.GetItem(), wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
619111b9
JS
855 ignoreChanges = false;
856
b600ed13 857 UpdateItem( event.GetItem() );
0b855868 858 EnsureVisible( event.GetItem() );
8b17ba72
RR
859 }
860 else
861 {
0b855868 862 wxMessageDialog dialog(this, _("Operation not permitted."), _("Error"), wxOK | wxICON_ERROR );
c8c0e54c 863 dialog.ShowModal();
0b855868 864 event.Veto();
8b17ba72 865 }
8b17ba72
RR
866}
867
23254b13
JS
868void wxFileCtrl::OnListColClick( wxListEvent &event )
869{
870 int col = event.GetColumn();
871
872 switch (col)
873 {
874 case wxFileData::FileList_Name :
06cc1fb9 875 case wxFileData::FileList_Size :
23254b13 876 case wxFileData::FileList_Type :
23254b13
JS
877 case wxFileData::FileList_Time : break;
878 default : return;
879 }
880
881 if ((wxFileData::fileListFieldType)col == m_sort_field)
06cc1fb9 882 m_sort_foward = !m_sort_foward;
23254b13
JS
883 else
884 m_sort_field = (wxFileData::fileListFieldType)col;
885
06cc1fb9 886 SortItems(m_sort_field, m_sort_foward);
23254b13
JS
887}
888
ec524671 889void wxFileCtrl::SortItems(wxFileData::fileListFieldType field, bool forward)
23254b13
JS
890{
891 m_sort_field = field;
ec524671
VZ
892 m_sort_foward = forward;
893 const long sort_dir = forward ? 1 : -1;
23254b13
JS
894
895 switch (m_sort_field)
896 {
06cc1fb9 897 case wxFileData::FileList_Size :
ec524671 898 wxListCtrl::SortItems(wxFileDataSizeCompare, sort_dir);
23254b13 899 break;
ec524671 900
23254b13 901 case wxFileData::FileList_Type :
ec524671
VZ
902 wxListCtrl::SortItems(wxFileDataTypeCompare, sort_dir);
903 break;
904
23254b13 905 case wxFileData::FileList_Time :
ec524671
VZ
906 wxListCtrl::SortItems(wxFileDataTimeCompare, sort_dir);
907 break;
812a5849
WS
908
909 case wxFileData::FileList_Name :
910 default :
911 wxListCtrl::SortItems(wxFileDataNameCompare, sort_dir);
912 break;
23254b13
JS
913 }
914}
915
7a82dabc
VZ
916wxFileCtrl::~wxFileCtrl()
917{
118322a3
WS
918 // Normally the data are freed via an EVT_LIST_DELETE_ALL_ITEMS event and
919 // wxFileCtrl::OnListDeleteAllItems. But if the event is generated after
920 // the destruction of the wxFileCtrl we need to free any data here:
921 FreeAllItemsData();
7a82dabc
VZ
922}
923
8b17ba72 924//-----------------------------------------------------------------------------
23254b13 925// wxGenericFileDialog
8b17ba72
RR
926//-----------------------------------------------------------------------------
927
5e673a6a
VS
928#define ID_LIST_MODE (wxID_FILEDLGG )
929#define ID_REPORT_MODE (wxID_FILEDLGG + 1)
930#define ID_UP_DIR (wxID_FILEDLGG + 5)
931#define ID_PARENT_DIR (wxID_FILEDLGG + 6)
932#define ID_NEW_DIR (wxID_FILEDLGG + 7)
933#define ID_CHOICE (wxID_FILEDLGG + 8)
934#define ID_TEXT (wxID_FILEDLGG + 9)
935#define ID_LIST_CTRL (wxID_FILEDLGG + 10)
5e673a6a 936#define ID_CHECK (wxID_FILEDLGG + 12)
8b17ba72 937
f74172ab 938IMPLEMENT_DYNAMIC_CLASS(wxGenericFileDialog, wxFileDialogBase)
23254b13
JS
939
940BEGIN_EVENT_TABLE(wxGenericFileDialog,wxDialog)
941 EVT_BUTTON(ID_LIST_MODE, wxGenericFileDialog::OnList)
942 EVT_BUTTON(ID_REPORT_MODE, wxGenericFileDialog::OnReport)
943 EVT_BUTTON(ID_UP_DIR, wxGenericFileDialog::OnUp)
944 EVT_BUTTON(ID_PARENT_DIR, wxGenericFileDialog::OnHome)
945 EVT_BUTTON(ID_NEW_DIR, wxGenericFileDialog::OnNew)
946 EVT_BUTTON(wxID_OK, wxGenericFileDialog::OnListOk)
947 EVT_LIST_ITEM_SELECTED(ID_LIST_CTRL, wxGenericFileDialog::OnSelected)
948 EVT_LIST_ITEM_ACTIVATED(ID_LIST_CTRL, wxGenericFileDialog::OnActivated)
949 EVT_CHOICE(ID_CHOICE,wxGenericFileDialog::OnChoiceFilter)
950 EVT_TEXT_ENTER(ID_TEXT,wxGenericFileDialog::OnTextEnter)
951 EVT_TEXT(ID_TEXT,wxGenericFileDialog::OnTextChange)
952 EVT_CHECKBOX(ID_CHECK,wxGenericFileDialog::OnCheck)
8b17ba72
RR
953END_EVENT_TABLE()
954
23254b13 955long wxGenericFileDialog::ms_lastViewStyle = wxLC_LIST;
ca65c044 956bool wxGenericFileDialog::ms_lastShowHidden = false;
655cf310 957
fe6cf128
VZ
958void wxGenericFileDialog::Init()
959{
960 m_bypassGenericImpl = false;
961
962 m_choice = NULL;
963 m_text = NULL;
964 m_list = NULL;
965 m_check = NULL;
966 m_static = NULL;
967 m_upDirButton = NULL;
968 m_newDirButton = NULL;
969}
970
23254b13 971wxGenericFileDialog::wxGenericFileDialog(wxWindow *parent,
9cedab37
VZ
972 const wxString& message,
973 const wxString& defaultDir,
974 const wxString& defaultFile,
975 const wxString& wildCard,
fe6cf128 976 long style,
4e1901b7 977 const wxPoint& pos,
fe6cf128 978 bool bypassGenericImpl ) : wxFileDialogBase()
8b17ba72 979{
fe6cf128
VZ
980 Init();
981 Create( parent, message, defaultDir, defaultFile, wildCard, style, pos, bypassGenericImpl );
4e1901b7
RR
982}
983
984bool wxGenericFileDialog::Create( wxWindow *parent,
abc2a4cc 985 const wxString& message,
fe6cf128 986 const wxString& defaultDir,
abc2a4cc
WS
987 const wxString& defaultFile,
988 const wxString& wildCard,
fe6cf128
VZ
989 long style,
990 const wxPoint& pos,
991 bool bypassGenericImpl )
4e1901b7 992{
fe6cf128
VZ
993 m_bypassGenericImpl = bypassGenericImpl;
994
7e4fb3b8 995 if (!wxFileDialogBase::Create(parent, message, defaultDir, defaultFile,
fe6cf128
VZ
996 wildCard, style, pos))
997 {
998 return false;
999 }
1000
1001 if (m_bypassGenericImpl)
1002 return true;
1003
4e1901b7 1004 if (!wxDialog::Create( parent, wxID_ANY, message, pos, wxDefaultSize,
f43255e8 1005 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
c81c9392 1006 ))
4e1901b7
RR
1007 {
1008 return false;
1009 }
f74172ab 1010
619111b9
JS
1011 ignoreChanges = true;
1012
ca65c044 1013 if (wxConfig::Get(false))
eaf40b23 1014 {
e7d9c398 1015 wxConfig::Get()->Read(wxT("/wxWindows/wxFileDialog/ViewStyle"),
9cedab37 1016 &ms_lastViewStyle);
e7d9c398 1017 wxConfig::Get()->Read(wxT("/wxWindows/wxFileDialog/ShowHidden"),
9cedab37 1018 &ms_lastShowHidden);
eaf40b23
VS
1019 }
1020
9cedab37
VZ
1021 if (m_dialogStyle == 0)
1022 m_dialogStyle = wxOPEN;
7941ba11 1023 if ((m_dialogStyle & wxMULTIPLE ) && !(m_dialogStyle & wxOPEN))
9b00bb16 1024 m_dialogStyle |= wxOPEN;
479cd5de 1025
353f41cb 1026 if ((m_dir.empty()) || (m_dir == wxT(".")))
ac2def68 1027 {
75ec8bd4 1028 m_dir = wxGetCwd();
619111b9
JS
1029 if (m_dir.empty())
1030 m_dir = wxFILE_SEP_PATH;
ac2def68 1031 }
7a82dabc 1032
353f41cb 1033 size_t len = m_dir.Len();
083f7497 1034 if ((len > 1) && (wxEndsWithPathSeparator(m_dir)))
353f41cb
RR
1035 m_dir.Remove( len-1, 1 );
1036
1037 m_path = m_dir;
75ec8bd4 1038 m_path += wxFILE_SEP_PATH;
8b17ba72 1039 m_path += defaultFile;
655cf310 1040 m_filterExtension = wxEmptyString;
c8c0e54c 1041
cae5359f 1042 // layout
4f5c180e 1043
2b5f62a0 1044 bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
c8c0e54c 1045
8b17ba72 1046 wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL );
c8c0e54c 1047
8b17ba72 1048 wxBoxSizer *buttonsizer = new wxBoxSizer( wxHORIZONTAL );
c8c0e54c 1049
e6daf794 1050 wxBitmapButton *but;
c8c0e54c 1051
7a82dabc 1052 but = new wxBitmapButton(this, ID_LIST_MODE,
36668b35 1053 wxArtProvider::GetBitmap(wxART_LIST_VIEW, wxART_BUTTON));
e6daf794
RR
1054#if wxUSE_TOOLTIPS
1055 but->SetToolTip( _("View files as a list view") );
1056#endif
1057 buttonsizer->Add( but, 0, wxALL, 5 );
c8c0e54c 1058
60d2cc25 1059 but = new wxBitmapButton(this, ID_REPORT_MODE,
36668b35 1060 wxArtProvider::GetBitmap(wxART_REPORT_VIEW, wxART_BUTTON));
e6daf794
RR
1061#if wxUSE_TOOLTIPS
1062 but->SetToolTip( _("View files as a detailed view") );
1063#endif
1064 buttonsizer->Add( but, 0, wxALL, 5 );
c8c0e54c 1065
0b855868 1066 buttonsizer->Add( 30, 5, 1 );
e6daf794 1067
06cc1fb9 1068 m_upDirButton = new wxBitmapButton(this, ID_UP_DIR,
36668b35 1069 wxArtProvider::GetBitmap(wxART_GO_DIR_UP, wxART_BUTTON));
e6daf794 1070#if wxUSE_TOOLTIPS
06cc1fb9 1071 m_upDirButton->SetToolTip( _("Go to parent directory") );
e6daf794 1072#endif
06cc1fb9 1073 buttonsizer->Add( m_upDirButton, 0, wxALL, 5 );
c8c0e54c 1074
37fd1c97 1075#ifndef __DOS__ // VS: Home directory is meaningless in MS-DOS...
60d2cc25 1076 but = new wxBitmapButton(this, ID_PARENT_DIR,
36668b35 1077 wxArtProvider::GetBitmap(wxART_GO_HOME, wxART_BUTTON));
e6daf794
RR
1078#if wxUSE_TOOLTIPS
1079 but->SetToolTip( _("Go to home directory") );
1080#endif
1081 buttonsizer->Add( but, 0, wxALL, 5);
c8c0e54c 1082
e6daf794 1083 buttonsizer->Add( 20, 20 );
75ec8bd4 1084#endif //!__DOS__
c8c0e54c 1085
06cc1fb9 1086 m_newDirButton = new wxBitmapButton(this, ID_NEW_DIR,
36668b35 1087 wxArtProvider::GetBitmap(wxART_NEW_DIR, wxART_BUTTON));
e6daf794 1088#if wxUSE_TOOLTIPS
06cc1fb9 1089 m_newDirButton->SetToolTip( _("Create new directory") );
e6daf794 1090#endif
06cc1fb9 1091 buttonsizer->Add( m_newDirButton, 0, wxALL, 5 );
c8c0e54c 1092
2b5f62a0 1093 if (is_pda)
c15521c6
RR
1094 mainsizer->Add( buttonsizer, 0, wxALL | wxEXPAND, 0 );
1095 else
1096 mainsizer->Add( buttonsizer, 0, wxALL | wxEXPAND, 5 );
c8c0e54c 1097
9c884972 1098 wxBoxSizer *staticsizer = new wxBoxSizer( wxHORIZONTAL );
2b5f62a0 1099 if (is_pda)
ca65c044
WS
1100 staticsizer->Add( new wxStaticText( this, wxID_ANY, _("Current directory:") ), 0, wxRIGHT, 10 );
1101 m_static = new wxStaticText( this, wxID_ANY, m_dir );
9c884972
RR
1102 staticsizer->Add( m_static, 1 );
1103 mainsizer->Add( staticsizer, 0, wxEXPAND | wxLEFT|wxRIGHT|wxBOTTOM, 10 );
1104
619111b9 1105 long style2 = ms_lastViewStyle;
9cedab37 1106 if ( !(m_dialogStyle & wxMULTIPLE) )
cd6b752b 1107 style2 |= wxLC_SINGLE_SEL;
9cedab37 1108
619111b9
JS
1109#ifdef __WXWINCE__
1110 style2 |= wxSIMPLE_BORDER;
1111#else
1112 style2 |= wxSUNKEN_BORDER;
1113#endif
1114
23254b13 1115 m_list = new wxFileCtrl( this, ID_LIST_CTRL,
9548f380 1116 wxEmptyString, ms_lastShowHidden,
9cedab37 1117 wxDefaultPosition, wxSize(540,200),
cd6b752b 1118 style2);
9cedab37 1119
2b5f62a0 1120 if (is_pda)
c15521c6 1121 {
41fecb44
VS
1122 // PDAs have a different screen layout
1123 mainsizer->Add( m_list, 1, wxEXPAND | wxLEFT|wxRIGHT, 5 );
1124
41fecb44 1125 wxBoxSizer *textsizer = new wxBoxSizer( wxHORIZONTAL );
8e13c1ec 1126 m_text = new wxTextCtrl( this, ID_TEXT, m_fileName, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
41fecb44
VS
1127 textsizer->Add( m_text, 1, wxCENTER | wxALL, 5 );
1128 mainsizer->Add( textsizer, 0, wxEXPAND );
1129
ca06ee0d
RR
1130 m_check = NULL;
1131 m_choice = new wxChoice( this, ID_CHOICE );
1132 textsizer->Add( m_choice, 1, wxCENTER|wxALL, 5 );
41fecb44 1133
c81c9392
WS
1134 wxSizer *bsizer = CreateButtonSizer( wxOK|wxCANCEL , false, 5 );
1135 if(bsizer->GetChildren().GetCount() > 0 )
1136 {
1137 mainsizer->Add( bsizer, 0, wxEXPAND | wxALL, 5 );
1138 }
1139 else
1140 {
1141 delete bsizer;
1142 }
c15521c6
RR
1143 }
1144 else
1145 {
41fecb44
VS
1146 mainsizer->Add( m_list, 1, wxEXPAND | wxLEFT|wxRIGHT, 10 );
1147
1148 wxBoxSizer *textsizer = new wxBoxSizer( wxHORIZONTAL );
8e13c1ec 1149 m_text = new wxTextCtrl( this, ID_TEXT, m_fileName, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
41fecb44 1150 textsizer->Add( m_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
5f7bcb48 1151 textsizer->Add( new wxButton( this, wxID_OK ), 0, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
41fecb44
VS
1152 mainsizer->Add( textsizer, 0, wxEXPAND );
1153
1154 wxBoxSizer *choicesizer = new wxBoxSizer( wxHORIZONTAL );
1155 m_choice = new wxChoice( this, ID_CHOICE );
1156 choicesizer->Add( m_choice, 1, wxCENTER|wxALL, 10 );
1157 m_check = new wxCheckBox( this, ID_CHECK, _("Show hidden files") );
9cedab37 1158 m_check->SetValue( ms_lastShowHidden );
41fecb44 1159 choicesizer->Add( m_check, 0, wxCENTER|wxALL, 10 );
5f7bcb48 1160 choicesizer->Add( new wxButton( this, wxID_CANCEL ), 0, wxCENTER | wxALL, 10 );
41fecb44 1161 mainsizer->Add( choicesizer, 0, wxEXPAND );
c15521c6 1162 }
24f932d2 1163
b4cfe261 1164 SetWildcard(wildCard);
8b17ba72 1165
ca65c044 1166 SetAutoLayout( true );
8b17ba72 1167 SetSizer( mainsizer );
c8c0e54c 1168
619111b9
JS
1169 if (!is_pda)
1170 {
1171 mainsizer->Fit( this );
1172 mainsizer->SetSizeHints( this );
ed58dbea 1173
619111b9
JS
1174 Centre( wxBOTH );
1175 }
c81c9392 1176
9cedab37 1177 m_text->SetFocus();
c81c9392 1178
619111b9 1179 ignoreChanges = false;
abc2a4cc 1180
4e1901b7 1181 return true;
8b17ba72
RR
1182}
1183
23254b13 1184wxGenericFileDialog::~wxGenericFileDialog()
cae5359f 1185{
619111b9
JS
1186 ignoreChanges = true;
1187
4e1901b7 1188 if (!m_bypassGenericImpl)
eaf40b23 1189 {
4e1901b7
RR
1190 if (wxConfig::Get(false))
1191 {
1192 wxConfig::Get()->Write(wxT("/wxWindows/wxFileDialog/ViewStyle"),
1193 ms_lastViewStyle);
1194 wxConfig::Get()->Write(wxT("/wxWindows/wxFileDialog/ShowHidden"),
1195 ms_lastShowHidden);
1196 }
c5ef41d3 1197
4e1901b7
RR
1198 const int count = m_choice->GetCount();
1199 for ( int i = 0; i < count; i++ )
1200 {
1201 delete (wxString *)m_choice->GetClientData(i);
1202 }
c5ef41d3 1203 }
cae5359f
RR
1204}
1205
23254b13 1206int wxGenericFileDialog::ShowModal()
9cedab37 1207{
619111b9
JS
1208 ignoreChanges = true;
1209
9cedab37 1210 m_list->GoToDir(m_dir);
06cc1fb9 1211 UpdateControls();
2b5f62a0 1212 m_text->SetValue(m_fileName);
9cedab37 1213
619111b9
JS
1214 ignoreChanges = false;
1215
9cedab37
VZ
1216 return wxDialog::ShowModal();
1217}
1218
16dce3b3
RR
1219bool wxGenericFileDialog::Show( bool show )
1220{
619111b9
JS
1221 // Called by ShowModal, so don't repeate the update
1222#ifndef __WIN32__
16dce3b3
RR
1223 if (show)
1224 {
1225 m_list->GoToDir(m_dir);
1226 UpdateControls();
1227 m_text->SetValue(m_fileName);
1228 }
619111b9 1229#endif
16dce3b3
RR
1230
1231 return wxDialog::Show( show );
1232}
1233
23254b13 1234void wxGenericFileDialog::DoSetFilterIndex(int filterindex)
2b5f62a0
VZ
1235{
1236 wxString *str = (wxString*) m_choice->GetClientData( filterindex );
1237 m_list->SetWild( *str );
1238 m_filterIndex = filterindex;
1239 if ( str->Left(2) == wxT("*.") )
1240 {
787d22ec
JS
1241 m_filterExtension = str->Mid(1);
1242 if (m_filterExtension == _T(".*"))
2b5f62a0
VZ
1243 m_filterExtension.clear();
1244 }
1245 else
1246 {
1247 m_filterExtension.clear();
1248 }
1249}
1250
b4cfe261
VZ
1251void wxGenericFileDialog::SetWildcard(const wxString& wildCard)
1252{
1253 wxFileDialogBase::SetWildcard(wildCard);
1254
1255 wxArrayString wildDescriptions, wildFilters;
1256 const size_t count = wxParseCommonDialogsFilter(m_wildCard,
1257 wildDescriptions,
1258 wildFilters);
1259 wxCHECK_RET( count, wxT("wxFileDialog: bad wildcard string") );
1260
7e4fb3b8
VZ
1261 const size_t countOld = m_choice->GetCount();
1262 size_t n;
1263 for ( n = 0; n < countOld; n++ )
fe6cf128
VZ
1264 {
1265 delete (wxString *)m_choice->GetClientData(n);
1266 }
7e4fb3b8 1267
fe6cf128 1268 for ( n = 0; n < count; n++ )
b4cfe261
VZ
1269 {
1270 m_choice->Append( wildDescriptions[n], new wxString( wildFilters[n] ) );
1271 }
1272
1273 SetFilterIndex( 0 );
1274}
1275
23254b13 1276void wxGenericFileDialog::SetFilterIndex( int filterindex )
04ea7f93
RR
1277{
1278 m_choice->SetSelection( filterindex );
2b5f62a0
VZ
1279
1280 DoSetFilterIndex(filterindex);
04ea7f93
RR
1281}
1282
23254b13 1283void wxGenericFileDialog::OnChoiceFilter( wxCommandEvent &event )
cae5359f 1284{
2b5f62a0 1285 DoSetFilterIndex((int)event.GetInt());
cae5359f
RR
1286}
1287
23254b13 1288void wxGenericFileDialog::OnCheck( wxCommandEvent &event )
bf9e3e73 1289{
9cedab37 1290 m_list->ShowHidden( (ms_lastShowHidden = event.GetInt() != 0) );
bf9e3e73
RR
1291}
1292
23254b13 1293void wxGenericFileDialog::OnActivated( wxListEvent &event )
8b17ba72 1294{
e1811a01 1295 HandleAction( event.m_item.m_text );
8b17ba72
RR
1296}
1297
23254b13 1298void wxGenericFileDialog::OnTextEnter( wxCommandEvent &WXUNUSED(event) )
cae5359f 1299{
b28a6678 1300 HandleAction( m_text->GetValue() );
cae5359f
RR
1301}
1302
23254b13 1303void wxGenericFileDialog::OnTextChange( wxCommandEvent &WXUNUSED(event) )
df413171
JS
1304{
1305 if (!ignoreChanges)
1306 {
1307 // Clear selections. Otherwise when the user types in a value they may
1308 // not get the file whose name they typed.
1309 if (m_list->GetSelectedItemCount() > 0)
1310 {
7f04165e 1311 long item = m_list->GetNextItem(-1, wxLIST_NEXT_ALL,
df413171
JS
1312 wxLIST_STATE_SELECTED);
1313 while ( item != -1 )
7f04165e 1314 {
df413171
JS
1315 m_list->SetItemState(item,0, wxLIST_STATE_SELECTED);
1316 item = m_list->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
7f04165e 1317 }
df413171
JS
1318 }
1319 }
1320}
1321
23254b13 1322void wxGenericFileDialog::OnSelected( wxListEvent &event )
8b17ba72 1323{
619111b9
JS
1324 static bool inSelected = false;
1325
1326 if (inSelected)
1327 return;
1328
1329 inSelected = true;
e1811a01 1330 wxString filename( event.m_item.m_text );
619111b9
JS
1331
1332#ifdef __WXWINCE__
1333 // No double-click on most WinCE devices, so do action immediately.
1334 HandleAction( filename );
1335#else
223d09f6 1336 if (filename == wxT("..")) return;
479cd5de 1337
06cc1fb9 1338 wxString dir = m_list->GetDir();
5e673a6a
VS
1339 if (!IsTopMostDir(dir))
1340 dir += wxFILE_SEP_PATH;
e1811a01 1341 dir += filename;
da865fdd 1342 if (wxDirExists(dir)) return;
479cd5de 1343
ca65c044 1344 ignoreChanges = true;
e1811a01 1345 m_text->SetValue( filename );
ca65c044 1346 ignoreChanges = false;
619111b9
JS
1347#endif
1348 inSelected = false;
8b17ba72
RR
1349}
1350
23254b13 1351void wxGenericFileDialog::HandleAction( const wxString &fn )
8b17ba72 1352{
619111b9
JS
1353 if (ignoreChanges)
1354 return;
1355
e1811a01 1356 wxString filename( fn );
c81c9392
WS
1357 if (filename.empty())
1358 {
1359#ifdef __WXWINCE__
b28a6678 1360 EndModal(wxID_CANCEL);
c81c9392
WS
1361#endif
1362 return;
1363 }
223d09f6 1364 if (filename == wxT(".")) return;
c8c0e54c 1365
c81c9392
WS
1366 wxString dir = m_list->GetDir();
1367
b600ed13
VZ
1368 // "some/place/" means they want to chdir not try to load "place"
1369 bool want_dir = filename.Last() == wxFILE_SEP_PATH;
1370 if (want_dir)
1371 filename = filename.RemoveLast();
1372
223d09f6 1373 if (filename == wxT(".."))
0b855868 1374 {
619111b9 1375 ignoreChanges = true;
0b855868
RR
1376 m_list->GoToParentDir();
1377 m_list->SetFocus();
06cc1fb9 1378 UpdateControls();
619111b9 1379 ignoreChanges = false;
c8c0e54c 1380 return;
0b855868
RR
1381 }
1382
75ec8bd4 1383#ifdef __UNIX__
223d09f6 1384 if (filename == wxT("~"))
ed58dbea 1385 {
619111b9 1386 ignoreChanges = true;
ed58dbea
RR
1387 m_list->GoToHomeDir();
1388 m_list->SetFocus();
06cc1fb9 1389 UpdateControls();
619111b9 1390 ignoreChanges = false;
c8c0e54c 1391 return;
ed58dbea 1392 }
c8c0e54c 1393
b600ed13 1394 if (filename.BeforeFirst(wxT('/')) == wxT("~"))
ed58dbea 1395 {
71f2fb52 1396 filename = wxString(wxGetUserHome()) + filename.Remove(0, 1);
ed58dbea 1397 }
75ec8bd4 1398#endif // __UNIX__
ed58dbea 1399
854aa1e1 1400 if (!(m_dialogStyle & wxSAVE))
cae5359f 1401 {
854aa1e1
RR
1402 if ((filename.Find(wxT('*')) != wxNOT_FOUND) ||
1403 (filename.Find(wxT('?')) != wxNOT_FOUND))
c8c0e54c 1404 {
854aa1e1
RR
1405 if (filename.Find(wxFILE_SEP_PATH) != wxNOT_FOUND)
1406 {
1407 wxMessageBox(_("Illegal file specification."), _("Error"), wxOK | wxICON_ERROR );
1408 return;
1409 }
1410 m_list->SetWild( filename );
c8c0e54c
VZ
1411 return;
1412 }
cae5359f
RR
1413 }
1414
5e673a6a
VS
1415 if (!IsTopMostDir(dir))
1416 dir += wxFILE_SEP_PATH;
1417 if (!wxIsAbsolutePath(filename))
ed58dbea
RR
1418 {
1419 dir += filename;
1420 filename = dir;
1421 }
c8c0e54c 1422
da865fdd 1423 if (wxDirExists(filename))
8b17ba72 1424 {
619111b9 1425 ignoreChanges = true;
8b17ba72 1426 m_list->GoToDir( filename );
06cc1fb9 1427 UpdateControls();
619111b9 1428 ignoreChanges = false;
c8c0e54c 1429 return;
8b17ba72 1430 }
c8c0e54c 1431
b600ed13
VZ
1432 // they really wanted a dir, but it doesn't exist
1433 if (want_dir)
1434 {
1435 wxMessageBox(_("Directory doesn't exist."), _("Error"),
1436 wxOK | wxICON_ERROR );
1437 return;
1438 }
1439
2b5f62a0
VZ
1440 // append the default extension to the filename if it doesn't have any
1441 //
1442 // VZ: the logic of testing for !wxFileExists() only for the open file
1443 // dialog is not entirely clear to me, why don't we allow saving to a
1444 // file without extension as well?
1445 if ( !(m_dialogStyle & wxOPEN) || !wxFileExists(filename) )
8b17ba72 1446 {
f74172ab 1447 filename = AppendExtension(filename, m_filterExtension);
8b17ba72 1448 }
2b5f62a0
VZ
1449
1450 // check that the file [doesn't] exist if necessary
1451 if ( (m_dialogStyle & wxSAVE) &&
1452 (m_dialogStyle & wxOVERWRITE_PROMPT) &&
1453 wxFileExists( filename ) )
8b17ba72 1454 {
2b5f62a0 1455 wxString msg;
88d6c988 1456 msg.Printf( _("File '%s' already exists, do you really want to overwrite it?"), filename.c_str() );
655cf310 1457
2b5f62a0
VZ
1458 if (wxMessageBox(msg, _("Confirm"), wxYES_NO) != wxYES)
1459 return;
1460 }
1461 else if ( (m_dialogStyle & wxOPEN) &&
1462 (m_dialogStyle & wxFILE_MUST_EXIST) &&
1463 !wxFileExists(filename) )
1464 {
1465 wxMessageBox(_("Please choose an existing file."), _("Error"),
1466 wxOK | wxICON_ERROR );
8b17ba72
RR
1467 }
1468
1469 SetPath( filename );
479cd5de 1470
3f6638b8 1471 // change to the directory where the user went if asked
fda09b3f 1472 if ( m_dialogStyle & wxCHANGE_DIR )
3f6638b8
VZ
1473 {
1474 wxString cwd;
1475 wxSplitPath(filename, &cwd, NULL, NULL);
1476
0b98a252 1477 if ( cwd != wxGetCwd() )
3f6638b8
VZ
1478 {
1479 wxSetWorkingDirectory(cwd);
1480 }
1481 }
1482
b28a6678 1483 EndModal(wxID_OK);
e1811a01
RR
1484}
1485
23254b13 1486void wxGenericFileDialog::OnListOk( wxCommandEvent &WXUNUSED(event) )
e1811a01
RR
1487{
1488 HandleAction( m_text->GetValue() );
8b17ba72
RR
1489}
1490
23254b13 1491void wxGenericFileDialog::OnList( wxCommandEvent &WXUNUSED(event) )
8b17ba72 1492{
619111b9 1493 ignoreChanges = true;
8b17ba72 1494 m_list->ChangeToListMode();
9cedab37 1495 ms_lastViewStyle = wxLC_LIST;
0b855868 1496 m_list->SetFocus();
619111b9 1497 ignoreChanges = false;
8b17ba72
RR
1498}
1499
23254b13 1500void wxGenericFileDialog::OnReport( wxCommandEvent &WXUNUSED(event) )
8b17ba72 1501{
619111b9 1502 ignoreChanges = true;
8b17ba72 1503 m_list->ChangeToReportMode();
9cedab37 1504 ms_lastViewStyle = wxLC_REPORT;
0b855868 1505 m_list->SetFocus();
619111b9 1506 ignoreChanges = false;
8b17ba72
RR
1507}
1508
23254b13 1509void wxGenericFileDialog::OnUp( wxCommandEvent &WXUNUSED(event) )
8b17ba72 1510{
619111b9 1511 ignoreChanges = true;
8b17ba72 1512 m_list->GoToParentDir();
0b855868 1513 m_list->SetFocus();
06cc1fb9 1514 UpdateControls();
619111b9 1515 ignoreChanges = false;
8b17ba72
RR
1516}
1517
23254b13 1518void wxGenericFileDialog::OnHome( wxCommandEvent &WXUNUSED(event) )
8b17ba72 1519{
619111b9 1520 ignoreChanges = true;
8b17ba72 1521 m_list->GoToHomeDir();
0b855868 1522 m_list->SetFocus();
06cc1fb9 1523 UpdateControls();
619111b9 1524 ignoreChanges = false;
0b855868
RR
1525}
1526
23254b13 1527void wxGenericFileDialog::OnNew( wxCommandEvent &WXUNUSED(event) )
0b855868 1528{
619111b9
JS
1529 ignoreChanges = true;
1530
0b855868 1531 m_list->MakeDir();
619111b9
JS
1532
1533 ignoreChanges = false;
8b17ba72
RR
1534}
1535
23254b13 1536void wxGenericFileDialog::SetPath( const wxString& path )
8b17ba72
RR
1537{
1538 // not only set the full path but also update filename and dir
1539 m_path = path;
619111b9
JS
1540
1541#ifdef __WXWINCE__
1542 if (m_path.empty())
1543 m_path = wxFILE_SEP_PATH;
1544#endif
1545
9cedab37 1546 if ( !path.empty() )
8b17ba72
RR
1547 {
1548 wxString ext;
1549 wxSplitPath(path, &m_dir, &m_fileName, &ext);
9cedab37 1550 if (!ext.empty())
c8c0e54c 1551 {
223d09f6 1552 m_fileName += wxT(".");
8b17ba72 1553 m_fileName += ext;
c8c0e54c 1554 }
8b17ba72
RR
1555 }
1556}
c8c0e54c 1557
23254b13 1558void wxGenericFileDialog::GetPaths( wxArrayString& paths ) const
7941ba11
RR
1559{
1560 paths.Empty();
28c9c76e
RR
1561 if (m_list->GetSelectedItemCount() == 0)
1562 {
1563 paths.Add( GetPath() );
1564 return;
1565 }
479cd5de 1566
7941ba11
RR
1567 paths.Alloc( m_list->GetSelectedItemCount() );
1568
06cc1fb9 1569 wxString dir = m_list->GetDir();
5e673a6a 1570#ifdef __UNIX__
7a82dabc 1571 if (dir != wxT("/"))
619111b9
JS
1572#endif
1573#ifdef __WXWINCE__
1574 if (dir != wxT("/") && dir != wxT("\\"))
5e673a6a
VS
1575#endif
1576 dir += wxFILE_SEP_PATH;
7941ba11
RR
1577
1578 wxListItem item;
1579 item.m_mask = wxLIST_MASK_TEXT;
1580
1581 item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
92da8bde 1582 while ( item.m_itemId != -1 )
68df5777 1583 {
7941ba11
RR
1584 m_list->GetItem( item );
1585 paths.Add( dir + item.m_text );
68df5777 1586 item.m_itemId = m_list->GetNextItem( item.m_itemId,
7941ba11
RR
1587 wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
1588 }
1589}
1590
23254b13 1591void wxGenericFileDialog::GetFilenames(wxArrayString& files) const
7941ba11
RR
1592{
1593 files.Empty();
28c9c76e
RR
1594 if (m_list->GetSelectedItemCount() == 0)
1595 {
1596 files.Add( GetFilename() );
1597 return;
1598 }
7941ba11
RR
1599 files.Alloc( m_list->GetSelectedItemCount() );
1600
1601 wxListItem item;
1602 item.m_mask = wxLIST_MASK_TEXT;
1603
1604 item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
92da8bde 1605 while ( item.m_itemId != -1 )
68df5777 1606 {
7941ba11
RR
1607 m_list->GetItem( item );
1608 files.Add( item.m_text );
68df5777 1609 item.m_itemId = m_list->GetNextItem( item.m_itemId,
7941ba11
RR
1610 wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
1611 }
1612}
1613
06cc1fb9
JS
1614void wxGenericFileDialog::UpdateControls()
1615{
1616 wxString dir = m_list->GetDir();
1617 m_static->SetLabel(dir);
1618
1619 bool enable = !IsTopMostDir(dir);
1620 m_upDirButton->Enable(enable);
1621
144cf6da 1622#if defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__)
06cc1fb9 1623 m_newDirButton->Enable(enable);
144cf6da 1624#endif // defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__)
06cc1fb9
JS
1625}
1626
23254b13 1627#ifdef USE_GENERIC_FILEDIALOG
655cf310 1628
412e0d47 1629IMPLEMENT_DYNAMIC_CLASS(wxFileDialog, wxGenericFileDialog)
655cf310 1630
23254b13
JS
1631#endif // USE_GENERIC_FILEDIALOG
1632
4e1901b7 1633#endif // wxUSE_FILEDLG