fixed SetFilterIndex() which was broken by the recent changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17354 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -89,13 +89,16 @@ public:
|
|||||||
void OnHome( wxCommandEvent &event );
|
void OnHome( wxCommandEvent &event );
|
||||||
void OnListOk( wxCommandEvent &event );
|
void OnListOk( wxCommandEvent &event );
|
||||||
void OnNew( wxCommandEvent &event );
|
void OnNew( wxCommandEvent &event );
|
||||||
void OnChoice( wxCommandEvent &event );
|
void OnChoiceFilter( wxCommandEvent &event );
|
||||||
void OnTextEnter( wxCommandEvent &event );
|
void OnTextEnter( wxCommandEvent &event );
|
||||||
void OnCheck( wxCommandEvent &event );
|
void OnCheck( wxCommandEvent &event );
|
||||||
|
|
||||||
void HandleAction( const wxString &fn );
|
void HandleAction( const wxString &fn );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
// use the filter with the given index
|
||||||
|
void DoSetFilterIndex(int filterindex);
|
||||||
|
|
||||||
wxString m_message;
|
wxString m_message;
|
||||||
long m_dialogStyle;
|
long m_dialogStyle;
|
||||||
wxString m_dir;
|
wxString m_dir;
|
||||||
|
@@ -673,6 +673,10 @@ long wxFileCtrl::Add( wxFileData *fd, wxListItem &item )
|
|||||||
|
|
||||||
void wxFileCtrl::UpdateFiles()
|
void wxFileCtrl::UpdateFiles()
|
||||||
{
|
{
|
||||||
|
// don't do anything before ShowModal() call which sets m_dirName
|
||||||
|
if ( m_dirName.empty() )
|
||||||
|
return;
|
||||||
|
|
||||||
wxBusyCursor bcur; // this may take a while...
|
wxBusyCursor bcur; // this may take a while...
|
||||||
|
|
||||||
long my_style = GetWindowStyleFlag();
|
long my_style = GetWindowStyleFlag();
|
||||||
@@ -988,7 +992,7 @@ BEGIN_EVENT_TABLE(wxFileDialog,wxDialog)
|
|||||||
EVT_BUTTON(wxID_OK, wxFileDialog::OnListOk)
|
EVT_BUTTON(wxID_OK, wxFileDialog::OnListOk)
|
||||||
EVT_LIST_ITEM_SELECTED(ID_LIST_CTRL, wxFileDialog::OnSelected)
|
EVT_LIST_ITEM_SELECTED(ID_LIST_CTRL, wxFileDialog::OnSelected)
|
||||||
EVT_LIST_ITEM_ACTIVATED(ID_LIST_CTRL, wxFileDialog::OnActivated)
|
EVT_LIST_ITEM_ACTIVATED(ID_LIST_CTRL, wxFileDialog::OnActivated)
|
||||||
EVT_CHOICE(ID_CHOICE,wxFileDialog::OnChoice)
|
EVT_CHOICE(ID_CHOICE,wxFileDialog::OnChoiceFilter)
|
||||||
EVT_TEXT_ENTER(ID_TEXT,wxFileDialog::OnTextEnter)
|
EVT_TEXT_ENTER(ID_TEXT,wxFileDialog::OnTextEnter)
|
||||||
EVT_CHECKBOX(ID_CHECK,wxFileDialog::OnCheck)
|
EVT_CHECKBOX(ID_CHECK,wxFileDialog::OnCheck)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
@@ -1221,27 +1225,33 @@ int wxFileDialog::ShowModal()
|
|||||||
return wxDialog::ShowModal();
|
return wxDialog::ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxFileDialog::DoSetFilterIndex(int filterindex)
|
||||||
|
{
|
||||||
|
wxString *str = (wxString*) m_choice->GetClientData( filterindex );
|
||||||
|
m_list->SetWild( *str );
|
||||||
|
m_filterIndex = filterindex;
|
||||||
|
if ( str->Left(2) == wxT("*.") )
|
||||||
|
{
|
||||||
|
m_filterExtension = str->Mid(2);
|
||||||
|
if (m_filterExtension == _T("*"))
|
||||||
|
m_filterExtension.clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_filterExtension.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetFilterIndex( int filterindex )
|
void wxFileDialog::SetFilterIndex( int filterindex )
|
||||||
{
|
{
|
||||||
m_choice->SetSelection( filterindex );
|
m_choice->SetSelection( filterindex );
|
||||||
wxCommandEvent event;
|
|
||||||
event.SetInt( filterindex );
|
DoSetFilterIndex(filterindex);
|
||||||
OnChoice( event );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::OnChoice( wxCommandEvent &event )
|
void wxFileDialog::OnChoiceFilter( wxCommandEvent &event )
|
||||||
{
|
{
|
||||||
int index = (int)event.GetInt();
|
DoSetFilterIndex((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 )
|
void wxFileDialog::OnCheck( wxCommandEvent &event )
|
||||||
|
Reference in New Issue
Block a user