X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/58772e4992e1a0601bddbf76fddbf4bb916cf85e..0a95d3369e08206a43032472418693f7726591e5:/src/gtk/filepicker.cpp diff --git a/src/gtk/filepicker.cpp b/src/gtk/filepicker.cpp index f5f6a0a97b..c79eb51426 100644 --- a/src/gtk/filepicker.cpp +++ b/src/gtk/filepicker.cpp @@ -22,9 +22,7 @@ #include "wx/filepicker.h" #include "wx/tooltip.h" -#include - - +#include "wx/gtk/private.h" // ============================================================================ // implementation @@ -45,10 +43,11 @@ bool wxFileButton::Create( wxWindow *parent, wxWindowID id, { if (!gtk_check_version(2,6,0)) { - // VERY IMPORTANT: this code is identic to relative code in wxFileButton; - // if you find a problem here, fix it also in wxFileButton ! + // VERY IMPORTANT: this code is identic to relative code in wxDirButton; + // if you find a problem here, fix it also in wxDirButton ! m_needParent = true; + m_acceptsFocus = true; if (!PreCreation( parent, pos, size ) || !wxControl::CreateBase(parent, id, pos, size, style & wxWINDOW_STYLE_MASK, @@ -95,7 +94,7 @@ bool wxFileButton::Create( wxWindow *parent, wxWindowID id, m_parent->DoAddChild( this ); PostCreation(size); - SetBestSize(size); + SetInitialSize(size); } else return wxGenericFileButton::Create(parent, id, label, path, message, wildcard, @@ -127,7 +126,6 @@ void wxFileButton::OnDialogOK(wxCommandEvent& ev) } } - void wxFileButton::SetPath(const wxString &str) { m_path = str; @@ -162,7 +160,7 @@ static void gtk_dirbutton_currentfolderchanged_callback(GtkFileChooserButton *wi // NB: it's important to use gtk_file_chooser_get_filename instead of // gtk_file_chooser_get_current_folder (see GTK docs) ! - gchar* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)); + wxGtkString filename(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget))); p->UpdatePath(filename); // since GtkFileChooserButton when used to pick directories also uses a combobox, @@ -172,7 +170,6 @@ static void gtk_dirbutton_currentfolderchanged_callback(GtkFileChooserButton *wi // style was given. if (p->HasFlag(wxDIRP_CHANGE_DIR)) chdir(filename); - g_free(filename); // ...and fire an event wxFileDirPickerEvent event(wxEVT_COMMAND_DIRPICKER_CHANGED, p, p->GetId(), p->GetPath()); @@ -200,6 +197,7 @@ bool wxDirButton::Create( wxWindow *parent, wxWindowID id, // if you find a problem here, fix it also in wxFileButton ! m_needParent = true; + m_acceptsFocus = true; if (!PreCreation( parent, pos, size ) || !wxControl::CreateBase(parent, id, pos, size, style & wxWINDOW_STYLE_MASK, @@ -243,7 +241,7 @@ bool wxDirButton::Create( wxWindow *parent, wxWindowID id, m_parent->DoAddChild( this ); PostCreation(size); - SetBestSize(size); + SetInitialSize(size); } else return wxGenericDirButton::Create(parent, id, label, path, message, wildcard,