]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/controls/controls.cpp
fixed reference to wxEvtHandler
[wxWidgets.git] / samples / controls / controls.cpp
index 81e65a023aa2594153f70a9531b9fda869f0914c..ca95765f7ba4d1ec49d8c1eb9592cb23e79505b4 100644 (file)
@@ -105,7 +105,7 @@ public:
 #endif // wxUSE_SPINBTN
 
 #if wxUSE_SPINCTRL
-    void OnSpinCtrl(wxCommandEvent& event);
+    void OnSpinCtrl(wxSpinEvent& event);
 #endif // wxUSE_SPINCTRL
 
     void OnEnableAll(wxCommandEvent& event);
@@ -265,7 +265,7 @@ bool MyApp::OnInit()
     frame->Show(TRUE);
     frame->SetCursor(wxCursor(wxCURSOR_HAND));
 
-    frame->GetPanel()->m_notebook->SetSelection(6);
+    //frame->GetPanel()->m_notebook->SetSelection(6);
 
     SetTopWindow(frame);
 
@@ -393,9 +393,10 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
 
     m_text = new wxTextCtrl(this, -1, "This is the log window.\n",
                             wxPoint(0, 250), wxSize(100, 50), wxTE_MULTILINE);
-    //  m_text->SetBackgroundColour("wheat");
+    m_text->SetBackgroundColour("wheat");
 
-    wxLog::AddTraceMask(_T("focus"));
+    if ( 0 )
+        wxLog::AddTraceMask(_T("focus"));
     m_logTargetOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_text));
 
     m_notebook = new wxNotebook(this, ID_NOTEBOOK);
@@ -632,11 +633,14 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
 
     (void)new wxBitmapButton(panel, -1, bitmap, wxPoint(100, 20));
 
-#if 0
+#ifdef __WXMSW__
     // test for masked bitmap display
     bitmap = wxBitmap("test2.bmp", wxBITMAP_TYPE_BMP);
-    bitmap.SetMask(new wxMask(bitmap, *wxBLUE));
-    (void)new wxBitmapButton(panel, -1, bitmap, wxPoint(300, 120));
+    if (bitmap.Ok())
+    {
+       bitmap.SetMask(new wxMask(bitmap, *wxBLUE));
+       (void)new wxStaticBitmap /* wxBitmapButton */ (panel, -1, bitmap, wxPoint(300, 120));
+    }
 #endif
 
     wxBitmap bmp1(wxTheApp->GetStdIcon(wxICON_INFORMATION)),
@@ -655,6 +659,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
     m_label = new wxStaticText(panel, -1, "Label with some long text",
                                wxPoint(250, 60), wxDefaultSize,
                                wxALIGN_RIGHT | wxST_NO_AUTORESIZE);
+    m_label->SetForegroundColour( *wxBLUE );
 
     m_notebook->AddPage(panel, "wxBitmapXXX");
 
@@ -750,13 +755,13 @@ void MyPanel::OnChangeColour(wxCommandEvent& WXUNUSED(event))
         SetBackgroundColour(s_colOld);
         s_colOld = wxNullColour;
 
-        m_lbSelectThis->SetForegroundColour("yellow");
-        m_lbSelectThis->SetBackgroundColour("blue");
+        m_lbSelectThis->SetForegroundColour("red");
+        m_lbSelectThis->SetBackgroundColour("white");
     }
     else
     {
-        s_colOld = GetBackgroundColour();
-        SetBackgroundColour("green");
+        s_colOld = wxColour("red");
+        SetBackgroundColour("white");
 
         m_lbSelectThis->SetForegroundColour("white");
         m_lbSelectThis->SetBackgroundColour("red");
@@ -828,6 +833,7 @@ void MyPanel::OnListBoxButtons( wxCommandEvent &event )
                 m_lbSelectThis->Enable( event.GetInt() == 0 );
                 m_lbSelectNum->Enable( event.GetInt() == 0 );
                 m_listboxSorted->Enable( event.GetInt() == 0 );
+                FindWindow(ID_CHANGE_COLOUR)->Enable( event.GetInt() == 0 );
                 break;
             }
         case ID_LISTBOX_SEL_NUM:
@@ -1065,7 +1071,7 @@ void MyPanel::OnSliderUpdate( wxCommandEvent &WXUNUSED(event) )
 
 #if wxUSE_SPINCTRL
 
-void MyPanel::OnSpinCtrl(wxCommandEvent& event)
+void MyPanel::OnSpinCtrl(wxSpinEvent& event)
 {
     wxString s;
     s.Printf(_T("Spin ctrl changed: now %d (from event: %d)\n"),
@@ -1141,16 +1147,16 @@ void MyPanel::OnShowProgress( wxCommandEvent& WXUNUSED(event) )
 
 
     bool cont = TRUE;
-    for ( int i = 0; i < max && cont; i++ )
+    for ( int i = 0; i <= max && cont; i++ )
     {
         wxSleep(1);
-        if ( i == max - 1 )
+        if ( i == max )
         {
             cont = dialog.Update(i, "That's all, folks!");
         }
         else if ( i == max / 2 )
         {
-            cont = dialog.Update(i, "Only a half left!");
+            cont = dialog.Update(i, "Only a half left (very long message)!");
         }
         else
         {
@@ -1214,12 +1220,15 @@ void MyFrame::OnQuit (wxCommandEvent& WXUNUSED(event) )
 
 void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) )
 {
-    wxBeginBusyCursor();
+    wxBusyCursor bc;
+
+#if 0 // VZ: my temp test code, will remove
+    wxGetTextFromUser("msg", "caption", "val", this);
+    return;
+#endif // 0
 
     wxMessageDialog dialog(this, "This is a control sample", "About Controls", wxOK );
     dialog.ShowModal();
-
-    wxEndBusyCursor();
 }
 
 void MyFrame::OnClearLog(wxCommandEvent& WXUNUSED(event))