added test for wxDataViewCtrl::Expand() and ::Collapse()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59378 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2009-03-06 19:20:25 +00:00
parent 4931e96a36
commit d2ee27fe25

View File

@@ -82,6 +82,8 @@ public: // event handlers
void OnDeleteMusic(wxCommandEvent& event);
void OnDeleteYear(wxCommandEvent& event);
void OnSelectNinth(wxCommandEvent& event);
void OnCollapse(wxCommandEvent& event);
void OnExpand(wxCommandEvent& event);
void OnPrependList(wxCommandEvent& event);
void OnDeleteList(wxCommandEvent& event);
@@ -245,6 +247,8 @@ enum
ID_DELETE_MUSIC = 101,
ID_DELETE_YEAR = 102,
ID_SELECT_NINTH = 103,
ID_COLLAPSE = 104,
ID_EXPAND = 105,
ID_PREPEND_LIST = 200,
ID_DELETE_LIST = 201,
@@ -263,6 +267,9 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_BUTTON( ID_DELETE_MUSIC, MyFrame::OnDeleteMusic )
EVT_BUTTON( ID_DELETE_YEAR, MyFrame::OnDeleteYear )
EVT_BUTTON( ID_SELECT_NINTH, MyFrame::OnSelectNinth )
EVT_BUTTON( ID_COLLAPSE, MyFrame::OnCollapse )
EVT_BUTTON( ID_EXPAND, MyFrame::OnExpand )
EVT_BUTTON( ID_PREPEND_LIST, MyFrame::OnPrependList )
EVT_BUTTON( ID_DELETE_LIST, MyFrame::OnDeleteList )
EVT_BUTTON( ID_GOTO, MyFrame::OnGoto)
@@ -347,6 +354,8 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int
button_sizer->Add( new wxButton( firstPanel, ID_DELETE_MUSIC,_("Delete selected")), 0, wxALL, 10 );
button_sizer->Add( new wxButton( firstPanel, ID_DELETE_YEAR, _("Delete \"Year\" column")), 0, wxALL, 10 );
button_sizer->Add( new wxButton( firstPanel, ID_SELECT_NINTH,_("Select Ninth")), 0, wxALL, 10 );
button_sizer->Add( new wxButton( firstPanel, ID_COLLAPSE, _("Collapse")), 0, wxALL, 10 );
button_sizer->Add( new wxButton( firstPanel, ID_EXPAND, _("Expand")), 0, wxALL, 10 );
wxSizer *firstPanelSz = new wxBoxSizer( wxVERTICAL );
m_ctrl[0]->SetMinSize(wxSize(-1, 200));
@@ -761,6 +770,20 @@ void MyFrame::OnSelectNinth( wxCommandEvent& WXUNUSED(event) )
m_ctrl[0]->Select( m_music_model->GetNinthItem() );
}
void MyFrame::OnCollapse( wxCommandEvent& WXUNUSED(event) )
{
wxDataViewItem item = m_ctrl[0]->GetSelection();
if (item.IsOk())
m_ctrl[0]->Collapse( item );
}
void MyFrame::OnExpand( wxCommandEvent& WXUNUSED(event) )
{
wxDataViewItem item = m_ctrl[0]->GetSelection();
if (item.IsOk())
m_ctrl[0]->Expand( item );
}
void MyFrame::OnValueChanged( wxDataViewEvent &event )
{
if (!m_log)