/////////////////////////////////////////////////////////////////////////////
-// Name: gtk/filedlg.cpp
+// Name: src/gtk/filedlg.cpp
// Purpose: native implementation of wxFileDialog
// Author: Robert Roebling, Zbigniew Zagorski, Mart Raudsepp
// Id: $Id$
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "filedlggtk.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
-// Include setup.h to get wxUSE flags for compilers that do not support precompilation of headers
-#include "wx/setup.h"
-
#if wxUSE_FILEDLG
#include "wx/filedlg.h"
+#ifndef WX_PRECOMP
+ #include "wx/intl.h"
+#endif
+
#ifdef __WXGTK24__
#include <gtk/gtk.h>
#include <unistd.h> // chdir
-#include "wx/intl.h"
#include "wx/filename.h" // wxFilename
#include "wx/tokenzr.h" // wxStringTokenizer
#include "wx/filefn.h" // ::wxGetCwd
//-----------------------------------------------------------------------------
extern void wxapp_install_idle_handler();
-extern bool g_isIdle;
//-----------------------------------------------------------------------------
// "clicked" for OK-button
int style = dialog->GetStyle();
gchar* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
+ // gtk version numbers must be identical with the one in ctor (that calls set_do_overwrite_confirmation)
+#if GTK_CHECK_VERSION(2,7,3)
+ if(gtk_check_version(2,7,3) != NULL)
+#endif
if ((style & wxSAVE) && (style & wxOVERWRITE_PROMPT))
{
if ( g_file_test(filename, G_FILE_TEST_EXISTS) )
GtkFileChooserAction gtk_action;
GtkWindow* gtk_parent = NULL;
if (parent)
- gtk_parent = GTK_WINDOW(parent->m_widget);
+ gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
- gchar* ok_btn_stock;
+ const gchar* ok_btn_stock;
if ( style & wxSAVE )
{
gtk_action = GTK_FILE_CHOOSER_ACTION_SAVE;
if ( style & wxSAVE )
{
- if ( !defaultDir.IsEmpty() )
+ if ( !defaultDir.empty() )
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
wxConvFileName->cWX2MB(defaultDir));
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget),
wxConvFileName->cWX2MB(defaultFileName));
+
+#if GTK_CHECK_VERSION(2,7,3)
+ if (!gtk_check_version(2,7,3))
+ gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(m_widget), TRUE);
+#endif
}
else
{
- if ( !defaultFileName.IsEmpty() )
+ if ( !defaultFileName.empty() )
{
wxString dir;
- if ( defaultDir.IsEmpty() )
+ if ( defaultDir.empty() )
dir = ::wxGetCwd();
else
dir = defaultDir;
GTK_FILE_CHOOSER(m_widget),
wxConvFileName->cWX2MB( wxFileName(dir, defaultFileName).GetFullPath() ) );
}
- else if ( !defaultDir.IsEmpty() )
+ else if ( !defaultDir.empty() )
gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),
wxConvFileName->cWX2MB(defaultDir) );
}
return wxGenericFileDialog::Show( show );
}
+void wxFileDialog::DoSetSize(int x, int y, int width, int height, int sizeFlags )
+{
+ if (!m_wxwindow)
+ return;
+ else
+ wxGenericFileDialog::DoSetSize( x, y, width, height, sizeFlags );
+}
+
wxString wxFileDialog::GetPath() const
{
#ifdef __WXGTK24__
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
- if (wxPathExists(dir))
+ if (wxDirExists(dir))
{
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(dir));
}