X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/acfd422afac254f4356904275656c0c15685fa1e..fbbba98df450fd35641d32d289143040834e9826:/src/gtk/filedlg.cpp diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index bd7d405395..c1c2c6f3e8 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -16,7 +16,7 @@ #include "wx/intl.h" #include "wx/generic/msgdlgg.h" -#include "gtk/gtk.h" +#include //----------------------------------------------------------------------------- // idle system @@ -116,9 +116,15 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, { m_needParent = FALSE; - PreCreation( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, "filedialog" ); + if (!PreCreation( parent, pos, wxDefaultSize ) || + !CreateBase( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, wxDefaultValidator, wxT("filedialog") )) + { + wxFAIL_MSG( wxT("wxXX creation failed") ); + return; + } + m_message = message; - m_path = _T(""); + m_path = wxT(""); m_fileName = defaultFileName; m_dir = defaultDir; m_wildCard = wildCard; @@ -135,7 +141,7 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, gtk_file_selection_hide_fileop_buttons( sel ); // they don't work anyway m_path.Append(m_dir); - if( ! m_path.IsEmpty() && m_path.Last()!=_T('/') ) + if( ! m_path.IsEmpty() && m_path.Last()!=wxT('/') ) m_path.Append('/'); m_path.Append(m_fileName); @@ -145,13 +151,13 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, GTK_SIGNAL_FUNC(gtk_filedialog_ok_callback), (gpointer*)this ); // strange way to internationalize - gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->ok_button)->child ), wxConv_current->cWX2MB(_("OK")) ); + gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->ok_button)->child ), wxConvCurrent->cWX2MB(_("OK")) ); gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_filedialog_cancel_callback), (gpointer*)this ); // strange way to internationalize - gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->cancel_button)->child ), wxConv_current->cWX2MB(_("Cancel")) ); + gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->cancel_button)->child ), wxConvCurrent->cWX2MB(_("Cancel")) ); gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event", GTK_SIGNAL_FUNC(gtk_filedialog_delete_callback), (gpointer)this ); @@ -165,7 +171,11 @@ void wxFileDialog::SetPath(const wxString& path) { wxString ext; wxSplitPath(path, &m_dir, &m_fileName, &ext); - m_fileName += ext; + if (!ext.IsEmpty()) + { + m_fileName += wxT("."); + m_fileName += ext; + } } } @@ -173,6 +183,21 @@ void wxFileDialog::SetPath(const wxString& path) // global functions // ---------------------------------------------------------------------------- +wxString +wxFileSelectorEx(const wxChar *message, + const wxChar *default_path, + const wxChar *default_filename, + int *indexDefaultExtension, + const wxChar *wildcard, + int flags, + wxWindow *parent, + int x, int y) +{ + // TODO: implement this somehow + return wxFileSelector(message, default_path, default_filename, wxT(""), + wildcard, flags, parent, x, y); +} + wxString wxFileSelector( const wxChar *title, const wxChar *defaultDir, const wxChar *defaultFileName, const wxChar *defaultExtension, const wxChar *filter, int flags, @@ -180,7 +205,7 @@ wxString wxFileSelector( const wxChar *title, { wxString filter2; if ( defaultExtension && !filter ) - filter2 = wxString(_T("*.")) + wxString(defaultExtension) ; + filter2 = wxString(wxT("*.")) + wxString(defaultExtension) ; else if ( filter ) filter2 = filter; @@ -212,9 +237,9 @@ wxString wxLoadFileSelector( const wxChar *what, const wxChar *extension, const wxString str = _("Load %s file"); wxSprintf(prompt, str, what); - if (*ext == _T('.')) ext++; + if (*ext == wxT('.')) ext++; wxChar wild[60]; - wxSprintf(wild, _T("*.%s"), ext); + wxSprintf(wild, wxT("*.%s"), ext); return wxFileSelector (prompt, (const wxChar *) NULL, default_name, ext, wild, 0, parent); } @@ -228,9 +253,9 @@ wxString wxSaveFileSelector(const wxChar *what, const wxChar *extension, const w wxString str = _("Save %s file"); wxSprintf(prompt, str, what); - if (*ext == _T('.')) ext++; + if (*ext == wxT('.')) ext++; wxChar wild[60]; - wxSprintf(wild, _T("*.%s"), ext); + wxSprintf(wild, wxT("*.%s"), ext); return wxFileSelector (prompt, (const wxChar *) NULL, default_name, ext, wild, 0, parent); }