]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/gauge.cpp
Fixed the code to actually work.
[wxWidgets.git] / samples / widgets / gauge.cpp
index 3075d39b81823db815142ff57aa54b5880b51fce..477f8d429bf138dff75f928ed0a77a261efee944 100644 (file)
@@ -29,6 +29,7 @@
     #include "wx/log.h"
     #include "wx/timer.h"
 
+    #include "wx/bitmap.h"
     #include "wx/button.h"
     #include "wx/checkbox.h"
     #include "wx/combobox.h"
@@ -41,7 +42,7 @@
 #include "wx/sizer.h"
 
 #include "widgets.h"
-
+#if wxUSE_GAUGE
 #include "icons/gauge.xpm"
 
 // ----------------------------------------------------------------------------
@@ -122,8 +123,8 @@ protected:
     wxTimer *m_timer;
 
 private:
-    DECLARE_EVENT_TABLE();
-    DECLARE_WIDGETS_PAGE(GaugeWidgetsPage);
+    DECLARE_EVENT_TABLE()
+    DECLARE_WIDGETS_PAGE(GaugeWidgetsPage)
 };
 
 // ----------------------------------------------------------------------------
@@ -209,7 +210,7 @@ GaugeWidgetsPage::GaugeWidgetsPage(wxNotebook *notebook,
                                             _T("Set &range"),
                                             GaugePage_RangeText,
                                             &m_textRange);
-    m_textRange->SetValue(wxString::Format(_T("%lu"), m_range));
+    m_textRange->SetValue( wxString::Format(_T("%lu"), m_range) );
     sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
 
     btn = new wxButton(this, GaugePage_Progress, _T("Simulate &progress"));
@@ -222,7 +223,7 @@ GaugeWidgetsPage::GaugeWidgetsPage(wxNotebook *notebook,
     wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL);
     m_gauge = new wxGauge(this, GaugePage_Gauge, m_range);
     sizerRight->Add(m_gauge, 1, wxCENTRE | wxALL, 5);
-    sizerRight->SetMinSize(250, 0);
+    sizerRight->SetMinSize(150, 0);
     m_sizerGauge = sizerRight; // save it to modify it later
 
     // the 3 panes panes compose the window
@@ -271,7 +272,7 @@ void GaugeWidgetsPage::CreateGauge()
     {
         val = m_gauge->GetValue();
 
-        m_sizerGauge->Remove(m_gauge);
+        m_sizerGauge->Detach( m_gauge );
         delete m_gauge;
     }
 
@@ -361,7 +362,7 @@ void GaugeWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
     event.Enable( m_chkVert->GetValue() || m_chkSmooth->GetValue() );
 }
 
-void GaugeWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
+void GaugeWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
 {
     CreateGauge();
 }
@@ -400,3 +401,5 @@ void GaugeWidgetsPage::StopTimer()
     wxLogMessage(_T("Progress finished."));
 }
 
+#endif
+    // wxUSE_GAUGE