]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/combobox.cpp
removed files with empty stubs
[wxWidgets.git] / samples / widgets / combobox.cpp
index 0abec9073457d4688a498dcad47c206422e15be6..d41699167e9d7d2e2698d7a8f7521899d1c7738b 100644 (file)
     #pragma hdrstop
 #endif
 
+#if wxUSE_COMBOBOX
+
 // for all others, include the necessary headers
 #ifndef WX_PRECOMP
     #include "wx/log.h"
 
+    #include "wx/bitmap.h"
     #include "wx/button.h"
     #include "wx/checkbox.h"
     #include "wx/combobox.h"
@@ -39,7 +42,7 @@
 #include "wx/sizer.h"
 
 #include "widgets.h"
-
+#if 1
 #include "icons/combobox.xpm"
 
 // ----------------------------------------------------------------------------
@@ -131,8 +134,8 @@ protected:
                *m_textDelete;
 
 private:
-    DECLARE_EVENT_TABLE();
-    DECLARE_WIDGETS_PAGE(ComboboxWidgetsPage);
+    DECLARE_EVENT_TABLE()
+    DECLARE_WIDGETS_PAGE(ComboboxWidgetsPage)
 };
 
 // ----------------------------------------------------------------------------
@@ -180,8 +183,6 @@ ComboboxWidgetsPage::ComboboxWidgetsPage(wxNotebook *notebook,
                                        wxImageList *imaglist)
                   : WidgetsPage(notebook)
 {
-    imaglist->Add(wxBitmap(combobox_xpm));
-
     // init everything
     m_chkSort =
     m_chkReadonly = (wxCheckBox *)NULL;
@@ -189,6 +190,8 @@ ComboboxWidgetsPage::ComboboxWidgetsPage(wxNotebook *notebook,
     m_combobox = (wxComboBox *)NULL;
     m_sizerCombo = (wxSizer *)NULL;
 
+    imaglist->Add(wxBitmap(combobox_xpm));
+
     /*
        What we create here is a frame having 3 panes: style pane is the
        leftmost one, in the middle the pane with buttons allowing to perform
@@ -275,7 +278,7 @@ ComboboxWidgetsPage::ComboboxWidgetsPage(wxNotebook *notebook,
                                 0, NULL,
                                 0);
     sizerRight->Add(m_combobox, 1, wxGROW | wxALL, 5);
-    sizerRight->SetMinSize(250, 0);
+    sizerRight->SetMinSize(150, 0);
     m_sizerCombo = sizerRight; // save it to modify it later
 
     // the 3 panes panes compose the window
@@ -338,7 +341,7 @@ void ComboboxWidgetsPage::CreateCombo()
             items.Add(m_combobox->GetString(n));
         }
 
-        m_sizerCombo->Remove(m_combobox);
+        m_sizerCombo->Detach( m_combobox );
         delete m_combobox;
     }
 
@@ -409,7 +412,7 @@ void ComboboxWidgetsPage::OnButtonClear(wxCommandEvent& event)
 
 void ComboboxWidgetsPage::OnButtonAdd(wxCommandEvent& event)
 {
-    static size_t s_item = 0;
+    static unsigned int s_item = 0;
 
     wxString s = m_textAdd->GetValue();
     if ( !m_textAdd->IsModified() )
@@ -424,7 +427,7 @@ void ComboboxWidgetsPage::OnButtonAdd(wxCommandEvent& event)
 void ComboboxWidgetsPage::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_combobox->Append(wxString::Format(_T("item #%u"), n));
     }
@@ -439,38 +442,49 @@ void ComboboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& event)
 
 void ComboboxWidgetsPage::OnUpdateUICurText(wxUpdateUIEvent& event)
 {
-    event.SetText( wxString::Format(_T("%d"), m_combobox->GetSelection()) );
+    if (m_combobox)
+        event.SetText( wxString::Format(_T("%d"), m_combobox->GetSelection()) );
 }
 
 void ComboboxWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
 {
-    event.Enable( m_chkSort->GetValue() || m_chkReadonly->GetValue() );
+    if (m_combobox)
+        event.Enable( m_chkSort->GetValue() || m_chkReadonly->GetValue() );
 }
 
 void ComboboxWidgetsPage::OnUpdateUIDeleteButton(wxUpdateUIEvent& event)
 {
-    unsigned long n;
-    event.Enable(m_textDelete->GetValue().ToULong(&n) &&
-                    (n < (unsigned)m_combobox->GetCount()));
+    if (m_combobox)
+    {
+      unsigned long n;
+      event.Enable(m_textDelete->GetValue().ToULong(&n) &&
+        (n < (unsigned)m_combobox->GetCount()));
+    }
 }
 
 void ComboboxWidgetsPage::OnUpdateUIDeleteSelButton(wxUpdateUIEvent& event)
 {
-    event.Enable(m_combobox->GetSelection() != -1);
+    if (m_combobox)
+        event.Enable(m_combobox->GetSelection() != -1);
 }
 
 void ComboboxWidgetsPage::OnUpdateUIClearButton(wxUpdateUIEvent& event)
 {
-    event.Enable(m_combobox->GetCount() != 0);
+    if (m_combobox)
+        event.Enable(m_combobox->GetCount() != 0);
 }
 
 void ComboboxWidgetsPage::OnUpdateUIAddSeveral(wxUpdateUIEvent& event)
 {
-    event.Enable(!(m_combobox->GetWindowStyle() & wxCB_SORT));
+    if (m_combobox)
+        event.Enable(!(m_combobox->GetWindowStyle() & wxCB_SORT));
 }
 
 void ComboboxWidgetsPage::OnComboText(wxCommandEvent& event)
 {
+    if (!m_combobox)
+        return;
+
     wxString s = event.GetString();
 
     wxASSERT_MSG( s == m_combobox->GetValue(),
@@ -481,10 +495,10 @@ void ComboboxWidgetsPage::OnComboText(wxCommandEvent& event)
 
 void ComboboxWidgetsPage::OnComboBox(wxCommandEvent& event)
 {
-    int sel = event.GetInt();
+    long sel = event.GetInt();
     m_textDelete->SetValue(wxString::Format(_T("%ld"), sel));
 
-    wxLogMessage(_T("Combobox item %d selected"), sel);
+    wxLogMessage(_T("Combobox item %ld selected"), sel);
 }
 
 void ComboboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
@@ -492,3 +506,6 @@ void ComboboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
     CreateCombo();
 }
 
+#endif //wxUSE_COMBOBOX
+
+#endif