]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/listbox.cpp
Needed adv library for xrcdemo
[wxWidgets.git] / samples / widgets / listbox.cpp
index 7541db358b8cb88c48e89e5e87da1935770c63f6..dc87d04c5bcab8b79a055c647bd56f9f4eec741e 100644 (file)
@@ -28,6 +28,7 @@
 #ifndef WX_PRECOMP
     #include "wx/log.h"
 
+    #include "wx/bitmap.h"
     #include "wx/button.h"
     #include "wx/checkbox.h"
     #include "wx/combobox.h"
@@ -42,7 +43,7 @@
 #include "wx/checklst.h"
 
 #include "widgets.h"
-
+#if 1
 #include "icons/listbox.xpm"
 
 // ----------------------------------------------------------------------------
@@ -292,7 +293,7 @@ ListboxWidgetsPage::ListboxWidgetsPage(wxNotebook *notebook,
                            0, NULL,
                            wxLB_HSCROLL);
     sizerRight->Add(m_lbox, 1, wxGROW | wxALL, 5);
-    sizerRight->SetMinSize(250, 0);
+    sizerRight->SetMinSize(150, 0);
     m_sizerLbox = sizerRight; // save it to modify it later
 
     // the 3 panes panes compose the window
@@ -351,10 +352,11 @@ void ListboxWidgetsPage::CreateLbox()
             items.Add(m_lbox->GetString(n));
         }
 
-        m_sizerLbox->Remove(m_lbox);
+        m_sizerLbox->Detach( m_lbox );
         delete m_lbox;
     }
 
+#if wxUSE_CHECKLISTBOX
     if ( m_chkCheck->GetValue() )
     {
         m_lbox = new wxCheckListBox(this, ListboxPage_Listbox,
@@ -363,6 +365,7 @@ void ListboxWidgetsPage::CreateLbox()
                                     flags);
     }
     else // just a listbox
+#endif
     {
         m_lbox = new wxListBox(this, ListboxPage_Listbox,
                                wxDefaultPosition, wxDefaultSize,
@@ -419,14 +422,14 @@ void ListboxWidgetsPage::OnButtonDeleteSel(wxCommandEvent& WXUNUSED(event))
     }
 }
 
-void ListboxWidgetsPage::OnButtonClear(wxCommandEvent& event)
+void ListboxWidgetsPage::OnButtonClear(wxCommandEvent& WXUNUSED(event))
 {
     m_lbox->Clear();
 }
 
-void ListboxWidgetsPage::OnButtonAdd(wxCommandEvent& event)
+void ListboxWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event))
 {
-    static size_t s_item = 0;
+    static unsigned int s_item = 0;
 
     wxString s = m_textAdd->GetValue();
     if ( !m_textAdd->IsModified() )
@@ -441,13 +444,13 @@ void ListboxWidgetsPage::OnButtonAdd(wxCommandEvent& event)
 void ListboxWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event))
 {
     // "many" means 1000 here
-    for ( size_t n = 0; n < 1000; n++ )
+    for ( unsigned int n = 0; n < 1000; n++ )
     {
         m_lbox->Append(wxString::Format(_T("item #%u"), n));
     }
 }
 
-void ListboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& event)
+void ListboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event))
 {
     wxArrayString items;
     items.Add(_T("First"));
@@ -489,24 +492,25 @@ void ListboxWidgetsPage::OnUpdateUIAddSeveral(wxUpdateUIEvent& event)
 
 void ListboxWidgetsPage::OnListbox(wxCommandEvent& event)
 {
-    int sel = event.GetInt();
+    long sel = event.GetInt();
     m_textDelete->SetValue(wxString::Format(_T("%ld"), sel));
 
-    wxLogMessage(_T("Listbox item %d selected"), sel);
+    wxLogMessage(_T("Listbox item %ld selected"), sel);
 }
 
 void ListboxWidgetsPage::OnListboxDClick(wxCommandEvent& event)
 {
-    wxLogMessage(_T("Listbox item %d double clicked"), event.GetInt());
+    wxLogMessage( _T("Listbox item %ld double clicked"), event.GetInt() );
 }
 
 void ListboxWidgetsPage::OnCheckListbox(wxCommandEvent& event)
 {
-    wxLogMessage(_T("Listbox item %d toggled"), event.GetInt());
+    wxLogMessage( _T("Listbox item %ld toggled"), event.GetInt() );
 }
 
-void ListboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
+void ListboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
 {
     CreateLbox();
 }
 
+#endif