]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/controls/controls.cpp
Use wxAnyButton's DoGetBestSize for toggle buttons
[wxWidgets.git] / samples / controls / controls.cpp
index ef951a18bb80662b47b7968d4d3b9082b34fc0ea..8cf794f12193fcb4380e9e8d72629c8582608d13 100644 (file)
@@ -5,7 +5,7 @@
 // Modified by:
 // RCS-ID:      $Id$
 // Copyright:   (c) Robert Roebling, Julian Smart
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // For compilers that support precompilation, includes "wx/wx.h".
@@ -721,7 +721,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
     for ( size_t n = 0; n < Image_Max; n++ )
     {
         wxBitmap bmp(s_iconNames[n]);
-        if ( !bmp.Ok() || (imagelist->Add(bmp) == -1) )
+        if ( !bmp.IsOk() || (imagelist->Add(bmp) == -1) )
         {
             wxLogWarning(wxT("Couldn't load the image '%s' for the book control page %d."),
                     s_iconNames[n], n);
@@ -855,7 +855,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
     m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200,
                              wxDefaultPosition, wxSize(155,wxDefaultCoord),
                              wxSL_AUTOTICKS | wxSL_LABELS);
-    m_slider->SetTickFreq(40, 0);
+    m_slider->SetTickFreq(40);
     sz->Add( m_slider, 0, wxALL, 10 );
 
     m_gaugeVert = new wxGauge( panel, wxID_ANY, 100,
@@ -949,14 +949,15 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
     dc.DrawText(wxT("Bitmap"), 30, 40);
     dc.SelectObject( wxNullBitmap );
 
-    (void)new wxBitmapButton(panel, ID_BITMAP_BTN, bitmap, wxPoint(100, 20));
-    (void)new wxToggleButton(panel, ID_BITMAP_BTN_ENABLE,
-                             wxT("Enable/disable &bitmap"), wxPoint(100, 140));
+    wxPanel *panel2 = new wxPanel(panel, -1, wxPoint(100, 0), wxSize(100, 200));
+    (void)new wxBitmapButton(panel2, ID_BITMAP_BTN, bitmap, wxPoint(0, 20));
+    (void)new wxToggleButton(panel2, ID_BITMAP_BTN_ENABLE,
+                             wxT("Enable/disable &bitmap"), wxPoint(0, 140));
 
 #if defined(__WXMSW__) || defined(__WXMOTIF__)
     // test for masked bitmap display
     bitmap = wxBitmap(wxT("test2.bmp"), wxBITMAP_TYPE_BMP);
-    if (bitmap.Ok())
+    if (bitmap.IsOk())
     {
        bitmap.SetMask(new wxMask(bitmap, *wxBLUE));
 
@@ -1182,7 +1183,7 @@ void MyPanel::OnChangeColour(wxCommandEvent& WXUNUSED(event))
 
     SetThemeEnabled(false);
     // test panel colour changing and propagation to the subcontrols
-    if ( s_colOld.Ok() )
+    if ( s_colOld.IsOk() )
     {
         SetBackgroundColour(s_colOld);
         s_colOld = wxNullColour;