}
#endif
- struct stat buff;
- wxStat( m_fileName.fn_str(), &buff );
+ wxStructStat buff;
+ wxStat( m_fileName, &buff );
#if defined(__UNIX__) && (!defined( __EMX__ ) && !defined(__VMS))
struct stat lbuff;
m_year = t->tm_year;
m_year += 1900;
- m_permissions.sprintf( wxT("%c%c%c"),
- ((( buff.st_mode & S_IRUSR ) == S_IRUSR ) ? wxT('r') : wxT('-')),
- ((( buff.st_mode & S_IWUSR ) == S_IWUSR ) ? wxT('w') : wxT('-')),
- ((( buff.st_mode & S_IXUSR ) == S_IXUSR ) ? wxT('x') : wxT('-')) );
+ char buffer[10];
+ sprintf( buffer, "%c%c%c",
+ ((( buff.st_mode & S_IRUSR ) == S_IRUSR ) ? 'r' : '-'),
+ ((( buff.st_mode & S_IWUSR ) == S_IWUSR ) ? 'w' : '-'),
+ ((( buff.st_mode & S_IXUSR ) == S_IXUSR ) ? 'x' : '-') );
+#if wxUSE_UNICODE
+ m_permissions = wxConvUTF8.cMB2WC( buffer );
+#else
+ m_permissions = buffer;
+#endif
+
+// m_permissions.sprintf( wxT("%c%c%c"),
+// ((( buff.st_mode & S_IRUSR ) == S_IRUSR ) ? wxT('r') : wxT('-')),
+// ((( buff.st_mode & S_IWUSR ) == S_IWUSR ) ? wxT('w') : wxT('-')),
+// ((( buff.st_mode & S_IXUSR ) == S_IXUSR ) ? wxT('x') : wxT('-')) );
}
wxString wxFileData::GetName() const
#endif
buttonsizer->Add( butNewDir, 0, wxALL, 5 );
- if (wxSystemSettings::GetScreen() >= wxSYS_SCREEN_PDA)
+ if (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA)
mainsizer->Add( buttonsizer, 0, wxALL | wxEXPAND, 0 );
else
mainsizer->Add( buttonsizer, 0, wxALL | wxEXPAND, 5 );
wxBoxSizer *staticsizer = new wxBoxSizer( wxHORIZONTAL );
- if (wxSystemSettings::GetScreen() < wxSYS_SCREEN_PDA)
+ if (wxSystemSettings::GetScreenType() > wxSYS_SCREEN_PDA)
staticsizer->Add( new wxStaticText( this, -1, _("Current directory:") ), 0, wxRIGHT, 10 );
m_static = new wxStaticText( this, -1, m_dir );
staticsizer->Add( m_static, 1 );
m_list->SetNewDirControl(butNewDir);
m_list->SetGoToParentControl(butDirUp);
- if (wxSystemSettings::GetScreen() >= wxSYS_SCREEN_PDA)
+ if (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA)
{
- // PDAs have a different screen layout
- mainsizer->Add( m_list, 1, wxEXPAND | wxLEFT|wxRIGHT, 5 );
-
- wxBoxSizer *choicesizer = new wxBoxSizer( wxHORIZONTAL );
- m_choice = new wxChoice( this, ID_CHOICE );
- choicesizer->Add( m_choice, 1, wxCENTER|wxALL, 5 );
- mainsizer->Add( choicesizer, 0, wxEXPAND );
-
- wxBoxSizer *textsizer = new wxBoxSizer( wxHORIZONTAL );
- m_text = new wxTextCtrl( this, ID_TEXT, m_fileName, wxDefaultPosition, wxDefaultSize, wxPROCESS_ENTER );
- textsizer->Add( m_text, 1, wxCENTER | wxALL, 5 );
- mainsizer->Add( textsizer, 0, wxEXPAND );
-
- m_check = new wxCheckBox( this, ID_CHECK, _("Show hidden files") );
- m_check->SetValue( s_lastShowHidden );
- textsizer->Add( m_check, 0, wxCENTER|wxALL, 5 );
-
- buttonsizer = new wxBoxSizer( wxHORIZONTAL );
- buttonsizer->Add( new wxButton( this, wxID_OK, _("OK") ), 0, wxCENTER | wxALL, 5 );
- buttonsizer->Add( new wxButton( this, wxID_CANCEL, _("Cancel") ), 0, wxCENTER | wxALL, 5 );
- mainsizer->Add( buttonsizer, 0, wxALIGN_RIGHT );
+ // PDAs have a different screen layout
+ mainsizer->Add( m_list, 1, wxEXPAND | wxLEFT|wxRIGHT, 5 );
+
+ wxBoxSizer *choicesizer = new wxBoxSizer( wxHORIZONTAL );
+ m_choice = new wxChoice( this, ID_CHOICE );
+ choicesizer->Add( m_choice, 1, wxCENTER|wxALL, 5 );
+ mainsizer->Add( choicesizer, 0, wxEXPAND );
+
+ wxBoxSizer *textsizer = new wxBoxSizer( wxHORIZONTAL );
+ m_text = new wxTextCtrl( this, ID_TEXT, m_fileName, wxDefaultPosition, wxDefaultSize, wxPROCESS_ENTER );
+ textsizer->Add( m_text, 1, wxCENTER | wxALL, 5 );
+ mainsizer->Add( textsizer, 0, wxEXPAND );
+
+ m_check = new wxCheckBox( this, ID_CHECK, _("Show hidden files") );
+ m_check->SetValue( s_lastShowHidden );
+ textsizer->Add( m_check, 0, wxCENTER|wxALL, 5 );
+
+ buttonsizer = new wxBoxSizer( wxHORIZONTAL );
+ buttonsizer->Add( new wxButton( this, wxID_OK, _("OK") ), 0, wxCENTER | wxALL, 5 );
+ buttonsizer->Add( new wxButton( this, wxID_CANCEL, _("Cancel") ), 0, wxCENTER | wxALL, 5 );
+ mainsizer->Add( buttonsizer, 0, wxALIGN_RIGHT );
}
else
{
- mainsizer->Add( m_list, 1, wxEXPAND | wxLEFT|wxRIGHT, 10 );
-
- wxBoxSizer *textsizer = new wxBoxSizer( wxHORIZONTAL );
- m_text = new wxTextCtrl( this, ID_TEXT, m_fileName, wxDefaultPosition, wxDefaultSize, wxPROCESS_ENTER );
- textsizer->Add( m_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
- textsizer->Add( new wxButton( this, wxID_OK, _("OK") ), 0, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
- mainsizer->Add( textsizer, 0, wxEXPAND );
-
- wxBoxSizer *choicesizer = new wxBoxSizer( wxHORIZONTAL );
- m_choice = new wxChoice( this, ID_CHOICE );
- choicesizer->Add( m_choice, 1, wxCENTER|wxALL, 10 );
- m_check = new wxCheckBox( this, ID_CHECK, _("Show hidden files") );
- m_check->SetValue( s_lastShowHidden );
- choicesizer->Add( m_check, 0, wxCENTER|wxALL, 10 );
- choicesizer->Add( new wxButton( this, wxID_CANCEL, _("Cancel") ), 0, wxCENTER | wxALL, 10 );
- mainsizer->Add( choicesizer, 0, wxEXPAND );
+ mainsizer->Add( m_list, 1, wxEXPAND | wxLEFT|wxRIGHT, 10 );
+
+ wxBoxSizer *textsizer = new wxBoxSizer( wxHORIZONTAL );
+ m_text = new wxTextCtrl( this, ID_TEXT, m_fileName, wxDefaultPosition, wxDefaultSize, wxPROCESS_ENTER );
+ textsizer->Add( m_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
+ textsizer->Add( new wxButton( this, wxID_OK, _("OK") ), 0, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
+ mainsizer->Add( textsizer, 0, wxEXPAND );
+
+ wxBoxSizer *choicesizer = new wxBoxSizer( wxHORIZONTAL );
+ m_choice = new wxChoice( this, ID_CHOICE );
+ choicesizer->Add( m_choice, 1, wxCENTER|wxALL, 10 );
+ m_check = new wxCheckBox( this, ID_CHECK, _("Show hidden files") );
+ m_check->SetValue( s_lastShowHidden );
+ choicesizer->Add( m_check, 0, wxCENTER|wxALL, 10 );
+ choicesizer->Add( new wxButton( this, wxID_CANCEL, _("Cancel") ), 0, wxCENTER | wxALL, 10 );
+ mainsizer->Add( choicesizer, 0, wxEXPAND );
}
m_choice->Append( firstWildText, (void*) new wxString( firstWild ) );
}
}
+void wxFileDialog::SetFilterIndex( int filterindex )
+{
+ m_choice->SetSelection( filterindex );
+ wxCommandEvent event;
+ event.SetInt( filterindex );
+ OnChoice( event );
+}
+
void wxFileDialog::OnChoice( wxCommandEvent &event )
{
int index = (int)event.GetInt();
}
}
-wxString wxLoadFileSelector( const wxChar *what, const wxChar *ext, const wxChar *default_name, wxWindow *parent )
+static wxString GetWildcardString(const wxChar *ext)
{
- wxString prompt = wxString::Format(_("Load %s file"), what);
-
- if (*ext == wxT('.'))
- ext++;
+ wxString wild;
+ if ( ext )
+ {
+ if ( *ext == wxT('.') )
+ ext++;
- wxString wild = wxString::Format(_T("*.%s"), ext);
+ wild << _T("*.") << ext;
+ }
+ else // no extension specified
+ {
+ wild = wxFileSelectorDefaultWildcardStr;
+ }
- return wxFileSelector(prompt, (const wxChar *) NULL, default_name,
- ext, wild, 0, parent);
+ return wild;
}
-wxString wxSaveFileSelector(const wxChar *what, const wxChar *extension, const wxChar *default_name,
- wxWindow *parent )
+wxString wxLoadFileSelector(const wxChar *what,
+ const wxChar *ext,
+ const wxChar *nameDef,
+ wxWindow *parent)
{
- wxChar *ext = (wxChar *)extension;
-
- wxString prompt = wxString::Format(_("Save %s file"), what);
-
- if (*ext == wxT('.'))
- ext++;
-
- wxString wild = wxString::Format(_T("*.%s"), ext);
+ wxString prompt;
+ if ( what && *what )
+ prompt = wxString::Format(_("Load %s file"), what);
+ else
+ prompt = _("Load file");
- return wxFileSelector(prompt, (const wxChar *) NULL, default_name,
- ext, wild, 0, parent);
+ return wxFileSelector(prompt, NULL, nameDef, ext,
+ GetWildcardString(ext), 0, parent);
}
+wxString wxSaveFileSelector(const wxChar *what,
+ const wxChar *ext,
+ const wxChar *nameDef,
+ wxWindow *parent)
+{
+ wxString prompt;
+ if ( what && *what )
+ prompt = wxString::Format(_("Save %s file"), what);
+ else
+ prompt = _("Save file");
-
-
-
+ return wxFileSelector(prompt, NULL, nameDef, ext,
+ GetWildcardString(ext), 0, parent);
+}
// A module to allow icons table cleanup