]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/listbox/lboxtest.cpp
VideoMode/Display split, TRUE->true and FALSE->false replacements.
[wxWidgets.git] / samples / listbox / lboxtest.cpp
index 85e68327519f857cac5d08802d9b521e00119a30..751a5a18ce604489e9755c84b744600eb23af44a 100644 (file)
@@ -38,6 +38,7 @@
 
 // for all others, include the necessary headers
 #ifndef WX_PRECOMP
+    #include "wx/wx.h"
     #include "wx/app.h"
     #include "wx/frame.h"
     #include "wx/dcclient.h"
@@ -187,7 +188,7 @@ private:
     // the log target we use to redirect messages to the listbox
     wxLog *m_logTarget;
 
-    // any class wishing to process wxWindows events must use this macro
+    // any class wishing to process wxWidgets events must use this macro
     DECLARE_EVENT_TABLE()
 };
 
@@ -227,7 +228,7 @@ private:
         }
     }
 
-    virtual void DoLogString(const wxChar *szString, time_t t)
+    virtual void DoLogString(const wxChar *szString, time_t WXUNUSED(t))
     {
         wxString msg;
         TimeStamp(&msg);
@@ -257,11 +258,6 @@ private:
 
 IMPLEMENT_APP(LboxTestApp)
 
-#ifdef __WXUNIVERSAL__
-    WX_USE_THEME(win32);
-    WX_USE_THEME(gtk);
-#endif // __WXUNIVERSAL__
-
 // ----------------------------------------------------------------------------
 // event tables
 // ----------------------------------------------------------------------------
@@ -294,9 +290,9 @@ BEGIN_EVENT_TABLE(LboxTestFrame, wxFrame)
     EVT_UPDATE_UI(LboxTest_DeleteSel, LboxTestFrame::OnUpdateUIDeleteSelButton)
 
     EVT_LISTBOX(LboxTest_Listbox, LboxTestFrame::OnListbox)
-    EVT_LISTBOX_DCLICK(-1, LboxTestFrame::OnListboxDClick)
-    EVT_CHECKBOX(-1, LboxTestFrame::OnCheckOrRadioBox)
-    EVT_RADIOBOX(-1, LboxTestFrame::OnCheckOrRadioBox)
+    EVT_LISTBOX_DCLICK(wxID_ANY, LboxTestFrame::OnListboxDClick)
+    EVT_CHECKBOX(wxID_ANY, LboxTestFrame::OnCheckOrRadioBox)
+    EVT_RADIOBOX(wxID_ANY, LboxTestFrame::OnCheckOrRadioBox)
 END_EVENT_TABLE()
 
 // ============================================================================
@@ -315,7 +311,7 @@ bool LboxTestApp::OnInit()
     //wxLog::AddTraceMask(_T("listbox"));
     wxLog::AddTraceMask(_T("scrollbar"));
 
-    return TRUE;
+    return true;
 }
 
 // ----------------------------------------------------------------------------
@@ -323,10 +319,10 @@ bool LboxTestApp::OnInit()
 // ----------------------------------------------------------------------------
 
 LboxTestFrame::LboxTestFrame(const wxString& title)
-             : wxFrame(NULL, -1, title, wxPoint(100, 100))
+             : wxFrame(NULL, wxID_ANY, title, wxPoint(100, 100))
 {
     // init everything
-    m_dirty = FALSE;
+    m_dirty = false;
     m_radioSelMode = (wxRadioBox *)NULL;
 
     m_chkVScroll =
@@ -339,7 +335,7 @@ LboxTestFrame::LboxTestFrame(const wxString& title)
 
     m_logTarget = (wxLog *)NULL;
 
-    wxPanel *panel = new wxPanel(this, -1);
+    wxPanel *panel = new wxPanel(this, wxID_ANY);
 
     /*
        What we create here is a frame having 3 panes: the explanatory pane to
@@ -360,15 +356,15 @@ LboxTestFrame::LboxTestFrame(const wxString& title)
         _T("multiple"),
     };
 
-    wxStaticBox *box = new wxStaticBox(panel, -1, _T("&Set listbox parameters"));
-    m_radioSelMode = new wxRadioBox(panel, -1, _T("Selection &mode:"),
+    wxStaticBox *box = new wxStaticBox(panel, wxID_ANY, _T("&Set listbox parameters"));
+    m_radioSelMode = new wxRadioBox(panel, wxID_ANY, _T("Selection &mode:"),
                                     wxDefaultPosition, wxDefaultSize,
                                     WXSIZEOF(modes), modes,
                                     1, wxRA_SPECIFY_COLS);
 
-    m_chkVScroll = new wxCheckBox(panel, -1, _T("Always show &vertical scrollbar"));
-    m_chkHScroll = new wxCheckBox(panel, -1, _T("Show &horizontal scrollbar"));
-    m_chkSort = new wxCheckBox(panel, -1, _T("&Sort items"));
+    m_chkVScroll = new wxCheckBox(panel, wxID_ANY, _T("Always show &vertical scrollbar"));
+    m_chkHScroll = new wxCheckBox(panel, wxID_ANY, _T("Show &horizontal scrollbar"));
+    m_chkSort = new wxCheckBox(panel, wxID_ANY, _T("&Sort items"));
 
     sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
 
@@ -386,7 +382,7 @@ LboxTestFrame::LboxTestFrame(const wxString& title)
     sizerLeft->Add(sizerBtn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
 
     // middle pane
-    wxStaticBox *box2 = new wxStaticBox(panel, -1, _T("&Change listbox contents"));
+    wxStaticBox *box2 = new wxStaticBox(panel, wxID_ANY, _T("&Change listbox contents"));
     wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
 
     wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL);
@@ -439,10 +435,10 @@ LboxTestFrame::LboxTestFrame(const wxString& title)
     // the lower one only has the log listbox and a button to clear it
     wxSizer *sizerDown = new wxStaticBoxSizer
                              (
-                               new wxStaticBox(panel, -1, _T("&Log window")),
+                               new wxStaticBox(panel, wxID_ANY, _T("&Log window")),
                                wxVERTICAL
                              );
-    m_lboxLog = new wxListBox(panel, -1);
+    m_lboxLog = new wxListBox(panel, wxID_ANY);
     sizerDown->Add(m_lboxLog, 1, wxGROW | wxALL, 5);
     wxBoxSizer *sizerBtns = new wxBoxSizer(wxHORIZONTAL);
     btn = new wxButton(panel, LboxTest_ClearLog, _T("Clear &log"));
@@ -459,9 +455,9 @@ LboxTestFrame::LboxTestFrame(const wxString& title)
 
     // final initialization
     Reset();
-    m_dirty = FALSE;
+    m_dirty = false;
 
-    panel->SetAutoLayout(TRUE);
+    panel->SetAutoLayout(true);
     panel->SetSizer(sizerTop);
 
     sizerTop->Fit(this);
@@ -494,11 +490,11 @@ void LboxTestFrame::Reset()
     }
 
     m_radioSelMode->SetSelection(LboxSel_Single);
-    m_chkSort->SetValue(FALSE);
-    m_chkHScroll->SetValue(TRUE);
-    m_chkVScroll->SetValue(FALSE);
+    m_chkSort->SetValue(false);
+    m_chkHScroll->SetValue(true);
+    m_chkVScroll->SetValue(false);
 
-    m_dirty = TRUE;
+    m_dirty = true;
 }
 
 void LboxTestFrame::CreateLbox()
@@ -530,11 +526,11 @@ void LboxTestFrame::CreateLbox()
             items.Add(m_lbox->GetString(n));
         }
 
-        m_sizerLbox->Remove(m_lbox);
+        m_sizerLbox->Detach(m_lbox);
         delete m_lbox;
     }
 
-    m_lbox = new wxListBox(this, -1,
+    m_lbox = new wxListBox(this, wxID_ANY,
                            wxDefaultPosition, wxDefaultSize,
                            0, NULL,
                            flags);
@@ -542,7 +538,7 @@ void LboxTestFrame::CreateLbox()
     m_sizerLbox->Add(m_lbox, 1, wxGROW | wxALL, 5);
     m_sizerLbox->Layout();
 
-    m_dirty = FALSE;
+    m_dirty = false;
 }
 
 // ----------------------------------------------------------------------------
@@ -597,17 +593,17 @@ void LboxTestFrame::OnButtonDeleteSel(wxCommandEvent& WXUNUSED(event))
     }
 }
 
-void LboxTestFrame::OnButtonClear(wxCommandEvent& event)
+void LboxTestFrame::OnButtonClear(wxCommandEvent& WXUNUSED(event))
 {
     m_lbox->Clear();
 }
 
-void LboxTestFrame::OnButtonClearLog(wxCommandEvent& event)
+void LboxTestFrame::OnButtonClearLog(wxCommandEvent& WXUNUSED(event))
 {
     m_lboxLog->Clear();
 }
 
-void LboxTestFrame::OnButtonAdd(wxCommandEvent& event)
+void LboxTestFrame::OnButtonAdd(wxCommandEvent& WXUNUSED(event))
 {
     static size_t s_item = 0;
 
@@ -630,7 +626,7 @@ void LboxTestFrame::OnButtonAddMany(wxCommandEvent& WXUNUSED(event))
     }
 }
 
-void LboxTestFrame::OnButtonAddSeveral(wxCommandEvent& event)
+void LboxTestFrame::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event))
 {
     wxArrayString items;
     items.Add(_T("First"));
@@ -670,18 +666,19 @@ void LboxTestFrame::OnUpdateUIAddSeveral(wxUpdateUIEvent& event)
 void LboxTestFrame::OnListbox(wxCommandEvent& event)
 {
     int sel = event.GetInt();
-    m_textDelete->SetValue(wxString::Format(_T("%ld"), sel));
+    m_textDelete->SetValue(wxString::Format(_T("%d"), sel));
 
     wxLogMessage(_T("Listbox item %d selected"), sel);
 }
 
 void LboxTestFrame::OnListboxDClick(wxCommandEvent& event)
 {
-    wxLogMessage(_T("Listbox item %d double clicked"), event.GetInt());
+    int sel = event.GetInt();
+    wxLogMessage(_T("Listbox item %d double clicked"), sel);
 }
 
-void LboxTestFrame::OnCheckOrRadioBox(wxCommandEvent& event)
+void LboxTestFrame::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
 {
-    m_dirty = TRUE;
+    m_dirty = true;
 }