]> git.saurik.com Git - wxWidgets.git/commitdiff
File/dir dialog styles and other changes (patch 1488371):
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 28 May 2006 23:32:12 +0000 (23:32 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 28 May 2006 23:32:12 +0000 (23:32 +0000)
- check invalid combinations of styles in wxFileDialogBase::Create()
- use wxFD_XXX naming convention for wxFileDialog styles
- replaces wxDD_NEW_DIR_BUTTON with wxDD_DIR_MUST_EXIST
- removes #ifdef __WXGTK24__ / #endif blocks from wxGTK code
- removes wxFileDialogBase::Get/SetStyle and wxFileDialogBase::m_fileName
- renames wxDirDialogGTK to wxDirDialog

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39402 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

53 files changed:
contrib/samples/animate/anitest.cpp
contrib/samples/stc/edit.cpp
contrib/samples/stc/stctest.cpp
contrib/samples/svg/svgtest.cpp
contrib/utils/convertrc/convert.cpp
docs/latex/wx/dirdlg.tex
docs/latex/wx/filedlg.tex
include/wx/cocoa/filedlg.h
include/wx/defs.h
include/wx/dirdlg.h
include/wx/filedlg.h
include/wx/generic/dirdlgg.h
include/wx/generic/filedlgg.h
include/wx/gtk/dirdlg.h
include/wx/gtk/filedlg.h
include/wx/gtk1/filedlg.h
include/wx/motif/filedlg.h
include/wx/msw/filedlg.h
include/wx/os2/filedlg.h
include/wx/palmos/filedlg.h
samples/combo/combo.cpp
samples/db/dbtest.cpp
samples/dialogs/dialogs.cpp
samples/image/image.cpp
samples/mobile/wxedit/wxedit.cpp
samples/opengl/penguin/penguin.cpp
samples/richtext/richtext.cpp
samples/sound/sound.cpp
samples/stc/edit.cpp
samples/stc/stctest.cpp
samples/svg/svgtest.cpp
src/common/datacmn.cpp
src/common/docview.cpp
src/common/dseldlg.cpp
src/common/fldlgcmn.cpp
src/generic/dirdlgg.cpp
src/generic/filedlgg.cpp
src/generic/prntdlgg.cpp
src/gtk/dirdlg.cpp
src/gtk/filedlg.cpp
src/gtk1/filedlg.cpp
src/html/helpwnd.cpp
src/mac/carbon/filedlg.cpp
src/mac/classic/dirdlg.cpp
src/mac/classic/filedlg.cpp
src/motif/filedlg.cpp
src/msw/dirdlg.cpp
src/msw/filedlg.cpp
src/msw/wince/filedlgwce.cpp
src/os2/dirdlg.cpp
src/os2/filedlg.cpp
src/palmos/filedlg.cpp
utils/configtool/src/configtoolview.cpp

index efe5d2b4739e3898f7528219b7747065addead3c..d402201c766e78dadb183c1fe3ce2fdd4d32a493 100644 (file)
@@ -154,7 +154,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
 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());
index a921882b5d7779aae945f0410422fddafaacf6b3..24be6831a8aa15ca830aaf01aed61a9edd08d8e1 100644 (file)
@@ -508,7 +508,7 @@ bool Edit::LoadFile ()
     // 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();
     }
@@ -557,7 +557,7 @@ bool Edit::SaveFile ()
     // 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();
     }
index 7eb8491fbe74e23bada2975a92abcd35e49fa2a3..fb3d1e02c8358ef87540ed6b4c4c9b3280a672d2 100644 (file)
@@ -352,7 +352,7 @@ void AppFrame::OnFileOpen (wxCommandEvent &WXUNUSED(event)) {
 #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);
@@ -373,7 +373,7 @@ void AppFrame::OnFileSaveAs (wxCommandEvent &WXUNUSED(event)) {
     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);
index 41aab0358b6c4072d66ede4ef1bbdefae037074b..a353b440ced1a83f6cde056dbbafd96d59828b86 100644 (file)
@@ -350,7 +350,7 @@ void MyFrame::FileSavePicture (wxCommandEvent & WXUNUSED(event) )
 
     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)
     {
index 43aebfce0526e96d1bfa0dded5ea4dc8e1f5305d..55cb0a878cc2ef002a07affafab0b0af4c105ae5 100644 (file)
@@ -126,14 +126,14 @@ void wxMainFrame::OnRc2Wxr(wxCommandEvent& WXUNUSED(event))
 #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)
@@ -155,7 +155,7 @@ void wxMainFrame::OnWXR2XML(wxCommandEvent& WXUNUSED(event))
 
     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)
@@ -176,7 +176,7 @@ void wxMainFrame::OnRC2XML(wxCommandEvent& WXUNUSED(event))
 
     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)
index ec61a15c83ea94fceae8a818fae7c799814fe463..ad92224286af7eb1af76a215a665175bbcd33f37 100644 (file)
@@ -16,14 +16,13 @@ This class represents the directory chooser dialog.
 \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}
index 859b7a030cb9d70eb8ed0358992d87aed6dc5f8f..6fc83576376ae4bac49b0f5b5eeec15f25287e84 100644 (file)
@@ -13,6 +13,26 @@ This class represents the file chooser dialog.
 
 <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}
@@ -25,9 +45,7 @@ functionality. The path and filename are distinct elements of a full file pathna
 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
@@ -52,7 +70,7 @@ is displayed as ``*.bmp'', and both
 
 \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.
 
@@ -71,28 +89,14 @@ Constructor. Use \helpref{wxFileDialog::ShowModal}{wxfiledialogshowmodal} to sho
 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}
 
@@ -153,12 +157,6 @@ Fills the array {\it paths} with the full paths of the files chosen. This
 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}
@@ -195,12 +193,6 @@ Sets the message that will be displayed on the dialog.
 
 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}}
index f91125b38a22113e4405a2396dcd3a272273c35c..17834726c104a7c50d7855dd7048f960d6e7d1b2 100644 (file)
@@ -29,8 +29,10 @@ public:
                  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);
index 926821d2039cc3371eaa47f60bd68b83dff4b72a..fb71c72c9f47919f174ccfd26ba5846a4ffff565 100644 (file)
@@ -1706,13 +1706,6 @@ enum wxBorder
 #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
index e8c7e441001099a45bcd4943b0f871da71d06806..aec60e874924861e9e84e5fa368715cbdaa1f0df 100644 (file)
@@ -24,13 +24,13 @@ extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogNameStr[];
 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
 
 //-------------------------------------------------------------------------
@@ -85,59 +85,34 @@ protected:
 
 // 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
 
 // ----------------------------------------------------------------------------
index cf82cba2cc1761ff09ddad522eb18584b6268ebb..535380397476dc246153ce42d701848b47ed089e 100644 (file)
@@ -23,6 +23,7 @@
 // wxFileDialog data
 //----------------------------------------------------------------------------
 
+#if WXWIN_COMPATIBILITY_2_6
 enum
 {
     wxOPEN              = 0x0001,
@@ -35,7 +36,21 @@ enum
     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[];
 
@@ -53,11 +68,13 @@ public:
                      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,
@@ -65,15 +82,16 @@ public:
                 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; }
@@ -83,7 +101,6 @@ public:
     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
@@ -108,7 +125,6 @@ public:
 
 protected:
     wxString      m_message;
-    long          m_dialogStyle;
     wxString      m_dir;
     wxString      m_path;       // Full path
     wxString      m_fileName;
@@ -168,8 +184,10 @@ wxSaveFileSelector(const wxChar *what,
 #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__)
index 1c48740479d39fd25962442dcffa84e9d748aa0f..6346f476ecfabeb1c5b342a5c1cf58dfd4d1fef6 100644 (file)
@@ -25,11 +25,9 @@ extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[];
 
 #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
 
index ac2de5b9f5953bcad96b158be085d98d206f8074..e684cfb6d4805392512c129e2f89fa948741c0f0 100644 (file)
@@ -50,8 +50,10 @@ public:
                         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,
@@ -59,8 +61,10 @@ public:
                  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();
index d62bcead0a706b748ce04f48cde94bc69bf64c9f..35d6085c211fa32334954002cf2353c85aad683a 100644 (file)
@@ -1,6 +1,6 @@
 /////////////////////////////////////////////////////////////////////////////
 // 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,
@@ -29,7 +29,7 @@ public:
                 const wxSize& size = wxDefaultSize,
                 const wxString& name = wxDirDialogNameStr);
 
-    virtual ~wxDirDialogGTK() {}
+    virtual ~wxDirDialog() { }
 
 
 public:     // overrides from wxGenericDirDialog
@@ -50,7 +50,7 @@ protected:
 
 
 private:
-    DECLARE_DYNAMIC_CLASS(wxDirDialogGTK)
+    DECLARE_DYNAMIC_CLASS(wxDirDialog)
     DECLARE_EVENT_TABLE()
     void OnFakeOk( wxCommandEvent &event );
 };
index bd6527f0b220a5f2552573da869a70e5efd120ed..ac1909fc8d05010e0cba07d0356f0badda4cc480 100644 (file)
@@ -26,8 +26,10 @@ public:
                  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() {}
 
index e4859f6e08a543edb442afcf2e0d68525ecbbe69..5a2537e8735b196b5b2d9e6a9f4050c63ae74e4b 100644 (file)
@@ -26,8 +26,10 @@ public:
                  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();
 
index 283bce05ec1c312bfcf1219054ac74e698261c81..a2d2ad228d8d462d60555e21d1df89bd8490dad4 100644 (file)
@@ -31,8 +31,10 @@ public:
                  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();
 };
index 37601524ba8d9026f6e9f6ba7c347cb22fc77fa7..169cfb12a53a5edf9a80c5f9808bc36ff0eda350 100644 (file)
@@ -24,8 +24,10 @@ public:
                  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;
index c19e3a1dfd720c72b54f961b0be5bdec98a1d1b3..b971141d7327d50f8b1c1e1c9898f3954d2e1ba6 100644 (file)
@@ -25,8 +25,10 @@ public:
                  ,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;
index 276c0ba77f4fa220bb80d642f0adeac18e5ca46b..3baac18463361d3d221bdb15c2488f46a720af61 100644 (file)
@@ -24,8 +24,10 @@ public:
                  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;
index 0b734e139ee59def6084cf63380a84b859113cf4..43e95ff6336c4e38df9fc20e6aa80646bf08accd 100644 (file)
@@ -597,7 +597,7 @@ public:
                          wxEmptyString,
                          GetValue(),
                          wxT("All files (*.*)|*.*"),
-                         wxOPEN);
+                         wxFD_OPEN);
 
         if ( dlg.ShowModal() == wxID_OK )
         {
index f54a13bcf6d4018af32118fc76f2c48c92dce18b..211f6ca7c3b3fafa69384c09b39e48a13ff57898 100644 (file)
@@ -1712,7 +1712,7 @@ bool CeditorDlg::Initialize()
 
 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)
     {
index 13a84b1546fe065e6264a27b2d896fbe639dfa44..82ffc35d8bb0a59c8bb5e5c8d054cd12405388d2 100644 (file)
@@ -729,7 +729,7 @@ void MyFrame::FileOpen2(wxCommandEvent& WXUNUSED(event) )
                                         wxFileSelectorDefaultWildcardStr,
                                         wxFileSelectorDefaultWildcardStr
                                     ),
-                                    wxCHANGE_DIR,
+                                    wxFD_OPEN|wxFD_CHANGE_DIR,
                                     this
                                    );
 
@@ -758,7 +758,7 @@ void MyFrame::FilesOpen(wxCommandEvent& WXUNUSED(event) )
 #endif
     wxFileDialog dialog(this, _T("Testing open multiple file dialog"),
                         wxEmptyString, wxEmptyString, wildcards,
-                        wxMULTIPLE);
+                        wxFD_OPEN|wxFD_MULTIPLE);
 
     if (dialog.ShowModal() == wxID_OK)
     {
@@ -791,7 +791,7 @@ void MyFrame::FileSave(wxCommandEvent& WXUNUSED(event) )
                         wxEmptyString,
                         _T("myletter.doc"),
                         _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
-                        wxSAVE|wxOVERWRITE_PROMPT);
+                        wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
 
     dialog.SetFilterIndex(1);
 
@@ -905,12 +905,12 @@ void MyFrame::DoDirChoose(int style)
 
 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
 
index edb79dd9da24a4b8411ef8ddd298649c390af5ea..85358943f9df08a90569bd0c9837ec235de84ef2 100644 (file)
@@ -170,7 +170,7 @@ public:
                                                 wxT("PCX files (*.pcx)|*.pcx|")
                                                 wxT("ICO files (*.ico)|*.ico|")
                                                 wxT("CUR files (*.cur)|*.cur"),
-                                                wxSAVE,
+                                                wxFD_SAVE,
                                                 this);
 
         if ( savefilename.empty() )
index 738df05ac4881860f5809e878792e019f29e7be9..73a259c9ed9c376d56f21c138504c7e209149c05 100644 (file)
@@ -220,7 +220,7 @@ void MyFrame::OnOpen( wxCommandEvent& WXUNUSED(event) )
 
     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();
@@ -275,7 +275,7 @@ void MyFrame::OnSaveAs( wxCommandEvent& WXUNUSED(event) )
 #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();
index f753b518bc45cc4904bc1cc16292ed9d127a194c..c16c4a4e3b86fe97632acecad7dd64c98fe40854 100644 (file)
@@ -108,7 +108,7 @@ void MyFrame::OnMenuFileOpen( wxCommandEvent& WXUNUSED(event) )
 #else
         wxT("DXF Drawing (*.dxf)|*.dxf)|All files (*.*)|*.*"),
 #endif
-        wxOPEN);
+        wxFD_OPEN);
     if (!filename.IsEmpty())
     {
         m_canvas->LoadDXF(filename);
index 6d52c0216ce648fb40f64d685fb6afff6366bfa6..12af81541b5ac83b57e736543a374b65cf6ee857 100644 (file)
@@ -721,7 +721,7 @@ void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
         path,
         filename,
         filter,
-        wxOPEN);
+        wxFD_OPEN);
 
     if (dialog.ShowModal() == wxID_OK)
     {
@@ -759,7 +759,7 @@ void MyFrame::OnSaveAs(wxCommandEvent& WXUNUSED(event))
         path,
         filename,
         filter,
-        wxSAVE);
+        wxFD_SAVE);
 
     if (dialog.ShowModal() == wxID_OK)
     {
index 22be97508f995347fe0e8ddfc47f8f0ee9af9759..a517d1a4059b9cf1a4ff7282d77f10a5a5241d8d 100644 (file)
@@ -984,7 +984,7 @@ void MyFrame::OnSelectFile(wxCommandEvent& WXUNUSED(event))
 #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();
index a921882b5d7779aae945f0410422fddafaacf6b3..24be6831a8aa15ca830aaf01aed61a9edd08d8e1 100644 (file)
@@ -508,7 +508,7 @@ bool Edit::LoadFile ()
     // 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();
     }
@@ -557,7 +557,7 @@ bool Edit::SaveFile ()
     // 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();
     }
index 7eb8491fbe74e23bada2975a92abcd35e49fa2a3..fb3d1e02c8358ef87540ed6b4c4c9b3280a672d2 100644 (file)
@@ -352,7 +352,7 @@ void AppFrame::OnFileOpen (wxCommandEvent &WXUNUSED(event)) {
 #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);
@@ -373,7 +373,7 @@ void AppFrame::OnFileSaveAs (wxCommandEvent &WXUNUSED(event)) {
     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);
index 41aab0358b6c4072d66ede4ef1bbdefae037074b..a353b440ced1a83f6cde056dbbafd96d59828b86 100644 (file)
@@ -350,7 +350,7 @@ void MyFrame::FileSavePicture (wxCommandEvent & WXUNUSED(event) )
 
     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)
     {
index 44e529bc76534655d643e7fc20ee24b78291ba2f..4b02aa834e7645b2c253691bcc8dafe40b624754 100644 (file)
@@ -76,6 +76,7 @@ extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorDefaultWildcardStr[] =
 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
index 96b44152cad1a8391d5368415efba7cf5fb05a98..e97ea52f18079495fd427c64f38e7e71a729d1da 100644 (file)
@@ -305,7 +305,7 @@ bool wxDocument::SaveAs()
             wxFileNameFromPath(GetFilename()),
             docTemplate->GetDefaultExtension(),
             filter,
-            wxSAVE | wxOVERWRITE_PROMPT,
+            wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
             GetDocumentWindow());
 
     if (tmp.empty())
index 4f4144bd0aec01d451411eb7a29bb24d545c8e12..40b10ce73b076c5215af7514dea7317f14ad75a6 100644 (file)
@@ -35,8 +35,6 @@
 // implementation
 // ============================================================================
 
-const wxChar wxDirSelectorPromptStr[] = wxT("Select a directory");
-
 wxString wxDirSelector(const wxString& message,
                        const wxString& defaultPath,
                        long style,
index 89de49cea486cc3358de6b58811595f39bd796f7..76e8b882dcbd1e31dec9c34b438563e6c28bb737 100644 (file)
@@ -35,7 +35,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxFileDialogBase, wxDialog)
 void wxFileDialogBase::Init()
 {
     m_filterIndex =
-    m_dialogStyle = 0;
+    m_windowStyle = 0;
 }
 
 bool wxFileDialogBase::Create(wxWindow *parent,
@@ -44,7 +44,9 @@ 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;
@@ -52,9 +54,20 @@ bool wxFileDialogBase::Create(wxWindow *parent,
     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"),
@@ -270,7 +283,7 @@ static wxString wxDefaultFileSelector(bool load,
     }
 
     return wxFileSelector(prompt, NULL, default_name, ext, wild,
-                          load ? wxOPEN : wxSAVE, parent);
+                          load ? wxFD_OPEN : wxFD_SAVE, parent);
 }
 
 //----------------------------------------------------------------------------
index aaa37122932747b2e0415ce8dafe16e704b8c134..5fb5435056f0b36e9e1a2527a5d349a324efef11 100644 (file)
@@ -109,7 +109,7 @@ bool wxGenericDirDialog::Create(wxWindow* 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"));
     }
@@ -133,7 +133,7 @@ bool wxGenericDirDialog::Create(wxWindow* parent,
 
     // 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,
@@ -158,7 +158,7 @@ bool wxGenericDirDialog::Create(wxWindow* parent,
     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")
index 13cf55815407b887312d0e3a68aa0bcd7720ca5c..e92a4ca990b41cda4afe06ed836e812ffc6afa34 100644 (file)
@@ -46,7 +46,7 @@
 #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
 
@@ -974,10 +974,12 @@ wxGenericFileDialog::wxGenericFileDialog(wxWindow *parent,
                            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,
@@ -987,12 +989,14 @@ 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;
     }
@@ -1000,8 +1004,8 @@ bool wxGenericFileDialog::Create( wxWindow *parent,
     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;
@@ -1017,11 +1021,6 @@ bool wxGenericFileDialog::Create( wxWindow *parent,
                               &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();
@@ -1102,7 +1101,7 @@ bool wxGenericFileDialog::Create( wxWindow *parent,
     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__
@@ -1404,7 +1403,7 @@ void wxGenericFileDialog::HandleAction( const wxString &fn )
     }
 #endif // __UNIX__
 
-    if (!(m_dialogStyle & wxSAVE))
+    if (!HasFlag(wxFD_SAVE))
     {
         if ((filename.Find(wxT('*')) != wxNOT_FOUND) ||
             (filename.Find(wxT('?')) != wxNOT_FOUND))
@@ -1449,14 +1448,13 @@ void wxGenericFileDialog::HandleAction( const wxString &fn )
     // 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;
@@ -1465,8 +1463,7 @@ void wxGenericFileDialog::HandleAction( const wxString &fn )
         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"),
@@ -1476,7 +1473,7 @@ void wxGenericFileDialog::HandleAction( const wxString &fn )
     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);
index 85303fefbdb45c86c971b1ca891698eec1b9aa75..9d5bb3541c07b3663a37f0ff62523ef71cd25b7f 100644 (file)
@@ -295,7 +295,7 @@ void wxGenericPrintDialog::OnOK(wxCommandEvent& WXUNUSED(event))
         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() );
index a4e8100ac70eaf72c4cd35b2f45950865ec157da..cd9beb423ab366eb3a09225e6dc1728518cc814b 100644 (file)
@@ -1,6 +1,6 @@
 /////////////////////////////////////////////////////////////////////////////
 // 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"
 
@@ -29,8 +29,6 @@
     #include "wx/filedlg.h"
 #endif
 
-#ifdef __WXGTK24__      // only for GTK+ > 2.4 there is GtkFileChooserDialog
-
 #include <gtk/gtk.h>
 #include "wx/gtk/private.h"
 
@@ -48,7 +46,7 @@ extern void wxapp_install_idle_handler();
 //-----------------------------------------------------------------------------
 
 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));
 
@@ -70,7 +68,7 @@ static void gtk_dirdialog_ok_callback(GtkWidget *widget, wxDirDialogGTK *dialog)
 
 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);
@@ -81,7 +79,7 @@ static void gtk_dirdialog_cancel_callback(GtkWidget *WXUNUSED(w),
 extern "C" {
 static void gtk_dirdialog_response_callback(GtkWidget *w,
                                              gint response,
-                                             wxDirDialogGTK *dialog)
+                                             wxDirDialog *dialog)
 {
     wxapp_install_idle_handler();
 
@@ -92,24 +90,21 @@ static void gtk_dirdialog_response_callback(GtkWidget *w,
 }
 }
 
-#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;
@@ -119,7 +114,7 @@ wxDirDialogGTK::wxDirDialogGTK(wxWindow* parent, const wxString& title,
             !CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
                     wxDefaultValidator, wxT("dirdialog")))
         {
-            wxFAIL_MSG( wxT("wxDirDialogGTK creation failed") );
+            wxFAIL_MSG( wxT("wxDirDialog creation failed") );
             return;
         }
 
@@ -128,8 +123,9 @@ wxDirDialogGTK::wxDirDialogGTK(wxWindow* parent, const wxString& title,
         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(
@@ -169,37 +165,31 @@ wxDirDialogGTK::wxDirDialogGTK(wxWindow* parent, const wxString& title,
         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;
@@ -207,9 +197,8 @@ void wxDirDialogGTK::DoSetSize(int x, int y, int width, int height, int sizeFlag
         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))
@@ -218,17 +207,14 @@ void wxDirDialogGTK::SetPath(const wxString& 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();
 }
 
index 75e879ed1c78d075a835c0de05bc23474968881a..39308de993b2cc824cd6f10d063d017558f78bc1 100644 (file)
@@ -10,7 +10,7 @@
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
-#if wxUSE_FILEDLG
+#if wxUSE_FILEDLG && defined(__WXGTK24__)
 
 #include "wx/filedlg.h"
 
@@ -19,8 +19,6 @@
     #include "wx/msgdlg.h"
 #endif
 
-#ifdef __WXGTK24__
-
 #include <gtk/gtk.h>
 #include "wx/gtk/private.h"
 
@@ -43,14 +41,14 @@ extern void wxapp_install_idle_handler();
 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) )
         {
@@ -68,7 +66,7 @@ static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog)
     }
 
     // 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);
@@ -111,7 +109,6 @@ static void gtk_filedialog_response_callback(GtkWidget *w,
 }
 }
 
-#endif // __WXGTK24__
 
 //-----------------------------------------------------------------------------
 // wxFileDialog
@@ -127,14 +124,14 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
                            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) ||
@@ -151,7 +148,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
             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;
@@ -172,7 +169,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
 
         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
@@ -195,7 +192,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
 
         SetWildcard(wildCard);
 
-        if ( style & wxSAVE )
+        if ( style & wxFD_SAVE )
         {
             if ( !defaultDir.empty() )
                 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
@@ -229,37 +226,30 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
         }
     }
     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 );
 }
 
@@ -273,17 +263,14 @@ void wxFileDialog::DoSetSize(int x, int y, int width, int height, int sizeFlags
 
 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);
@@ -294,13 +281,11 @@ void wxFileDialog::GetFilenames(wxArrayString& files) const
         }
     }
     else
-#endif
         wxGenericFileDialog::GetFilenames( files );
 }
 
 void wxFileDialog::GetPaths(wxArrayString& paths) const
 {
-#ifdef __WXGTK24__
     if (!gtk_check_version(2,4,0))
     {
         paths.Empty();
@@ -322,26 +307,22 @@ void wxFileDialog::GetPaths(wxArrayString& paths) const
             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;
@@ -349,13 +330,11 @@ void wxFileDialog::SetPath(const wxString& path)
         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))
@@ -364,50 +343,42 @@ void wxFileDialog::SetDirectory(const wxString& 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
@@ -455,13 +426,12 @@ void wxFileDialog::SetWildcard(const wxString& wildCard)
         }
     }
     else
-#endif
         wxGenericFileDialog::SetWildcard( wildCard );
 }
 
 void wxFileDialog::SetFilterIndex(int filterIndex)
 {
-#ifdef __WXGTK24__
+
     if (!gtk_check_version(2,4,0))
     {
         gpointer filter;
@@ -482,13 +452,11 @@ void wxFileDialog::SetFilterIndex(int filterIndex)
         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);
@@ -506,8 +474,7 @@ int wxFileDialog::GetFilterIndex() const
             return index;
     }
     else
-#endif
                 return wxGenericFileDialog::GetFilterIndex();
 }
 
-#endif // wxUSE_FILEDLG
+#endif // wxUSE_FILEDLG &&  __WXGTK24__
index f64b08470315d9f3ef02cd1e934cd522ab895ff9..06b502e07a7cd7c9902894b703709860886b430c 100644 (file)
@@ -29,11 +29,13 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
                            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()
index ca22611722d8474abdc0457afad7909238dcba10..509dd8a2d5fbe9dd2c12539c8b02c9151a9ddd86 100644 (file)
@@ -1533,7 +1533,7 @@ void wxHtmlHelpWindow::OnToolbar(wxCommandEvent& event)
                                             wxEmptyString,
                                             wxEmptyString,
                                             filemask,
-                                            wxOPEN | wxFILE_MUST_EXIST,
+                                            wxFD_OPEN | wxFD_FILE_MUST_EXIST,
                                             this);
                 if (!s.empty())
                 {
index 14222c20ec37955794d4839a9e9376d181046347..faca927d1aa56b50d533833642fedc0d448d1ba2 100644 (file)
@@ -259,8 +259,8 @@ 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)
+    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") ) ;
 }
@@ -338,7 +338,7 @@ int wxFileDialog::ShowModal()
         }
     }
 
-    if (m_dialogStyle & wxSAVE)
+    if (HasFlag(wxFD_SAVE))
     {
         myData.saveMode = true;
 
@@ -352,7 +352,7 @@ int wxFileDialog::ShowModal()
             dialogCreateOptions.optionFlags |= kNavPreserveSaveFileExtension;
 
 #if TARGET_API_MAC_OSX
-        if (!(m_dialogStyle & wxOVERWRITE_PROMPT))
+        if (!(m_windowStyle & wxOVERWRITE_PROMPT))
             dialogCreateOptions.optionFlags |= kNavDontConfirmReplacement;
 #endif
 
@@ -413,7 +413,7 @@ int wxFileDialog::ShowModal()
             if (err != noErr)
                 break;
 
-            if (m_dialogStyle & wxSAVE)
+            if (HasFlag(wxFD_SAVE))
                 thePath = wxMacFSRefToPath( &theFSRef, navReply.saveFileName );
             else
                 thePath = wxMacFSRefToPath( &theFSRef );
index ad199358fb594fc4ac40aaf03600862332b01852..4fc1a2b21c7be32361287bd2ff10416a889cf029 100644 (file)
@@ -43,7 +43,7 @@ wxDirDialog::wxDirDialog(wxWindow *parent,
 {
     wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
     m_message = message;
-    m_dialogStyle = style;
+    m_windowStyle = style;
     m_parent = parent;
     m_path = defaultPath;
 }
index 27ec563fe170dff8cf79f611765e2b3930bdf25a..110650d4ce57be04698ce230c5e92563a20559f0 100644 (file)
@@ -292,8 +292,8 @@ 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)
+        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") ) ;
 }
@@ -372,7 +372,7 @@ int wxFileDialog::ShowModal()
     OpenUserDataRec myData;
     myData.defaultLocation = m_dir;
 
-    if (m_dialogStyle & wxSAVE)
+    if (HasFlag(wxFD_SAVE))
     {
         dialogCreateOptions.optionFlags |= kNavNoTypePopup;
         dialogCreateOptions.optionFlags |= kNavDontAutoTranslate;
@@ -445,7 +445,7 @@ int wxFileDialog::ShowModal()
                 break;
 
             CFURLRef fullURLRef;
-            if (m_dialogStyle & wxSAVE)
+            if (HasFlag(wxFD_SAVE))
             {
                 CFURLRef parentURLRef = ::CFURLCreateFromFSRef(NULL, &theFSRef);
 
@@ -562,7 +562,7 @@ int wxFileDialog::ShowModal()
             wxMacStringToPascal( myData.name[i] , (StringPtr)(*mNavOptions.popupExtension)[i].menuItemName ) ;
         }
     }
-    if ( m_dialogStyle & wxSAVE )
+    if ( HasFlag(wxFD_SAVE) )
     {
         myData.saveMode = true ;
 
@@ -584,7 +584,7 @@ int wxFileDialog::ShowModal()
         myData.saveMode = false ;
 
         mNavFilterUPP = NewNavObjectFilterUPP( CrossPlatformFilterCallback ) ;
-        if ( m_dialogStyle & wxMULTIPLE )
+        if ( m_windowStyle & wxMULTIPLE )
             mNavOptions.dialogOptionFlags |= kNavAllowMultipleFiles ;
         else
             mNavOptions.dialogOptionFlags &= ~kNavAllowMultipleFiles ;
index 0411d9d54a818f8581f57b5d88948beb63235e05..9e481db223795b0b58ef95bb525152d563c720ec 100644 (file)
@@ -117,8 +117,8 @@ 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)
+                           long style, const wxPoint& pos, const wxSize& sz, const wxString& name)
+             :wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name)
 {
     m_filterIndex = 1;
 }
index 018f4e13239fdc33c8e9c4037c604a9ae68cb35c..8c8591fd67b7ee34d24631d0c2c9ac97612f4f95 100644 (file)
@@ -148,7 +148,7 @@ int wxDirDialog::ShowModal()
     // 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)
index 36e5f9c58b39581a8bdf34d125edd025c3d2a9cd..b1972a672c4f7c3f58b7123cc1245ae037e0d153 100644 (file)
@@ -129,13 +129,15 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
                            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;
 
@@ -278,13 +280,13 @@ int wxFileDialog::ShowModal()
 
 #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
@@ -302,7 +304,7 @@ int wxFileDialog::ShowModal()
 #endif
     }
 
-    if (m_dialogStyle & wxMULTIPLE )
+    if (m_windowStyle & wxMULTIPLE )
     {
         // OFN_EXPLORER must always be specified with OFN_ALLOWMULTISELECT
         msw_flags |= OFN_EXPLORER | OFN_ALLOWMULTISELECT;
@@ -311,12 +313,12 @@ int wxFileDialog::ShowModal()
     // 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;
     }
@@ -413,7 +415,7 @@ int wxFileDialog::ShowModal()
     // 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;
@@ -436,7 +438,7 @@ int wxFileDialog::ShowModal()
     //== 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
@@ -446,7 +448,7 @@ int wxFileDialog::ShowModal()
     {
         of.lStructSize = wxOPENFILENAME_V4_SIZE;
 
-        success = DoShowCommFileDialog(&of, m_dialogStyle, &errCode);
+        success = DoShowCommFileDialog(&of, m_windowStyle, &errCode);
 
         if ( success || !errCode )
         {
@@ -470,7 +472,7 @@ int wxFileDialog::ShowModal()
 
         m_fileNames.Empty();
 
-        if ( ( m_dialogStyle & wxMULTIPLE ) &&
+        if ( ( m_windowStyle & wxMULTIPLE ) &&
 #if defined(OFN_EXPLORER)
              ( fileNameBuffer[of.nFileOffset-1] == wxT('\0') )
 #else
index 6d0cfe94cfd48ff2f343bee66ef83c59bda11dad..f3b084eb9f90a60c5d866fffd2235b88b36b416c 100644 (file)
@@ -70,9 +70,9 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
                            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;
index 9dacdc82d3ed99914d80ee0a71235cef9fccdd73..f833230fef09fb53dddbbe0246f3b66739920eb6 100644 (file)
@@ -36,7 +36,7 @@ wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message,
         long style, const wxPoint& pos)
 {
     m_message = message;
-    m_dialogStyle = style;
+    m_windowStyle = style;
     m_parent = parent;
     m_path = defaultPath;
 }
index eb13f404432128d20e103ad46d85a2d2e7ab516a..96c26f14cae56fc930771c55a08e635e7b50695f 100644 (file)
@@ -71,13 +71,15 @@ wxFileDialog::wxFileDialog (
 , 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
@@ -124,19 +126,19 @@ int wxFileDialog::ShowModal()
     *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);
@@ -222,7 +224,7 @@ int wxFileDialog::ShowModal()
     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++)
             {
@@ -236,7 +238,7 @@ int wxFileDialog::ShowModal()
             }
             ::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));
@@ -301,8 +303,8 @@ int wxFileDialog::ShowModal()
             //
             // === 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;
index 7051ff5aaeb7c2e667564a034631534bada080a6..1770673d4078c95385d9ee87a9c798a6b6580fb5 100644 (file)
@@ -75,8 +75,10 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
                            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)
 
 {
 }
index 937eda5f747fc6f6fd9a2783a0562d61887b8a01..0005f52690322178235ca5f62d2819846b859e13 100644 (file)
@@ -913,7 +913,7 @@ void ctConfigToolView::OnSaveSetupFile(wxCommandEvent& WXUNUSED(event))
     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)
     {
@@ -946,7 +946,7 @@ void ctConfigToolView::OnSaveConfigureCommand(wxCommandEvent& WXUNUSED(event))
     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)
     {