- buttonsizer->Add( but, 0, wxALL, 5 );
-
- but = new wxBitmapButton( this, ID_REPORT_MODE, wxBitmap( repview_xpm ) );
-#if wxUSE_TOOLTIPS
- but->SetToolTip( _("View files as a detailed view") );
-#endif
- buttonsizer->Add( but, 0, wxALL, 5 );
-
- buttonsizer->Add( 30, 5, 1 );
-
- but = new wxBitmapButton( this, ID_UP_DIR, wxBitmap( dir_up_xpm ) );
-#if wxUSE_TOOLTIPS
- but->SetToolTip( _("Go to parent directory") );
-#endif
- buttonsizer->Add( but, 0, wxALL, 5 );
-
- but = new wxBitmapButton( this, ID_PARENT_DIR, wxBitmap(home_xpm) );
-#if wxUSE_TOOLTIPS
- but->SetToolTip( _("Go to home directory") );
-#endif
- buttonsizer->Add( but, 0, wxALL, 5);
-
- buttonsizer->Add( 20, 20 );
-
- but = new wxBitmapButton( this, ID_NEW_DIR, wxBitmap(new_dir_xpm) );
-#if wxUSE_TOOLTIPS
- but->SetToolTip( _("Create new directory") );
-#endif
- buttonsizer->Add( but, 0, wxALL, 5 );
-
- mainsizer->Add( buttonsizer, 0, wxALL | wxEXPAND, 5 );
-
- wxBoxSizer *staticsizer = new wxBoxSizer( wxHORIZONTAL );
- staticsizer->Add( new wxStaticText( this, -1, _("Current directory:") ), 0, wxRIGHT, 10 );
- m_static = new wxStaticText( this, -1, m_dir );
- staticsizer->Add( m_static, 1 );
- mainsizer->Add( staticsizer, 0, wxEXPAND | wxLEFT|wxRIGHT|wxBOTTOM, 10 );
-
- if (m_dialogStyle & wxMULTIPLE)
- m_list = new wxFileCtrl( this, ID_LIST_CTRL, m_dir, firstWild, wxDefaultPosition,
- wxSize(440,180), s_lastViewStyle | wxSUNKEN_BORDER );
- else
- m_list = new wxFileCtrl( this, ID_LIST_CTRL, m_dir, firstWild, wxDefaultPosition,
- wxSize(440,180), s_lastViewStyle | wxSUNKEN_BORDER | wxLC_SINGLE_SEL );
- m_list -> ShowHidden(s_lastShowHidden);
- 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 ) );
- while (tokens.HasMoreTokens())
- {
- firstWildText = tokens.GetNextToken();
- firstWild = tokens.GetNextToken();
- m_choice->Append( firstWildText, (void*) new wxString( firstWild ) );
- }
- m_choice->SetSelection( 0 );
-
- SetAutoLayout( TRUE );
- SetSizer( mainsizer );
-
- mainsizer->Fit( this );
- mainsizer->SetSizeHints( this );
-
- Centre( wxBOTH );
-
- if (m_fileName.IsEmpty())
- m_list->SetFocus();
- else
- m_text->SetFocus();
-
- wxEndBusyCursor();
-}
-
-wxFileDialog::~wxFileDialog()
-{
- if (wxConfig::Get(FALSE))
- {
- wxConfig::Get() -> Write(wxT("/wxWindows/wxFileDialog/ViewStyle"), s_lastViewStyle);
- wxConfig::Get() -> Write(wxT("/wxWindows/wxFileDialog/ShowHidden"), s_lastShowHidden);
- }
-}
-
-void wxFileDialog::OnChoice( wxCommandEvent &event )
-{
- int index = (int)event.GetInt();
- wxString *str = (wxString*) m_choice->GetClientData( index );
- m_list->SetWild( *str );
- m_filterIndex = index;
- if ( str -> Left( 2 ) == wxT("*.") )
- {
- m_filterExtension = str -> Mid( 1 );
- if (m_filterExtension == ".*") m_filterExtension = wxEmptyString;
- }
- else
- m_filterExtension = wxEmptyString;
-}
-
-void wxFileDialog::OnCheck( wxCommandEvent &event )
-{
- m_list->ShowHidden( (s_lastShowHidden = event.GetInt() != 0) );
-}
-
-void wxFileDialog::OnActivated( wxListEvent &event )
-{
- HandleAction( event.m_item.m_text );
-}
-
-void wxFileDialog::OnTextEnter( wxCommandEvent &WXUNUSED(event) )
-{
- wxCommandEvent cevent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK);
- cevent.SetEventObject( this );
- GetEventHandler()->ProcessEvent( cevent );
-}
-
-void wxFileDialog::OnSelected( wxListEvent &event )
-{
- if (FindFocus() != m_list) return;
-
- wxString filename( event.m_item.m_text );
- if (filename == wxT("..")) return;