virtual wxListCtrl support (UNTESTED)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10872 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -189,6 +189,9 @@ protected:
|
|||||||
friend wxListMainWindow;
|
friend wxListMainWindow;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// create the header window
|
||||||
|
void CreateHeaderWindow();
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
DECLARE_DYNAMIC_CLASS(wxListCtrl);
|
DECLARE_DYNAMIC_CLASS(wxListCtrl);
|
||||||
};
|
};
|
||||||
|
@@ -32,10 +32,14 @@ typedef int (wxCALLBACK *wxListCtrlCompare)(long item1, long item2, long sortDat
|
|||||||
// style flags
|
// style flags
|
||||||
#define wxLC_VRULES 0x0001
|
#define wxLC_VRULES 0x0001
|
||||||
#define wxLC_HRULES 0x0002
|
#define wxLC_HRULES 0x0002
|
||||||
|
|
||||||
#define wxLC_ICON 0x0004
|
#define wxLC_ICON 0x0004
|
||||||
#define wxLC_SMALL_ICON 0x0008
|
#define wxLC_SMALL_ICON 0x0008
|
||||||
#define wxLC_LIST 0x0010
|
#define wxLC_LIST 0x0010
|
||||||
#define wxLC_REPORT 0x0020
|
#define wxLC_REPORT 0x0020
|
||||||
|
#define wxLC_MODE_MASK \
|
||||||
|
(wxLC_ICON | wxLC_SMALL_ICON | wxLC_LIST | wxLC_REPORT)
|
||||||
|
|
||||||
#define wxLC_ALIGN_TOP 0x0040
|
#define wxLC_ALIGN_TOP 0x0040
|
||||||
#define wxLC_ALIGN_LEFT 0x0080
|
#define wxLC_ALIGN_LEFT 0x0080
|
||||||
#define wxLC_AUTOARRANGE 0x0100
|
#define wxLC_AUTOARRANGE 0x0100
|
||||||
|
@@ -64,6 +64,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_MENU(LIST_DESELECT_ALL, MyFrame::OnDeselectAll)
|
EVT_MENU(LIST_DESELECT_ALL, MyFrame::OnDeselectAll)
|
||||||
EVT_MENU(LIST_SELECT_ALL, MyFrame::OnSelectAll)
|
EVT_MENU(LIST_SELECT_ALL, MyFrame::OnSelectAll)
|
||||||
EVT_MENU(LIST_DELETE, MyFrame::OnDelete)
|
EVT_MENU(LIST_DELETE, MyFrame::OnDelete)
|
||||||
|
EVT_MENU(LIST_ADD, MyFrame::OnAdd)
|
||||||
EVT_MENU(LIST_DELETE_ALL, MyFrame::OnDeleteAll)
|
EVT_MENU(LIST_DELETE_ALL, MyFrame::OnDeleteAll)
|
||||||
EVT_MENU(LIST_SORT, MyFrame::OnSort)
|
EVT_MENU(LIST_SORT, MyFrame::OnSort)
|
||||||
EVT_MENU(LIST_SET_FG_COL, MyFrame::OnSetFgColour)
|
EVT_MENU(LIST_SET_FG_COL, MyFrame::OnSetFgColour)
|
||||||
@@ -178,7 +179,8 @@ MyFrame::MyFrame(const wxChar *title, int x, int y, int w, int h)
|
|||||||
menuList->AppendSeparator();
|
menuList->AppendSeparator();
|
||||||
menuList->Append(LIST_SORT, _T("&Sort\tCtrl-S"));
|
menuList->Append(LIST_SORT, _T("&Sort\tCtrl-S"));
|
||||||
menuList->AppendSeparator();
|
menuList->AppendSeparator();
|
||||||
menuList->Append(LIST_DELETE, _T("&Delete first item"));
|
menuList->Append(LIST_ADD, _T("&Append an item\tCtrl-P"));
|
||||||
|
menuList->Append(LIST_DELETE, _T("&Delete first item\tCtrl-X"));
|
||||||
menuList->Append(LIST_DELETE_ALL, _T("Delete &all items"));
|
menuList->Append(LIST_DELETE_ALL, _T("Delete &all items"));
|
||||||
menuList->AppendSeparator();
|
menuList->AppendSeparator();
|
||||||
menuList->Append(LIST_TOGGLE_MULTI_SEL, _T("&Multiple selection\tCtrl-M"),
|
menuList->Append(LIST_TOGGLE_MULTI_SEL, _T("&Multiple selection\tCtrl-M"),
|
||||||
@@ -197,7 +199,7 @@ MyFrame::MyFrame(const wxChar *title, int x, int y, int w, int h)
|
|||||||
|
|
||||||
m_listCtrl = new MyListCtrl(this, LIST_CTRL,
|
m_listCtrl = new MyListCtrl(this, LIST_CTRL,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxLC_LIST |
|
wxLC_REPORT | //wxLC_LIST |
|
||||||
wxSUNKEN_BORDER |
|
wxSUNKEN_BORDER |
|
||||||
wxLC_EDIT_LABELS |
|
wxLC_EDIT_LABELS |
|
||||||
wxLC_SINGLE_SEL
|
wxLC_SINGLE_SEL
|
||||||
@@ -209,11 +211,16 @@ MyFrame::MyFrame(const wxChar *title, int x, int y, int w, int h)
|
|||||||
|
|
||||||
m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_logWindow));
|
m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_logWindow));
|
||||||
|
|
||||||
|
#if 0
|
||||||
for ( int i = 0; i < 30; i++ )
|
for ( int i = 0; i < 30; i++ )
|
||||||
{
|
{
|
||||||
long idx = m_listCtrl->InsertItem(i, wxString::Format(_T("Item %d"), i));
|
long idx = m_listCtrl->InsertItem(i, wxString::Format(_T("Item %d"), i));
|
||||||
m_listCtrl->SetItemData(idx, i*i);
|
m_listCtrl->SetItemData(idx, i*i);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
wxCommandEvent event;
|
||||||
|
OnReportView(event);
|
||||||
|
#endif
|
||||||
|
|
||||||
CreateStatusBar(3);
|
CreateStatusBar(3);
|
||||||
}
|
}
|
||||||
@@ -410,7 +417,6 @@ void MyFrame::OnSmallIconTextView(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
void MyFrame::OnVirtualView(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnVirtualView(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
#ifdef __WXMSW__
|
|
||||||
m_logWindow->Clear();
|
m_logWindow->Clear();
|
||||||
|
|
||||||
// we really have to recreate it
|
// we really have to recreate it
|
||||||
@@ -431,9 +437,8 @@ void MyFrame::OnVirtualView(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
m_listCtrl->SetItemCount(1000000);
|
m_listCtrl->SetItemCount(1000000);
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
SendSizeEvent();
|
SendSizeEvent();
|
||||||
#else
|
|
||||||
wxLogError(_T("Sorry, not implemented"));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,16 +476,16 @@ void MyFrame::OnToggleMultiSel(wxCommandEvent& WXUNUSED(event))
|
|||||||
long flags = m_listCtrl->GetWindowStyleFlag();
|
long flags = m_listCtrl->GetWindowStyleFlag();
|
||||||
if ( flags & wxLC_SINGLE_SEL )
|
if ( flags & wxLC_SINGLE_SEL )
|
||||||
{
|
{
|
||||||
|
m_logWindow->WriteText("multiple\n");
|
||||||
m_listCtrl->SetWindowStyleFlag(flags & ~wxLC_SINGLE_SEL);
|
m_listCtrl->SetWindowStyleFlag(flags & ~wxLC_SINGLE_SEL);
|
||||||
m_logWindow->WriteText("multiple");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
m_logWindow->WriteText("single\n");
|
||||||
m_listCtrl->SetWindowStyleFlag(flags | wxLC_SINGLE_SEL);
|
m_listCtrl->SetWindowStyleFlag(flags | wxLC_SINGLE_SEL);
|
||||||
m_logWindow->WriteText("single");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_logWindow->WriteText("\nRecreate the control now\n");
|
m_logWindow->WriteText("Recreate the control now\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnSetFgColour(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnSetFgColour(wxCommandEvent& WXUNUSED(event))
|
||||||
@@ -495,6 +500,11 @@ void MyFrame::OnSetBgColour(wxCommandEvent& WXUNUSED(event))
|
|||||||
m_listCtrl->Refresh();
|
m_listCtrl->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnAdd(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
m_listCtrl->InsertItem(m_listCtrl->GetItemCount(), _T("Appended item"));
|
||||||
|
}
|
||||||
|
|
||||||
void MyFrame::OnDelete(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnDelete(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
if ( m_listCtrl->GetItemCount() )
|
if ( m_listCtrl->GetItemCount() )
|
||||||
|
@@ -76,6 +76,7 @@ public:
|
|||||||
void OnToggleFirstSel(wxCommandEvent& event);
|
void OnToggleFirstSel(wxCommandEvent& event);
|
||||||
void OnDeselectAll(wxCommandEvent& event);
|
void OnDeselectAll(wxCommandEvent& event);
|
||||||
void OnSelectAll(wxCommandEvent& event);
|
void OnSelectAll(wxCommandEvent& event);
|
||||||
|
void OnAdd(wxCommandEvent& event);
|
||||||
void OnDelete(wxCommandEvent& event);
|
void OnDelete(wxCommandEvent& event);
|
||||||
void OnDeleteAll(wxCommandEvent& event);
|
void OnDeleteAll(wxCommandEvent& event);
|
||||||
void OnSort(wxCommandEvent& event);
|
void OnSort(wxCommandEvent& event);
|
||||||
@@ -99,20 +100,22 @@ private:
|
|||||||
// IDs for the menu commands
|
// IDs for the menu commands
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
LIST_ABOUT,
|
||||||
LIST_QUIT,
|
LIST_QUIT,
|
||||||
|
|
||||||
LIST_LIST_VIEW,
|
LIST_LIST_VIEW,
|
||||||
LIST_ICON_VIEW,
|
LIST_ICON_VIEW,
|
||||||
LIST_ICON_TEXT_VIEW,
|
LIST_ICON_TEXT_VIEW,
|
||||||
LIST_SMALL_ICON_VIEW,
|
LIST_SMALL_ICON_VIEW,
|
||||||
LIST_SMALL_ICON_TEXT_VIEW,
|
LIST_SMALL_ICON_TEXT_VIEW,
|
||||||
|
LIST_REPORT_VIEW,
|
||||||
LIST_VIRTUAL_VIEW,
|
LIST_VIRTUAL_VIEW,
|
||||||
|
|
||||||
LIST_REPORT_VIEW,
|
|
||||||
LIST_DESELECT_ALL,
|
LIST_DESELECT_ALL,
|
||||||
LIST_SELECT_ALL,
|
LIST_SELECT_ALL,
|
||||||
LIST_ABOUT,
|
|
||||||
LIST_DELETE_ALL,
|
LIST_DELETE_ALL,
|
||||||
LIST_DELETE,
|
LIST_DELETE,
|
||||||
|
LIST_ADD,
|
||||||
LIST_SORT,
|
LIST_SORT,
|
||||||
LIST_SET_FG_COL,
|
LIST_SET_FG_COL,
|
||||||
LIST_SET_BG_COL,
|
LIST_SET_BG_COL,
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user