]> git.saurik.com Git - wxWidgets.git/commitdiff
Implement wxDirDialog:: and wxFileDialog::Create() in wxGTK.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 14 Mar 2012 12:32:27 +0000 (12:32 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 14 Mar 2012 12:32:27 +0000 (12:32 +0000)
Simply move the code from non-default constructor to Create(). This allows to
create the dialogs using 2-step creation if necessary.

Closes #14069.

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

docs/changes.txt
include/wx/gtk/dirdlg.h
include/wx/gtk/filedlg.h
src/gtk/dirdlg.cpp
src/gtk/filedlg.cpp

index ceb551bb946fe3ea58fbdf029707cb3d501fd436..ef7179451501fe2fbf13aa563d5f39ca057e7684 100644 (file)
@@ -499,6 +499,7 @@ GTK:
 
 - Implement support for wxBG_STYLE_TRANSPARENT (Armel Asselin).
 - Fix wxNotebook best size calculation.
 
 - Implement support for wxBG_STYLE_TRANSPARENT (Armel Asselin).
 - Fix wxNotebook best size calculation.
+- Implement wxDirDialog::Create() and wxFileDialog::Create() (vinayakgarg).
 
 MSW:
 
 
 MSW:
 
index e8f905c67e646cfe463ebd794577b0ec6d6be3a3..fe457b7755aa1bdf1778102062ddbac0bbf9a591 100644 (file)
@@ -26,7 +26,13 @@ public:
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 const wxString& name = wxDirDialogNameStr);
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 const wxString& name = wxDirDialogNameStr);
-
+    bool Create(wxWindow *parent,
+                const wxString& message = wxDirSelectorPromptStr,
+                const wxString& defaultPath = wxEmptyString,
+                long style = wxDD_DEFAULT_STYLE,
+                const wxPoint& pos = wxDefaultPosition,
+                const wxSize& size = wxDefaultSize,
+                const wxString& name = wxDirDialogNameStr);
     virtual ~wxDirDialog() { }
 
 
     virtual ~wxDirDialog() { }
 
 
index 08854018e54fe7a9df62148285d7b966e429c0c6..209a098a6e9f6bebb22bbccca5c660a328dd93bb 100644 (file)
@@ -30,6 +30,15 @@ public:
                  const wxPoint& pos = wxDefaultPosition,
                  const wxSize& sz = wxDefaultSize,
                  const wxString& name = wxFileDialogNameStr);
                  const wxPoint& pos = wxDefaultPosition,
                  const wxSize& sz = wxDefaultSize,
                  const wxString& name = wxFileDialogNameStr);
+    bool Create(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);
     virtual ~wxFileDialog();
 
     virtual wxString GetPath() const;
     virtual ~wxFileDialog();
 
     virtual wxString GetPath() const;
index 07cc55c8d17ceca4dd1fba9241db4348d54984c1..3843eb3ac500ae87db67361a1c8d898b6b75cc4b 100644 (file)
@@ -98,6 +98,17 @@ wxDirDialog::wxDirDialog(wxWindow* parent,
                          const wxPoint& pos,
                          const wxSize& WXUNUSED(sz),
                          const wxString& WXUNUSED(name))
                          const wxPoint& pos,
                          const wxSize& WXUNUSED(sz),
                          const wxString& WXUNUSED(name))
+{
+    Create(parent, title, defaultPath, style, pos);
+}
+
+bool wxDirDialog::Create(wxWindow* parent,
+                         const wxString& title,
+                         const wxString& defaultPath,
+                         long style,
+                         const wxPoint& pos,
+                         const wxSize& WXUNUSED(sz),
+                         const wxString& WXUNUSED(name))
 {
     m_message = title;
 
 {
     m_message = title;
 
@@ -108,7 +119,7 @@ wxDirDialog::wxDirDialog(wxWindow* parent,
                 wxDefaultValidator, wxT("dirdialog")))
     {
         wxFAIL_MSG( wxT("wxDirDialog creation failed") );
                 wxDefaultValidator, wxT("dirdialog")))
     {
         wxFAIL_MSG( wxT("wxDirDialog creation failed") );
-        return;
+        return false;
     }
 
     GtkWindow* gtk_parent = NULL;
     }
 
     GtkWindow* gtk_parent = NULL;
@@ -147,6 +158,7 @@ wxDirDialog::wxDirDialog(wxWindow* parent,
     if ( !defaultPath.empty() )
         gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),
                 defaultPath.fn_str() );
     if ( !defaultPath.empty() )
         gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),
                 defaultPath.fn_str() );
+    return true;
 }
 
 void wxDirDialog::OnFakeOk(wxCommandEvent& WXUNUSED(event))
 }
 
 void wxDirDialog::OnFakeOk(wxCommandEvent& WXUNUSED(event))
index 85118048ed0c0f70e5a6139042dd113425b39fed..b1a370e37606f43a4b9901064d5bf9eb54dc9770 100644 (file)
@@ -174,13 +174,24 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
                            const wxSize& sz,
                            const wxString& name)
     : wxFileDialogBase()
                            const wxSize& sz,
                            const wxString& name)
     : wxFileDialogBase()
+{
+    Create(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name);
+}
+
+bool 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)
 {
     parent = GetParentForModalDialog(parent, style);
 
     if (!wxFileDialogBase::Create(parent, message, defaultDir, defaultFileName,
                                   wildCard, style, pos, sz, name))
     {
 {
     parent = GetParentForModalDialog(parent, style);
 
     if (!wxFileDialogBase::Create(parent, message, defaultDir, defaultFileName,
                                   wildCard, style, pos, sz, name))
     {
-        return;
+        return false;
     }
 
     if (!PreCreation(parent, pos, wxDefaultSize) ||
     }
 
     if (!PreCreation(parent, pos, wxDefaultSize) ||
@@ -188,7 +199,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
                 wxDefaultValidator, wxT("filedialog")))
     {
         wxFAIL_MSG( wxT("wxFileDialog creation failed") );
                 wxDefaultValidator, wxT("filedialog")))
     {
         wxFAIL_MSG( wxT("wxFileDialog creation failed") );
-        return;
+        return false;
     }
 
     GtkFileChooserAction gtk_action;
     }
 
     GtkFileChooserAction gtk_action;
@@ -311,6 +322,8 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
                          G_CALLBACK(gtk_filedialog_update_preview_callback),
                          previewImage);
     }
                          G_CALLBACK(gtk_filedialog_update_preview_callback),
                          previewImage);
     }
+
+    return true;
 }
 
 wxFileDialog::~wxFileDialog()
 }
 
 wxFileDialog::~wxFileDialog()