]> git.saurik.com Git - wxWidgets.git/commitdiff
Add default ctors and Create() to wxDirDialog and wxFileDialog in wxOSX.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 10 Jul 2013 21:12:07 +0000 (21:12 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 10 Jul 2013 21:12:07 +0000 (21:12 +0000)
Allow two-step creation of these classes.

Closes #15316.

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

include/wx/osx/dirdlg.h
include/wx/osx/filedlg.h
src/osx/carbon/dirdlg.cpp
src/osx/carbon/filedlg.cpp
src/osx/cocoa/dirdlg.mm
src/osx/cocoa/filedlg.mm

index a33a20b6be7adb37a48e51af17f6dc55db63d21a..9b7660e883127d93ee3854f0c5bff608e3be3887 100644 (file)
 class WXDLLIMPEXP_CORE wxDirDialog : public wxDirDialogBase
 {
 public:
+    wxDirDialog() { Init(); }
+
     wxDirDialog(wxWindow *parent,
+                const wxString& message = wxDirSelectorPromptStr,
+                const wxString& defaultPath = wxT(""),
+                long style = wxDD_DEFAULT_STYLE,
+                const wxPoint& pos = wxDefaultPosition,
+                const wxSize& size = wxDefaultSize,
+                const wxString& name = wxDirDialogNameStr)
+    {
+        Init();
+
+        Create(parent,message,defaultPath,style,pos,size,name);
+    }
+
+    void Create(wxWindow *parent,
                 const wxString& message = wxDirSelectorPromptStr,
                 const wxString& defaultPath = wxT(""),
                 long style = wxDD_DEFAULT_STYLE,
@@ -47,6 +62,9 @@ private:
     WX_NSObject m_sheetDelegate;
 #endif
 
+    // Common part of all ctors.
+    void Init();
+
     DECLARE_DYNAMIC_CLASS(wxDirDialog)
 };
 
index 2d7e1648f406b2c09bce436f4faa5a54579916c3..7b1e58a6959d2b2d14a0494e122ff79be7d2177b 100644 (file)
@@ -31,7 +31,23 @@ protected:
     wxArrayString m_paths;
 
 public:
+    wxFileDialog() { Init(); }
     wxFileDialog(wxWindow *parent,
+                 const wxString& message = wxFileSelectorPromptStr,
+                 const wxString& defaultDir = wxEmptyString,
+                 const wxString& defaultFile = wxEmptyString,
+                 const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
+                 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,sz,name);
+    }
+
+    void Create(wxWindow *parent,
                  const wxString& message = wxFileSelectorPromptStr,
                  const wxString& defaultDir = wxEmptyString,
                  const wxString& defaultFile = wxEmptyString,
@@ -87,6 +103,10 @@ protected:
     WX_NSObject m_delegate;
     WX_NSObject m_sheetDelegate;
 #endif
+
+private:
+    // Common part of all ctors.
+    void Init();
 };
 
 #endif // _WX_FILEDLG_H_
index 9ff1c075e7058beb7064f4c7cc6ff45f68ecee99..e006b9d14fc2358033ef2b5f95831a6376c9dc5f 100644 (file)
@@ -55,7 +55,11 @@ static pascal void NavEventProc(
     }
 }
 
-wxDirDialog::wxDirDialog(wxWindow *parent,
+void wxDirDialog::Init()
+{
+}
+
+void wxDirDialog::Create(wxWindow *parent,
                          const wxString& message,
                          const wxString& defaultPath,
                          long style,
index b0a4e7b51b444608790d6c4c781fe442c02fa9e4..6e0b83dc2551cc2029e3e9030046c3c8d060c215 100644 (file)
@@ -456,12 +456,17 @@ static pascal void NavEventProc(
 }
 
 
-wxFileDialog::wxFileDialog(
+void wxFileDialog::Init()
+{
+}
+
+void wxFileDialog::Create(
     wxWindow *parent, const wxString& message,
     const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
     long style, const wxPoint& pos, const wxSize& sz, const wxString& name)
-    : wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name)
 {
+    wxFileDialogBase::Create(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name);
+
     wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
 }
 
index 02f92f94f834021452b8ae1fef664c9c9fce5ede..f7869a075a5c19e5f76f1eeca673d0ad692dd4ba 100644 (file)
 
 IMPLEMENT_CLASS(wxDirDialog, wxDialog)
 
-wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message,
+void wxDirDialog::Init()
+{
+    m_sheetDelegate = nil;
+}
+
+void wxDirDialog::Create(wxWindow *parent, const wxString& message,
         const wxString& defaultPath, long style, const wxPoint& WXUNUSED(pos),
         const wxSize& WXUNUSED(size), const wxString& WXUNUSED(name))
 {
index 40d4f4645f089b33d32a64865b6f1f8e9fd467b5..85ac597d3f8cbd453e092bc008df7bf0b81ddefd 100644 (file)
@@ -187,16 +187,22 @@ bool HasAppKit_10_6()
 
 IMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase)
 
-wxFileDialog::wxFileDialog(
+void wxFileDialog::Init()
+{
+    m_filterIndex = -1;
+    m_delegate = nil;
+    m_sheetDelegate = nil;
+}
+
+void wxFileDialog::Create(
     wxWindow *parent, const wxString& message,
     const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
     long style, const wxPoint& pos, const wxSize& sz, const wxString& name)
-    : wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name)
 {
-    m_filterIndex = -1;
+    wxFileDialogBase::Create(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name);
+
     m_sheetDelegate = [[ModalDialogDelegate alloc] init];
     [(ModalDialogDelegate*)m_sheetDelegate setImplementation: this];
-    m_delegate = nil;
 }
 
 wxFileDialog::~wxFileDialog()