wxFileDialog::GetFilename and GetDir work now
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1961 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -40,7 +40,7 @@ public:
|
|||||||
const wxPoint& pos = wxDefaultPosition);
|
const wxPoint& pos = wxDefaultPosition);
|
||||||
|
|
||||||
void SetMessage(const wxString& message) { m_message = message; }
|
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 SetDirectory(const wxString& dir) { m_dir = dir; }
|
||||||
void SetFilename(const wxString& name) { m_fileName = name; }
|
void SetFilename(const wxString& name) { m_fileName = name; }
|
||||||
void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
|
void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
|
||||||
|
@@ -40,7 +40,7 @@ public:
|
|||||||
const wxPoint& pos = wxDefaultPosition);
|
const wxPoint& pos = wxDefaultPosition);
|
||||||
|
|
||||||
void SetMessage(const wxString& message) { m_message = message; }
|
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 SetDirectory(const wxString& dir) { m_dir = dir; }
|
||||||
void SetFilename(const wxString& name) { m_fileName = name; }
|
void SetFilename(const wxString& name) { m_fileName = name; }
|
||||||
void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
|
void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
|
||||||
|
@@ -122,7 +122,8 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message,
|
|||||||
gtk_file_selection_hide_fileop_buttons( sel ); // they don't work anyway
|
gtk_file_selection_hide_fileop_buttons( sel ); // they don't work anyway
|
||||||
|
|
||||||
m_path.Append(m_dir);
|
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);
|
m_path.Append(m_fileName);
|
||||||
|
|
||||||
if(m_path.Length()>1) gtk_file_selection_set_filename(sel,m_path);
|
if(m_path.Length()>1) gtk_file_selection_set_filename(sel,m_path);
|
||||||
@@ -143,12 +144,28 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message,
|
|||||||
GTK_SIGNAL_FUNC(gtk_filedialog_delete_callback), (gpointer)this );
|
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,
|
wxString wxFileSelector( const char *title,
|
||||||
const char *defaultDir, const char *defaultFileName,
|
const char *defaultDir, const char *defaultFileName,
|
||||||
const char *defaultExtension, const char *filter, int flags,
|
const char *defaultExtension, const char *filter, int flags,
|
||||||
wxWindow *parent, int x, int y )
|
wxWindow *parent, int x, int y )
|
||||||
{
|
{
|
||||||
wxString filter2("");
|
wxString filter2;
|
||||||
if ( defaultExtension && !filter )
|
if ( defaultExtension && !filter )
|
||||||
filter2 = wxString("*.") + wxString(defaultExtension) ;
|
filter2 = wxString("*.") + wxString(defaultExtension) ;
|
||||||
else if ( filter )
|
else if ( filter )
|
||||||
@@ -157,14 +174,10 @@ wxString wxFileSelector( const char *title,
|
|||||||
wxString defaultDirString;
|
wxString defaultDirString;
|
||||||
if (defaultDir)
|
if (defaultDir)
|
||||||
defaultDirString = defaultDir;
|
defaultDirString = defaultDir;
|
||||||
else
|
|
||||||
defaultDirString = "";
|
|
||||||
|
|
||||||
wxString defaultFilenameString;
|
wxString defaultFilenameString;
|
||||||
if (defaultFileName)
|
if (defaultFileName)
|
||||||
defaultFilenameString = defaultFileName;
|
defaultFilenameString = defaultFileName;
|
||||||
else
|
|
||||||
defaultFilenameString = "";
|
|
||||||
|
|
||||||
wxFileDialog fileDialog( parent, title, defaultDirString, defaultFilenameString, filter2, flags, wxPoint(x, y) );
|
wxFileDialog fileDialog( parent, title, defaultDirString, defaultFilenameString, filter2, flags, wxPoint(x, y) );
|
||||||
|
|
||||||
|
@@ -122,7 +122,8 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message,
|
|||||||
gtk_file_selection_hide_fileop_buttons( sel ); // they don't work anyway
|
gtk_file_selection_hide_fileop_buttons( sel ); // they don't work anyway
|
||||||
|
|
||||||
m_path.Append(m_dir);
|
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);
|
m_path.Append(m_fileName);
|
||||||
|
|
||||||
if(m_path.Length()>1) gtk_file_selection_set_filename(sel,m_path);
|
if(m_path.Length()>1) gtk_file_selection_set_filename(sel,m_path);
|
||||||
@@ -143,12 +144,28 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message,
|
|||||||
GTK_SIGNAL_FUNC(gtk_filedialog_delete_callback), (gpointer)this );
|
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,
|
wxString wxFileSelector( const char *title,
|
||||||
const char *defaultDir, const char *defaultFileName,
|
const char *defaultDir, const char *defaultFileName,
|
||||||
const char *defaultExtension, const char *filter, int flags,
|
const char *defaultExtension, const char *filter, int flags,
|
||||||
wxWindow *parent, int x, int y )
|
wxWindow *parent, int x, int y )
|
||||||
{
|
{
|
||||||
wxString filter2("");
|
wxString filter2;
|
||||||
if ( defaultExtension && !filter )
|
if ( defaultExtension && !filter )
|
||||||
filter2 = wxString("*.") + wxString(defaultExtension) ;
|
filter2 = wxString("*.") + wxString(defaultExtension) ;
|
||||||
else if ( filter )
|
else if ( filter )
|
||||||
@@ -157,14 +174,10 @@ wxString wxFileSelector( const char *title,
|
|||||||
wxString defaultDirString;
|
wxString defaultDirString;
|
||||||
if (defaultDir)
|
if (defaultDir)
|
||||||
defaultDirString = defaultDir;
|
defaultDirString = defaultDir;
|
||||||
else
|
|
||||||
defaultDirString = "";
|
|
||||||
|
|
||||||
wxString defaultFilenameString;
|
wxString defaultFilenameString;
|
||||||
if (defaultFileName)
|
if (defaultFileName)
|
||||||
defaultFilenameString = defaultFileName;
|
defaultFilenameString = defaultFileName;
|
||||||
else
|
|
||||||
defaultFilenameString = "";
|
|
||||||
|
|
||||||
wxFileDialog fileDialog( parent, title, defaultDirString, defaultFilenameString, filter2, flags, wxPoint(x, y) );
|
wxFileDialog fileDialog( parent, title, defaultDirString, defaultFilenameString, filter2, flags, wxPoint(x, y) );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user