extracted common code into a single wxfileDialogBase class (patch 758901)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22113 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
f363e05c6d
commit
f74172ab42
@ -18,8 +18,10 @@
|
||||
#pragma interface "filedlg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/dialog.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxFileDialog data and generic functions
|
||||
// wxFileDialog data
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
enum
|
||||
@ -36,15 +38,74 @@ enum
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxFileSelectorPromptStr;
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxFileSelectorDefaultWildcardStr;
|
||||
|
||||
// Parses the filterStr, returning the number of filters.
|
||||
// Returns 0 if none or if there's a problem, they arrays will contain an equal
|
||||
// number of items found before the error.
|
||||
// filterStr is in the form:
|
||||
// "All files (*.*)|*.*|Image Files (*.jpeg *.png)|*.jpg;*.png"
|
||||
extern int wxParseFileFilter(const wxString& filterStr,
|
||||
//----------------------------------------------------------------------------
|
||||
// wxFileDialogBase
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxFileDialogBase: public wxDialog
|
||||
{
|
||||
public:
|
||||
wxFileDialogBase () {}
|
||||
|
||||
wxFileDialogBase(wxWindow *parent,
|
||||
const wxString& message = wxFileSelectorPromptStr,
|
||||
const wxString& defaultDir = wxEmptyString,
|
||||
const wxString& defaultFile = wxEmptyString,
|
||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||
long style = 0,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
|
||||
virtual void SetMessage(const wxString& message) { m_message = message; }
|
||||
virtual void SetPath(const wxString& path) { m_path = path; }
|
||||
virtual void SetDirectory(const wxString& dir) { m_dir = dir; }
|
||||
virtual void SetFilename(const wxString& name) { m_fileName = name; }
|
||||
virtual void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
|
||||
virtual void SetStyle(long style) { m_dialogStyle = style; }
|
||||
virtual void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; }
|
||||
|
||||
virtual wxString GetMessage() const { return m_message; }
|
||||
virtual wxString GetPath() const { return m_path; }
|
||||
virtual void GetPaths(wxArrayString& paths) const { paths.Empty(); paths.Add(m_path); }
|
||||
virtual wxString GetDirectory() const { return m_dir; }
|
||||
virtual wxString GetFilename() const { return m_fileName; }
|
||||
virtual void GetFilenames(wxArrayString& files) const { files.Empty(); files.Add(m_fileName); }
|
||||
virtual wxString GetWildcard() const { return m_wildCard; }
|
||||
virtual long GetStyle() const { return m_dialogStyle; }
|
||||
virtual int GetFilterIndex() const { return m_filterIndex; }
|
||||
|
||||
// Utility functions
|
||||
|
||||
// Parses the wildCard, returning the number of filters.
|
||||
// Returns 0 if none or if there's a problem,
|
||||
// The arrays will contain an equal number of items found before the error.
|
||||
// wildCard is in the form:
|
||||
// "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
|
||||
static int ParseWildcard(const wxString& wildCard,
|
||||
wxArrayString& descriptions,
|
||||
wxArrayString& filters);
|
||||
|
||||
// Append first extension to filePath from a ';' separated extensionList
|
||||
// if filePath = "path/foo.bar" just return it as is
|
||||
// if filePath = "foo[.]" and extensionList = "*.jpg;*.png" return "foo.jpg"
|
||||
// if the extension is "*.j?g" (has wildcards) or "jpg" then return filePath
|
||||
static wxString AppendExtension(const wxString &filePath,
|
||||
const wxString &extensionList);
|
||||
|
||||
protected:
|
||||
wxString m_message;
|
||||
long m_dialogStyle;
|
||||
wxWindow *m_parent;
|
||||
wxString m_dir;
|
||||
wxString m_path; // Full path
|
||||
wxString m_fileName;
|
||||
wxString m_wildCard;
|
||||
int m_filterIndex;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxFileDialogBase)
|
||||
DECLARE_NO_COPY_CLASS(wxFileDialogBase)
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxFileDialog convenience functions
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -16,7 +16,6 @@
|
||||
#pragma interface "filedlgg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/listctrl.h"
|
||||
#include "wx/datetime.h"
|
||||
|
||||
@ -43,39 +42,27 @@ class WXDLLEXPORT wxTextCtrl;
|
||||
// wxGenericFileDialog
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxGenericFileDialog: public wxDialog
|
||||
class WXDLLEXPORT wxGenericFileDialog: public wxFileDialogBase
|
||||
{
|
||||
public:
|
||||
wxGenericFileDialog() { }
|
||||
|
||||
wxGenericFileDialog(wxWindow *parent,
|
||||
const wxString& message = wxFileSelectorPromptStr,
|
||||
const wxString& defaultDir = _T(""),
|
||||
const wxString& defaultFile = _T(""),
|
||||
const wxString& defaultDir = wxEmptyString,
|
||||
const wxString& defaultFile = wxEmptyString,
|
||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||
long style = 0,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
virtual ~wxGenericFileDialog();
|
||||
|
||||
void SetMessage(const wxString& message) { SetTitle(message); }
|
||||
void SetPath(const wxString& path);
|
||||
void SetDirectory(const wxString& dir) { m_dir = dir; }
|
||||
void SetFilename(const wxString& name) { m_fileName = name; }
|
||||
void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
|
||||
void SetStyle(long style) { m_dialogStyle = style; }
|
||||
void SetFilterIndex(int filterIndex);
|
||||
|
||||
wxString GetMessage() const { return m_message; }
|
||||
wxString GetPath() const { return m_path; }
|
||||
wxString GetDirectory() const { return m_dir; }
|
||||
wxString GetFilename() const { return m_fileName; }
|
||||
wxString GetWildcard() const { return m_wildCard; }
|
||||
long GetStyle() const { return m_dialogStyle; }
|
||||
int GetFilterIndex() const { return m_filterIndex; }
|
||||
virtual void SetMessage(const wxString& message) { SetTitle(message); }
|
||||
virtual void SetPath(const wxString& path);
|
||||
virtual void SetFilterIndex(int filterIndex);
|
||||
|
||||
// for multiple file selection
|
||||
void GetPaths(wxArrayString& paths) const;
|
||||
void GetFilenames(wxArrayString& files) const;
|
||||
virtual void GetPaths(wxArrayString& paths) const;
|
||||
virtual void GetFilenames(wxArrayString& files) const;
|
||||
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
@ -103,13 +90,6 @@ protected:
|
||||
// use the filter with the given index
|
||||
void DoSetFilterIndex(int filterindex);
|
||||
|
||||
wxString m_message;
|
||||
long m_dialogStyle;
|
||||
wxString m_dir;
|
||||
wxString m_path; // Full path
|
||||
wxString m_fileName;
|
||||
wxString m_wildCard;
|
||||
int m_filterIndex;
|
||||
wxString m_filterExtension;
|
||||
wxChoice *m_choice;
|
||||
wxTextCtrl *m_text;
|
||||
|
@ -15,50 +15,24 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "wx/dialog.h"
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// File selector
|
||||
// wxFileDialog
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class wxFileDialog: public wxDialog
|
||||
class wxFileDialog: public wxFileDialogBase
|
||||
{
|
||||
public:
|
||||
wxFileDialog() { }
|
||||
|
||||
wxFileDialog(wxWindow *parent,
|
||||
const wxString& message = wxFileSelectorPromptStr,
|
||||
const wxString& defaultDir = "",
|
||||
const wxString& defaultFile = "",
|
||||
const wxString& defaultDir = wxEmptyString,
|
||||
const wxString& defaultFile = wxEmptyString,
|
||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||
long style = 0,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
|
||||
void SetMessage(const wxString& message) { m_message = message; }
|
||||
void SetPath(const wxString& path);
|
||||
void SetDirectory(const wxString& dir) { m_dir = dir; }
|
||||
void SetFilename(const wxString& name) { m_fileName = name; }
|
||||
void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
|
||||
void SetStyle(long style) { m_dialogStyle = style; }
|
||||
void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; }
|
||||
|
||||
wxString GetMessage() const { return m_message; }
|
||||
wxString GetPath() const { return m_path; }
|
||||
wxString GetDirectory() const { return m_dir; }
|
||||
wxString GetFilename() const { return m_fileName; }
|
||||
wxString GetWildcard() const { return m_wildCard; }
|
||||
long GetStyle() const { return m_dialogStyle; }
|
||||
int GetFilterIndex() const { return m_filterIndex ; }
|
||||
|
||||
protected:
|
||||
wxString m_message;
|
||||
long m_dialogStyle;
|
||||
wxWindow * m_parent;
|
||||
wxString m_dir;
|
||||
wxString m_path; // Full path
|
||||
wxString m_fileName;
|
||||
wxString m_wildCard;
|
||||
int m_filterIndex;
|
||||
virtual void SetPath(const wxString& path);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxFileDialog)
|
||||
|
@ -15,50 +15,24 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "wx/dialog.h"
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// File selector
|
||||
// wxFileDialog
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class wxFileDialog: public wxDialog
|
||||
class wxFileDialog: public wxFileDialogBase
|
||||
{
|
||||
public:
|
||||
wxFileDialog() { }
|
||||
|
||||
wxFileDialog(wxWindow *parent,
|
||||
const wxString& message = wxFileSelectorPromptStr,
|
||||
const wxString& defaultDir = "",
|
||||
const wxString& defaultFile = "",
|
||||
const wxString& defaultDir = wxEmptyString,
|
||||
const wxString& defaultFile = wxEmptyString,
|
||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||
long style = 0,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
|
||||
void SetMessage(const wxString& message) { m_message = message; }
|
||||
void SetPath(const wxString& path);
|
||||
void SetDirectory(const wxString& dir) { m_dir = dir; }
|
||||
void SetFilename(const wxString& name) { m_fileName = name; }
|
||||
void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
|
||||
void SetStyle(long style) { m_dialogStyle = style; }
|
||||
void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; }
|
||||
|
||||
wxString GetMessage() const { return m_message; }
|
||||
wxString GetPath() const { return m_path; }
|
||||
wxString GetDirectory() const { return m_dir; }
|
||||
wxString GetFilename() const { return m_fileName; }
|
||||
wxString GetWildcard() const { return m_wildCard; }
|
||||
long GetStyle() const { return m_dialogStyle; }
|
||||
int GetFilterIndex() const { return m_filterIndex ; }
|
||||
|
||||
protected:
|
||||
wxString m_message;
|
||||
long m_dialogStyle;
|
||||
wxWindow * m_parent;
|
||||
wxString m_dir;
|
||||
wxString m_path; // Full path
|
||||
wxString m_fileName;
|
||||
wxString m_wildCard;
|
||||
int m_filterIndex;
|
||||
virtual void SetPath(const wxString& path);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxFileDialog)
|
||||
|
@ -16,56 +16,34 @@
|
||||
#pragma interface "filedlg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/dialog.h"
|
||||
//-------------------------------------------------------------------------
|
||||
// wxFileDialog
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* File selector
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxFileDialog: public wxDialog
|
||||
class WXDLLEXPORT wxFileDialog: public wxFileDialogBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxFileDialog)
|
||||
protected:
|
||||
wxString m_message;
|
||||
long m_dialogStyle;
|
||||
wxWindow * m_parent;
|
||||
wxString m_dir;
|
||||
wxString m_path; // Full path
|
||||
wxString m_fileName;
|
||||
wxArrayString m_fileNames;
|
||||
wxArrayString m_paths;
|
||||
wxString m_wildCard;
|
||||
int m_filterIndex;
|
||||
|
||||
public:
|
||||
wxFileDialog(wxWindow *parent, const wxString& message = wxFileSelectorPromptStr,
|
||||
const wxString& defaultDir = wxEmptyString, const wxString& defaultFile = wxEmptyString, const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||
long style = 0, const wxPoint& pos = wxDefaultPosition);
|
||||
wxFileDialog(wxWindow *parent,
|
||||
const wxString& message = wxFileSelectorPromptStr,
|
||||
const wxString& defaultDir = wxEmptyString,
|
||||
const wxString& defaultFile = wxEmptyString,
|
||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||
long style = 0,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
|
||||
inline void SetMessage(const wxString& message) { m_message = message; }
|
||||
inline void SetPath(const wxString& path) { m_path = path; }
|
||||
inline void SetDirectory(const wxString& dir) { m_dir = dir; }
|
||||
inline void SetFilename(const wxString& name) { m_fileName = name; }
|
||||
inline void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
|
||||
inline void SetStyle(long style) { m_dialogStyle = style; }
|
||||
inline void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; }
|
||||
virtual void GetPaths(wxArrayString& paths) const { paths = m_paths; }
|
||||
|
||||
inline wxString GetMessage() const { return m_message; }
|
||||
inline wxString GetPath() const { return m_path; }
|
||||
inline wxString GetDirectory() const { return m_dir; }
|
||||
inline wxString GetFilename() const { return m_fileName; }
|
||||
void GetPaths(wxArrayString& paths) const { paths = m_paths; }
|
||||
void GetFilenames(wxArrayString& files) const { files = m_fileNames; }
|
||||
inline wxString GetWildcard() const { return m_wildCard; }
|
||||
inline long GetStyle() const { return m_dialogStyle; }
|
||||
inline int GetFilterIndex() const { return m_filterIndex ; }
|
||||
|
||||
int ShowModal();
|
||||
virtual int ShowModal();
|
||||
|
||||
// not supported for file dialog, RR
|
||||
virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
|
||||
int WXUNUSED(width), int WXUNUSED(height),
|
||||
int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {}
|
||||
|
||||
};
|
||||
|
||||
#endif // _WX_FILEDLG_H_
|
||||
|
@ -16,55 +16,29 @@
|
||||
#pragma interface "filedlg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/dialog.h"
|
||||
//-------------------------------------------------------------------------
|
||||
// wxFileDialog
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* File selector
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxFileDialog: public wxDialog
|
||||
class WXDLLEXPORT wxFileDialog: public wxFileDialogBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxFileDialog)
|
||||
public:
|
||||
wxString m_message;
|
||||
long m_dialogStyle;
|
||||
wxWindow * m_parent;
|
||||
wxString m_dir;
|
||||
wxString m_path; // Full path
|
||||
wxString m_fileName;
|
||||
wxString m_wildCard;
|
||||
int m_filterIndex;
|
||||
|
||||
// For Motif
|
||||
wxPoint m_pos;
|
||||
static wxString m_fileSelectorAnswer;
|
||||
static bool m_fileSelectorReturned;
|
||||
|
||||
public:
|
||||
wxFileDialog(wxWindow *parent, const wxString& message = wxFileSelectorPromptStr,
|
||||
const wxString& defaultDir = "", const wxString& defaultFile = "", const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||
long style = 0, const wxPoint& pos = wxDefaultPosition);
|
||||
wxFileDialog(wxWindow *parent,
|
||||
const wxString& message = wxFileSelectorPromptStr,
|
||||
const wxString& defaultDir = wxEmptyString,
|
||||
const wxString& defaultFile = wxEmptyString,
|
||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||
long style = 0,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
|
||||
inline void SetMessage(const wxString& message) { m_message = message; }
|
||||
inline void SetPath(const wxString& path) { m_path = path; }
|
||||
inline void SetDirectory(const wxString& dir) { m_dir = dir; }
|
||||
inline void SetFilename(const wxString& name) { m_fileName = name; }
|
||||
inline void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
|
||||
inline void SetStyle(long style) { m_dialogStyle = style; }
|
||||
inline void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; }
|
||||
|
||||
inline wxString GetMessage() const { return m_message; }
|
||||
inline wxString GetPath() const { return m_path; }
|
||||
inline void GetPaths(wxArrayString& a) { a.Empty(); a.Add(m_path); }
|
||||
inline wxString GetDirectory() const { return m_dir; }
|
||||
inline wxString GetFilename() const { return m_fileName; }
|
||||
inline void GetFilenames(wxArrayString& a) { a.Empty();
|
||||
a.Add( m_fileName); }
|
||||
inline wxString GetWildcard() const { return m_wildCard; }
|
||||
inline long GetStyle() const { return m_dialogStyle; }
|
||||
inline int GetFilterIndex() const { return m_filterIndex ; }
|
||||
|
||||
int ShowModal();
|
||||
virtual int ShowModal();
|
||||
};
|
||||
|
||||
#endif // _WX_FILEDLG_H_
|
||||
|
@ -16,13 +16,11 @@
|
||||
#pragma interface "filedlg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/dialog.h"
|
||||
//-------------------------------------------------------------------------
|
||||
// wxFileDialog
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* File selector
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxFileDialog: public wxDialog
|
||||
class WXDLLEXPORT wxFileDialog: public wxFileDialogBase
|
||||
{
|
||||
public:
|
||||
wxFileDialog(wxWindow *parent,
|
||||
@ -33,38 +31,14 @@ public:
|
||||
long style = 0,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
|
||||
void SetMessage(const wxString& message) { m_message = message; }
|
||||
void SetPath(const wxString& path);
|
||||
void SetDirectory(const wxString& dir) { m_dir = dir; }
|
||||
void SetFilename(const wxString& name) { m_fileName = name; }
|
||||
void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
|
||||
void SetStyle(long style) { m_dialogStyle = style; }
|
||||
void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; }
|
||||
|
||||
wxString GetMessage() const { return m_message; }
|
||||
wxString GetPath() const { return m_path; }
|
||||
void GetPaths(wxArrayString& paths) const;
|
||||
wxString GetDirectory() const { return m_dir; }
|
||||
wxString GetFilename() const { return m_fileName; }
|
||||
void GetFilenames(wxArrayString& files) const { files = m_fileNames; }
|
||||
wxString GetWildcard() const { return m_wildCard; }
|
||||
long GetStyle() const { return m_dialogStyle; }
|
||||
int GetFilterIndex() const { return m_filterIndex ; }
|
||||
virtual void SetPath(const wxString& path);
|
||||
virtual void GetPaths(wxArrayString& paths) const;
|
||||
|
||||
virtual int ShowModal();
|
||||
|
||||
protected:
|
||||
wxString m_message;
|
||||
long m_dialogStyle;
|
||||
wxWindow * m_parent;
|
||||
wxString m_dir;
|
||||
wxString m_path; // Full path
|
||||
wxString m_fileName;
|
||||
wxArrayString m_fileNames;
|
||||
wxString m_wildCard;
|
||||
int m_filterIndex;
|
||||
|
||||
private:
|
||||
wxArrayString m_fileNames;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxFileDialog)
|
||||
DECLARE_NO_COPY_CLASS(wxFileDialog)
|
||||
};
|
||||
|
@ -12,56 +12,29 @@
|
||||
#ifndef _WX_FILEDLG_H_
|
||||
#define _WX_FILEDLG_H_
|
||||
|
||||
#include "wx/dialog.h"
|
||||
//-------------------------------------------------------------------------
|
||||
// wxFileDialog
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* File selector
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxFileDialog: public wxDialog
|
||||
class WXDLLEXPORT wxFileDialog: public wxFileDialogBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxFileDialog)
|
||||
public:
|
||||
wxFileDialog( wxWindow* pParent
|
||||
,const wxString& rsMessage = wxFileSelectorPromptStr
|
||||
,const wxString& rsDefaultDir = ""
|
||||
,const wxString& rsDefaultFile = ""
|
||||
,const wxString& rsDefaultDir = wxEmptyString
|
||||
,const wxString& rsDefaultFile = wxEmptyString
|
||||
,const wxString& rsWildCard = wxFileSelectorDefaultWildcardStr
|
||||
,long lStyle = 0
|
||||
,const wxPoint& rPos = wxDefaultPosition
|
||||
);
|
||||
|
||||
inline void SetMessage(const wxString& rsMessage) { m_sMessage = rsMessage; }
|
||||
inline void SetPath(const wxString& rsPath) { m_sPath = rsPath; }
|
||||
inline void SetDirectory(const wxString& rsDir) { m_sDir = rsDir; }
|
||||
inline void SetFilename(const wxString& rsName) { m_sFileName = rsName; }
|
||||
inline void SetWildcard(const wxString& rsWildCard) { m_sWildCard = rsWildCard; }
|
||||
inline void SetStyle(long lStyle) { m_lDialogStyle = lStyle; }
|
||||
inline void SetFilterIndex(int nFilterIndex) { m_nFilterIndex = nFilterIndex; }
|
||||
|
||||
inline wxString GetMessage(void) const { return m_sMessage; }
|
||||
inline wxString GetPath(void) const { return m_sPath; }
|
||||
void GetPaths(wxArrayString& rasPath) const;
|
||||
inline wxString GetDirectory(void) const { return m_sDir; }
|
||||
inline wxString GetFilename(void) const { return m_sFileName; }
|
||||
inline void GetFilenames(wxArrayString& rasFilenames) { rasFilenames = m_asFileNames; }
|
||||
inline wxString GetWildcard(void) const { return m_sWildCard; }
|
||||
inline long GetStyle(void) const { return m_lDialogStyle; }
|
||||
inline int GetFilterIndex() const { return m_nFilterIndex ; }
|
||||
virtual void GetPaths(wxArrayString& rasPath) const;
|
||||
|
||||
int ShowModal();
|
||||
|
||||
protected:
|
||||
wxString m_sMessage;
|
||||
long m_lDialogStyle;
|
||||
wxWindow* m_pParent;
|
||||
wxString m_sDir;
|
||||
wxString m_sPath; // Full path
|
||||
wxString m_sFileName;
|
||||
wxArrayString m_asFileNames;
|
||||
wxString m_sWildCard;
|
||||
int m_nFilterIndex;
|
||||
wxPoint m_vPos;
|
||||
wxArrayString m_fileNames;
|
||||
}; // end of CLASS wxFileDialog
|
||||
|
||||
#endif // _WX_FILEDLG_H_
|
||||
|
@ -30,217 +30,45 @@
|
||||
|
||||
#if wxUSE_FILEDLG
|
||||
|
||||
wxString wxFileSelector(const wxChar *title,
|
||||
const wxChar *defaultDir,
|
||||
const wxChar *defaultFileName,
|
||||
const wxChar *defaultExtension,
|
||||
const wxChar *filter,
|
||||
int flags,
|
||||
wxWindow *parent,
|
||||
int x, int y)
|
||||
//----------------------------------------------------------------------------
|
||||
// wxFileDialogBase
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFileDialogBase, wxDialog)
|
||||
|
||||
wxFileDialogBase::wxFileDialogBase(wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& defaultDir,
|
||||
const wxString& defaultFile,
|
||||
const wxString& wildCard,
|
||||
long style,
|
||||
const wxPoint& pos)
|
||||
{
|
||||
// The defaultExtension, if non-NULL, is
|
||||
// appended to the filename if the user fails to type an extension. The new
|
||||
// implementation (taken from wxFileSelectorEx) appends the extension
|
||||
// automatically, by looking at the filter specification. In fact this
|
||||
// should be better than the native Microsoft implementation because
|
||||
// Windows only allows *one* default extension, whereas here we do the
|
||||
// right thing depending on the filter the user has chosen.
|
||||
m_parent = parent;
|
||||
m_message = message;
|
||||
m_dir = defaultDir;
|
||||
m_fileName = defaultFile;
|
||||
m_wildCard = wildCard;
|
||||
m_dialogStyle = style;
|
||||
m_path = wxT("");
|
||||
m_filterIndex = 0;
|
||||
|
||||
// If there's a default extension specified but no filter, we create a
|
||||
// suitable filter.
|
||||
if (m_wildCard.IsEmpty())
|
||||
m_wildCard = wxFileSelectorDefaultWildcardStr;
|
||||
|
||||
wxString filter2;
|
||||
if ( defaultExtension && !filter )
|
||||
filter2 = wxString(wxT("*.")) + defaultExtension;
|
||||
else if ( filter )
|
||||
filter2 = filter;
|
||||
|
||||
wxString defaultDirString;
|
||||
if (defaultDir)
|
||||
defaultDirString = defaultDir;
|
||||
|
||||
wxString defaultFilenameString;
|
||||
if (defaultFileName)
|
||||
defaultFilenameString = defaultFileName;
|
||||
|
||||
wxFileDialog fileDialog(parent, title, defaultDirString,
|
||||
defaultFilenameString, filter2,
|
||||
flags, wxPoint(x, y));
|
||||
if( wxStrlen(defaultExtension) != 0 )
|
||||
// convert m_wildCard from "*.bar" to "Files (*.bar)|*.bar"
|
||||
if ( m_wildCard.Find(wxT('|')) == wxNOT_FOUND )
|
||||
{
|
||||
int filterFind = 0,
|
||||
filterIndex = 0;
|
||||
|
||||
for( unsigned int i = 0; i < filter2.Len(); i++ )
|
||||
{
|
||||
if( filter2.GetChar(i) == wxT('|') )
|
||||
{
|
||||
// save the start index of the new filter
|
||||
unsigned int is = i++;
|
||||
|
||||
// find the end of the filter
|
||||
for( ; i < filter2.Len(); i++ )
|
||||
{
|
||||
if(filter2[i] == wxT('|'))
|
||||
break;
|
||||
}
|
||||
|
||||
if( i-is-1 > 0 && is+1 < filter2.Len() )
|
||||
{
|
||||
if( filter2.Mid(is+1,i-is-1).Contains(defaultExtension) )
|
||||
{
|
||||
filterFind = filterIndex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
filterIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
fileDialog.SetFilterIndex(filterFind);
|
||||
}
|
||||
|
||||
wxString filename;
|
||||
if ( fileDialog.ShowModal() == wxID_OK )
|
||||
{
|
||||
filename = fileDialog.GetPath();
|
||||
}
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
wxString wxFileSelector( const wxChar *title,
|
||||
const wxChar *defaultDir,
|
||||
const wxChar *defaultFileName,
|
||||
const wxChar *defaultExtension,
|
||||
const wxChar *filter,
|
||||
int flags,
|
||||
wxWindow *parent,
|
||||
int x,
|
||||
int y )
|
||||
{
|
||||
wxString filter2;
|
||||
if ( defaultExtension && !filter )
|
||||
filter2 = wxString(wxT("*.")) + wxString(defaultExtension) ;
|
||||
else if ( filter )
|
||||
filter2 = filter;
|
||||
|
||||
wxString defaultDirString;
|
||||
if (defaultDir)
|
||||
defaultDirString = defaultDir;
|
||||
|
||||
wxString defaultFilenameString;
|
||||
if (defaultFileName)
|
||||
defaultFilenameString = defaultFileName;
|
||||
|
||||
wxFileDialog fileDialog( parent, title, defaultDirString, defaultFilenameString, filter2, flags, wxPoint(x, y) );
|
||||
|
||||
if ( fileDialog.ShowModal() == wxID_OK )
|
||||
{
|
||||
return fileDialog.GetPath();
|
||||
}
|
||||
else
|
||||
{
|
||||
return wxEmptyString;
|
||||
m_wildCard.Printf(_("Files (%s)|%s"),
|
||||
m_wildCard.c_str(), m_wildCard.c_str());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
wxString wxFileSelectorEx(const wxChar *title,
|
||||
const wxChar *defaultDir,
|
||||
const wxChar *defaultFileName,
|
||||
int* defaultFilterIndex,
|
||||
const wxChar *filter,
|
||||
int flags,
|
||||
wxWindow* parent,
|
||||
int x,
|
||||
int y)
|
||||
|
||||
{
|
||||
wxFileDialog fileDialog(parent,
|
||||
title ? title : wxT(""),
|
||||
defaultDir ? defaultDir : wxT(""),
|
||||
defaultFileName ? defaultFileName : wxT(""),
|
||||
filter ? filter : wxT(""),
|
||||
flags, wxPoint(x, y));
|
||||
|
||||
wxString filename;
|
||||
if ( fileDialog.ShowModal() == wxID_OK )
|
||||
{
|
||||
if ( defaultFilterIndex )
|
||||
*defaultFilterIndex = fileDialog.GetFilterIndex();
|
||||
|
||||
filename = fileDialog.GetPath();
|
||||
}
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Generic file load/save dialog (for internal use only)
|
||||
// see wx[Load/Save]FileSelector
|
||||
static wxString wxDefaultFileSelector(bool load,
|
||||
const wxChar *what,
|
||||
const wxChar *extension,
|
||||
const wxChar *default_name,
|
||||
wxWindow *parent)
|
||||
{
|
||||
wxString prompt;
|
||||
wxString str;
|
||||
if (load)
|
||||
str = _("Load %s file");
|
||||
else
|
||||
str = _("Save %s file");
|
||||
prompt.Printf(str, what);
|
||||
|
||||
wxString wild;
|
||||
const wxChar *ext = extension;
|
||||
if ( ext )
|
||||
{
|
||||
if ( *ext == wxT('.') )
|
||||
ext++;
|
||||
|
||||
wild.Printf(wxT("*.%s"), ext);
|
||||
}
|
||||
else // no extension specified
|
||||
{
|
||||
wild = wxFileSelectorDefaultWildcardStr;
|
||||
}
|
||||
|
||||
return wxFileSelector(prompt, NULL, default_name, ext, wild,
|
||||
load ? wxOPEN : wxSAVE, parent);
|
||||
}
|
||||
|
||||
// Generic file load dialog
|
||||
WXDLLEXPORT wxString wxLoadFileSelector(const wxChar *what,
|
||||
const wxChar *extension,
|
||||
const wxChar *default_name,
|
||||
wxWindow *parent)
|
||||
{
|
||||
return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
|
||||
}
|
||||
|
||||
// Generic file save dialog
|
||||
WXDLLEXPORT wxString wxSaveFileSelector(const wxChar *what,
|
||||
const wxChar *extension,
|
||||
const wxChar *default_name,
|
||||
wxWindow *parent)
|
||||
{
|
||||
return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
|
||||
}
|
||||
|
||||
|
||||
// Parses the filterStr, returning the number of filters.
|
||||
// Returns 0 if none or if there's a problem.
|
||||
// filterStr is in the form: "All files (*.*)|*.*|JPEG Files (*.jpeg)|*.jpg"
|
||||
|
||||
int wxParseFileFilter(const wxString& filterStr,
|
||||
int wxFileDialogBase::ParseWildcard(const wxString& filterStr,
|
||||
wxArrayString& descriptions,
|
||||
wxArrayString& filters)
|
||||
{
|
||||
@ -290,5 +118,205 @@ int wxParseFileFilter(const wxString& filterStr,
|
||||
return filters.GetCount();
|
||||
}
|
||||
|
||||
wxString wxFileDialogBase::AppendExtension(const wxString &filePath,
|
||||
const wxString &extensionList)
|
||||
{
|
||||
// strip off path, to avoid problems with "path.bar/foo"
|
||||
wxString fileName = filePath.AfterLast(wxFILE_SEP_PATH);
|
||||
|
||||
// if fileName is of form "foo.bar" it's ok, return it
|
||||
int idx_dot = fileName.Find(wxT('.'), TRUE);
|
||||
if ((idx_dot != wxNOT_FOUND) && (idx_dot < (int)fileName.Len() - 1))
|
||||
return filePath;
|
||||
|
||||
// get the first extension from extensionList, or all of it
|
||||
wxString ext = extensionList.BeforeFirst(wxT(';'));
|
||||
|
||||
// if ext == "foo" or "foo." there's no extension
|
||||
int idx_ext_dot = ext.Find(wxT('.'), TRUE);
|
||||
if ((idx_ext_dot == wxNOT_FOUND) || (idx_ext_dot == (int)ext.Len() - 1))
|
||||
return filePath;
|
||||
else
|
||||
ext = ext.AfterLast(wxT('.'));
|
||||
|
||||
// if ext == "*" or "bar*" or "b?r" or " " then its not valid
|
||||
if ((ext.Find(wxT('*')) != wxNOT_FOUND) ||
|
||||
(ext.Find(wxT('?')) != wxNOT_FOUND) ||
|
||||
(ext.Strip(wxString::both).IsEmpty()))
|
||||
return filePath;
|
||||
|
||||
// if fileName doesn't have a '.' then add one
|
||||
if (filePath.Last() != wxT('.'))
|
||||
ext = wxT(".") + ext;
|
||||
|
||||
return filePath + ext;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxFileDialog convenience functions
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
wxString wxFileSelector(const wxChar *title,
|
||||
const wxChar *defaultDir,
|
||||
const wxChar *defaultFileName,
|
||||
const wxChar *defaultExtension,
|
||||
const wxChar *filter,
|
||||
int flags,
|
||||
wxWindow *parent,
|
||||
int x, int y)
|
||||
{
|
||||
// The defaultExtension, if non-NULL, is
|
||||
// appended to the filename if the user fails to type an extension. The new
|
||||
// implementation (taken from wxFileSelectorEx) appends the extension
|
||||
// automatically, by looking at the filter specification. In fact this
|
||||
// should be better than the native Microsoft implementation because
|
||||
// Windows only allows *one* default extension, whereas here we do the
|
||||
// right thing depending on the filter the user has chosen.
|
||||
|
||||
// If there's a default extension specified but no filter, we create a
|
||||
// suitable filter.
|
||||
|
||||
wxString filter2;
|
||||
if ( defaultExtension && !filter )
|
||||
filter2 = wxString(wxT("*.")) + defaultExtension;
|
||||
else if ( filter )
|
||||
filter2 = filter;
|
||||
|
||||
wxString defaultDirString;
|
||||
if (defaultDir)
|
||||
defaultDirString = defaultDir;
|
||||
|
||||
wxString defaultFilenameString;
|
||||
if (defaultFileName)
|
||||
defaultFilenameString = defaultFileName;
|
||||
|
||||
wxFileDialog fileDialog(parent, title, defaultDirString,
|
||||
defaultFilenameString, filter2,
|
||||
flags, wxPoint(x, y));
|
||||
|
||||
// if filter is of form "All files (*)|*|..." set correct filter index
|
||||
if((wxStrlen(defaultExtension) != 0) && (filter2.Find(wxT('|')) != wxNOT_FOUND))
|
||||
{
|
||||
int filterIndex = 0;
|
||||
|
||||
wxArrayString descriptions, filters;
|
||||
// don't care about errors, handled already by wxFileDialog
|
||||
(void)wxFileDialogBase::ParseWildcard(filter2, descriptions, filters);
|
||||
for (size_t n=0; n<filters.GetCount(); n++)
|
||||
{
|
||||
if (filters[n].Contains(defaultExtension))
|
||||
{
|
||||
filterIndex = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (filterIndex > 0)
|
||||
fileDialog.SetFilterIndex(filterIndex);
|
||||
}
|
||||
|
||||
wxString filename;
|
||||
if ( fileDialog.ShowModal() == wxID_OK )
|
||||
{
|
||||
filename = fileDialog.GetPath();
|
||||
}
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxFileSelectorEx
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
wxString wxFileSelectorEx(const wxChar *title,
|
||||
const wxChar *defaultDir,
|
||||
const wxChar *defaultFileName,
|
||||
int* defaultFilterIndex,
|
||||
const wxChar *filter,
|
||||
int flags,
|
||||
wxWindow* parent,
|
||||
int x,
|
||||
int y)
|
||||
|
||||
{
|
||||
wxFileDialog fileDialog(parent,
|
||||
title ? title : wxT(""),
|
||||
defaultDir ? defaultDir : wxT(""),
|
||||
defaultFileName ? defaultFileName : wxT(""),
|
||||
filter ? filter : wxT(""),
|
||||
flags, wxPoint(x, y));
|
||||
|
||||
wxString filename;
|
||||
if ( fileDialog.ShowModal() == wxID_OK )
|
||||
{
|
||||
if ( defaultFilterIndex )
|
||||
*defaultFilterIndex = fileDialog.GetFilterIndex();
|
||||
|
||||
filename = fileDialog.GetPath();
|
||||
}
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxDefaultFileSelector - Generic load/save dialog (for internal use only)
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
static wxString wxDefaultFileSelector(bool load,
|
||||
const wxChar *what,
|
||||
const wxChar *extension,
|
||||
const wxChar *default_name,
|
||||
wxWindow *parent)
|
||||
{
|
||||
wxString prompt;
|
||||
wxString str;
|
||||
if (load)
|
||||
str = _("Load %s file");
|
||||
else
|
||||
str = _("Save %s file");
|
||||
prompt.Printf(str, what);
|
||||
|
||||
wxString wild;
|
||||
const wxChar *ext = extension;
|
||||
if ( ext )
|
||||
{
|
||||
if ( *ext == wxT('.') )
|
||||
ext++;
|
||||
|
||||
wild.Printf(wxT("*.%s"), ext);
|
||||
}
|
||||
else // no extension specified
|
||||
{
|
||||
wild = wxFileSelectorDefaultWildcardStr;
|
||||
}
|
||||
|
||||
return wxFileSelector(prompt, NULL, default_name, ext, wild,
|
||||
load ? wxOPEN : wxSAVE, parent);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxLoadFileSelector
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT wxString wxLoadFileSelector(const wxChar *what,
|
||||
const wxChar *extension,
|
||||
const wxChar *default_name,
|
||||
wxWindow *parent)
|
||||
{
|
||||
return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxSaveFileSelector
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT wxString wxSaveFileSelector(const wxChar *what,
|
||||
const wxChar *extension,
|
||||
const wxChar *default_name,
|
||||
wxWindow *parent)
|
||||
{
|
||||
return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
|
||||
}
|
||||
|
||||
#endif // wxUSE_FILEDLG
|
||||
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "wx/mimetype.h"
|
||||
#include "wx/image.h"
|
||||
#include "wx/choice.h"
|
||||
#include "wx/filedlg.h" // for wxFileDialogBase::ParseWildcard
|
||||
|
||||
#if wxUSE_STATLINE
|
||||
#include "wx/statline.h"
|
||||
@ -101,9 +102,6 @@ extern bool wxIsDriveAvailable(const wxString& dirName);
|
||||
#undef GetFirstChild
|
||||
#endif
|
||||
|
||||
// declared in filedlg.h, defined in fldlgcmn.cpp
|
||||
extern int wxParseFileFilter(const wxString& filterStr, wxArrayString& descriptions, wxArrayString& filters);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGetAvailableDrives, for WINDOWS, DOS, WXPM, MAC, UNIX (returns "/")
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1046,7 +1044,7 @@ bool wxGenericDirCtrl::ExtractWildcard(const wxString& filterStr, int n, wxStrin
|
||||
|
||||
int wxGenericDirCtrl::ParseFilter(const wxString& filterStr, wxArrayString& filters, wxArrayString& descriptions)
|
||||
{
|
||||
return wxParseFileFilter(filterStr, descriptions, filters );
|
||||
return wxFileDialogBase::ParseWildcard(filterStr, descriptions, filters );
|
||||
}
|
||||
|
||||
void wxGenericDirCtrl::DoResize()
|
||||
|
@ -810,7 +810,7 @@ wxFileCtrl::~wxFileCtrl()
|
||||
#define ID_ACTIVATED (wxID_FILEDLGG + 11)
|
||||
#define ID_CHECK (wxID_FILEDLGG + 12)
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxGenericFileDialog,wxDialog)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxGenericFileDialog, wxFileDialogBase)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxGenericFileDialog,wxDialog)
|
||||
EVT_BUTTON(ID_LIST_MODE, wxGenericFileDialog::OnList)
|
||||
@ -837,9 +837,11 @@ wxGenericFileDialog::wxGenericFileDialog(wxWindow *parent,
|
||||
const wxString& wildCard,
|
||||
long style,
|
||||
const wxPoint& pos )
|
||||
: wxDialog( parent, -1, message, pos, wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
|
||||
:wxFileDialogBase(parent, message, defaultDir, defaultFile, wildCard, style, pos)
|
||||
{
|
||||
wxDialog::Create( parent, -1, message, pos, wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER );
|
||||
|
||||
if (wxConfig::Get(FALSE))
|
||||
{
|
||||
wxConfig::Get()->Read(wxT("/wxWindows/wxFileDialog/ViewStyle"),
|
||||
@ -848,15 +850,11 @@ wxGenericFileDialog::wxGenericFileDialog(wxWindow *parent,
|
||||
&ms_lastShowHidden);
|
||||
}
|
||||
|
||||
m_message = message;
|
||||
m_dialogStyle = style;
|
||||
|
||||
if (m_dialogStyle == 0)
|
||||
m_dialogStyle = wxOPEN;
|
||||
if ((m_dialogStyle & wxMULTIPLE ) && !(m_dialogStyle & wxOPEN))
|
||||
m_dialogStyle |= wxOPEN;
|
||||
|
||||
m_dir = defaultDir;
|
||||
if ((m_dir.empty()) || (m_dir == wxT(".")))
|
||||
{
|
||||
m_dir = wxGetCwd();
|
||||
@ -869,30 +867,13 @@ wxGenericFileDialog::wxGenericFileDialog(wxWindow *parent,
|
||||
m_path = m_dir;
|
||||
m_path += wxFILE_SEP_PATH;
|
||||
m_path += defaultFile;
|
||||
m_fileName = defaultFile;
|
||||
m_wildCard = wildCard;
|
||||
m_filterIndex = 0;
|
||||
m_filterExtension = wxEmptyString;
|
||||
|
||||
// interpret wildcards
|
||||
|
||||
if (m_wildCard.IsEmpty())
|
||||
m_wildCard = _("All files (*)|*");
|
||||
|
||||
wxArrayString wildDescriptions, wildFilters;
|
||||
int wild_count = wxParseFileFilter(m_wildCard, wildDescriptions, wildFilters);
|
||||
|
||||
int wild_count = ParseWildcard(m_wildCard, wildDescriptions, wildFilters);
|
||||
wxASSERT_MSG(wild_count > 0, wxT("Wrong file type descripition") );
|
||||
|
||||
// if error parsing, add default back
|
||||
if (wildFilters.GetCount() < 1u)
|
||||
{
|
||||
wild_count = 1;
|
||||
m_wildCard = _("All files (*)|*");
|
||||
wildDescriptions.Add(_("All files (*)"));
|
||||
wildFilters.Add(wxT("*"));
|
||||
}
|
||||
|
||||
// layout
|
||||
|
||||
bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
|
||||
@ -1212,13 +1193,7 @@ void wxGenericFileDialog::HandleAction( const wxString &fn )
|
||||
// file without extension as well?
|
||||
if ( !(m_dialogStyle & wxOPEN) || !wxFileExists(filename) )
|
||||
{
|
||||
wxString ext;
|
||||
wxSplitPath(filename, NULL, NULL, &ext);
|
||||
if ( ext.empty() )
|
||||
{
|
||||
// append the first extension of the filter string
|
||||
filename += m_filterExtension.BeforeFirst(_T(';'));
|
||||
}
|
||||
filename = AppendExtension(filename, m_filterExtension);
|
||||
}
|
||||
|
||||
// check that the file [doesn't] exist if necessary
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "wx/intl.h"
|
||||
#include "wx/generic/msgdlgg.h"
|
||||
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -120,12 +119,13 @@ void gtk_filedialog_cancel_callback( GtkWidget *WXUNUSED(w), wxFileDialog *dialo
|
||||
// wxFileDialog
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxDialog)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxFileDialogBase)
|
||||
|
||||
wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message,
|
||||
const wxString& defaultDir, const wxString& defaultFileName,
|
||||
const wxString& wildCard,
|
||||
long style, const wxPoint& pos )
|
||||
:wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos)
|
||||
{
|
||||
m_needParent = FALSE;
|
||||
|
||||
@ -136,14 +136,6 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message,
|
||||
return;
|
||||
}
|
||||
|
||||
m_message = message;
|
||||
m_path = wxT("");
|
||||
m_fileName = defaultFileName;
|
||||
m_dir = defaultDir;
|
||||
m_wildCard = wildCard;
|
||||
m_dialogStyle = style;
|
||||
m_filterIndex = 1;
|
||||
|
||||
m_widget = gtk_file_selection_new( m_message.mbc_str() );
|
||||
|
||||
int x = (gdk_screen_width () - 400) / 2;
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "wx/intl.h"
|
||||
#include "wx/generic/msgdlgg.h"
|
||||
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -120,12 +119,13 @@ void gtk_filedialog_cancel_callback( GtkWidget *WXUNUSED(w), wxFileDialog *dialo
|
||||
// wxFileDialog
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxDialog)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxFileDialogBase)
|
||||
|
||||
wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message,
|
||||
const wxString& defaultDir, const wxString& defaultFileName,
|
||||
const wxString& wildCard,
|
||||
long style, const wxPoint& pos )
|
||||
:wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos)
|
||||
{
|
||||
m_needParent = FALSE;
|
||||
|
||||
@ -136,14 +136,6 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message,
|
||||
return;
|
||||
}
|
||||
|
||||
m_message = message;
|
||||
m_path = wxT("");
|
||||
m_fileName = defaultFileName;
|
||||
m_dir = defaultDir;
|
||||
m_wildCard = wildCard;
|
||||
m_dialogStyle = style;
|
||||
m_filterIndex = 1;
|
||||
|
||||
m_widget = gtk_file_selection_new( m_message.mbc_str() );
|
||||
|
||||
int x = (gdk_screen_width () - 400) / 2;
|
||||
|
@ -26,7 +26,7 @@
|
||||
#endif
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_CLASS(wxFileDialog, wxDialog)
|
||||
IMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase)
|
||||
#endif
|
||||
|
||||
// begin wxmac
|
||||
@ -277,16 +277,9 @@ static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, void *dat
|
||||
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
||||
const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
|
||||
long style, const wxPoint& pos)
|
||||
:wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos)
|
||||
{
|
||||
wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
|
||||
m_message = message;
|
||||
m_dialogStyle = style;
|
||||
m_parent = parent;
|
||||
m_path = wxT("");
|
||||
m_fileName = defaultFileName;
|
||||
m_dir = defaultDir;
|
||||
m_wildCard = wildCard;
|
||||
m_filterIndex = 0;
|
||||
}
|
||||
|
||||
pascal Boolean CrossPlatformFilterCallback (
|
||||
|
@ -26,7 +26,7 @@
|
||||
#endif
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_CLASS(wxFileDialog, wxDialog)
|
||||
IMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase)
|
||||
#endif
|
||||
|
||||
// begin wxmac
|
||||
@ -277,16 +277,9 @@ static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, void *dat
|
||||
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
||||
const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
|
||||
long style, const wxPoint& pos)
|
||||
:wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos)
|
||||
{
|
||||
wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
|
||||
m_message = message;
|
||||
m_dialogStyle = style;
|
||||
m_parent = parent;
|
||||
m_path = wxT("");
|
||||
m_fileName = defaultFileName;
|
||||
m_dir = defaultDir;
|
||||
m_wildCard = wildCard;
|
||||
m_filterIndex = 0;
|
||||
}
|
||||
|
||||
pascal Boolean CrossPlatformFilterCallback (
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/filedlg.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/app.h"
|
||||
@ -47,7 +46,7 @@
|
||||
|
||||
#include "wx/motif/private.h"
|
||||
|
||||
IMPLEMENT_CLASS(wxFileDialog, wxDialog)
|
||||
IMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase)
|
||||
|
||||
#define DEFAULT_FILE_SELECTOR_SIZE 0
|
||||
// Let Motif defines the size of File
|
||||
@ -115,16 +114,9 @@ static wxString ParseWildCard( const wxString& wild )
|
||||
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
||||
const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
|
||||
long style, const wxPoint& pos)
|
||||
:wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos)
|
||||
{
|
||||
m_message = message;
|
||||
m_dialogStyle = style;
|
||||
m_parent = parent;
|
||||
m_path = "";
|
||||
m_fileName = defaultFileName;
|
||||
m_dir = defaultDir;
|
||||
m_wildCard = wildCard;
|
||||
m_filterIndex = 1;
|
||||
m_pos = pos;
|
||||
}
|
||||
|
||||
static void wxChangeListBoxColours(wxWindow* WXUNUSED(win), Widget widget)
|
||||
|
@ -33,7 +33,6 @@
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/utils.h"
|
||||
#include "wx/msgdlg.h"
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/filedlg.h"
|
||||
#include "wx/filefn.h"
|
||||
#include "wx/intl.h"
|
||||
@ -76,11 +75,7 @@
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxWin macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(wxFileDialog, wxDialog)
|
||||
IMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFileDialog
|
||||
@ -92,18 +87,12 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
|
||||
const wxString& defaultFileName,
|
||||
const wxString& wildCard,
|
||||
long style,
|
||||
const wxPoint& WXUNUSED(pos))
|
||||
const wxPoint& pos)
|
||||
:wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos)
|
||||
|
||||
{
|
||||
m_message = message;
|
||||
m_dialogStyle = style;
|
||||
if ( ( m_dialogStyle & wxMULTIPLE ) && ( m_dialogStyle & wxSAVE ) )
|
||||
m_dialogStyle &= ~wxMULTIPLE;
|
||||
m_parent = parent;
|
||||
m_path = wxEmptyString;
|
||||
m_fileName = defaultFileName;
|
||||
m_dir = defaultDir;
|
||||
m_wildCard = wildCard;
|
||||
m_filterIndex = 0;
|
||||
}
|
||||
|
||||
void wxFileDialog::GetPaths(wxArrayString& paths) const
|
||||
@ -350,8 +339,6 @@ int wxFileDialog::ShowModal()
|
||||
}
|
||||
else
|
||||
{
|
||||
const wxChar* extension = NULL;
|
||||
|
||||
//=== Adding the correct extension >>=================================
|
||||
|
||||
m_filterIndex = (int)of.nFilterIndex - 1;
|
||||
@ -360,39 +347,15 @@ int wxFileDialog::ShowModal()
|
||||
(of.nFileExtension && fileNameBuffer[of.nFileExtension] == wxT('\0')) )
|
||||
{
|
||||
// User has typed a filename without an extension:
|
||||
const wxChar* extension = filterBuffer;
|
||||
int maxFilter = (int)(of.nFilterIndex*2L) - 1;
|
||||
|
||||
// A filename can end in a "." here ("abc."), this means it
|
||||
// does not have an extension. Because later on a "." with
|
||||
// the default extension is appended we remove the "." if
|
||||
// filename ends with one (We don't want files called
|
||||
// "abc..ext")
|
||||
int idx = wxStrlen(fileNameBuffer) - 1;
|
||||
if ( fileNameBuffer[idx] == wxT('.') )
|
||||
{
|
||||
fileNameBuffer[idx] = wxT('\0');
|
||||
}
|
||||
for( int i = 0; i < maxFilter; i++ ) // get extension
|
||||
extension = extension + wxStrlen( extension ) + 1;
|
||||
|
||||
int maxFilter = (int)(of.nFilterIndex*2L-1L);
|
||||
extension = filterBuffer;
|
||||
|
||||
for( int i = 0; i < maxFilter; i++ ) { // get extension
|
||||
extension = extension + wxStrlen( extension ) +1;
|
||||
}
|
||||
|
||||
extension = wxStrrchr( extension, wxT('.') );
|
||||
if ( extension // != "blabla"
|
||||
&& !wxStrrchr( extension, wxT('*') ) // != "blabla.*"
|
||||
&& !wxStrrchr( extension, wxT('?') ) // != "blabla.?"
|
||||
&& extension[1] // != "blabla."
|
||||
&& extension[1] != wxT(' ') ) // != "blabla. "
|
||||
{
|
||||
// now concat extension to the fileName:
|
||||
m_fileName = wxString(fileNameBuffer) + extension;
|
||||
|
||||
int len = wxStrlen( fileNameBuffer );
|
||||
wxStrncpy( fileNameBuffer + len, extension, wxMAXPATH - len );
|
||||
fileNameBuffer[ wxMAXPATH -1 ] = wxT('\0');
|
||||
}
|
||||
m_fileName = AppendExtension(fileNameBuffer, extension);
|
||||
wxStrncpy(fileNameBuffer, m_fileName.c_str(), wxMin(m_fileName.Len(), wxMAXPATH-1));
|
||||
fileNameBuffer[wxMin(m_fileName.Len(), wxMAXPATH-1)] = wxT('\0');
|
||||
}
|
||||
|
||||
m_path = fileNameBuffer;
|
||||
|
@ -19,7 +19,6 @@
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/utils.h"
|
||||
#include "wx/msgdlg.h"
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/filedlg.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
@ -56,7 +55,7 @@
|
||||
#ifndef MAXEXT
|
||||
# define MAXEXT 5
|
||||
#endif
|
||||
IMPLEMENT_CLASS(wxFileDialog, wxDialog)
|
||||
IMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// CLASS wxFileDialog
|
||||
@ -71,34 +70,29 @@ wxFileDialog::wxFileDialog (
|
||||
, long lStyle
|
||||
, const wxPoint& rPos
|
||||
)
|
||||
:wxFileDialogBase(pParent, rsMessage, rsDefaultDir, rsDefaultFileName, rsWildCard, lStyle, rPos)
|
||||
|
||||
{
|
||||
m_sMessage = rsMessage;
|
||||
m_lDialogStyle = lStyle;
|
||||
if ((m_lDialogStyle & wxMULTIPLE) && (m_lDialogStyle & wxSAVE))
|
||||
m_lDialogStyle &= ~wxMULTIPLE;
|
||||
m_pParent = pParent;
|
||||
m_sPath = "";
|
||||
m_sFileName = rsDefaultFileName;
|
||||
m_sDir = rsDefaultDir;
|
||||
m_sWildCard = rsWildCard;
|
||||
m_nFilterIndex = 1;
|
||||
m_vPos = rPos;
|
||||
if ((m_dialogStyle & wxMULTIPLE) && (m_dialogStyle & wxSAVE))
|
||||
m_dialogStyle &= ~wxMULTIPLE;
|
||||
|
||||
m_filterIndex = 1;
|
||||
} // end of wxFileDialog::wxFileDialog
|
||||
|
||||
void wxFileDialog::GetPaths (
|
||||
wxArrayString& rasPaths
|
||||
) const
|
||||
{
|
||||
wxString sDir(m_sDir);
|
||||
size_t nCount = m_asFileNames.GetCount();
|
||||
wxString sDir(m_dir);
|
||||
size_t nCount = m_fileNames.GetCount();
|
||||
|
||||
rasPaths.Empty();
|
||||
if (m_sDir.Last() != _T('\\'))
|
||||
if (m_dir.Last() != _T('\\'))
|
||||
sDir += _T('\\');
|
||||
|
||||
for ( size_t n = 0; n < nCount; n++ )
|
||||
{
|
||||
rasPaths.Add(sDir + m_asFileNames[n]);
|
||||
rasPaths.Add(sDir + m_fileNames[n]);
|
||||
}
|
||||
} // end of wxFileDialog::GetPaths
|
||||
|
||||
@ -112,14 +106,14 @@ int wxFileDialog::ShowModal()
|
||||
wxChar zTitleBuffer[wxMAXFILE + 1 + wxMAXEXT]; // the file-name, without path
|
||||
wxString sDir;
|
||||
size_t i;
|
||||
size_t nLen = m_sDir.length();
|
||||
size_t nLen = m_dir.length();
|
||||
int nCount = 0;
|
||||
FILEDLG vFileDlg;
|
||||
ULONG lFlags = 0L;
|
||||
|
||||
memset(&vFileDlg, '\0', sizeof(FILEDLG));
|
||||
if (m_pParent)
|
||||
hWnd = (HWND) m_pParent->GetHWND();
|
||||
if (m_parent)
|
||||
hWnd = (HWND) m_parent->GetHWND();
|
||||
if (!hWnd && wxTheApp->GetTopWindow())
|
||||
hWnd = (HWND) wxTheApp->GetTopWindow()->GetHWND();
|
||||
|
||||
@ -127,14 +121,14 @@ int wxFileDialog::ShowModal()
|
||||
*zFileNameBuffer = wxT('\0');
|
||||
*zTitleBuffer = wxT('\0');
|
||||
|
||||
if (m_lDialogStyle & wxSAVE)
|
||||
if (m_dialogStyle & wxSAVE)
|
||||
lFlags = FDS_SAVEAS_DIALOG;
|
||||
else
|
||||
lFlags = FDS_OPEN_DIALOG;
|
||||
|
||||
if ((m_lDialogStyle & wxHIDE_READONLY) || (m_lDialogStyle & wxSAVE))
|
||||
if ((m_dialogStyle & wxHIDE_READONLY) || (m_dialogStyle & wxSAVE))
|
||||
lFlags |= FDS_SAVEAS_DIALOG;
|
||||
if (m_lDialogStyle & wxMULTIPLE )
|
||||
if (m_dialogStyle & wxMULTIPLE )
|
||||
lFlags |= FDS_OPEN_DIALOG | FDS_MULTIPLESEL;
|
||||
|
||||
vFileDlg.cbSize = sizeof(FILEDLG);
|
||||
@ -149,7 +143,7 @@ int wxFileDialog::ShowModal()
|
||||
sDir.reserve(nLen);
|
||||
for ( i = 0; i < nLen; i++ )
|
||||
{
|
||||
wxChar ch = m_sDir[i];
|
||||
wxChar ch = m_dir[i];
|
||||
|
||||
switch (ch)
|
||||
{
|
||||
@ -165,7 +159,7 @@ int wxFileDialog::ShowModal()
|
||||
case _T('\\'):
|
||||
while (i < nLen - 1)
|
||||
{
|
||||
wxChar chNext = m_sDir[i + 1];
|
||||
wxChar chNext = m_dir[i + 1];
|
||||
|
||||
if (chNext != _T('\\') && chNext != _T('/'))
|
||||
break;
|
||||
@ -189,10 +183,10 @@ int wxFileDialog::ShowModal()
|
||||
sDir += ch;
|
||||
}
|
||||
}
|
||||
if ( wxStrlen(m_sWildCard) == 0 )
|
||||
if ( wxStrlen(m_wildCard) == 0 )
|
||||
sTheFilter = "";
|
||||
else
|
||||
sTheFilter = m_sWildCard;
|
||||
sTheFilter = m_wildCard;
|
||||
|
||||
pzFilterBuffer = strtok((char*)sTheFilter.c_str(), "|");
|
||||
while(pzFilterBuffer != NULL)
|
||||
@ -207,38 +201,38 @@ int wxFileDialog::ShowModal()
|
||||
nCount++;
|
||||
}
|
||||
if (nCount == 0)
|
||||
sDir += m_sFileName;
|
||||
sDir += m_fileName;
|
||||
if (sDir.IsEmpty())
|
||||
sDir = "*.*";
|
||||
wxStrcpy(vFileDlg.szFullFile, sDir.c_str());
|
||||
sFilterBuffer = sDir;
|
||||
|
||||
hWnd = ::WinFileDlg( HWND_DESKTOP
|
||||
,GetHwndOf(m_pParent)
|
||||
,GetHwndOf(m_parent)
|
||||
,&vFileDlg
|
||||
);
|
||||
if (hWnd && vFileDlg.lReturn == DID_OK)
|
||||
{
|
||||
m_asFileNames.Empty();
|
||||
if ((m_lDialogStyle & wxMULTIPLE ) && vFileDlg.ulFQFCount > 1)
|
||||
m_fileNames.Empty();
|
||||
if ((m_dialogStyle & wxMULTIPLE ) && vFileDlg.ulFQFCount > 1)
|
||||
{
|
||||
for (int i = 0; i < vFileDlg.ulFQFCount; i++)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
m_sDir = wxPathOnly(wxString((const char*)*vFileDlg.papszFQFilename[0]));
|
||||
m_sPath = (const char*)*vFileDlg.papszFQFilename[0];
|
||||
m_dir = wxPathOnly(wxString((const char*)*vFileDlg.papszFQFilename[0]));
|
||||
m_path = (const char*)*vFileDlg.papszFQFilename[0];
|
||||
}
|
||||
m_sFileName = wxFileNameFromPath(wxString((const char*)*vFileDlg.papszFQFilename[i]));
|
||||
m_asFileNames.Add(m_sFileName);
|
||||
m_fileName = wxFileNameFromPath(wxString((const char*)*vFileDlg.papszFQFilename[i]));
|
||||
m_fileNames.Add(m_fileName);
|
||||
}
|
||||
::WinFreeFileDlgList(vFileDlg.papszFQFilename);
|
||||
}
|
||||
else if (!(m_lDialogStyle & wxSAVE))
|
||||
else if (!(m_dialogStyle & wxSAVE))
|
||||
{
|
||||
m_sPath = vFileDlg.szFullFile;
|
||||
m_sFileName = wxFileNameFromPath(vFileDlg.szFullFile);
|
||||
m_sDir = wxPathOnly(vFileDlg.szFullFile);
|
||||
m_path = vFileDlg.szFullFile;
|
||||
m_fileName = wxFileNameFromPath(vFileDlg.szFullFile);
|
||||
m_dir = wxPathOnly(vFileDlg.szFullFile);
|
||||
}
|
||||
else // save file
|
||||
{
|
||||
@ -250,8 +244,8 @@ int wxFileDialog::ShowModal()
|
||||
wxString sExt;
|
||||
|
||||
wxSplitPath( zFileNameBuffer
|
||||
,&m_sPath
|
||||
,&m_sFileName
|
||||
,&m_path
|
||||
,&m_fileName
|
||||
,&sExt
|
||||
);
|
||||
if (zFileNameBuffer[nIdx] == wxT('.') || sExt.IsEmpty())
|
||||
@ -285,28 +279,28 @@ int wxFileDialog::ShowModal()
|
||||
//
|
||||
// Now concat extension to the fileName:
|
||||
//
|
||||
m_sPath = wxString(zFileNameBuffer) + pzExtension;
|
||||
m_path = wxString(zFileNameBuffer) + pzExtension;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sPath = vFileDlg.szFullFile;
|
||||
m_path = vFileDlg.szFullFile;
|
||||
}
|
||||
m_sFileName = wxFileNameFromPath(vFileDlg.szFullFile);
|
||||
m_sDir = wxPathOnly(vFileDlg.szFullFile);
|
||||
m_fileName = wxFileNameFromPath(vFileDlg.szFullFile);
|
||||
m_dir = wxPathOnly(vFileDlg.szFullFile);
|
||||
|
||||
//
|
||||
// === Simulating the wxOVERWRITE_PROMPT >>============================
|
||||
//
|
||||
if ((m_lDialogStyle & wxOVERWRITE_PROMPT) &&
|
||||
(m_lDialogStyle & wxSAVE) &&
|
||||
(wxFileExists(m_sPath.c_str())))
|
||||
if ((m_dialogStyle & wxOVERWRITE_PROMPT) &&
|
||||
(m_dialogStyle & wxSAVE) &&
|
||||
(wxFileExists(m_path.c_str())))
|
||||
{
|
||||
wxString sMessageText;
|
||||
|
||||
sMessageText.Printf( _("File '%s' already exists.\nDo you want to replace it?")
|
||||
,m_sPath.c_str()
|
||||
,m_path.c_str()
|
||||
);
|
||||
if (wxMessageBox( sMessageText
|
||||
,wxT("Save File As")
|
||||
|
Loading…
Reference in New Issue
Block a user