]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/listctrl/listtest.cpp
Added wxQuantize
[wxWidgets.git] / samples / listctrl / listtest.cpp
index c9462339ddf61ec1dd5920fd026c5e13eecbd7de..b440b9eaf75a61e6918f847c7a62728f1e810bc2 100644 (file)
@@ -78,6 +78,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
     EVT_MENU(LIST_THAW, MyFrame::OnThaw)
 
     EVT_UPDATE_UI(LIST_SHOW_COL_INFO, MyFrame::OnUpdateShowColInfo)
+    EVT_UPDATE_UI(LIST_TOGGLE_MULTI_SEL, MyFrame::OnUpdateToggleMultiSel)    
 END_EVENT_TABLE()
 
 BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl)
@@ -132,16 +133,16 @@ bool MyApp::OnInit()
   MyFrame *frame = new MyFrame(wxT("wxListCtrl Test"), 50, 50, 450, 340);
 
   // Show the frame
-  frame->Show(TRUE);
+  frame->Show(true);
 
   SetTopWindow(frame);
 
-  return TRUE;
+  return true;
 }
 
 // My frame constructor
 MyFrame::MyFrame(const wxChar *title, int x, int y, int w, int h)
-       : wxFrame((wxFrame *)NULL, -1, title, wxPoint(x, y), wxSize(w, h))
+       : wxFrame((wxFrame *)NULL, wxID_ANY, title, wxPoint(x, y), wxSize(w, h))
 {
     m_listCtrl = (MyListCtrl *) NULL;
     m_logWindow = (wxTextCtrl *) NULL;
@@ -150,8 +151,8 @@ MyFrame::MyFrame(const wxChar *title, int x, int y, int w, int h)
     SetIcon( wxICON(mondrian) );
 
     // Make an image list containing large icons
-    m_imageListNormal = new wxImageList(32, 32, TRUE);
-    m_imageListSmall = new wxImageList(16, 16, TRUE);
+    m_imageListNormal = new wxImageList(32, 32, true);
+    m_imageListSmall = new wxImageList(16, 16, true);
 
 #ifdef __WXMSW__
     m_imageListNormal->Add( wxIcon(_T("icon1"), wxBITMAP_TYPE_ICO_RESOURCE) );
@@ -215,7 +216,7 @@ MyFrame::MyFrame(const wxChar *title, int x, int y, int w, int h)
     menuList->Append(LIST_THAW, _T("Tha&w\tCtrl-W"));
     menuList->AppendSeparator();
     menuList->Append(LIST_TOGGLE_MULTI_SEL, _T("&Multiple selection\tCtrl-M"),
-            _T("Toggle multiple selection"), TRUE);
+            _T("Toggle multiple selection"), true);
 
     wxMenu *menuCol = new wxMenu;
     menuCol->Append(LIST_SET_FG_COL, _T("&Foreground colour..."));
@@ -228,8 +229,8 @@ MyFrame::MyFrame(const wxChar *title, int x, int y, int w, int h)
     menubar->Append(menuCol, _T("&Colour"));
     SetMenuBar(menubar);
 
-    m_panel = new wxPanel(this, -1);
-    m_logWindow = new wxTextCtrl(m_panel, -1, wxEmptyString,
+    m_panel = new wxPanel(this, wxID_ANY);
+    m_logWindow = new wxTextCtrl(m_panel, wxID_ANY, wxEmptyString,
                                  wxDefaultPosition, wxDefaultSize,
                                  wxTE_MULTILINE | wxSUNKEN_BORDER);
 
@@ -237,7 +238,9 @@ MyFrame::MyFrame(const wxChar *title, int x, int y, int w, int h)
 
     RecreateList(wxLC_REPORT | wxLC_SINGLE_SEL);
 
+#if wxUSE_STATUSBAR
     CreateStatusBar(3);
+#endif // wxUSE_STATUSBAR
 }
 
 MyFrame::~MyFrame()
@@ -279,7 +282,7 @@ bool MyFrame::CheckNonVirtual() const
 
 void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
 {
-    Close(TRUE);
+    Close(true);
 }
 
 void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
@@ -372,7 +375,7 @@ void MyFrame::RecreateList(long flags, bool withText)
                 break;
 
             case wxLC_SMALL_ICON:
-                InitWithIconItems(withText, TRUE);
+                InitWithIconItems(withText, true);
                 break;
 
             case wxLC_REPORT:
@@ -489,7 +492,7 @@ void MyFrame::InitWithIconItems(bool withText, bool sameIcon)
 
 void MyFrame::OnIconView(wxCommandEvent& WXUNUSED(event))
 {
-    RecreateList(wxLC_ICON, FALSE);
+    RecreateList(wxLC_ICON, false);
 }
 
 void MyFrame::OnIconTextView(wxCommandEvent& WXUNUSED(event))
@@ -499,7 +502,7 @@ void MyFrame::OnIconTextView(wxCommandEvent& WXUNUSED(event))
 
 void MyFrame::OnSmallIconView(wxCommandEvent& WXUNUSED(event))
 {
-    RecreateList(wxLC_SMALL_ICON, FALSE);
+    RecreateList(wxLC_SMALL_ICON, false);
 }
 
 void MyFrame::OnSmallIconTextView(wxCommandEvent& WXUNUSED(event))
@@ -591,6 +594,11 @@ void MyFrame::OnToggleMultiSel(wxCommandEvent& WXUNUSED(event))
     RecreateList(flags);
 }
 
+void MyFrame::OnUpdateToggleMultiSel(wxUpdateUIEvent& event)
+{
+     event.Check((m_listCtrl->GetWindowStyleFlag() & wxLC_SINGLE_SEL) == 0);
+}
+
 void MyFrame::OnSetFgColour(wxCommandEvent& WXUNUSED(event))
 {
     m_listCtrl->SetForegroundColour(wxGetColourFromUser(this));