const wxPoint& pos = wxDefaultPosition);
void SetMessage(const wxString& message) { m_message = message; }
- void SetPath(const wxString& path) { m_path = path; }
+ void SetPath(const wxString& path);
void SetDirectory(const wxString& dir) { m_dir = dir; }
void SetFilename(const wxString& name) { m_fileName = name; }
void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
const wxPoint& pos = wxDefaultPosition);
void SetMessage(const wxString& message) { m_message = message; }
- void SetPath(const wxString& path) { m_path = path; }
+ void SetPath(const wxString& path);
void SetDirectory(const wxString& dir) { m_dir = dir; }
void SetFilename(const wxString& name) { m_fileName = name; }
void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
gtk_file_selection_hide_fileop_buttons( sel ); // they don't work anyway
m_path.Append(m_dir);
- if(! m_path.IsEmpty() && m_path.Last()!='/') m_path.Append('/');
+ if( ! m_path.IsEmpty() && 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_FUNC(gtk_filedialog_delete_callback), (gpointer)this );
}
+void wxFileDialog::SetPath(const wxString& path)
+{
+ // not only set the full path but also update filename and dir
+ m_path = path;
+ if ( !!path )
+ {
+ wxString ext;
+ wxSplitPath(path, &m_dir, &m_fileName, &ext);
+ m_fileName += ext;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// global functions
+// ----------------------------------------------------------------------------
+
wxString wxFileSelector( const char *title,
const char *defaultDir, const char *defaultFileName,
const char *defaultExtension, const char *filter, int flags,
wxWindow *parent, int x, int y )
{
- wxString filter2("");
+ wxString filter2;
if ( defaultExtension && !filter )
filter2 = wxString("*.") + wxString(defaultExtension) ;
else if ( filter )
wxString defaultDirString;
if (defaultDir)
defaultDirString = defaultDir;
- else
- defaultDirString = "";
wxString defaultFilenameString;
if (defaultFileName)
defaultFilenameString = defaultFileName;
- else
- defaultFilenameString = "";
wxFileDialog fileDialog( parent, title, defaultDirString, defaultFilenameString, filter2, flags, wxPoint(x, y) );
gtk_file_selection_hide_fileop_buttons( sel ); // they don't work anyway
m_path.Append(m_dir);
- if(! m_path.IsEmpty() && m_path.Last()!='/') m_path.Append('/');
+ if( ! m_path.IsEmpty() && 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_FUNC(gtk_filedialog_delete_callback), (gpointer)this );
}
+void wxFileDialog::SetPath(const wxString& path)
+{
+ // not only set the full path but also update filename and dir
+ m_path = path;
+ if ( !!path )
+ {
+ wxString ext;
+ wxSplitPath(path, &m_dir, &m_fileName, &ext);
+ m_fileName += ext;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// global functions
+// ----------------------------------------------------------------------------
+
wxString wxFileSelector( const char *title,
const char *defaultDir, const char *defaultFileName,
const char *defaultExtension, const char *filter, int flags,
wxWindow *parent, int x, int y )
{
- wxString filter2("");
+ wxString filter2;
if ( defaultExtension && !filter )
filter2 = wxString("*.") + wxString(defaultExtension) ;
else if ( filter )
wxString defaultDirString;
if (defaultDir)
defaultDirString = defaultDir;
- else
- defaultDirString = "";
wxString defaultFilenameString;
if (defaultFileName)
defaultFilenameString = defaultFileName;
- else
- defaultFilenameString = "";
wxFileDialog fileDialog( parent, title, defaultDirString, defaultFilenameString, filter2, flags, wxPoint(x, y) );