WxListView2Frame::WxListView2Frame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title)
{
// Create a top-level panel to hold all the contents of the frame
wxPanel* panel = new wxPanel(this, wxID_ANY);
// Create a wxListView control with one column.
// The default style is wxLC_REPORT so columns need
// to be added explicitly.
wxListView* listView = new wxListView(panel, wxID_ANY,
wxDefaultPosition, wxSize(250, 200));
listView->AppendColumn("Column 1");
listView->AppendColumn("Column 2");
// Add three items to the list
listView->InsertItem(0, "Item 1");
listView->SetItem(0, 1, "Amber");
listView->InsertItem(1, "Item 2");
listView->SetItem(1, 1, "Blue");
listView->InsertItem(2, "Item 3");
listView->SetItem(2, 1, "Cyan");
// Set up the sizer for the panel
wxBoxSizer* panelSizer = new wxBoxSizer(wxHORIZONTAL);
panelSizer->Add(listView, 1, wxEXPAND);
panel->SetSizer(panelSizer);
// Set up the sizer for the frame and resize the frame
// according to its contents
wxBoxSizer* topSizer = new wxBoxSizer(wxHORIZONTAL);
topSizer->Add(panel, 1, wxEXPAND);
SetSizerAndFit(topSizer);
}