X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4c36ca57a1a2f99acff49dd44f27ab1a2a7ce411..bd73ba41f93a040ecf9c18040d7f788992d0a6ec:/samples/controls/controls.cpp diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 13dca99061..0673cb6bbb 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -34,7 +34,7 @@ #include "wx/tooltip.h" #endif -#if defined(__WXGTK__) || defined(__WXMOTIF__) +#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) #define USE_XPM #endif @@ -284,7 +284,7 @@ private: // other //---------------------------------------------------------------------- -static void SetControlClientData(const char *name, +static void SetControlClientData(const wxChar *name, wxControlWithItems *control); IMPLEMENT_APP(MyApp) @@ -315,8 +315,8 @@ bool MyApp::OnInit() y = 50; if ( argc == 3 ) { - wxSscanf(argv[1], "%d", &x); - wxSscanf(argv[2], "%d", &y); + //wxSscanf(argv[1], "%d", &x); + //wxSscanf(argv[2], "%d", &y); } // Create the main frame window @@ -569,7 +569,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) wxBitmap bmp(s_iconNames[n]); if ( !bmp.Ok() || (imagelist->Add(bmp) == -1) ) { - wxLogWarning("Couldn't load the image '%s' for the notebook page %d.", + wxLogWarning(wxT("Couldn't load the image '%s' for the notebook page %d."), s_iconNames[n], n); } } @@ -596,8 +596,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) wxPoint(10,90), wxSize(120,70), 5, choices, wxLB_SORT ); - SetControlClientData("listbox", m_listbox); - SetControlClientData("listbox", m_listboxSorted); + SetControlClientData(wxT("listbox"), m_listbox); + SetControlClientData(wxT("listbox"), m_listboxSorted); m_listbox->SetCursor(*wxCROSS_CURSOR); #if wxUSE_TOOLTIPS @@ -634,8 +634,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_choiceSorted = new wxChoice( panel, ID_CHOICE_SORTED, wxPoint(10,70), wxSize(120,-1), 5, choices, wxCB_SORT ); - SetControlClientData("choice", m_choice); - SetControlClientData("choice", m_choiceSorted); + SetControlClientData(wxT("choice"), m_choice); + SetControlClientData(wxT("choice"), m_choiceSorted); m_choice->SetSelection(2); m_choice->SetBackgroundColour( "red" ); @@ -701,7 +701,9 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_gaugeVert = new wxGauge( panel, -1, 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), wxSL_LABELS ); + m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxPoint(18,90), wxSize(155,-1), + wxSL_AUTOTICKS | wxSL_LABELS ); + m_slider->SetTickFreq(40, 0); (void)new wxStaticBox( panel, -1, "&Explanation", wxPoint(230,10), wxSize(270,130) ); #ifdef __WXMOTIF__ // No wrapping text in wxStaticText yet :-( @@ -745,7 +747,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) panel = new wxPanel(m_notebook); -#if !defined(__WXMOTIF__) && !defined(__WXMAC__) && !defined(__WIN16__) // wxStaticBitmap not working under Motif yet; and icons not allowed under WIN16. +#if !defined(__WXMOTIF__) && !defined(__WIN16__) // wxStaticBitmap not working under Motif yet; and icons not allowed under WIN16. wxIcon icon = wxTheApp->GetStdIcon(wxICON_INFORMATION); wxStaticBitmap *bmpStatic = new wxStaticBitmap(panel, -1, icon, wxPoint(10, 10)); @@ -785,6 +787,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) bmp1, wxPoint(30, 70) ); + bmpBtn->SetBitmapSelected(bmp2); bmpBtn->SetBitmapFocus(bmp3); @@ -792,6 +795,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) (void)new wxToggleButton(panel, ID_BUTTON_LABEL, "&Toggle label", wxPoint(250, 20)); #endif // wxUSE_TOGGLEBTN + m_label = new wxStaticText(panel, -1, "Label with some long text", wxPoint(250, 60), wxDefaultSize, wxALIGN_RIGHT /*| wxST_NO_AUTORESIZE*/); @@ -867,12 +871,16 @@ void MyPanel::OnPageChanging( wxNotebookEvent &event ) } } - *m_text << "Notebook selection is being changed from " << selOld << "\n"; + *m_text << "Notebook selection is being changed from " << selOld + << " to " << event.GetSelection() + << " (current page from notebook is " + << m_notebook->GetSelection() << ")\n"; } void MyPanel::OnPageChanged( wxNotebookEvent &event ) { - *m_text << "Notebook selection is " << event.GetSelection() << "\n"; + *m_text << "Notebook selection is now " << event.GetSelection() + << " (from notebook: " << m_notebook->GetSelection() << ")\n"; } void MyPanel::OnTestButton(wxCommandEvent& event) @@ -1497,14 +1505,14 @@ void MyComboBox::OnKeyUp(wxKeyEvent& event) event.Skip(); } -static void SetControlClientData(const char *name, +static void SetControlClientData(const wxChar *name, wxControlWithItems *control) { size_t count = control->GetCount(); for ( size_t n = 0; n < count; n++ ) { wxString s; - s.Printf("%s client data for '%s'", + s.Printf(wxT("%s client data for '%s'"), name, control->GetString(n).c_str()); control->SetClientObject(n, new wxStringClientData(s));