]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/controls/controls.cpp
compilation warning fixed
[wxWidgets.git] / samples / controls / controls.cpp
index a0fdff245776af411f9d384f2966a607da5c4280..9a425672bba3ca15f717c3078a8300623a6b9245 100644 (file)
@@ -26,6 +26,7 @@
 #if !defined( __WXMSW__ ) || defined( __WIN95__ )
 #include "wx/spinbutt.h"
 #endif
 #if !defined( __WXMSW__ ) || defined( __WIN95__ )
 #include "wx/spinbutt.h"
 #endif
+#include "wx/tglbtn.h"
 #include "wx/notebook.h"
 #include "wx/imaglist.h"
 
 #include "wx/notebook.h"
 #include "wx/imaglist.h"
 
@@ -33,7 +34,7 @@
     #include "wx/tooltip.h"
 #endif
 
     #include "wx/tooltip.h"
 #endif
 
-#if defined(__WXGTK__) || defined(__WXMOTIF__)
+#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__)
     #define USE_XPM
 #endif
 
     #define USE_XPM
 #endif
 
@@ -478,7 +479,9 @@ EVT_BUTTON    (ID_BTNPROGRESS,          MyPanel::OnShowProgress)
 #if wxUSE_SPINCTRL
 EVT_SPINCTRL  (ID_SPINCTRL,             MyPanel::OnSpinCtrl)
 #endif // wxUSE_SPINCTRL
 #if wxUSE_SPINCTRL
 EVT_SPINCTRL  (ID_SPINCTRL,             MyPanel::OnSpinCtrl)
 #endif // wxUSE_SPINCTRL
-EVT_BUTTON    (ID_BUTTON_LABEL,         MyPanel::OnUpdateLabel)
+#if wxUSE_TOGGLEBTN
+EVT_TOGGLEBUTTON(ID_BUTTON_LABEL,       MyPanel::OnUpdateLabel)
+#endif // wxUSE_TOGGLEBTN
 EVT_CHECKBOX  (ID_CHANGE_COLOUR,        MyPanel::OnChangeColour)
 EVT_BUTTON    (ID_BUTTON_TEST1,         MyPanel::OnTestButton)
 EVT_BUTTON    (ID_BUTTON_TEST2,         MyPanel::OnTestButton)
 EVT_CHECKBOX  (ID_CHANGE_COLOUR,        MyPanel::OnChangeColour)
 EVT_BUTTON    (ID_BUTTON_TEST1,         MyPanel::OnTestButton)
 EVT_BUTTON    (ID_BUTTON_TEST2,         MyPanel::OnTestButton)
@@ -698,7 +701,9 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
     m_gaugeVert = new wxGauge( panel, -1, 100,
                                wxPoint(195,35), wxSize(30, 90),
                                wxGA_VERTICAL | wxGA_SMOOTH | wxNO_BORDER );
     m_gaugeVert = new wxGauge( panel, -1, 100,
                                wxPoint(195,35), wxSize(30, 90),
                                wxGA_VERTICAL | wxGA_SMOOTH | wxNO_BORDER );
-    m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxPoint(18,90), wxSize(155,-1), wxSL_LABELS );
+    m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxPoint(18,90), wxSize(155,-1),
+                             wxSL_AUTOTICKS | wxSL_LABELS );
+    m_slider->SetTickFreq(40, 0);
     (void)new wxStaticBox( panel, -1, "&Explanation", wxPoint(230,10), wxSize(270,130) );
 #ifdef __WXMOTIF__
     // No wrapping text in wxStaticText yet :-(
     (void)new wxStaticBox( panel, -1, "&Explanation", wxPoint(230,10), wxSize(270,130) );
 #ifdef __WXMOTIF__
     // No wrapping text in wxStaticText yet :-(
@@ -780,12 +785,16 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
                                  (
                                   panel, -1,
                                   bmp1,
                                  (
                                   panel, -1,
                                   bmp1,
-                                  wxPoint(30, 50)
+                                  wxPoint(30, 70)
                                  );
     bmpBtn->SetBitmapSelected(bmp2);
     bmpBtn->SetBitmapFocus(bmp3);
 
                                  );
     bmpBtn->SetBitmapSelected(bmp2);
     bmpBtn->SetBitmapFocus(bmp3);
 
-    (void)new wxButton(panel, ID_BUTTON_LABEL, "&Toggle label", wxPoint(250, 20));
+#if wxUSE_TOGGLEBTN
+    (void)new wxToggleButton(panel, ID_BUTTON_LABEL,
+                             "&Toggle label", wxPoint(250, 20));
+#endif // wxUSE_TOGGLEBTN
+
     m_label = new wxStaticText(panel, -1, "Label with some long text",
                                wxPoint(250, 60), wxDefaultSize,
                                wxALIGN_RIGHT /*| wxST_NO_AUTORESIZE*/);
     m_label = new wxStaticText(panel, -1, "Label with some long text",
                                wxPoint(250, 60), wxDefaultSize,
                                wxALIGN_RIGHT /*| wxST_NO_AUTORESIZE*/);
@@ -861,12 +870,16 @@ void MyPanel::OnPageChanging( wxNotebookEvent &event )
         }
     }
 
         }
     }
 
-    *m_text << "Notebook selection is being changed from " << selOld << "\n";
+    *m_text << "Notebook selection is being changed from " << selOld
+            << " to " << event.GetSelection()
+            << " (current page from notebook is "
+            << m_notebook->GetSelection() << ")\n";
 }
 
 void MyPanel::OnPageChanged( wxNotebookEvent &event )
 {
 }
 
 void MyPanel::OnPageChanged( wxNotebookEvent &event )
 {
-    *m_text << "Notebook selection is " << event.GetSelection() << "\n";
+    *m_text << "Notebook selection is now " << event.GetSelection()
+            << " (from notebook: " << m_notebook->GetSelection() << ")\n";
 }
 
 void MyPanel::OnTestButton(wxCommandEvent& event)
 }
 
 void MyPanel::OnTestButton(wxCommandEvent& event)
@@ -1207,12 +1220,10 @@ void MyPanel::OnSetFont( wxCommandEvent &WXUNUSED(event) )
     m_text->SetFont( *wxITALIC_FONT );
 }
 
     m_text->SetFont( *wxITALIC_FONT );
 }
 
-void MyPanel::OnUpdateLabel( wxCommandEvent &WXUNUSED(event) )
+void MyPanel::OnUpdateLabel( wxCommandEvent &event )
 {
 {
-    static bool s_long = TRUE;
-
-    s_long = !s_long;
-    m_label->SetLabel(s_long ? "Very very very very very long text." : "Shorter text.");
+    m_label->SetLabel(event.GetInt() ? "Very very very very very long text."
+                                     : "Shorter text.");
 }
 
 void MyPanel::OnSliderUpdate( wxCommandEvent &WXUNUSED(event) )
 }
 
 void MyPanel::OnSliderUpdate( wxCommandEvent &WXUNUSED(event) )