void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
{
wxFileDialog dialog(this, _T("Please choose an animated GIF"),
- wxEmptyString, wxEmptyString, wxT("*.gif"), wxOPEN);
+ wxEmptyString, wxEmptyString, wxT("*.gif"), wxFD_OPEN);
if (dialog.ShowModal() == wxID_OK)
{
wxString filename(dialog.GetPath());
// get filname
if (!m_filename) {
wxFileDialog dlg (this, _T("Open file"), wxEmptyString, wxEmptyString,
- _T("Any file (*)|*"), wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR);
+ _T("Any file (*)|*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR);
if (dlg.ShowModal() != wxID_OK) return false;
m_filename = dlg.GetPath();
}
// get filname
if (!m_filename) {
wxFileDialog dlg (this, _T("Save file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"),
- wxSAVE | wxOVERWRITE_PROMPT);
+ wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
if (dlg.ShowModal() != wxID_OK) return false;
m_filename = dlg.GetPath();
}
#if wxUSE_FILEDLG
wxString fname;
wxFileDialog dlg (this, _T("Open file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"),
- wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR);
+ wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR);
if (dlg.ShowModal() != wxID_OK) return;
fname = dlg.GetPath ();
FileOpen (fname);
if (!m_edit) return;
#if wxUSE_FILEDLG
wxString filename = wxEmptyString;
- wxFileDialog dlg (this, _T("Save file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"), wxSAVE|wxOVERWRITE_PROMPT);
+ wxFileDialog dlg (this, _T("Save file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
if (dlg.ShowModal() != wxID_OK) return;
filename = dlg.GetPath();
m_edit->SaveFile (filename);
wxFileDialog dialog(this, wxT("Save Picture as"), wxEmptyString, pChild->GetTitle(),
wxT("SVG vector picture files (*.svg)|*.svg"),
- wxSAVE|wxOVERWRITE_PROMPT);
+ wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
if (dialog.ShowModal() == wxID_OK)
{
#if wxUSE_FILEDLG
wxFileDialog filed(this);
filed.SetWildcard(_T("*.rc"));
- filed.SetStyle(wxOPEN);
+ filed.SetStyle(wxFD_OPEN);
if (filed.ShowModal()!=wxID_OK)
return;
wxFileDialog wxrfile(this,_T("Enter Desired WXR file name"));
wxrfile.SetWildcard(_T("*.wxr"));
- wxrfile.SetStyle(wxOPEN);
+ wxrfile.SetStyle(wxFD_OPEN);
wxrfile.SetFilename(_T("resource.wxr"));
if (wxrfile.ShowModal()!=wxID_OK)
wxFileDialog xmlfile(this,_T("Enter Desired XML file name"));
xmlfile.SetWildcard(_T("*.xml"));
- xmlfile.SetStyle(wxOPEN);
+ xmlfile.SetStyle(wxFD_OPEN);
xmlfile.SetFilename(_T("resource.xml"));
if (xmlfile.ShowModal()!=wxID_OK)
wxFileDialog xmlfile(this,_T("Enter Desired XML file name"));
xmlfile.SetWildcard(_T("*.xml"));
- xmlfile.SetStyle(wxOPEN);
+ xmlfile.SetStyle(wxFD_OPEN);
xmlfile.SetFilename(_T("resource.xml"));
if (xmlfile.ShowModal()!=wxID_OK)
\wxheading{Window styles}
\begin{twocollist}\itemsep=0pt
-\twocolitem{\windowstyle{wxDD\_DEFAULT\_STYLE}}{Equivalent to a combination of wxDEFAULT\_DIALOG\_STYLE, wxDD\_NEW\_DIR\_BUTTON and wxRESIZE\_BORDER (the last one is not used under wxWinCE).}
-\twocolitem{\windowstyle{wxDD\_NEW\_DIR\_BUTTON}}{Add "Create new
-directory" button and allow directory names to be editable. On
-Windows the new directory button is only available with recent
-versions of the common dialogs.}
+\twocolitem{\windowstyle{wxDD\_DEFAULT\_STYLE}}{Equivalent to a combination of wxDEFAULT\_DIALOG\_STYLE and wxRESIZE\_BORDER (the last one is not used under wxWinCE).}
+\twocolitem{\windowstyle{wxDD\_DIR_MUST_EXIST}}{The dialog will allow the user to choose only an existing folder. When this style is not given, a "Create new directory" button is added to the dialog (on Windows) or some other way is provided to the user to type the name of a new folder.}
\twocolitem{\windowstyle{wxDD\_CHANGE\_DIR}}{Change the current working directory to the directory chosen by the user.}
\end{twocollist}
+{\bf NB:} on Windows the new directory button is only available with recent versions of the common dialogs.
+
See also \helpref{Generic window styles}{windowstyles}.
\wxheading{See also}
<wx/filedlg.h>
+\wxheading{Window styles}
+
+\begin{twocollist}\itemsep=0pt
+\twocolitem{\windowstyle{wxFD\_DEFAULT\_STYLE}}{Equivalent to wxFD_OPEN.}
+\twocolitem{\windowstyle{wxFD\_OPEN}}{This is an open dialog; usually this means that the default button's label of the dialog is "Open". Cannot be combined with wxFD\_SAVE.}
+\twocolitem{\windowstyle{wxFD\_SAVE}}{This is a save dialog; usually this means that the default button's label of the dialog is "Save". Cannot be combined with wxFD\_OPEN.}
+\twocolitem{{\windowstyle wxFD\_OVERWRITE\_PROMPT}}{For save dialog only: prompt for a confirmation if a file will be overwritten.}
+\twocolitem{{\windowstyle wxFD\_FILE\_MUST\_EXIST}}{For open dialog only: the user may only select files that actually exist.}
+\twocolitem{{\windowstyle wxFD_MULTIPLE}}{For open dialog only: allows selecting multiple files.}
+\twocolitem{{\windowstyle wxFD_CHANGE\_DIR}}{Change the current working directory to the directory where the file(s) chosen by the user are.}
+\end{twocollist}
+
+{\bf NB:} Previous versions of wxWidgets used {\tt wxFD_CHANGE\_DIR} by default
+under MS Windows which allowed the program to simply remember the last
+directory where user selected the files to open/save. This (desired)
+functionality must be implemented in the program itself now (manually remember
+the last path used and pass it to the dialog the next time it is called) or
+by using this flag.
+
+
\wxheading{See also}
\helpref{wxFileDialog overview}{wxfiledialogoverview}, \helpref{wxFileSelector}{wxfileselector}
If path is ``", the current directory will be used. If filename is ``",
no default filename will be supplied. The wildcard determines what files
are displayed in the file selector, and file extension supplies a type
-extension for the required filename. Flags may be a combination of wxOPEN,
-wxSAVE, wxOVERWRITE\_PROMPT, wxHIDE\_READONLY, wxFILE\_MUST\_EXIST,
-wxMULTIPLE, wxCHANGE\_DIR or 0.
+extension for the required filename.
Both the X and Windows versions implement a wildcard filter. Typing a
filename containing wildcards (*, ?) in the filename text item, and
\func{}{wxFileDialog}{\param{wxWindow* }{parent}, \param{const wxString\& }{message = "Choose a file"},\rtfsp
\param{const wxString\& }{defaultDir = ""}, \param{const wxString\& }{defaultFile = ``"},\rtfsp
-\param{const wxString\& }{wildcard = ``*.*"}, \param{long }{style = 0}, \param{const wxPoint\& }{pos = wxDefaultPosition}}
+\param{const wxString\& }{wildcard = ``*.*"}, \param{long }{style = wxFD\_DEFAULT\_STYLE}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{sz = wxDefaultSize}, \param{const wxString\& }{name = "filedlg"}}
Constructor. Use \helpref{wxFileDialog::ShowModal}{wxfiledialogshowmodal} to show the dialog.
Note that the native Motif dialog has some limitations with respect to
wildcards; see the Remarks section above.}
-\docparam{style}{A dialog style. A bitlist of:
-
-\twocolwidtha{5cm}
-\begin{twocollist}
-\twocolitem{{\bf wxOPEN}}{This is an open dialog.}
-\twocolitem{{\bf wxSAVE}}{This is a save dialog.}
-\twocolitem{{\bf wxOVERWRITE\_PROMPT}}{For save dialog only: prompt for a confirmation if a file will be overwritten.}
-\twocolitem{{\bf wxHIDE\_READONLY}}{Do not display the checkbox to toggle display of read-only files. Deprecated in 2.6; the checkbox is never shown.}
-\twocolitem{{\bf wxFILE\_MUST\_EXIST}}{The user may only select files that actually exist.}
-\twocolitem{{\bf wxMULTIPLE}}{For open dialog only: allows selecting multiple files.}
-\twocolitem{{\bf wxCHANGE\_DIR}}{Change the current working directory to the directory where the file(s) chosen by the user are.}
-\end{twocollist}%
-}
+\docparam{style}{A dialog style. See wxFD_* styles for more info.}
\docparam{pos}{Dialog position. Not implemented.}
-{\bf NB:} Previous versions of wxWidgets used {\tt wxCHANGE\_DIR} by default
-under MS Windows which allowed the program to simply remember the last
-directory where user selected the files to open/save. This (desired)
-functionality must be implemented in the program itself now (manually remember
-the last path used and pass it to the dialog the next time it is called) or
-by using this flag.
+\docparam{size}{Dialog size. Not implemented.}
+
+\docparam{name}{Dialog name. Not implemented.}
+
\membersection{wxFileDialog::\destruct{wxFileDialog}}\label{wxfiledialogdtor}
function should only be used with the dialogs which have {\tt wxMULTIPLE} style,
use \helpref{GetPath}{wxfiledialoggetpath} for the others.
-\membersection{wxFileDialog::GetStyle}\label{wxfiledialoggetstyle}
-
-\constfunc{long}{GetStyle}{\void}
-
-Returns the dialog style.
-
\membersection{wxFileDialog::GetWildcard}\label{wxfiledialoggetwildcard}
\constfunc{wxString}{GetWildcard}{\void}
Sets the path (the combined directory and filename that will be returned when the dialog is dismissed).
-\membersection{wxFileDialog::SetStyle}\label{wxfiledialogsetstyle}
-
-\func{void}{SetStyle}{\param{long }{style}}
-
-Sets the dialog style. See \helpref{wxFileDialog::wxFileDialog}{wxfiledialogctor} for details.
-
\membersection{wxFileDialog::SetWildcard}\label{wxfiledialogsetwildcard}
\func{void}{SetWildcard}{\param{const wxString\& }{wildCard}}
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
- long style = 0,
- const wxPoint& pos = wxDefaultPosition);
+ long style = wxFD_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ const wxString& name = wxFileDialogNameStr);
~wxFileDialog();
virtual void SetPath(const wxString& path);
#define wxPD_REMAINING_TIME 0x0040
#define wxPD_CAN_SKIP 0x0080
-/*
- * wxDirDialog styles
- */
-
-#define wxDD_NEW_DIR_BUTTON 0x0080
-#define wxDD_CHANGE_DIR 0x0100
-
/*
* extended dialog specifiers. these values are stored in a different
extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogDefaultFolderStr[];
extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[];
+#define wxDD_DIR_MUST_EXIST 0x0080
+#define wxDD_CHANGE_DIR 0x0100
#ifdef __WXWINCE__
- #define wxDD_DEFAULT_STYLE \
- (wxDEFAULT_DIALOG_STYLE | wxDD_NEW_DIR_BUTTON)
+ #define wxDD_DEFAULT_STYLE wxDEFAULT_DIALOG_STYLE
#else
- #define wxDD_DEFAULT_STYLE \
- (wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxDD_NEW_DIR_BUTTON)
+ #define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
#endif
//-------------------------------------------------------------------------
// Universal and non-port related switches with need for generic implementation
#if defined(__WXUNIVERSAL__)
-
#include "wx/generic/dirdlgg.h"
#define wxDirDialog wxGenericDirDialog
-
#elif defined(__WXMSW__) && (defined(__SALFORDC__) || \
!wxUSE_OLE || \
(defined (__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS))
-
#include "wx/generic/dirdlgg.h"
#define wxDirDialog wxGenericDirDialog
-
-// MS PocketPC or MS Smartphone
#elif defined(__WXMSW__) && defined(__WXWINCE__) && !defined(__HANDHELDPC__)
-
- #include "wx/generic/dirdlgg.h"
+ #include "wx/generic/dirdlgg.h" // MS PocketPC or MS Smartphone
#define wxDirDialog wxGenericDirDialog
-
-// Native MSW
#elif defined(__WXMSW__)
-
- #include "wx/msw/dirdlg.h"
-
-// Native GTK for gtk2.x and generic for gtk1.x
+ #include "wx/msw/dirdlg.h" // Native MSW
+#elif defined(__WXGTK24__)
+ #include "wx/gtk/dirdlg.h" // Native GTK for gtk2.4
#elif defined(__WXGTK__)
-
-#if defined( __WXGTK20__ )
- #include "wx/gtk/dirdlg.h"
- #define wxDirDialog wxDirDialogGTK
-#else
#include "wx/generic/dirdlgg.h"
#define wxDirDialog wxGenericDirDialog
-#endif
-
-// Native Mac
#elif defined(__WXMAC__)
-
- #include "wx/mac/dirdlg.h"
-
-// Native Cocoa
+ #include "wx/mac/dirdlg.h" // Native Mac
#elif defined(__WXCOCOA__)
-
- #include "wx/cocoa/dirdlg.h"
-
-// Other ports use generic implementation
+ #include "wx/cocoa/dirdlg.h" // Native Cocoa
#elif defined(__WXMOTIF__) || \
defined(__WXX11__) || \
defined(__WXMGL__) || \
defined(__WXCOCOA__) || \
defined(__WXPM__)
-
- #include "wx/generic/dirdlgg.h"
+ #include "wx/generic/dirdlgg.h" // Other ports use generic implementation
#define wxDirDialog wxGenericDirDialog
-
#endif
// ----------------------------------------------------------------------------
// wxFileDialog data
//----------------------------------------------------------------------------
+#if WXWIN_COMPATIBILITY_2_6
enum
{
wxOPEN = 0x0001,
wxMULTIPLE = 0x0020,
wxCHANGE_DIR = 0x0040
};
+#endif
+enum
+{
+ wxFD_OPEN = 0x0001,
+ wxFD_SAVE = 0x0002,
+ wxFD_OVERWRITE_PROMPT = 0x0004,
+ wxFD_FILE_MUST_EXIST = 0x0010,
+ wxFD_MULTIPLE = 0x0020,
+ wxFD_CHANGE_DIR = 0x0040
+};
+
+#define wxFD_DEFAULT_STYLE wxFD_OPEN
+
+extern WXDLLEXPORT_DATA(const wxChar) wxFileDialogNameStr[];
extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorPromptStr[];
extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorDefaultWildcardStr[];
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
- long style = 0,
- const wxPoint& pos = wxDefaultPosition) : wxDialog()
+ long style = wxFD_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ const wxString& name = wxFileDialogNameStr)
{
Init();
- Create(parent, message, defaultDir, defaultFile, wildCard, style, pos);
+ Create(parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name);
}
bool Create(wxWindow *parent,
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
- long style = 0,
- const wxPoint& pos = wxDefaultPosition);
+ long style = wxFD_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ const wxString& name = wxFileDialogNameStr);
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 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
protected:
wxString m_message;
- long m_dialogStyle;
wxString m_dir;
wxString m_path; // Full path
wxString m_fileName;
#include "wx/msw/filedlg.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/filedlg.h"
+#elif defined(__WXGTK24__)
+#include "wx/gtk/filedlg.h" // GTK+ > 2.4 has native version
#elif defined(__WXGTK20__)
-#include "wx/gtk/filedlg.h"
+#include "wx/generic/filedlgg.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/filedlg.h"
#elif defined(__WXX11__)
#ifndef wxDD_DEFAULT_STYLE
#ifdef __WXWINCE__
- #define wxDD_DEFAULT_STYLE \
- (wxDEFAULT_DIALOG_STYLE | wxDD_NEW_DIR_BUTTON)
+ #define wxDD_DEFAULT_STYLE wxDEFAULT_DIALOG_STYLE
#else
- #define wxDD_DEFAULT_STYLE \
- (wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxDD_NEW_DIR_BUTTON)
+ #define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
#endif
#endif
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
- long style = 0,
+ long style = wxFD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ const wxString& name = wxFileDialogNameStr,
bool bypassGenericImpl = false );
bool Create( wxWindow *parent,
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
- long style = 0,
+ long style = wxFD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ const wxString& name = wxFileDialogNameStr,
bool bypassGenericImpl = false );
virtual ~wxGenericFileDialog();
/////////////////////////////////////////////////////////////////////////////
// Name: dirdlg.h
-// Purpose: wxDirDialogGTK
+// Purpose: wxDirDialog
// Author: Francesco Montorsi
// Id: $Id$
// Copyright: (c) 2006 Francesco Montorsi
#include "wx/generic/dirdlgg.h"
//-------------------------------------------------------------------------
-// wxDirDialogGTK
+// wxDirDialog
//-------------------------------------------------------------------------
-class WXDLLIMPEXP_CORE wxDirDialogGTK : public wxGenericDirDialog
+class WXDLLIMPEXP_CORE wxDirDialog : public wxGenericDirDialog
{
public:
- wxDirDialogGTK() { }
+ wxDirDialog() { }
- wxDirDialogGTK(wxWindow *parent,
+ wxDirDialog(wxWindow *parent,
const wxString& message = wxDirSelectorPromptStr,
const wxString& defaultPath = wxEmptyString,
long style = wxDD_DEFAULT_STYLE,
const wxSize& size = wxDefaultSize,
const wxString& name = wxDirDialogNameStr);
- virtual ~wxDirDialogGTK() {}
+ virtual ~wxDirDialog() { }
public: // overrides from wxGenericDirDialog
private:
- DECLARE_DYNAMIC_CLASS(wxDirDialogGTK)
+ DECLARE_DYNAMIC_CLASS(wxDirDialog)
DECLARE_EVENT_TABLE()
void OnFakeOk( wxCommandEvent &event );
};
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
- long style = 0,
- const wxPoint& pos = wxDefaultPosition);
+ long style = wxFD_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ const wxString& name = wxFileDialogNameStr);
virtual ~wxFileDialog() {}
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
- long style = 0,
- const wxPoint& pos = wxDefaultPosition);
+ long style = wxFD_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ const wxString& name = wxFileDialogNameStr);
virtual ~wxFileDialog();
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
- long style = 0,
- const wxPoint& pos = wxDefaultPosition);
+ long style = wxFD_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ const wxString& name = wxFileDialogNameStr);
virtual int ShowModal();
};
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
- long style = 0,
- const wxPoint& pos = wxDefaultPosition);
+ long style = wxFD_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ const wxString& name = wxFileDialogNameStr);
virtual void SetPath(const wxString& path);
virtual void GetPaths(wxArrayString& paths) const;
,const wxString& rsDefaultDir = wxEmptyString
,const wxString& rsDefaultFile = wxEmptyString
,const wxString& rsWildCard = wxFileSelectorDefaultWildcardStr
- ,long lStyle = 0
- ,const wxPoint& rPos = wxDefaultPosition
+ ,long lStyle = wxFD_DEFAULT_STYLE
+ ,const wxPoint& rPos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ const wxString& name = wxFileDialogNameStr
);
virtual void GetPaths(wxArrayString& rasPath) const;
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
- long style = 0,
- const wxPoint& pos = wxDefaultPosition);
+ long style = wxFD_DEFAULT_STYLE,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& sz = wxDefaultSize,
+ const wxString& name = wxFileDialogNameStr);
virtual void SetPath(const wxString& path);
virtual void GetPaths(wxArrayString& paths) const;
wxEmptyString,
GetValue(),
wxT("All files (*.*)|*.*"),
- wxOPEN);
+ wxFD_OPEN);
if ( dlg.ShowModal() == wxID_OK )
{
void CeditorDlg::OnSelectPict()
{
- wxFileDialog dlg(this, wxT("Choose an image file less than 60K"), wxEmptyString, wxEmptyString, wxT("JPEG files (*.jpg)|*.jpg|GIF files (*.gif)|*.gif|BMP files (*.bmp)|*.bmp|All Files (*.*)|*.*"), wxOPEN);
+ wxFileDialog dlg(this, wxT("Choose an image file less than 60K"), wxEmptyString, wxEmptyString, wxT("JPEG files (*.jpg)|*.jpg|GIF files (*.gif)|*.gif|BMP files (*.bmp)|*.bmp|All Files (*.*)|*.*"), wxFD_OPEN);
if (dlg.ShowModal() == wxID_OK)
{
wxFileSelectorDefaultWildcardStr,
wxFileSelectorDefaultWildcardStr
),
- wxCHANGE_DIR,
+ wxFD_OPEN|wxFD_CHANGE_DIR,
this
);
#endif
wxFileDialog dialog(this, _T("Testing open multiple file dialog"),
wxEmptyString, wxEmptyString, wildcards,
- wxMULTIPLE);
+ wxFD_OPEN|wxFD_MULTIPLE);
if (dialog.ShowModal() == wxID_OK)
{
wxEmptyString,
_T("myletter.doc"),
_T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
- wxSAVE|wxOVERWRITE_PROMPT);
+ wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
dialog.SetFilterIndex(1);
void MyFrame::DirChoose(wxCommandEvent& WXUNUSED(event) )
{
- DoDirChoose(wxDD_DEFAULT_STYLE & ~wxDD_NEW_DIR_BUTTON);
+ DoDirChoose(wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
}
void MyFrame::DirChooseNew(wxCommandEvent& WXUNUSED(event) )
{
- DoDirChoose(wxDD_DEFAULT_STYLE | wxDD_NEW_DIR_BUTTON);
+ DoDirChoose(wxDD_DEFAULT_STYLE & ~wxDD_DIR_MUST_EXIST);
}
#endif // wxUSE_DIRDLG
wxT("PCX files (*.pcx)|*.pcx|")
wxT("ICO files (*.ico)|*.ico|")
wxT("CUR files (*.cur)|*.cur"),
- wxSAVE,
+ wxFD_SAVE,
this);
if ( savefilename.empty() )
wxFileDialog dialog( this, _T("Open text"), wxEmptyString, wxEmptyString,
_T("Text file (*.txt)|*.txt|Any file (*)|*"),
- wxOPEN|wxFILE_MUST_EXIST );
+ wxFD_OPEN|wxFD_FILE_MUST_EXIST );
if (dialog.ShowModal() == wxID_OK)
{
m_text->Clear();
#if wxUSE_FILEDLG
wxFileDialog dialog( this, _T("Open text"), wxEmptyString, wxEmptyString,
_T("Text file (*.txt)|*.txt|Any file (*)|*"),
- wxSAVE|wxOVERWRITE_PROMPT );
+ wxFD_SAVE|wxFD_OVERWRITE_PROMPT );
if (dialog.ShowModal() == wxID_OK)
{
m_filename = dialog.GetPath();
#else
wxT("DXF Drawing (*.dxf)|*.dxf)|All files (*.*)|*.*"),
#endif
- wxOPEN);
+ wxFD_OPEN);
if (!filename.IsEmpty())
{
m_canvas->LoadDXF(filename);
path,
filename,
filter,
- wxOPEN);
+ wxFD_OPEN);
if (dialog.ShowModal() == wxID_OK)
{
path,
filename,
filter,
- wxSAVE);
+ wxFD_SAVE);
if (dialog.ShowModal() == wxID_OK)
{
#if wxUSE_FILEDLG
wxFileDialog dlg(this, _T("Choose a sound file"),
wxEmptyString, wxEmptyString,
- _T("WAV files (*.wav)|*.wav"), wxOPEN|wxCHANGE_DIR);
+ _T("WAV files (*.wav)|*.wav"), wxFD_OPEN|wxFD_CHANGE_DIR);
if ( dlg.ShowModal() == wxID_OK )
{
m_soundFile = dlg.GetPath();
// get filname
if (!m_filename) {
wxFileDialog dlg (this, _T("Open file"), wxEmptyString, wxEmptyString,
- _T("Any file (*)|*"), wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR);
+ _T("Any file (*)|*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR);
if (dlg.ShowModal() != wxID_OK) return false;
m_filename = dlg.GetPath();
}
// get filname
if (!m_filename) {
wxFileDialog dlg (this, _T("Save file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"),
- wxSAVE | wxOVERWRITE_PROMPT);
+ wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
if (dlg.ShowModal() != wxID_OK) return false;
m_filename = dlg.GetPath();
}
#if wxUSE_FILEDLG
wxString fname;
wxFileDialog dlg (this, _T("Open file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"),
- wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR);
+ wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR);
if (dlg.ShowModal() != wxID_OK) return;
fname = dlg.GetPath ();
FileOpen (fname);
if (!m_edit) return;
#if wxUSE_FILEDLG
wxString filename = wxEmptyString;
- wxFileDialog dlg (this, _T("Save file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"), wxSAVE|wxOVERWRITE_PROMPT);
+ wxFileDialog dlg (this, _T("Save file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
if (dlg.ShowModal() != wxID_OK) return;
filename = dlg.GetPath();
m_edit->SaveFile (filename);
wxFileDialog dialog(this, wxT("Save Picture as"), wxEmptyString, pChild->GetTitle(),
wxT("SVG vector picture files (*.svg)|*.svg"),
- wxSAVE|wxOVERWRITE_PROMPT);
+ wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
if (dialog.ShowModal() == wxID_OK)
{
extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogNameStr[] = wxT("wxDirCtrl");
extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogDefaultFolderStr[] = wxT("/");
+extern WXDLLEXPORT_DATA(const wxChar) wxFileDialogNameStr[] = wxT("filedlg");
#if defined(__WXMSW__) || defined(__OS2__)
WXDLLEXPORT_DATA(const wxChar *) wxUserResourceStr = wxT("TEXT");
#endif
wxFileNameFromPath(GetFilename()),
docTemplate->GetDefaultExtension(),
filter,
- wxSAVE | wxOVERWRITE_PROMPT,
+ wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
GetDocumentWindow());
if (tmp.empty())
// implementation
// ============================================================================
-const wxChar wxDirSelectorPromptStr[] = wxT("Select a directory");
-
wxString wxDirSelector(const wxString& message,
const wxString& defaultPath,
long style,
void wxFileDialogBase::Init()
{
m_filterIndex =
- m_dialogStyle = 0;
+ m_windowStyle = 0;
}
bool wxFileDialogBase::Create(wxWindow *parent,
const wxString& defaultFile,
const wxString& wildCard,
long style,
- const wxPoint& WXUNUSED(pos))
+ const wxPoint& WXUNUSED(pos),
+ const wxSize& WXUNUSED(sz),
+ const wxString& WXUNUSED(name))
{
m_message = message;
m_dir = defaultDir;
m_wildCard = wildCard;
m_parent = parent;
- m_dialogStyle = style;
+ m_windowStyle = style;
m_filterIndex = 0;
+#ifdef __WXDEBUG__
+ // check the given styles
+ wxASSERT_MSG(HasFlag(wxFD_OPEN) || HasFlag(wxFD_SAVE), wxT("You must specify one of wxFD_OPEN and wxFD_SAVE styles"));
+ if (HasFlag(wxFD_SAVE))
+ wxASSERT_MSG( !HasFlag(wxFD_OPEN) && !HasFlag(wxFD_MULTIPLE) && !HasFlag(wxFD_FILE_MUST_EXIST),
+ wxT("wxFileDialog - wxFD_OPEN, wxFD_MULTIPLE or wxFD_FILE_MUST_EXIST used on a save dialog" ) );
+ if (HasFlag(wxFD_OPEN))
+ wxASSERT_MSG( !HasFlag(wxFD_SAVE) && !HasFlag(wxFD_OVERWRITE_PROMPT),
+ wxT("wxFileDialog - wxFD_SAVE or wxFD_OVERWRITE_PROMPT used on a open dialog" ) );
+#endif
+
if ( wildCard.empty() || wildCard == wxFileSelectorDefaultWildcardStr )
{
m_wildCard = wxString::Format(_("All files (%s)|%s"),
}
return wxFileSelector(prompt, NULL, default_name, ext, wild,
- load ? wxOPEN : wxSAVE, parent);
+ load ? wxFD_OPEN : wxFD_SAVE, parent);
}
//----------------------------------------------------------------------------
wxMenu *dirMenu = new wxMenu;
dirMenu->Append(ID_GO_HOME, _("Home"));
- if (style & wxDD_NEW_DIR_BUTTON)
+ if (!HasFlag(wxDD_DIR_MUST_EXIST))
{
dirMenu->Append(ID_NEW, _("New directory"));
}
// I'm not convinced we need a New button, and we tend to get annoying
// accidental-editing with label editing enabled.
- if (style & wxDD_NEW_DIR_BUTTON)
+ if (!HasFlag(wxDD_DIR_MUST_EXIST))
{
wxBitmapButton* newButton =
new wxBitmapButton(this, ID_NEW,
long dirStyle = wxDIRCTRL_DIR_ONLY | wxDEFAULT_CONTROL_BORDER;
#ifdef __WXMSW__
- if (style & wxDD_NEW_DIR_BUTTON)
+ if (!HasFlag(wxDD_DIR_MUST_EXIST))
{
// Only under Windows do we need the wxTR_EDIT_LABEL tree control style
// before we can call EditLabel (required for "New directory")
#include "wx/artprov.h"
#include "wx/filefn.h"
#include "wx/file.h" // for wxS_IXXX constants only
-#include "wx/filedlg.h" // wxOPEN, wxSAVE...
+#include "wx/filedlg.h" // wxFD_OPEN, wxFD_SAVE...
#include "wx/generic/filedlgg.h"
#include "wx/generic/dirctrlg.h" // for wxFileIconsTable
const wxString& wildCard,
long style,
const wxPoint& pos,
+ const wxSize& sz,
+ const wxString& name,
bool bypassGenericImpl ) : wxFileDialogBase()
{
Init();
- Create( parent, message, defaultDir, defaultFile, wildCard, style, pos, bypassGenericImpl );
+ Create( parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name, bypassGenericImpl );
}
bool wxGenericFileDialog::Create( wxWindow *parent,
const wxString& wildCard,
long style,
const wxPoint& pos,
+ const wxSize& sz,
+ const wxString& name,
bool bypassGenericImpl )
{
m_bypassGenericImpl = bypassGenericImpl;
if (!wxFileDialogBase::Create(parent, message, defaultDir, defaultFile,
- wildCard, style, pos))
+ wildCard, style, pos, sz, name))
{
return false;
}
if (m_bypassGenericImpl)
return true;
- if (!wxDialog::Create( parent, wxID_ANY, message, pos, wxDefaultSize,
- wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
+ if (!wxDialog::Create( parent, wxID_ANY, message, pos, sz,
+ wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER, name
))
{
return false;
&ms_lastShowHidden);
}
- if (m_dialogStyle == 0)
- m_dialogStyle = wxOPEN;
- if ((m_dialogStyle & wxMULTIPLE ) && !(m_dialogStyle & wxOPEN))
- m_dialogStyle |= wxOPEN;
-
if ((m_dir.empty()) || (m_dir == wxT(".")))
{
m_dir = wxGetCwd();
mainsizer->Add( staticsizer, 0, wxEXPAND | wxLEFT|wxRIGHT|wxBOTTOM, 10 );
long style2 = ms_lastViewStyle;
- if ( !(m_dialogStyle & wxMULTIPLE) )
+ if ( !HasFlag(wxFD_MULTIPLE) )
style2 |= wxLC_SINGLE_SEL;
#ifdef __WXWINCE__
}
#endif // __UNIX__
- if (!(m_dialogStyle & wxSAVE))
+ if (!HasFlag(wxFD_SAVE))
{
if ((filename.Find(wxT('*')) != wxNOT_FOUND) ||
(filename.Find(wxT('?')) != wxNOT_FOUND))
// VZ: the logic of testing for !wxFileExists() only for the open file
// dialog is not entirely clear to me, why don't we allow saving to a
// file without extension as well?
- if ( !(m_dialogStyle & wxOPEN) || !wxFileExists(filename) )
+ if ( !HasFlag(wxFD_OPEN) || !wxFileExists(filename) )
{
filename = AppendExtension(filename, m_filterExtension);
}
// check that the file [doesn't] exist if necessary
- if ( (m_dialogStyle & wxSAVE) &&
- (m_dialogStyle & wxOVERWRITE_PROMPT) &&
+ if ( HasFlag(wxFD_SAVE) && HasFlag(wxFD_OVERWRITE_PROMPT) &&
wxFileExists( filename ) )
{
wxString msg;
if (wxMessageBox(msg, _("Confirm"), wxYES_NO) != wxYES)
return;
}
- else if ( (m_dialogStyle & wxOPEN) &&
- (m_dialogStyle & wxFILE_MUST_EXIST) &&
+ else if ( HasFlag(wxFD_OPEN) && HasFlag(wxFD_FILE_MUST_EXIST) &&
!wxFileExists(filename) )
{
wxMessageBox(_("Please choose an existing file."), _("Error"),
SetPath( filename );
// change to the directory where the user went if asked
- if ( m_dialogStyle & wxCHANGE_DIR )
+ if ( HasFlag(wxFD_CHANGE_DIR) )
{
wxString cwd;
wxSplitPath(filename, &cwd, NULL, NULL);
wxFileName fname( m_printDialogData.GetPrintData().GetFilename() );
wxFileDialog dialog( this, _("PostScript file"),
- fname.GetPath(), fname.GetFullName(), wxT("*.ps"), wxSAVE | wxOVERWRITE_PROMPT );
+ fname.GetPath(), fname.GetFullName(), wxT("*.ps"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if (dialog.ShowModal() != wxID_OK) return;
m_printDialogData.GetPrintData().SetFilename( dialog.GetPath() );
/////////////////////////////////////////////////////////////////////////////
// Name: src/gtk/dirdlg.cpp
-// Purpose: native implementation of wxDirDialogGTK
+// Purpose: native implementation of wxDirDialog
// Author: Robert Roebling, Zbigniew Zagorski, Mart Raudsepp, Francesco Montorsi
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling, 2004 Zbigniew Zagorski, 2005 Mart Raudsepp
/*
- NOTE: the GtkFileChooser interface can be used both for wxFileDialog and for wxDirDialogGTK.
+ NOTE: the GtkFileChooser interface can be used both for wxFileDialog and for wxDirDialog.
Thus following code is very similar (even if not identic) to src/gtk/filedlg.cpp
If you find a problem in this code, remember to check also that file !
*/
-#if wxUSE_DIRDLG
+#if wxUSE_DIRDLG && defined( __WXGTK24__ )
#include "wx/dirdlg.h"
#include "wx/filedlg.h"
#endif
-#ifdef __WXGTK24__ // only for GTK+ > 2.4 there is GtkFileChooserDialog
-
#include <gtk/gtk.h>
#include "wx/gtk/private.h"
//-----------------------------------------------------------------------------
extern "C" {
-static void gtk_dirdialog_ok_callback(GtkWidget *widget, wxDirDialogGTK *dialog)
+static void gtk_dirdialog_ok_callback(GtkWidget *widget, wxDirDialog *dialog)
{
gchar* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
extern "C" {
static void gtk_dirdialog_cancel_callback(GtkWidget *WXUNUSED(w),
- wxDirDialogGTK *dialog)
+ wxDirDialog *dialog)
{
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
event.SetEventObject(dialog);
extern "C" {
static void gtk_dirdialog_response_callback(GtkWidget *w,
gint response,
- wxDirDialogGTK *dialog)
+ wxDirDialog *dialog)
{
wxapp_install_idle_handler();
}
}
-#endif // __WXGTK24__
-
//-----------------------------------------------------------------------------
-// wxDirDialogGTK
+// wxDirDialog
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxDirDialogGTK,wxGenericDirDialog)
+IMPLEMENT_DYNAMIC_CLASS(wxDirDialog,wxGenericDirDialog)
-BEGIN_EVENT_TABLE(wxDirDialogGTK,wxGenericDirDialog)
- EVT_BUTTON(wxID_OK, wxDirDialogGTK::OnFakeOk)
+BEGIN_EVENT_TABLE(wxDirDialog,wxGenericDirDialog)
+ EVT_BUTTON(wxID_OK, wxDirDialog::OnFakeOk)
END_EVENT_TABLE()
-wxDirDialogGTK::wxDirDialogGTK(wxWindow* parent, const wxString& title,
+wxDirDialog::wxDirDialog(wxWindow* parent, const wxString& title,
const wxString& defaultPath, long style,
const wxPoint& pos, const wxSize& sz,
const wxString& name)
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
m_message = title;
!CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
wxDefaultValidator, wxT("dirdialog")))
{
- wxFAIL_MSG( wxT("wxDirDialogGTK creation failed") );
+ wxFAIL_MSG( wxT("wxDirDialog creation failed") );
return;
}
if (parent)
gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
+ if (HasFlag(wxDD_DIR_MUST_EXIST))
gtk_action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
- if (style & wxDD_NEW_DIR_BUTTON)
+ else
gtk_action = GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER;
m_widget = gtk_file_chooser_dialog_new(
wxGenericDirDialog::Create(parent, title, defaultPath, style, pos, sz, name);
}
-void wxDirDialogGTK::OnFakeOk( wxCommandEvent &event )
+void wxDirDialog::OnFakeOk( wxCommandEvent &event )
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
wxDialog::OnOK( event );
else
-#endif
wxGenericDirDialog::OnOK( event );
}
-int wxDirDialogGTK::ShowModal()
+int wxDirDialog::ShowModal()
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
return wxDialog::ShowModal();
else
-#endif
return wxGenericDirDialog::ShowModal();
}
-bool wxDirDialogGTK::Show( bool show )
+bool wxDirDialog::Show( bool show )
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
return wxDialog::Show( show );
else
-#endif
return wxGenericDirDialog::Show( show );
}
-void wxDirDialogGTK::DoSetSize(int x, int y, int width, int height, int sizeFlags )
+void wxDirDialog::DoSetSize(int x, int y, int width, int height, int sizeFlags)
{
if (!m_wxwindow)
return;
wxGenericDirDialog::DoSetSize( x, y, width, height, sizeFlags );
}
-void wxDirDialogGTK::SetPath(const wxString& dir)
+void wxDirDialog::SetPath(const wxString& dir)
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
if (wxDirExists(dir))
}
}
else
-#endif
wxGenericDirDialog::SetPath( dir );
}
-wxString wxDirDialogGTK::GetPath() const
+wxString wxDirDialog::GetPath() const
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
return wxConvFileName->cMB2WX( gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(m_widget) ) );
else
-#endif
return wxGenericDirDialog::GetPath();
}
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
-#if wxUSE_FILEDLG
+#if wxUSE_FILEDLG && defined(__WXGTK24__)
#include "wx/filedlg.h"
#include "wx/msgdlg.h"
#endif
-#ifdef __WXGTK24__
-
#include <gtk/gtk.h>
#include "wx/gtk/private.h"
extern "C" {
static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog)
{
- int style = dialog->GetStyle();
+ int style = dialog->GetWindowStyle();
gchar* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
// gtk version numbers must be identical with the one in ctor (that calls set_do_overwrite_confirmation)
#if GTK_CHECK_VERSION(2,7,3)
if(gtk_check_version(2,7,3) != NULL)
#endif
- if ((style & wxSAVE) && (style & wxOVERWRITE_PROMPT))
+ if ((style & wxFD_SAVE) && (style & wxFD_OVERWRITE_PROMPT))
{
if ( g_file_test(filename, G_FILE_TEST_EXISTS) )
{
}
// change to the directory where the user went if asked
- if (style & wxCHANGE_DIR)
+ if (style & wxFD_CHANGE_DIR)
{
// Use chdir to not care about filename encodings
gchar* folder = g_path_get_dirname(filename);
}
}
-#endif // __WXGTK24__
//-----------------------------------------------------------------------------
// wxFileDialog
const wxString& defaultDir,
const wxString& defaultFileName,
const wxString& wildCard,
- long style, const wxPoint& pos)
+ long style, const wxPoint& pos,
+ const wxSize& sz,
+ const wxString& name)
: wxGenericFileDialog(parent, message, defaultDir, defaultFileName,
- wildCard, style, pos, true )
+ wildCard, style, pos, sz, name, true )
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
- wxASSERT_MSG( !( (style & wxSAVE) && (style & wxMULTIPLE) ), wxT("wxFileDialog - wxMULTIPLE used on a save dialog" ) );
m_needParent = false;
if (!PreCreation(parent, pos, wxDefaultSize) ||
gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
const gchar* ok_btn_stock;
- if ( style & wxSAVE )
+ if ( style & wxFD_SAVE )
{
gtk_action = GTK_FILE_CHOOSER_ACTION_SAVE;
ok_btn_stock = GTK_STOCK_SAVE;
gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_ACCEPT);
- if ( style & wxMULTIPLE )
+ if ( style & wxFD_MULTIPLE )
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(m_widget), true);
// gtk_widget_hide_on_delete is used here to avoid that Gtk automatically destroys
SetWildcard(wildCard);
- if ( style & wxSAVE )
+ if ( style & wxFD_SAVE )
{
if ( !defaultDir.empty() )
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
}
}
else
-#endif
wxGenericFileDialog::Create( parent, message, defaultDir, defaultFileName, wildCard, style, pos );
}
void wxFileDialog::OnFakeOk( wxCommandEvent &event )
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
wxDialog::OnOK( event );
else
-#endif
wxGenericFileDialog::OnListOk( event );
}
int wxFileDialog::ShowModal()
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
return wxDialog::ShowModal();
else
-#endif
return wxGenericFileDialog::ShowModal();
}
bool wxFileDialog::Show( bool show )
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
return wxDialog::Show( show );
else
-#endif
return wxGenericFileDialog::Show( show );
}
wxString wxFileDialog::GetPath() const
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
return wxConvFileName->cMB2WX(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget)));
else
-#endif
return wxGenericFileDialog::GetPath();
}
void wxFileDialog::GetFilenames(wxArrayString& files) const
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
GetPaths(files);
}
}
else
-#endif
wxGenericFileDialog::GetFilenames( files );
}
void wxFileDialog::GetPaths(wxArrayString& paths) const
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
paths.Empty();
paths.Add(GetPath());
}
else
-#endif
wxGenericFileDialog::GetPaths( paths );
}
void wxFileDialog::SetMessage(const wxString& message)
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
m_message = message;
SetTitle(message);
}
else
-#endif
wxGenericFileDialog::SetMessage( message );
}
void wxFileDialog::SetPath(const wxString& path)
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
if (path.empty()) return;
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(path));
}
else
-#endif
wxGenericFileDialog::SetPath( path );
}
void wxFileDialog::SetDirectory(const wxString& dir)
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
if (wxDirExists(dir))
}
}
else
-#endif
wxGenericFileDialog::SetDirectory( dir );
}
wxString wxFileDialog::GetDirectory() const
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
return wxConvFileName->cMB2WX(
gtk_file_chooser_get_current_folder( GTK_FILE_CHOOSER(m_widget) ) );
else
-#endif
return wxGenericFileDialog::GetDirectory();
}
void wxFileDialog::SetFilename(const wxString& name)
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
- if (GetStyle() & wxSAVE)
+ if (HasFlag(wxFD_SAVE))
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(name));
else
SetPath(wxFileName(GetDirectory(), name).GetFullPath());
}
else
-#endif
wxGenericFileDialog::SetFilename( name );
}
wxString wxFileDialog::GetFilename() const
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
return wxFileName(
wxConvFileName->cMB2WX(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget))) ).GetFullName();
else
-#endif
return wxGenericFileDialog::GetFilename();
}
void wxFileDialog::SetWildcard(const wxString& wildCard)
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
// parse filters
}
}
else
-#endif
wxGenericFileDialog::SetWildcard( wildCard );
}
void wxFileDialog::SetFilterIndex(int filterIndex)
{
-#ifdef __WXGTK24__
+
if (!gtk_check_version(2,4,0))
{
gpointer filter;
g_slist_free(filters);
}
else
-#endif
wxGenericFileDialog::SetFilterIndex( filterIndex );
}
int wxFileDialog::GetFilterIndex() const
{
-#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
GtkFileChooser *chooser = GTK_FILE_CHOOSER(m_widget);
return index;
}
else
-#endif
return wxGenericFileDialog::GetFilterIndex();
}
-#endif // wxUSE_FILEDLG
+#endif // wxUSE_FILEDLG && __WXGTK24__
const wxString& defaultDir,
const wxString& defaultFileName,
const wxString& wildCard,
- long style, const wxPoint& pos)
+ long style, const wxPoint& pos,
+ const wxSize& sz,
+ const wxString& name)
: wxGenericFileDialog(parent, message, defaultDir, defaultFileName,
- wildCard, style, pos, true )
+ wildCard, style, pos, sz, name, true )
{
- wxGenericFileDialog::Create( parent, message, defaultDir, defaultFileName, wildCard, style, pos );
+ wxGenericFileDialog::Create( parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name );
}
wxFileDialog::~wxFileDialog()
wxEmptyString,
wxEmptyString,
filemask,
- wxOPEN | wxFILE_MUST_EXIST,
+ wxFD_OPEN | wxFD_FILE_MUST_EXIST,
this);
if (!s.empty())
{
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)
+ long style, const wxPoint& pos, const wxSize& sz, const wxString& name)
+ : wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name)
{
wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
}
}
}
- if (m_dialogStyle & wxSAVE)
+ if (HasFlag(wxFD_SAVE))
{
myData.saveMode = true;
dialogCreateOptions.optionFlags |= kNavPreserveSaveFileExtension;
#if TARGET_API_MAC_OSX
- if (!(m_dialogStyle & wxOVERWRITE_PROMPT))
+ if (!(m_windowStyle & wxOVERWRITE_PROMPT))
dialogCreateOptions.optionFlags |= kNavDontConfirmReplacement;
#endif
if (err != noErr)
break;
- if (m_dialogStyle & wxSAVE)
+ if (HasFlag(wxFD_SAVE))
thePath = wxMacFSRefToPath( &theFSRef, navReply.saveFileName );
else
thePath = wxMacFSRefToPath( &theFSRef );
{
wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
m_message = message;
- m_dialogStyle = style;
+ m_windowStyle = style;
m_parent = parent;
m_path = defaultPath;
}
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)
+ long style, const wxPoint& pos, const wxSize& sz, const wxString& name)
+ :wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name)
{
wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
}
OpenUserDataRec myData;
myData.defaultLocation = m_dir;
- if (m_dialogStyle & wxSAVE)
+ if (HasFlag(wxFD_SAVE))
{
dialogCreateOptions.optionFlags |= kNavNoTypePopup;
dialogCreateOptions.optionFlags |= kNavDontAutoTranslate;
break;
CFURLRef fullURLRef;
- if (m_dialogStyle & wxSAVE)
+ if (HasFlag(wxFD_SAVE))
{
CFURLRef parentURLRef = ::CFURLCreateFromFSRef(NULL, &theFSRef);
wxMacStringToPascal( myData.name[i] , (StringPtr)(*mNavOptions.popupExtension)[i].menuItemName ) ;
}
}
- if ( m_dialogStyle & wxSAVE )
+ if ( HasFlag(wxFD_SAVE) )
{
myData.saveMode = true ;
myData.saveMode = false ;
mNavFilterUPP = NewNavObjectFilterUPP( CrossPlatformFilterCallback ) ;
- if ( m_dialogStyle & wxMULTIPLE )
+ if ( m_windowStyle & wxMULTIPLE )
mNavOptions.dialogOptionFlags |= kNavAllowMultipleFiles ;
else
mNavOptions.dialogOptionFlags &= ~kNavAllowMultipleFiles ;
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)
+ long style, const wxPoint& pos, const wxSize& sz, const wxString& name)
+ :wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name)
{
m_filterIndex = 1;
}
// is also the only way to have a resizable dialog
//
// "new" style is only available in the version 5.0+ of comctl32.dll
- const bool needNewDir = HasFlag(wxDD_NEW_DIR_BUTTON);
+ const bool needNewDir = !HasFlag(wxDD_DIR_MUST_EXIST);
if ( (needNewDir || HasFlag(wxRESIZE_BORDER)) && (verComCtl32 >= 500) )
{
if (needNewDir)
const wxString& defaultFileName,
const wxString& wildCard,
long style,
- const wxPoint& pos)
+ const wxPoint& pos,
+ const wxSize& sz,
+ const wxString& name)
: wxFileDialogBase(parent, message, defaultDir, defaultFileName,
- wildCard, style, pos)
+ wildCard, style, pos, sz, name)
{
- if ( ( m_dialogStyle & wxMULTIPLE ) && ( m_dialogStyle & wxSAVE ) )
- m_dialogStyle &= ~wxMULTIPLE;
+ if ( ( m_windowStyle & wxMULTIPLE ) && ( m_windowStyle & wxSAVE ) )
+ m_windowStyle &= ~wxMULTIPLE;
m_bMovedWindow = false;
#if WXWIN_COMPATIBILITY_2_4
long msw_flags = 0;
- if ( (m_dialogStyle & wxHIDE_READONLY) || (m_dialogStyle & wxSAVE) )
+ if ( (m_windowStyle & wxHIDE_READONLY) || (m_windowStyle & wxSAVE) )
msw_flags |= OFN_HIDEREADONLY;
#else
long msw_flags = OFN_HIDEREADONLY;
#endif
- if ( m_dialogStyle & wxFILE_MUST_EXIST )
+ if ( m_windowStyle & wxFILE_MUST_EXIST )
msw_flags |= OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
/*
If the window has been moved the programmer is probably
#endif
}
- if (m_dialogStyle & wxMULTIPLE )
+ if (m_windowStyle & wxMULTIPLE )
{
// OFN_EXPLORER must always be specified with OFN_ALLOWMULTISELECT
msw_flags |= OFN_EXPLORER | OFN_ALLOWMULTISELECT;
// if wxCHANGE_DIR flag is not given we shouldn't change the CWD which the
// standard dialog does by default (notice that under NT it does it anyhow,
// OFN_NOCHANGEDIR or not, see below)
- if ( !(m_dialogStyle & wxCHANGE_DIR) )
+ if ( !(m_windowStyle & wxCHANGE_DIR) )
{
msw_flags |= OFN_NOCHANGEDIR;
}
- if ( m_dialogStyle & wxOVERWRITE_PROMPT )
+ if ( m_windowStyle & wxOVERWRITE_PROMPT )
{
msw_flags |= OFN_OVERWRITEPROMPT;
}
// user types "foo" and the default extension is ".bar" we should force it
// to check for "foo.bar" existence and not "foo")
wxString defextBuffer; // we need it to be alive until GetSaveFileName()!
- if (m_dialogStyle & wxSAVE)
+ if (m_windowStyle & wxSAVE)
{
const wxChar* extension = filterBuffer;
int maxFilter = (int)(of.nFilterIndex*2L) - 1;
//== Execute FileDialog >>=================================================
DWORD errCode;
- bool success = DoShowCommFileDialog(&of, m_dialogStyle, &errCode);
+ bool success = DoShowCommFileDialog(&of, m_windowStyle, &errCode);
#ifdef wxTRY_SMALLER_OPENFILENAME
// the system might be too old to support the new version file dialog
{
of.lStructSize = wxOPENFILENAME_V4_SIZE;
- success = DoShowCommFileDialog(&of, m_dialogStyle, &errCode);
+ success = DoShowCommFileDialog(&of, m_windowStyle, &errCode);
if ( success || !errCode )
{
m_fileNames.Empty();
- if ( ( m_dialogStyle & wxMULTIPLE ) &&
+ if ( ( m_windowStyle & wxMULTIPLE ) &&
#if defined(OFN_EXPLORER)
( fileNameBuffer[of.nFileOffset-1] == wxT('\0') )
#else
const wxPoint& WXUNUSED(pos))
{
m_message = message;
- m_dialogStyle = style;
- if ( ( m_dialogStyle & wxMULTIPLE ) && ( m_dialogStyle & wxSAVE ) )
- m_dialogStyle &= ~wxMULTIPLE;
+ m_windowStyle = style;
+ if ( ( m_windowStyle & wxMULTIPLE ) && ( m_windowStyle & wxSAVE ) )
+ m_windowStyle &= ~wxMULTIPLE;
m_parent = parent;
m_path = wxEmptyString;
m_fileName = defaultFileName;
long style, const wxPoint& pos)
{
m_message = message;
- m_dialogStyle = style;
+ m_windowStyle = style;
m_parent = parent;
m_path = defaultPath;
}
, const wxString& rsDefaultFileName
, const wxString& rsWildCard
, long lStyle
-, const wxPoint& rPos
+, const wxPoint& rPos,
+ const wxSize& sz,
+ const wxString& name
)
- :wxFileDialogBase(pParent, rsMessage, rsDefaultDir, rsDefaultFileName, rsWildCard, lStyle, rPos)
+ :wxFileDialogBase(pParent, rsMessage, rsDefaultDir, rsDefaultFileName, rsWildCard, lStyle, rPos, sz, name)
{
- if ((m_dialogStyle & wxMULTIPLE) && (m_dialogStyle & wxSAVE))
- m_dialogStyle &= ~wxMULTIPLE;
+ if ((m_windowStyle & wxMULTIPLE) && (m_windowStyle & wxSAVE))
+ m_windowStyle &= ~wxMULTIPLE;
m_filterIndex = 1;
} // end of wxFileDialog::wxFileDialog
*zFileNameBuffer = wxT('\0');
*zTitleBuffer = wxT('\0');
- if (m_dialogStyle & wxSAVE)
+ if (m_windowStyle & wxSAVE)
lFlags = FDS_SAVEAS_DIALOG;
else
lFlags = FDS_OPEN_DIALOG;
#if WXWIN_COMPATIBILITY_2_4
- if (m_dialogStyle & wxHIDE_READONLY)
+ if (m_windowStyle & wxHIDE_READONLY)
lFlags |= FDS_SAVEAS_DIALOG;
#endif
- if (m_dialogStyle & wxSAVE)
+ if (m_windowStyle & wxSAVE)
lFlags |= FDS_SAVEAS_DIALOG;
- if (m_dialogStyle & wxMULTIPLE )
+ if (m_windowStyle & wxMULTIPLE )
lFlags |= FDS_OPEN_DIALOG | FDS_MULTIPLESEL;
vFileDlg.cbSize = sizeof(FILEDLG);
if (hWnd && vFileDlg.lReturn == DID_OK)
{
m_fileNames.Empty();
- if ((m_dialogStyle & wxMULTIPLE ) && vFileDlg.ulFQFCount > 1)
+ if ((m_windowStyle & wxMULTIPLE ) && vFileDlg.ulFQFCount > 1)
{
for (int i = 0; i < (int)vFileDlg.ulFQFCount; i++)
{
}
::WinFreeFileDlgList(vFileDlg.papszFQFilename);
}
- else if (!(m_dialogStyle & wxSAVE))
+ else if (!(m_windowStyle & wxSAVE))
{
m_path = (wxChar*)vFileDlg.szFullFile;
m_fileName = wxFileNameFromPath(wxString((const wxChar*)vFileDlg.szFullFile));
//
// === Simulating the wxOVERWRITE_PROMPT >>============================
//
- if ((m_dialogStyle & wxOVERWRITE_PROMPT) &&
- (m_dialogStyle & wxSAVE) &&
+ if ((m_windowStyle & wxOVERWRITE_PROMPT) &&
+ (m_windowStyle & wxSAVE) &&
(wxFileExists(m_path.c_str())))
{
wxString sMessageText;
const wxString& defaultFileName,
const wxString& wildCard,
long style,
- const wxPoint& pos)
- :wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos)
+ const wxPoint& pos,
+ const wxSize& sz,
+ const wxString& name)
+ :wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name)
{
}
wxFileDialog dialog(wxTheApp->GetTopWindow(),
_("Save Setup File As"),
path, filename ,
- wildcard, wxSAVE|wxOVERWRITE_PROMPT);
+ wildcard, wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
if (dialog.ShowModal() == wxID_OK)
{
wxFileDialog dialog(wxTheApp->GetTopWindow(),
_("Save Configure Command File As"),
path, filename ,
- wildcard, wxSAVE|wxOVERWRITE_PROMPT);
+ wildcard, wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
if (dialog.ShowModal() == wxID_OK)
{