+void MyFrame::OnFind(wxCommandEvent& WXUNUSED(event))
+{
+ wxStopWatch sw;
+
+ const int itemCount = m_listCtrl->GetItemCount();
+ for ( int i = 0; i < itemCount; i++ )
+ m_listCtrl->FindItem(-1, i);
+
+ wxLogMessage("Calling Find() for all %d items took %ld ms",
+ itemCount, sw.Time());
+}
+
+void MyFrame::OnShowSelInfo(wxCommandEvent& WXUNUSED(event))
+{
+ int selCount = m_listCtrl->GetSelectedItemCount();
+ wxLogMessage(_T("%d items selected:"), selCount);
+
+ // don't show too many items
+ size_t shownCount = 0;
+
+ long item = m_listCtrl->GetNextItem(-1, wxLIST_NEXT_ALL,
+ wxLIST_STATE_SELECTED);
+ while ( item != -1 )
+ {
+ wxLogMessage(_T("\t%ld (%s)"),
+ item, m_listCtrl->GetItemText(item).c_str());
+
+ if ( ++shownCount > 10 )
+ {
+ wxLogMessage(_T("\t... more selected items snipped..."));
+ break;
+ }
+
+ item = m_listCtrl->GetNextItem(item, wxLIST_NEXT_ALL,
+ wxLIST_STATE_SELECTED);
+ }
+}
+
+void MyFrame::OnShowViewRect(wxCommandEvent& WXUNUSED(event))
+{
+ const wxRect r = m_listCtrl->GetViewRect();
+ wxLogMessage("View rect: (%d, %d)-(%d, %d)",
+ r.GetLeft(), r.GetTop(), r.GetRight(), r.GetBottom());
+}
+
+// ----------------------------------------------------------------------------
+// column order tests
+// ----------------------------------------------------------------------------
+
+#ifdef wxHAS_LISTCTRL_COLUMN_ORDER
+
+static wxString DumpIntArray(const wxArrayInt& a)
+{
+ wxString s("{ ");
+ const size_t count = a.size();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ if ( n )
+ s += ", ";
+ s += wxString::Format("%lu", (unsigned long)a[n]);
+ }
+
+ s += " }";
+
+ return s;
+}
+
+void MyFrame::OnSetColOrder(wxCommandEvent& WXUNUSED(event))
+{
+ wxArrayInt order(3);
+ order[0] = 2;
+ order[1] = 0;
+ order[2] = 1;
+ if ( m_listCtrl->SetColumnsOrder(order) )
+ wxLogMessage("Column order set to %s", DumpIntArray(order));
+}
+
+void MyFrame::OnGetColOrder(wxCommandEvent& WXUNUSED(event))
+{
+ // show what GetColumnsOrder() returns
+ const wxArrayInt order = m_listCtrl->GetColumnsOrder();
+ wxString msg = "Columns order: " +
+ DumpIntArray(m_listCtrl->GetColumnsOrder()) + "\n";
+
+ int n;
+ const int count = m_listCtrl->GetColumnCount();
+
+ // show the results of GetColumnOrder() for each column
+ msg += "GetColumnOrder() results:\n";
+ for ( n = 0; n < count; n++ )
+ {
+ msg += wxString::Format(" %2d -> %2d\n",
+ n, m_listCtrl->GetColumnOrder(n));
+ }
+
+ // and the results of GetColumnIndexFromOrder() too
+ msg += "GetColumnIndexFromOrder() results:\n";
+ for ( n = 0; n < count; n++ )
+ {
+ msg += wxString::Format(" %2d -> %2d\n",
+ n, m_listCtrl->GetColumnIndexFromOrder(n));
+ }
+
+ wxLogMessage("%s", msg);
+}
+
+#endif // wxHAS_LISTCTRL_COLUMN_ORDER
+
+void MyFrame::OnShowColInfo(wxCommandEvent& WXUNUSED(event))