added 'show columns info' menu command
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7622 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -66,6 +66,8 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_MENU(LIST_SET_FG_COL, MyFrame::OnSetFgColour)
|
EVT_MENU(LIST_SET_FG_COL, MyFrame::OnSetFgColour)
|
||||||
EVT_MENU(LIST_SET_BG_COL, MyFrame::OnSetBgColour)
|
EVT_MENU(LIST_SET_BG_COL, MyFrame::OnSetBgColour)
|
||||||
EVT_MENU(LIST_TOGGLE_MULTI_SEL, MyFrame::OnToggleMultiSel)
|
EVT_MENU(LIST_TOGGLE_MULTI_SEL, MyFrame::OnToggleMultiSel)
|
||||||
|
EVT_MENU(LIST_SHOW_COL_INFO, MyFrame::OnShowColInfo)
|
||||||
|
EVT_UPDATE_UI(LIST_SHOW_COL_INFO, MyFrame::OnUpdateShowColInfo)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl)
|
BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl)
|
||||||
@@ -172,6 +174,7 @@ MyFrame::MyFrame(const wxChar *title, int x, int y, int w, int h)
|
|||||||
menuList->Append(LIST_TOGGLE_FIRST, "&Toggle first item\tCtrl-T");
|
menuList->Append(LIST_TOGGLE_FIRST, "&Toggle first item\tCtrl-T");
|
||||||
menuList->Append(LIST_DESELECT_ALL, "&Deselect All\tCtrl-D");
|
menuList->Append(LIST_DESELECT_ALL, "&Deselect All\tCtrl-D");
|
||||||
menuList->Append(LIST_SELECT_ALL, "S&elect All\tCtrl-A");
|
menuList->Append(LIST_SELECT_ALL, "S&elect All\tCtrl-A");
|
||||||
|
menuList->Append(LIST_SHOW_COL_INFO, "Show &column info\tCtrl-C");
|
||||||
menuList->AppendSeparator();
|
menuList->AppendSeparator();
|
||||||
menuList->Append(LIST_SORT, "&Sort\tCtrl-S");
|
menuList->Append(LIST_SORT, "&Sort\tCtrl-S");
|
||||||
menuList->AppendSeparator();
|
menuList->AppendSeparator();
|
||||||
@@ -318,7 +321,7 @@ void MyFrame::OnReportView(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxStopWatch sw;
|
wxStopWatch sw;
|
||||||
|
|
||||||
wxString buf;
|
wxString buf;
|
||||||
static const int NUM_ITEMS = 3000;
|
static const int NUM_ITEMS = 30;//00;
|
||||||
for ( int i = 0; i < NUM_ITEMS; i++ )
|
for ( int i = 0; i < NUM_ITEMS; i++ )
|
||||||
{
|
{
|
||||||
buf.Printf(_T("This is item %d"), i);
|
buf.Printf(_T("This is item %d"), i);
|
||||||
@@ -432,6 +435,22 @@ void MyFrame::OnSort(wxCommandEvent& WXUNUSED(event))
|
|||||||
sw.Time()));
|
sw.Time()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnShowColInfo(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
int count = m_listCtrl->GetColumnCount();
|
||||||
|
wxLogMessage("%d columns:", count);
|
||||||
|
for ( int c = 0; c < count; c++ )
|
||||||
|
{
|
||||||
|
wxLogMessage("\tcolumn %d has width %d", c,
|
||||||
|
m_listCtrl->GetColumnWidth(c));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnUpdateShowColInfo(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable( (m_listCtrl->GetWindowStyleFlag() & wxLC_REPORT) != 0 );
|
||||||
|
}
|
||||||
|
|
||||||
void MyFrame::OnToggleMultiSel(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnToggleMultiSel(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
m_logWindow->WriteText("Current selection mode: ");
|
m_logWindow->WriteText("Current selection mode: ");
|
||||||
|
@@ -74,6 +74,8 @@ public:
|
|||||||
void OnSetFgColour(wxCommandEvent& event);
|
void OnSetFgColour(wxCommandEvent& event);
|
||||||
void OnSetBgColour(wxCommandEvent& event);
|
void OnSetBgColour(wxCommandEvent& event);
|
||||||
void OnToggleMultiSel(wxCommandEvent& event);
|
void OnToggleMultiSel(wxCommandEvent& event);
|
||||||
|
void OnShowColInfo(wxCommandEvent& event);
|
||||||
|
void OnUpdateShowColInfo(wxUpdateUIEvent& event);
|
||||||
|
|
||||||
void BusyOn(wxCommandEvent& event);
|
void BusyOn(wxCommandEvent& event);
|
||||||
void BusyOff(wxCommandEvent& event);
|
void BusyOff(wxCommandEvent& event);
|
||||||
@@ -109,6 +111,7 @@ enum
|
|||||||
LIST_SET_BG_COL,
|
LIST_SET_BG_COL,
|
||||||
LIST_TOGGLE_MULTI_SEL,
|
LIST_TOGGLE_MULTI_SEL,
|
||||||
LIST_TOGGLE_FIRST,
|
LIST_TOGGLE_FIRST,
|
||||||
|
LIST_SHOW_COL_INFO,
|
||||||
|
|
||||||
LIST_CTRL = 1000
|
LIST_CTRL = 1000
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user