X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/be5a51fb592f3fa2ba38ac6cd1e488d6d806058c..4fa87bd948a00e9cc2a31a577663c344632f521c:/samples/controls/controls.cpp diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 54f732373c..098505621e 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -183,6 +183,7 @@ public: MyPanel *GetPanel() const { return m_panel; } private: +#if wxUSE_STATUSBAR void UpdateStatusBar(const wxPoint& pos, const wxSize& size) { if ( m_frameStatusBar ) @@ -198,6 +199,7 @@ private: SetStatusText(msg, 1); } } +#endif // wxUSE_STATUSBAR MyPanel *m_panel; @@ -658,8 +660,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,wxDefaultCoord), 5, choices ); + m_choiceSorted = new wxChoice( panel, ID_CHOICE_SORTED, wxPoint(10,70), wxSize(120,wxDefaultCoord), 5, choices, wxCB_SORT ); SetChoiceClientData(wxT("choice"), m_choice); @@ -682,7 +684,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, wxDefaultCoord), 5, choices, wxCB_READONLY | wxPROCESS_ENTER); m_combo->SetBackgroundColour(*wxBLUE); @@ -732,7 +734,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,wxDefaultCoord), wxSL_AUTOTICKS | wxSL_LABELS ); m_slider->SetTickFreq(40, 0); #if wxUSE_TOOLTIPS @@ -748,7 +750,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, wxDefaultCoord) ); #else (void)new wxStaticText( panel, wxID_ANY, @@ -765,9 +767,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,wxDefaultCoord) ); #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, wxDefaultCoord) ); m_spinbutton->SetRange(-40,30); m_spinbutton->SetValue(initialSpinValue); @@ -776,7 +778,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, wxDefaultCoord) ); m_spinctrl->SetRange(10,30); m_spinctrl->SetValue(15); #endif // wxUSE_SPINCTRL @@ -852,8 +854,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")); @@ -881,15 +882,17 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_buttonSizer = new wxBoxSizer (wxVERTICAL); - m_sizerBtn1 = new wxButton(panel, wxID_ANY, _T("Test Button &1") ); + m_sizerBtn1 = new wxButton(panel, wxID_ANY, _T("Test Button &1 (tab order 1)") ); m_buttonSizer->Add( m_sizerBtn1, 0, wxALL, 10 ); - m_sizerBtn2 = new wxButton(panel, wxID_ANY, _T("Test Button &2") ); + m_sizerBtn2 = new wxButton(panel, wxID_ANY, _T("Test Button &2 (tab order 3)") ); m_buttonSizer->Add( m_sizerBtn2, 0, wxALL, 10 ); - m_sizerBtn3 = new wxButton(panel, wxID_ANY, _T("Test Button &3") ); + m_sizerBtn3 = new wxButton(panel, wxID_ANY, _T("Test Button &3 (tab order 2)") ); m_buttonSizer->Add( m_sizerBtn3, 0, wxALL, 10 ); - m_sizerBtn4 = new wxButton(panel, wxID_ANY, _T("Test Button &4") ); + m_sizerBtn4 = new wxButton(panel, wxID_ANY, _T("Test Button &4 (tab order 4)") ); m_buttonSizer->Add( m_sizerBtn4, 0, wxALL, 10 ); + m_sizerBtn3->MoveBeforeInTabOrder(m_sizerBtn2); + m_hsizer->Add (m_buttonSizer); m_hsizer->Add( 20,20, 1 ); m_bigBtn = new wxButton(panel, wxID_ANY, _T("Multiline\nbutton") ); @@ -957,14 +960,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 { @@ -1055,9 +1059,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; @@ -1560,7 +1564,9 @@ MyFrame::MyFrame(const wxChar *title, int x, int y) SetMenuBar(menu_bar); +#if wxUSE_STATUSBAR CreateStatusBar(2); +#endif // wxUSE_STATUSBAR m_panel = new MyPanel( this, 10, 10, 300, 100 ); @@ -1629,14 +1635,18 @@ void MyFrame::OnEnableAll(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnMove( wxMoveEvent& event ) { +#if wxUSE_STATUSBAR UpdateStatusBar(event.GetPosition(), GetSize()); +#endif // wxUSE_STATUSBAR event.Skip(); } void MyFrame::OnSize( wxSizeEvent& event ) { +#if wxUSE_STATUSBAR UpdateStatusBar(GetPosition(), event.GetSize()); +#endif // wxUSE_STATUSBAR event.Skip(); } @@ -1663,7 +1673,9 @@ void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) ) #endif ); +#if wxUSE_STATUSBAR SetStatusText(msg); +#endif // wxUSE_STATUSBAR } }