this->m_style = style;
m_inSelected = false;
m_noSelChgEvent = false;
+ m_check = NULL;
// check that the styles are not contradictory
wxASSERT_MSG( !( ( m_style & wxFC_SAVE ) && ( m_style & wxFC_OPEN ) ),
wxBoxSizer *staticsizer = new wxBoxSizer( wxHORIZONTAL );
if ( is_pda )
- staticsizer->Add( new wxStaticText( this, wxID_ANY, _( "Current directory:" ) ), 0, wxRIGHT, 10 );
+ staticsizer->Add( new wxStaticText( this, wxID_ANY, _( "Current directory:" ) ),
+ wxSizerFlags().DoubleBorder(wxRIGHT) );
m_static = new wxStaticText( this, wxID_ANY, m_dir );
staticsizer->Add( m_static, 1 );
- mainsizer->Add( staticsizer, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 10 );
+ mainsizer->Add( staticsizer, wxSizerFlags().Expand().Border());
long style2 = wxLC_LIST;
if ( !( m_style & wxFC_MULTIPLE ) )
wxBoxSizer *textsizer = new wxBoxSizer( wxHORIZONTAL );
textsizer->Add( m_text, wxSizerFlags( 1 ).Centre().Border() );
+ textsizer->Add( m_choice, wxSizerFlags( 1 ).Centre().Border() );
mainsizer->Add( textsizer, wxSizerFlags().Expand() );
- m_check = NULL;
- textsizer->Add( m_choice, wxSizerFlags( 1 ).Centre().Border() );
}
else // !is_pda
{
- mainsizer->Add( m_list, wxSizerFlags( 1 ).Expand().DoubleHorzBorder() );
-
- wxBoxSizer *textsizer = new wxBoxSizer( wxHORIZONTAL );
- textsizer->Add( m_text, wxSizerFlags( 1 ).Centre().
- DoubleBorder( wxLEFT | wxRIGHT | wxTOP ) );
- mainsizer->Add( textsizer, wxSizerFlags().Expand() );
-
- wxSizerFlags flagsCentre;
- flagsCentre.Centre().DoubleBorder();
+ mainsizer->Add( m_list, wxSizerFlags( 1 ).Expand().Border() );
+ mainsizer->Add( m_text, wxSizerFlags().Expand().Border() );
wxBoxSizer *choicesizer = new wxBoxSizer( wxHORIZONTAL );
- choicesizer->Add( m_choice, wxSizerFlags( flagsCentre ).Proportion( 1 ) );
+ choicesizer->Add( m_choice, wxSizerFlags( 1 ).Centre() );
if ( !( m_style & wxFC_NOSHOWHIDDEN ) )
- {
+ {
m_check = new wxCheckBox( this, ID_CHECK, _( "Show &hidden files" ) );
- choicesizer->Add( m_check, flagsCentre );
- }
+ choicesizer->Add( m_check, wxSizerFlags().Centre().DoubleBorder(wxLEFT) );
+ }
- mainsizer->Add( choicesizer, wxSizerFlags().Expand() );
+ mainsizer->Add( choicesizer, wxSizerFlags().Expand().Border() );
}
SetWildcard( wildCard );
return fn;
}
-void wxGenericFileCtrl::DoGetFilenames( wxArrayString& filenames, const bool fullPath ) const
+// helper used in DoGetFilenames() and needed because Borland can't compile
+// operator?: inline
+static inline wxString GetFileNameOrPath(const wxFileName& fn, bool fullPath)
+{
+ return fullPath ? fn.GetFullPath() : fn.GetFullName();
+}
+
+void
+wxGenericFileCtrl::DoGetFilenames(wxArrayString& filenames, bool fullPath) const
{
filenames.clear();
if ( fn.IsRelative() )
fn.MakeAbsolute(dir);
- filenames.push_back(fullPath ? fn.GetFullPath() : fn.GetFullName());
+ filenames.push_back(GetFileNameOrPath(fn, fullPath));
return;
}
m_list->GetItem(item);
const wxFileName fn(dir, item.m_text);
- filenames.push_back(fullPath ? fn.GetFullPath() : fn.GetFullName());
+ filenames.push_back(GetFileNameOrPath(fn, fullPath));
}
}
void wxGenericFileCtrl::DoSetFilterIndex( int filterindex )
{
- const wxString& str = (wx_static_cast(wxStringClientData *,
- m_choice->GetClientObject( filterindex )))
- ->GetData();
+ wxClientData *pcd = m_choice->GetClientObject( filterindex );
+ if ( !pcd )
+ return;
+
+ const wxString& str = ((static_cast<wxStringClientData *>(pcd))->GetData());
m_list->SetWild( str );
m_filterIndex = filterindex;
if ( str.Left( 2 ) == wxT( "*." ) )