summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f40ccee)
dialog
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@315
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
{
DECLARE_DYNAMIC_CLASS(wxFileDialog)
{
DECLARE_DYNAMIC_CLASS(wxFileDialog)
+
+ friend void gtk_filedialog_ok_callback( GtkWidget *widget, gpointer data );
{
DECLARE_DYNAMIC_CLASS(wxFileDialog)
{
DECLARE_DYNAMIC_CLASS(wxFileDialog)
+
+ friend void gtk_filedialog_ok_callback( GtkWidget *widget, gpointer data );
#include "wx/filedlg.h"
#include "wx/utils.h"
#include "wx/intl.h"
#include "wx/filedlg.h"
#include "wx/utils.h"
#include "wx/intl.h"
+#include "wx/generic/msgdlgg.h"
//-----------------------------------------------------------------------------
// wxFileDialog
//-----------------------------------------------------------------------------
// wxFileDialog
{
wxFileDialog *dialog = (wxFileDialog*)data;
wxCommandEvent event(wxEVT_NULL);
{
wxFileDialog *dialog = (wxFileDialog*)data;
wxCommandEvent event(wxEVT_NULL);
+
+ if(dialog->GetStyle()&(wxSAVE|wxOVERWRITE_PROMPT))
+ if(wxFileExists(gtk_file_selection_get_filename(GTK_FILE_SELECTION(dialog->m_widget) ))) {
+ if(wxMessageBox("File exists. Overwrite?","Confirm",wxYES_NO)!=wxYES)
+ return;
+ }
+
dialog->OnOk( event );
};
dialog->OnOk( event );
};
m_fileName = defaultFileName;
m_dir = defaultDir;
m_wildCard = wildCard;
m_fileName = defaultFileName;
m_dir = defaultDir;
m_wildCard = wildCard;
m_filterIndex = 1;
m_widget = gtk_file_selection_new( "File selection" );
GtkFileSelection *sel = GTK_FILE_SELECTION(m_widget);
m_filterIndex = 1;
m_widget = gtk_file_selection_new( "File selection" );
GtkFileSelection *sel = GTK_FILE_SELECTION(m_widget);
+
+ m_path.Append(m_dir);
+ if(m_path.Last()!='/') m_path.Append('/');
+ m_path.Append(m_fileName);
+
+ if(m_path.Length()>1) gtk_file_selection_set_filename(sel,m_path);
gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked",
GTK_SIGNAL_FUNC(gtk_filedialog_ok_callback), (gpointer*)this );
gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked",
GTK_SIGNAL_FUNC(gtk_filedialog_ok_callback), (gpointer*)this );
int wxFileDialog::ShowModal(void)
{
int ret = wxDialog::ShowModal();
int wxFileDialog::ShowModal(void)
{
int ret = wxDialog::ShowModal();
if (ret == wxID_OK)
{
m_fileName = gtk_file_selection_get_filename( GTK_FILE_SELECTION(m_widget) );
if (ret == wxID_OK)
{
m_fileName = gtk_file_selection_get_filename( GTK_FILE_SELECTION(m_widget) );
#include "wx/filedlg.h"
#include "wx/utils.h"
#include "wx/intl.h"
#include "wx/filedlg.h"
#include "wx/utils.h"
#include "wx/intl.h"
+#include "wx/generic/msgdlgg.h"
//-----------------------------------------------------------------------------
// wxFileDialog
//-----------------------------------------------------------------------------
// wxFileDialog
{
wxFileDialog *dialog = (wxFileDialog*)data;
wxCommandEvent event(wxEVT_NULL);
{
wxFileDialog *dialog = (wxFileDialog*)data;
wxCommandEvent event(wxEVT_NULL);
+
+ if(dialog->GetStyle()&(wxSAVE|wxOVERWRITE_PROMPT))
+ if(wxFileExists(gtk_file_selection_get_filename(GTK_FILE_SELECTION(dialog->m_widget) ))) {
+ if(wxMessageBox("File exists. Overwrite?","Confirm",wxYES_NO)!=wxYES)
+ return;
+ }
+
dialog->OnOk( event );
};
dialog->OnOk( event );
};
m_fileName = defaultFileName;
m_dir = defaultDir;
m_wildCard = wildCard;
m_fileName = defaultFileName;
m_dir = defaultDir;
m_wildCard = wildCard;
m_filterIndex = 1;
m_widget = gtk_file_selection_new( "File selection" );
GtkFileSelection *sel = GTK_FILE_SELECTION(m_widget);
m_filterIndex = 1;
m_widget = gtk_file_selection_new( "File selection" );
GtkFileSelection *sel = GTK_FILE_SELECTION(m_widget);
+
+ m_path.Append(m_dir);
+ if(m_path.Last()!='/') m_path.Append('/');
+ m_path.Append(m_fileName);
+
+ if(m_path.Length()>1) gtk_file_selection_set_filename(sel,m_path);
gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked",
GTK_SIGNAL_FUNC(gtk_filedialog_ok_callback), (gpointer*)this );
gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked",
GTK_SIGNAL_FUNC(gtk_filedialog_ok_callback), (gpointer*)this );
int wxFileDialog::ShowModal(void)
{
int ret = wxDialog::ShowModal();
int wxFileDialog::ShowModal(void)
{
int ret = wxDialog::ShowModal();
if (ret == wxID_OK)
{
m_fileName = gtk_file_selection_get_filename( GTK_FILE_SELECTION(m_widget) );
if (ret == wxID_OK)
{
m_fileName = gtk_file_selection_get_filename( GTK_FILE_SELECTION(m_widget) );