+ // Create the main frame window
+ MyFrame *frame = new MyFrame(wxT("wxListCtrl Test"));
+
+ // Show the frame
+ frame->Show(true);
+
+ return true;
+}
+
+
+
+// ----------------------------------------------------------------------------
+// MyFrame
+// ----------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+ EVT_SIZE(MyFrame::OnSize)
+
+ EVT_MENU(LIST_QUIT, MyFrame::OnQuit)
+ EVT_MENU(LIST_ABOUT, MyFrame::OnAbout)
+ EVT_MENU(LIST_LIST_VIEW, MyFrame::OnListView)
+ EVT_MENU(LIST_REPORT_VIEW, MyFrame::OnReportView)
+ EVT_MENU(LIST_ICON_VIEW, MyFrame::OnIconView)
+ EVT_MENU(LIST_ICON_TEXT_VIEW, MyFrame::OnIconTextView)
+ EVT_MENU(LIST_SMALL_ICON_VIEW, MyFrame::OnSmallIconView)
+ EVT_MENU(LIST_SMALL_ICON_TEXT_VIEW, MyFrame::OnSmallIconTextView)
+ EVT_MENU(LIST_VIRTUAL_VIEW, MyFrame::OnVirtualView)
+ EVT_MENU(LIST_SMALL_VIRTUAL_VIEW, MyFrame::OnSmallVirtualView)
+
+ EVT_MENU(LIST_SET_ITEMS_COUNT, MyFrame::OnSetItemsCount)
+
+ EVT_MENU(LIST_GOTO, MyFrame::OnGoTo)
+ EVT_MENU(LIST_FOCUS_LAST, MyFrame::OnFocusLast)
+ EVT_MENU(LIST_TOGGLE_FIRST, MyFrame::OnToggleFirstSel)
+ EVT_MENU(LIST_DESELECT_ALL, MyFrame::OnDeselectAll)
+ EVT_MENU(LIST_SELECT_ALL, MyFrame::OnSelectAll)
+ EVT_MENU(LIST_DELETE, MyFrame::OnDelete)
+ EVT_MENU(LIST_ADD, MyFrame::OnAdd)
+ EVT_MENU(LIST_EDIT, MyFrame::OnEdit)
+ EVT_MENU(LIST_DELETE_ALL, MyFrame::OnDeleteAll)
+ EVT_MENU(LIST_SORT, MyFrame::OnSort)
+ EVT_MENU(LIST_SET_FG_COL, MyFrame::OnSetFgColour)
+ EVT_MENU(LIST_SET_BG_COL, MyFrame::OnSetBgColour)
+ EVT_MENU(LIST_ROW_LINES, MyFrame::OnSetRowLines)
+ EVT_MENU(LIST_TOGGLE_MULTI_SEL, MyFrame::OnToggleMultiSel)
+ EVT_MENU(LIST_SHOW_COL_INFO, MyFrame::OnShowColInfo)
+ EVT_MENU(LIST_SHOW_SEL_INFO, MyFrame::OnShowSelInfo)
+ EVT_MENU(LIST_SHOW_VIEW_RECT, MyFrame::OnShowViewRect)
+#ifdef wxHAS_LISTCTRL_COLUMN_ORDER
+ EVT_MENU(LIST_SET_COL_ORDER, MyFrame::OnSetColOrder)
+ EVT_MENU(LIST_GET_COL_ORDER, MyFrame::OnGetColOrder)
+#endif // wxHAS_LISTCTRL_COLUMN_ORDER
+ EVT_MENU(LIST_FREEZE, MyFrame::OnFreeze)
+ EVT_MENU(LIST_THAW, MyFrame::OnThaw)
+ EVT_MENU(LIST_TOGGLE_LINES, MyFrame::OnToggleLines)
+ EVT_MENU(LIST_TOGGLE_HEADER, MyFrame::OnToggleHeader)
+ EVT_MENU(LIST_TOGGLE_BELL, MyFrame::OnToggleBell)
+#ifdef __WXOSX__
+ EVT_MENU(LIST_MAC_USE_GENERIC, MyFrame::OnToggleMacUseGeneric)
+#endif // __WXOSX__
+ EVT_MENU(LIST_FIND, MyFrame::OnFind)
+
+ EVT_UPDATE_UI(LIST_SHOW_COL_INFO, MyFrame::OnUpdateUIEnableInReport)
+ EVT_UPDATE_UI(LIST_TOGGLE_HEADER, MyFrame::OnUpdateUIEnableInReport)
+
+ EVT_UPDATE_UI(LIST_TOGGLE_MULTI_SEL, MyFrame::OnUpdateToggleMultiSel)
+ EVT_UPDATE_UI(LIST_TOGGLE_HEADER, MyFrame::OnUpdateToggleHeader)
+ EVT_UPDATE_UI(LIST_ROW_LINES, MyFrame::OnUpdateRowLines)
+END_EVENT_TABLE()
+
+// My frame constructor
+MyFrame::MyFrame(const wxChar *title)
+ : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600, 500))
+{
+ m_listCtrl = NULL;
+ m_logWindow = NULL;
+ m_smallVirtual = false;
+ m_numListItems = 10;
+
+ // Give it an icon
+ SetIcon(wxICON(sample));
+
+ // Make an image list containing large icons
+ m_imageListNormal = new wxImageList(32, 32, true);
+ m_imageListSmall = new wxImageList(16, 16, true);
+
+#ifdef wxHAS_IMAGES_IN_RESOURCES
+ m_imageListNormal->Add( wxIcon(wxT("icon1"), wxBITMAP_TYPE_ICO_RESOURCE) );
+ m_imageListNormal->Add( wxIcon(wxT("icon2"), wxBITMAP_TYPE_ICO_RESOURCE) );
+ m_imageListNormal->Add( wxIcon(wxT("icon3"), wxBITMAP_TYPE_ICO_RESOURCE) );
+ m_imageListNormal->Add( wxIcon(wxT("icon4"), wxBITMAP_TYPE_ICO_RESOURCE) );
+ m_imageListNormal->Add( wxIcon(wxT("icon5"), wxBITMAP_TYPE_ICO_RESOURCE) );
+ m_imageListNormal->Add( wxIcon(wxT("icon6"), wxBITMAP_TYPE_ICO_RESOURCE) );
+ m_imageListNormal->Add( wxIcon(wxT("icon7"), wxBITMAP_TYPE_ICO_RESOURCE) );
+ m_imageListNormal->Add( wxIcon(wxT("icon8"), wxBITMAP_TYPE_ICO_RESOURCE) );
+ m_imageListNormal->Add( wxIcon(wxT("icon9"), wxBITMAP_TYPE_ICO_RESOURCE) );
+
+ m_imageListSmall->Add( wxIcon(wxT("iconsmall"), wxBITMAP_TYPE_ICO_RESOURCE) );