X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9230b62136ee786760375bf59292dabff6277aeb..751731864888f00e31e6dce1092ac28a1fac5358:/samples/controls/controls.cpp?ds=sidebyside diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 489ed36f65..71540feb37 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: controls.cpp -// Purpose: Controls wxWindows sample +// Purpose: Controls wxWidgets sample // Author: Robert Roebling // Modified by: // RCS-ID: $Id$ @@ -45,17 +45,9 @@ #include "icons/gauge.xpm" #endif -#ifdef __WIN16__ - // Win16 doesn't have them - #ifdef wxUSE_SPINBTN - #undef wxUSE_SPINBTN - #endif - #define wxUSE_SPINBTN 0 -#else - #ifndef wxUSE_SPINBTN +#ifndef wxUSE_SPINBTN #define wxUSE_SPINBTN 1 - #endif -#endif // __WIN16__ +#endif #include "wx/progdlg.h" @@ -349,7 +341,7 @@ bool MyApp::OnInit() } // Create the main frame window - MyFrame *frame = new MyFrame(_T("Controls wxWindows App"), x, y); + MyFrame *frame = new MyFrame(_T("Controls wxWidgets App"), x, y); frame->Show(true); return true; @@ -666,8 +658,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) #if wxUSE_CHOICE panel = new wxPanel(m_notebook); - m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,-1), 5, choices ); - m_choiceSorted = new wxChoice( panel, ID_CHOICE_SORTED, wxPoint(10,70), wxSize(120,-1), + m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,wxDefaultSize.y), 5, choices ); + m_choiceSorted = new wxChoice( panel, ID_CHOICE_SORTED, wxPoint(10,70), wxSize(120,wxDefaultSize.y), 5, choices, wxCB_SORT ); SetChoiceClientData(wxT("choice"), m_choice); @@ -690,7 +682,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) (void)new wxStaticBox( panel, wxID_ANY, _T("&Box around combobox"), wxPoint(5, 5), wxSize(150, 100)); m_combo = new MyComboBox( panel, ID_COMBO, _T("This"), - wxPoint(20,25), wxSize(120, -1), + wxPoint(20,25), wxSize(120, wxDefaultSize.y), 5, choices, wxCB_READONLY | wxPROCESS_ENTER); m_combo->SetBackgroundColour(*wxBLUE); @@ -740,7 +732,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_gaugeVert = new wxGauge( panel, wxID_ANY, 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), + m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxPoint(18,90), wxSize(155,wxDefaultSize.y), wxSL_AUTOTICKS | wxSL_LABELS ); m_slider->SetTickFreq(40, 0); #if wxUSE_TOOLTIPS @@ -756,7 +748,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) (void)new wxStaticText( panel, wxID_ANY, _T("Drag the slider!"), wxPoint(250,30), - wxSize(240, -1) + wxSize(240, wxDefaultSize.y) ); #else (void)new wxStaticText( panel, wxID_ANY, @@ -773,9 +765,9 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) int initialSpinValue = -5; wxString s; s << initialSpinValue; - m_spintext = new wxTextCtrl( panel, wxID_ANY, s, wxPoint(20,160), wxSize(80,-1) ); + m_spintext = new wxTextCtrl( panel, wxID_ANY, s, wxPoint(20,160), wxSize(80,wxDefaultSize.y) ); #if wxUSE_SPINBTN - m_spinbutton = new wxSpinButton( panel, ID_SPIN, wxPoint(103,160), wxSize(80, -1) ); + m_spinbutton = new wxSpinButton( panel, ID_SPIN, wxPoint(103,160), wxSize(80, wxDefaultSize.y) ); m_spinbutton->SetRange(-40,30); m_spinbutton->SetValue(initialSpinValue); @@ -784,7 +776,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) #endif // wxUSE_SPINBTN #if wxUSE_SPINCTRL - m_spinctrl = new wxSpinCtrl( panel, ID_SPINCTRL, _T(""), wxPoint(200, 160), wxSize(80, -1) ); + m_spinctrl = new wxSpinCtrl( panel, ID_SPINCTRL, _T(""), wxPoint(200, 160), wxSize(80, wxDefaultSize.y) ); m_spinctrl->SetRange(10,30); m_spinctrl->SetValue(15); #endif // wxUSE_SPINCTRL @@ -793,7 +785,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) panel = new wxPanel(m_notebook); -#if !defined(__WXMOTIF__) && !defined(__WIN16__) // wxStaticBitmap not working under Motif yet; and icons not allowed under WIN16. +#if !defined(__WXMOTIF__) // wxStaticBitmap not working under Motif yet. wxIcon icon = wxArtProvider::GetIcon(wxART_INFORMATION); (void) new wxStaticBitmap( panel, wxID_ANY, icon, wxPoint(10, 10) ); @@ -860,8 +852,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL ); wxStaticBoxSizer *csizer = - new wxStaticBoxSizer (new wxStaticBox (panel, wxID_ANY, _T("Show Buttons")), - wxHORIZONTAL ); + new wxStaticBoxSizer (new wxStaticBox (panel, wxID_ANY, _T("Show Buttons")), wxHORIZONTAL ); wxCheckBox *check1, *check2, *check3, *check4, *check14, *checkBig; check1 = new wxCheckBox (panel, ID_SIZER_CHECK1, _T("1")); @@ -965,14 +956,15 @@ void MyPanel::OnChangeColour(wxCommandEvent& WXUNUSED(event)) { static wxColour s_colOld; + SetThemeEnabled(false); // test panel colour changing and propagation to the subcontrols if ( s_colOld.Ok() ) { SetBackgroundColour(s_colOld); s_colOld = wxNullColour; - m_lbSelectThis->SetForegroundColour(wxT("red")); - m_lbSelectThis->SetBackgroundColour(wxT("white")); + m_lbSelectThis->SetForegroundColour(wxNullColour); + m_lbSelectThis->SetBackgroundColour(wxNullColour); } else { @@ -1063,9 +1055,9 @@ void MyPanel::OnListBoxButtons( wxCommandEvent &event ) } case ID_LISTBOX_SEL_STR: { - if (m_listbox->FindString(_T("This")) > -1) + if (m_listbox->FindString(_T("This")) != wxNOT_FOUND) m_listbox->SetStringSelection( _T("This") ); - if (m_listboxSorted->FindString(_T("This")) > -1) + if (m_listboxSorted->FindString(_T("This")) != wxNOT_FOUND) m_listboxSorted->SetStringSelection( _T("This") ); m_lbSelectNum->WarpPointer( 40, 14 ); break;