+wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
+ const wxString& defaultDir,
+ const wxString& defaultFileName,
+ const wxString& wildCard,
+ long style, const wxPoint& pos)
+ : wxGenericFileDialog(parent, message, defaultDir, defaultFileName,
+ wildCard, style, pos, true )
+{
+#ifdef __WXGTK24__
+ if (!gtk_check_version(2,4,0))
+ {
+ m_needParent = FALSE;
+ m_destroyed_by_delete = FALSE;
+
+ if (!PreCreation(parent, pos, wxDefaultSize) ||
+ !CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
+ wxDefaultValidator, wxT("filedialog")))
+ {
+ wxFAIL_MSG( wxT("wxFileDialog creation failed") );
+ return;
+ }
+
+ bool multiple = (style & wxMULTIPLE) == wxMULTIPLE;
+ GtkFileChooserAction gtk_action;
+ GtkWindow* gtk_parent = NULL;
+ if (parent)
+ gtk_parent = GTK_WINDOW(parent->m_widget);
+
+ gchar* ok_btn_stock;
+ if ((style & wxSAVE) == wxSAVE)
+ {
+ gtk_action = GTK_FILE_CHOOSER_ACTION_SAVE;
+ ok_btn_stock = GTK_STOCK_SAVE;
+ }
+ else
+ {
+ gtk_action = GTK_FILE_CHOOSER_ACTION_OPEN;
+ ok_btn_stock = GTK_STOCK_OPEN;
+ }
+ m_widget = gtk_file_chooser_dialog_new(
+ wxGTK_CONV(m_message),
+ gtk_parent,
+ gtk_action,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ ok_btn_stock, GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(m_widget), multiple);
+
+ gtk_signal_connect(GTK_OBJECT(m_widget),
+ "response",
+ GTK_SIGNAL_FUNC(gtk_filedialog_response_callback),
+ (gpointer*)this);
+
+ m_path = m_dir;
+ if (!m_path.empty() && m_path.Last() != wxT('/'))
+ m_path += wxT('/');
+ m_path += m_fileName;
+ SetPath(m_path);
+
+ SetWildcard(wildCard);
+ SetFilterIndex(0);
+ }
+ else
+#endif
+ wxGenericFileDialog::Create( parent, message, defaultDir, defaultFileName, wildCard, style, pos );