X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d3eb13d2aa8b7f9e2da9921d4a64b9aa8488ff19..407f216223670d7450eca5f8bfff7f61a7accca3:/samples/controls/controls.cpp diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index da9256e9b7..8cf794f121 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -5,7 +5,7 @@ // Modified by: // RCS-ID: $Id$ // Copyright: (c) Robert Roebling, Julian Smart -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx/wx.h". @@ -33,12 +33,7 @@ #endif // __WXMSW__ #endif // wxUSE_TOOLTIPS -#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__) - #define USE_XPM -#endif - -#ifdef USE_XPM - #include "mondrian.xpm" +#ifndef __WXMSW__ #include "icons/choice.xpm" #include "icons/combo.xpm" #include "icons/list.xpm" @@ -62,6 +57,10 @@ #define EVT_TOGGLEBUTTON EVT_CHECKBOX #endif +#if !defined(__WXMSW__) && !defined(__WXPM__) + #include "../sample.xpm" +#endif + //---------------------------------------------------------------------- // class definitions //---------------------------------------------------------------------- @@ -662,7 +661,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) wxT("examples.") }; -#ifdef USE_XPM +#ifndef __WXMSW__ // image ids enum { @@ -691,7 +690,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) imagelist-> Add( wxBitmap( gauge_xpm )); #endif // wxUSE_GAUGE m_book->SetImageList(imagelist); -#elif defined(__WXMSW__) +#else // load images from resources enum { @@ -722,7 +721,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) for ( size_t n = 0; n < Image_Max; n++ ) { wxBitmap bmp(s_iconNames[n]); - if ( !bmp.Ok() || (imagelist->Add(bmp) == -1) ) + if ( !bmp.IsOk() || (imagelist->Add(bmp) == -1) ) { wxLogWarning(wxT("Couldn't load the image '%s' for the book control page %d."), s_iconNames[n], n); @@ -730,19 +729,6 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) } m_book->SetImageList(imagelist); -#else - - // No images for now -#define Image_List -1 -#define Image_Choice -1 -#define Image_Combo -1 -#define Image_Text -1 -#define Image_Radio -1 -#if wxUSE_GAUGE -#define Image_Gauge -1 -#endif // wxUSE_GAUGE -#define Image_Max -1 - #endif wxPanel *panel = new wxPanel(m_book); @@ -869,7 +855,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxDefaultPosition, wxSize(155,wxDefaultCoord), wxSL_AUTOTICKS | wxSL_LABELS); - m_slider->SetTickFreq(40, 0); + m_slider->SetTickFreq(40); sz->Add( m_slider, 0, wxALL, 10 ); m_gaugeVert = new wxGauge( panel, wxID_ANY, 100, @@ -963,14 +949,15 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) dc.DrawText(wxT("Bitmap"), 30, 40); dc.SelectObject( wxNullBitmap ); - (void)new wxBitmapButton(panel, ID_BITMAP_BTN, bitmap, wxPoint(100, 20)); - (void)new wxToggleButton(panel, ID_BITMAP_BTN_ENABLE, - wxT("Enable/disable &bitmap"), wxPoint(100, 140)); + wxPanel *panel2 = new wxPanel(panel, -1, wxPoint(100, 0), wxSize(100, 200)); + (void)new wxBitmapButton(panel2, ID_BITMAP_BTN, bitmap, wxPoint(0, 20)); + (void)new wxToggleButton(panel2, ID_BITMAP_BTN_ENABLE, + wxT("Enable/disable &bitmap"), wxPoint(0, 140)); #if defined(__WXMSW__) || defined(__WXMOTIF__) // test for masked bitmap display bitmap = wxBitmap(wxT("test2.bmp"), wxBITMAP_TYPE_BMP); - if (bitmap.Ok()) + if (bitmap.IsOk()) { bitmap.SetMask(new wxMask(bitmap, *wxBLUE)); @@ -1196,7 +1183,7 @@ void MyPanel::OnChangeColour(wxCommandEvent& WXUNUSED(event)) SetThemeEnabled(false); // test panel colour changing and propagation to the subcontrols - if ( s_colOld.Ok() ) + if ( s_colOld.IsOk() ) { SetBackgroundColour(s_colOld); s_colOld = wxNullColour; @@ -1800,9 +1787,7 @@ MyFrame::MyFrame(const wxChar *title, int x, int y) // The wxICON() macros loads an icon from a resource under Windows // and uses an #included XPM image under GTK+ and Motif -#ifdef USE_XPM - SetIcon( wxICON(mondrian) ); -#endif + SetIcon( wxICON(sample) ); wxMenu *file_menu = new wxMenu;