Implement wxDirDialog:: and wxFileDialog::Create() in wxGTK.
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
This commit is contained in:
@@ -499,6 +499,7 @@ GTK:
|
||||
|
||||
- Implement support for wxBG_STYLE_TRANSPARENT (Armel Asselin).
|
||||
- Fix wxNotebook best size calculation.
|
||||
- Implement wxDirDialog::Create() and wxFileDialog::Create() (vinayakgarg).
|
||||
|
||||
MSW:
|
||||
|
||||
|
@@ -26,7 +26,13 @@ public:
|
||||
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() { }
|
||||
|
||||
|
||||
|
@@ -30,6 +30,15 @@ public:
|
||||
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;
|
||||
|
@@ -98,6 +98,17 @@ wxDirDialog::wxDirDialog(wxWindow* parent,
|
||||
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;
|
||||
|
||||
@@ -108,7 +119,7 @@ wxDirDialog::wxDirDialog(wxWindow* parent,
|
||||
wxDefaultValidator, wxT("dirdialog")))
|
||||
{
|
||||
wxFAIL_MSG( wxT("wxDirDialog creation failed") );
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
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() );
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxDirDialog::OnFakeOk(wxCommandEvent& WXUNUSED(event))
|
||||
|
@@ -174,13 +174,24 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
||||
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))
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
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") );
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
GtkFileChooserAction gtk_action;
|
||||
@@ -311,6 +322,8 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
||||
G_CALLBACK(gtk_filedialog_update_preview_callback),
|
||||
previewImage);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxFileDialog::~wxFileDialog()
|
||||
|
Reference in New Issue
Block a user