-#ifdef __WXGTK24__
-#include "wx/gtk/private.h"
-
-//-----------------------------------------------------------------------------
-// idle system
-//-----------------------------------------------------------------------------
-
-extern void wxapp_install_idle_handler();
-extern bool g_isIdle;
-
-//-----------------------------------------------------------------------------
-// "clicked" for OK-button
-//-----------------------------------------------------------------------------
-
-static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog)
-{
- int style = dialog->GetStyle();
- gchar* text = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
- wxString filename(wxGTK_CONV_BACK(text));
-
- if ((style & wxSAVE) && (style & wxOVERWRITE_PROMPT))
- {
- if (wxFileExists(filename))
- {
- wxString msg;
- msg.Printf(
- _("File '%s' already exists, do you really want to overwrite it?"),
- filename.c_str());
-
- wxMessageDialog dlg(dialog, msg, _("Confirm"),
- wxYES_NO | wxICON_QUESTION);
- if (dlg.ShowModal() != wxID_YES)
- return;
- }
- }
- else if ((style & wxOPEN) && ( style & wxFILE_MUST_EXIST))
- {
- if (!wxFileExists( filename ))
- {
- wxMessageDialog dlg(dialog,
- _("Please choose an existing file."),
- _("Error"), wxOK | wxICON_ERROR);
- dlg.ShowModal();
-
- return;
- }
- }
-
- // change to the directory where the user went if asked
- if (style & wxCHANGE_DIR)
- {
- wxString cwd;
- wxSplitPath(filename, &cwd, NULL, NULL);
-
- if (cwd != wxGetCwd())
- {
- wxSetWorkingDirectory(cwd);
- }
- }
-
- dialog->SetPath(filename);
- dialog->UpdateFromDialog();
-
- wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK);
- event.SetEventObject(dialog);
- dialog->GetEventHandler()->ProcessEvent(event);
-}
-
-//-----------------------------------------------------------------------------
-// "clicked" for Cancel-button
-//-----------------------------------------------------------------------------
-
-static void gtk_filedialog_cancel_callback(GtkWidget *WXUNUSED(w),
- wxFileDialog *dialog)
-{
- wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
- event.SetEventObject(dialog);
- dialog->GetEventHandler()->ProcessEvent(event);
-}
-
-static void gtk_filedialog_response_callback(GtkWidget *w,
- int response,
- wxFileDialog *dialog)
-{
- wxapp_install_idle_handler();
-
- if (response == GTK_RESPONSE_ACCEPT)
- gtk_filedialog_ok_callback(w, dialog);
- else if (response == GTK_RESPONSE_CANCEL)
- gtk_filedialog_cancel_callback(w, dialog);
- else // "delete"
- {
- gtk_filedialog_cancel_callback(w, dialog);
- dialog->m_destroyed_by_delete = true;
- }
-}
-#endif