]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/controls/controls.cpp
Now uses the version number when doing a cleandll
[wxWidgets.git] / samples / controls / controls.cpp
index 12a60a156cc50bf2de7524e27c76f61c4e9fdb2c..27f1baa1285cc7f4efc0ee9cbc89ed09c9e81f7e 100644 (file)
@@ -398,15 +398,6 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
     (void)new wxButton( panel, ID_CHOICE_FONT, "Set Italic font", wxPoint(340,130), wxSize(140,30) );
     (void)new wxCheckBox( panel, ID_CHOICE_ENABLE, "Disable", wxPoint(20,130), wxSize(140,30) );
 
-    wxIcon icon = wxTheApp->GetStdIcon(wxICON_INFORMATION);
-    wxSize sizeIcon = wxSize(icon.GetWidth(), icon.GetHeight());
-
-    wxStaticBitmap *bitmap = new wxStaticBitmap( panel, -1, icon, wxPoint(50, 60), sizeIcon);
-
-    // this doesn't work under wxGTK
-    bitmap = new wxStaticBitmap( panel, -1, wxNullBitmap, wxPoint(10, 60), sizeIcon);
-    bitmap->SetBitmap(icon);
-
     m_notebook->AddPage(panel, "wxChoice", FALSE, Image_Choice);
 
     panel = new wxPanel(m_notebook);
@@ -436,22 +427,22 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
     m_fontButton = new wxButton( panel, ID_SET_FONT, "Set more Italic font", wxPoint(340,30), wxSize(140,30) );
     (void)new wxButton( panel, ID_RADIOBOX_FONT, "Set Italic font", wxPoint(340,80), wxSize(140,30) );
     (void)new wxCheckBox( panel, ID_RADIOBOX_ENABLE, "Disable", wxPoint(340,130), wxSize(140,30) );
-    wxRadioButton *rb = new wxRadioButton( panel, ID_RADIOBUTTON_1, "Radiobutton1", wxPoint(210,170), wxSize(110,30) );
+    wxRadioButton *rb = new wxRadioButton( panel, ID_RADIOBUTTON_1, "Radiobutton1", wxPoint(210,170), wxSize(110,30), wxRB_GROUP );
     rb->SetValue( FALSE );
     (void)new wxRadioButton( panel, ID_RADIOBUTTON_2, "Radiobutton2", wxPoint(340,170), wxSize(110,30) );
     m_notebook->AddPage(panel, "wxRadioBox", FALSE, Image_Radio);
 
     panel = new wxPanel(m_notebook);
-    (void)new wxStaticBox( panel, -1, "wxGauge and wxSlider", wxPoint(10,10), wxSize(180,130) );
+    (void)new wxStaticBox( panel, -1, "wxGauge and wxSlider", wxPoint(10,10), wxSize(200,130) );
     m_gauge = new wxGauge( panel, -1, 200, wxPoint(18,50), wxSize(155, 30) );
     m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxPoint(18,90), wxSize(155,-1), wxSL_LABELS );
-    (void)new wxStaticBox( panel, -1, "Explanation", wxPoint(200,10), wxSize(290,130) );
+    (void)new wxStaticBox( panel, -1, "Explanation", wxPoint(220,10), wxSize(270,130) );
 #ifdef __WXMOTIF__
     // No wrapping text in wxStaticText yet :-(
     (void)new wxStaticText( panel, -1,
                             "Drag the slider!",
-                            wxPoint(208,30),
-                            wxSize(210, -1)
+                            wxPoint(228,30),
+                            wxSize(240, -1)
                           );
 #else
     (void)new wxStaticText( panel, -1,
@@ -461,8 +452,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
                             "\n"
                             "This is also supposed to demonstrate how\n"
                             "to use static controls.\n",
-                            wxPoint(208,25),
-                            wxSize(250, 110)
+                           wxPoint(228,25),
+                           wxSize(240, 110)
                           );
 #endif
     m_spintext = new wxTextCtrl( panel, -1, "0", wxPoint(20,160), wxSize(80,-1) );
@@ -475,6 +466,34 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
                                   wxPoint(208, 159) );
 #endif
     m_notebook->AddPage(panel, "wxGauge", FALSE, Image_Gauge);
+
+    panel = new wxPanel(m_notebook);
+    wxIcon icon = wxTheApp->GetStdIcon(wxICON_INFORMATION);
+    wxStaticBitmap *bmpStatic = new wxStaticBitmap(panel, -1, icon, wxPoint(10, 10));
+
+    bmpStatic = new wxStaticBitmap(panel, -1, wxNullIcon, wxPoint(50, 10));
+    bmpStatic->SetIcon(wxTheApp->GetStdIcon(wxICON_QUESTION));
+
+    wxBitmap bitmap( 100, 100 );
+    wxMemoryDC dc;
+    dc.SelectObject( bitmap );
+    dc.SetPen(*wxGREEN_PEN);
+    dc.DrawEllipse(5, 5, 90, 90);
+    dc.DrawText("Bitmap", 20, 20);
+    dc.SelectObject( wxNullBitmap );
+
+    wxBitmapButton *bmpBtn = new wxBitmapButton
+                                 (
+                                  panel,
+                                  -1,
+                                  bitmap,
+                                  wxPoint(100, 20)
+                                 );
+    bmpBtn = NULL; // suppress warning
+
+    new wxButton(panel, -1, "Another button", wxPoint(250, 20));
+
+    m_notebook->AddPage(panel, "wxBitmapXXX");
 }
 
 void MyPanel::OnSize( wxSizeEvent& WXUNUSED(event) )
@@ -489,22 +508,20 @@ void MyPanel::OnSize( wxSizeEvent& WXUNUSED(event) )
 
 void MyPanel::OnPageChanging( wxNotebookEvent &event )
 {
-    int selNew = event.GetSelection(),
-        selOld = event.GetOldSelection();
-    if ( selOld == 2 && selNew == 4 )
+    int selOld = event.GetOldSelection();
+    if ( selOld == 2 )
     {
         wxMessageBox("This demonstrates how a program may prevent the "
-                     "page change from taking place - the current page will "
-                     "stay the third one", "Conntrol sample",
+                     "page change from taking place - \n the current page will "
+                     "stay the third one", "Control sample",
                      wxICON_INFORMATION | wxOK);
 
         event.Veto();
+
+        return;
     }
-    else
-    {
-        *m_text << "Notebook selection is being changed from "
-                << selOld << " to " << selNew << "\n";
-    }
+
+    *m_text << "Notebook selection is being changed from " << selOld << "\n";
 }
 
 void MyPanel::OnPageChanged( wxNotebookEvent &event )
@@ -761,7 +778,7 @@ void MyPanel::OnShowProgress( wxCommandEvent& WXUNUSED(event) )
                             max,    // range
                             this,   // parent
                             wxPD_CAN_ABORT | wxPD_APP_MODAL | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME);
-                            
+
 
     bool cont = TRUE;
     for ( int i = 0; i < max && cont; i++ )