m_wildcard = wildcard;
if ((m_dialog = CreateDialog()) == NULL)
return false;
-
+
// little trick used to avoid problems when there are other GTK windows 'grabbed':
// GtkFileChooserDialog won't be responsive to user events if there is another
// window which called gtk_grab_add (and this happens if e.g. a wxDialog is running
// use as label the currently selected file
m_widget = gtk_file_chooser_button_new_with_dialog( m_dialog->m_widget );
-
+
g_object_ref(m_widget);
gtk_widget_show(m_widget);
void wxFileButton::SetPath(const wxString &str)
{
m_path = str;
-
+
if (m_dialog)
UpdateDialogPath(m_dialog);
}
+void wxFileButton::SetInitialDirectory(const wxString& dir)
+{
+ if (m_dialog)
+ DoSetInitialDirectory(static_cast<wxFileDialog*>(m_dialog), dir);
+ else
+ wxGenericFileButton::SetInitialDirectory(dir);
+}
+
#endif // wxUSE_FILEPICKERCTRL && defined(__WXGTK26__)
#if wxUSE_DIRPICKERCTRL && defined(__WXGTK26__)
+#ifdef __UNIX__
#include <unistd.h> // chdir
+#endif
//-----------------------------------------------------------------------------
// "current-folder-changed"
m_widget = gtk_file_chooser_button_new_with_dialog( m_dialog->m_widget );
g_object_ref(m_widget);
-
+
gtk_widget_show(m_widget);
// GtkFileChooserButton signals
}
void wxDirButton::GTKUpdatePath(const char *gtkpath)
-{
+{
m_path = wxString::FromUTF8(gtkpath);
}
void wxDirButton::SetPath(const wxString& str)
UpdateDialogPath(m_dialog);
}
+void wxDirButton::SetInitialDirectory(const wxString& dir)
+{
+ if (m_dialog)
+ {
+ if (m_path.empty())
+ static_cast<wxDirDialog*>(m_dialog)->SetPath(dir);
+ }
+ else
+ wxGenericDirButton::SetInitialDirectory(dir);
+}
+
#endif // wxUSE_DIRPICKERCTRL && defined(__WXGTK26__)