- // Make a menubar
- wxMenu *file_menu = new wxMenu;
-
- file_menu->Append(LIST_LIST_VIEW, "&List view");
- file_menu->Append(LIST_REPORT_VIEW, "&Report view");
- file_menu->Append(LIST_ICON_VIEW, "&Icon view");
- 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_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->Append(LIST_DELETE_ALL, "Delete &all items");
- file_menu->AppendSeparator();
- file_menu->Append(BUSY_ON, "&Busy cursor on");
- file_menu->Append(BUSY_OFF, "&Busy cursor off");
- file_menu->AppendSeparator();
- file_menu->Append(LIST_ABOUT, "&About");
- file_menu->Append(LIST_QUIT, "E&xit");
- wxMenuBar *menu_bar = new wxMenuBar;
- menu_bar->Append(file_menu, "&File");
- frame->SetMenuBar(menu_bar);
-
- // Make a panel with a message
- frame->m_listCtrl = new MyListCtrl(frame, LIST_CTRL, wxPoint(0, 0), wxSize(400, 200),
- wxLC_LIST|wxSUNKEN_BORDER|wxLC_EDIT_LABELS);
-// wxLC_LIST|wxLC_USER_TEXT|wxSUNKEN_BORDER); // wxLC_USER_TEXT requires app to supply all text on demand
- frame->m_logWindow = new wxTextCtrl(frame, -1, "", wxPoint(0, 0), wxSize(400, 200), wxTE_MULTILINE|wxSUNKEN_BORDER);
-
- wxLayoutConstraints *c = new wxLayoutConstraints;
- c->top.SameAs (frame, wxTop);
- c->left.SameAs (frame, wxLeft);
- c->right.SameAs (frame, wxRight);
- c->height.PercentOf (frame, wxHeight, 66);
- frame->m_listCtrl->SetConstraints(c);
-
- c = new wxLayoutConstraints;
- c->top.Below (frame->m_listCtrl);
- c->left.SameAs (frame, wxLeft);
- c->right.SameAs (frame, wxRight);
- c->bottom.SameAs (frame, wxBottom);
- frame->m_logWindow->SetConstraints(c);
- frame->SetAutoLayout(TRUE);
-
- for ( int i=0; i < 30; i++)
- {
- wxChar buf[20];
- wxSprintf(buf, _T("Item %d"), i);
- frame->m_listCtrl->InsertItem(i, buf);
- }
+ // Make a menubar
+ wxMenu *menuFile = new wxMenu;
+ menuFile->Append(LIST_ABOUT, _T("&About"));
+ menuFile->AppendSeparator();
+ menuFile->Append(LIST_QUIT, _T("E&xit\tAlt-X"));
+
+ wxMenu *menuView = new wxMenu;
+ menuView->Append(LIST_LIST_VIEW, _T("&List view\tF1"));
+ menuView->Append(LIST_REPORT_VIEW, _T("&Report view\tF2"));
+ menuView->Append(LIST_ICON_VIEW, _T("&Icon view\tF3"));
+ menuView->Append(LIST_ICON_TEXT_VIEW, _T("Icon view with &text\tF4"));
+ menuView->Append(LIST_SMALL_ICON_VIEW, _T("&Small icon view\tF5"));
+ menuView->Append(LIST_SMALL_ICON_TEXT_VIEW, _T("Small icon &view with text\tF6"));
+ menuView->Append(LIST_VIRTUAL_VIEW, _T("&Virtual view\tF7"));
+ menuView->Append(LIST_SMALL_VIRTUAL_VIEW, _T("Small virtual vie&w\tF8"));
+
+ wxMenu *menuList = new wxMenu;
+ menuList->Append(LIST_FOCUS_LAST, _T("&Make last item current\tCtrl-L"));
+ menuList->Append(LIST_TOGGLE_FIRST, _T("To&ggle first item\tCtrl-G"));
+ menuList->Append(LIST_DESELECT_ALL, _T("&Deselect All\tCtrl-D"));
+ menuList->Append(LIST_SELECT_ALL, _T("S&elect All\tCtrl-A"));
+ menuList->AppendSeparator();
+ menuList->Append(LIST_SHOW_COL_INFO, _T("Show &column info\tCtrl-C"));
+ menuList->Append(LIST_SHOW_SEL_INFO, _T("Show &selected items\tCtrl-S"));
+ menuList->AppendSeparator();
+ menuList->Append(LIST_SORT, _T("&Sort\tCtrl-S"));
+ menuList->AppendSeparator();
+ menuList->Append(LIST_ADD, _T("&Append an item\tCtrl-P"));
+ menuList->Append(LIST_EDIT, _T("&Edit the item\tCtrl-E"));
+ menuList->Append(LIST_DELETE, _T("&Delete first item\tCtrl-X"));
+ menuList->Append(LIST_DELETE_ALL, _T("Delete &all items"));
+ menuList->AppendSeparator();
+ menuList->Append(LIST_FREEZE, _T("Free&ze\tCtrl-Z"));
+ menuList->Append(LIST_THAW, _T("Tha&w\tCtrl-W"));
+ menuList->AppendSeparator();
+ menuList->AppendCheckItem(LIST_TOGGLE_LINES, _T("Toggle &lines\tCtrl-I"));
+ menuList->Append(LIST_TOGGLE_MULTI_SEL, _T("&Multiple selection\tCtrl-M"),
+ _T("Toggle multiple selection"), true);
+
+ wxMenu *menuCol = new wxMenu;
+ menuCol->Append(LIST_SET_FG_COL, _T("&Foreground colour..."));
+ menuCol->Append(LIST_SET_BG_COL, _T("&Background colour..."));
+
+ wxMenuBar *menubar = new wxMenuBar;
+ menubar->Append(menuFile, _T("&File"));
+ menubar->Append(menuView, _T("&View"));
+ menubar->Append(menuList, _T("&List"));
+ menubar->Append(menuCol, _T("&Colour"));
+ SetMenuBar(menubar);
+
+ m_panel = new wxPanel(this, wxID_ANY);
+ m_logWindow = new wxTextCtrl(m_panel, wxID_ANY, wxEmptyString,
+ wxDefaultPosition, wxDefaultSize,
+ wxTE_MULTILINE | wxSUNKEN_BORDER);
+
+ m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_logWindow));
+
+ RecreateList(wxLC_REPORT | wxLC_SINGLE_SEL);
+
+#if wxUSE_STATUSBAR
+ CreateStatusBar(3);
+#endif // wxUSE_STATUSBAR
+}