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) ||
wxDefaultValidator, wxT("filedialog")))
{
wxFAIL_MSG( wxT("wxFileDialog creation failed") );
- return;
+ return false;
}
GtkFileChooserAction gtk_action;
G_CALLBACK(gtk_filedialog_update_preview_callback),
previewImage);
}
+
+ return true;
}
wxFileDialog::~wxFileDialog()
void wxFileDialog::SetPath(const wxString& path)
{
+ // Don't do anything if no path is specified, in particular don't set the
+ // path to m_dir below as this would result in opening the dialog in the
+ // parent directory of this one instead of m_dir itself.
+ if ( path.empty() )
+ return;
+
// we need an absolute path for GTK native chooser so ensure that we have
- // it
+ // it: use the initial directory if it was set or just CWD otherwise (this
+ // is the default behaviour if m_dir is empty)
wxFileName fn(path);
- fn.MakeAbsolute();
+ fn.MakeAbsolute(m_dir);
m_fc.SetPath(fn.GetFullPath());
}