added (de)select all
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@628 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -37,6 +37,8 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_MENU(LIST_ICON_TEXT_VIEW, MyFrame::OnIconTextView)
|
EVT_MENU(LIST_ICON_TEXT_VIEW, MyFrame::OnIconTextView)
|
||||||
EVT_MENU(LIST_SMALL_ICON_VIEW, MyFrame::OnSmallIconView)
|
EVT_MENU(LIST_SMALL_ICON_VIEW, MyFrame::OnSmallIconView)
|
||||||
EVT_MENU(LIST_SMALL_ICON_TEXT_VIEW, MyFrame::OnSmallIconTextView)
|
EVT_MENU(LIST_SMALL_ICON_TEXT_VIEW, MyFrame::OnSmallIconTextView)
|
||||||
|
EVT_MENU(LIST_DESELECT_ALL, MyFrame::OnDeselectAll)
|
||||||
|
EVT_MENU(LIST_DESELECT_ALL, MyFrame::OnSelectAll)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl)
|
BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl)
|
||||||
@@ -125,6 +127,8 @@ bool MyApp::OnInit(void)
|
|||||||
file_menu->Append(LIST_ICON_TEXT_VIEW, "Icon view with &text");
|
file_menu->Append(LIST_ICON_TEXT_VIEW, "Icon view with &text");
|
||||||
file_menu->Append(LIST_SMALL_ICON_VIEW, "&Small icon view");
|
file_menu->Append(LIST_SMALL_ICON_VIEW, "&Small icon view");
|
||||||
file_menu->Append(LIST_SMALL_ICON_TEXT_VIEW, "Small icon &view with text");
|
file_menu->Append(LIST_SMALL_ICON_TEXT_VIEW, "Small icon &view with text");
|
||||||
|
file_menu->Append(LIST_DESELECT_ALL, "&Deselect All");
|
||||||
|
file_menu->Append(LIST_SELECT_ALL, "S&elect All");
|
||||||
file_menu->AppendSeparator();
|
file_menu->AppendSeparator();
|
||||||
file_menu->Append(LIST_ABOUT, "&About");
|
file_menu->Append(LIST_ABOUT, "&About");
|
||||||
file_menu->Append(LIST_QUIT, "E&xit");
|
file_menu->Append(LIST_QUIT, "E&xit");
|
||||||
@@ -198,6 +202,22 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
|||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnDeselectAll(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
int n = m_listCtrl->GetItemCount();
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < n; i++)
|
||||||
|
m_listCtrl->SetItemState(i,0,wxLIST_STATE_SELECTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnSelectAll(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
int n = m_listCtrl->GetItemCount();
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < n; i++)
|
||||||
|
m_listCtrl->SetItemState(i,wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
|
||||||
|
}
|
||||||
|
|
||||||
void MyFrame::OnListView(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnListView(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
m_logWindow->Clear();
|
m_logWindow->Clear();
|
||||||
|
@@ -60,6 +60,8 @@ class MyFrame: public wxFrame
|
|||||||
void OnSmallIconView(wxCommandEvent& event);
|
void OnSmallIconView(wxCommandEvent& event);
|
||||||
void OnSmallIconTextView(wxCommandEvent& event);
|
void OnSmallIconTextView(wxCommandEvent& event);
|
||||||
bool OnClose(void) { return TRUE; }
|
bool OnClose(void) { return TRUE; }
|
||||||
|
void OnDeselectAll(wxCommandEvent& event);
|
||||||
|
void OnSelectAll(wxCommandEvent& event);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
@@ -73,6 +75,8 @@ class MyFrame: public wxFrame
|
|||||||
#define LIST_SMALL_ICON_VIEW 5
|
#define LIST_SMALL_ICON_VIEW 5
|
||||||
#define LIST_SMALL_ICON_TEXT_VIEW 6
|
#define LIST_SMALL_ICON_TEXT_VIEW 6
|
||||||
#define LIST_REPORT_VIEW 7
|
#define LIST_REPORT_VIEW 7
|
||||||
|
#define LIST_DESELECT_ALL 8
|
||||||
|
#define LIST_SELECT_ALL 9
|
||||||
#define LIST_ABOUT 102
|
#define LIST_ABOUT 102
|
||||||
|
|
||||||
#define LIST_CTRL 1000
|
#define LIST_CTRL 1000
|
||||||
|
Reference in New Issue
Block a user