From 61c083e7818114734695cb26aa006098a86e62c3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Tue, 23 Nov 2004 11:45:07 +0000 Subject: [PATCH] wxBookCtrl->wxBookCtrlBase. wxBookCtrl is now most suitable book for given platform. Samples adjustement. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30723 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/tchanges.tex | 6 +-- docs/latex/wx/tsamples.tex | 4 +- include/wx/bookctrl.h | 63 +++++++++++++++++++-------- include/wx/choicebk.h | 6 +-- include/wx/listbook.h | 6 +-- include/wx/notebook.h | 10 ++--- include/wx/sizer.h | 12 +++--- samples/controls/controls.cpp | 80 +++++++++++++++++------------------ samples/notebook/notebook.cpp | 36 ++++++++-------- samples/notebook/notebook.h | 2 +- samples/widgets/button.cpp | 8 ++-- samples/widgets/checkbox.cpp | 8 ++-- samples/widgets/combobox.cpp | 8 ++-- samples/widgets/gauge.cpp | 8 ++-- samples/widgets/listbox.cpp | 6 +-- samples/widgets/notebook.cpp | 12 ++---- samples/widgets/radiobox.cpp | 14 +++--- samples/widgets/slider.cpp | 15 ++++--- samples/widgets/spinbtn.cpp | 10 +++-- samples/widgets/static.cpp | 8 ++-- samples/widgets/textctrl.cpp | 6 +-- samples/widgets/widgets.cpp | 50 +++++++++++----------- samples/widgets/widgets.h | 12 +++--- src/common/bookctrl.cpp | 38 ++++++++--------- src/common/sizer.cpp | 2 +- src/generic/choicbkg.cpp | 10 ++--- src/generic/listbkg.cpp | 10 ++--- 27 files changed, 240 insertions(+), 210 deletions(-) diff --git a/docs/latex/wx/tchanges.tex b/docs/latex/wx/tchanges.tex index 1b60d6e97d..0b49efefdc 100644 --- a/docs/latex/wx/tchanges.tex +++ b/docs/latex/wx/tchanges.tex @@ -101,8 +101,8 @@ wxURL has undergone some radical changes. * Many accessors of wxURL - GetHostName, GetProtocolName, and GetPath, have been replaced by its parent's (wxURI) counterparts - GetServer, GetScheme, and GetPath, respectively. - - * ConvertToValidURI has been replaced by wxURI. Do not use + + * ConvertToValidURI has been replaced by wxURI. Do not use ConvertToValidURI for future applications. * ConvertFromURI has been replaced by wxURI::Unescape. @@ -190,7 +190,7 @@ wxURL has undergone some radical changes. \subsection{Depreciated changes since 2.4.x} -- wxURL::GetInputStream() and similar functionality has been depreciated in +- wxURL::GetInputStream() and similar functionality has been depreciated in favor of other ways of connecting, such as though sockets or wxFileSystem. - wxDocManager::GetNoHistoryFiles() renamed to GetHistoryFilesCount() diff --git a/docs/latex/wx/tsamples.tex b/docs/latex/wx/tsamples.tex index 1a214499d0..d20037ea77 100644 --- a/docs/latex/wx/tsamples.tex +++ b/docs/latex/wx/tsamples.tex @@ -344,7 +344,7 @@ The sample also provides some timings for adding/deleting/sorting a lot of \subsection{Mediaplayer sample}\label{samplemediaplayer} This sample demonstrates how to use all the features of -\helpref{wxMediaCtrl}{wxmediactrl} and play various types of sound, video, +\helpref{wxMediaCtrl}{wxmediactrl} and play various types of sound, video, and other files. @@ -352,7 +352,7 @@ It replaces the old dynamic sample. \subsection{Notebook sample}\label{samplenotebook} -This samples shows family of controls which derive from wxBookCtrl base class. +This samples shows family of controls which derive from wxBookCtrlBase base class. Although initially it was written to demonstrate \helpref{wxNotebook}{wxnotebook} only, it can now be also used to see \helpref{wxListbook}{wxlistbook} and \helpref{wxChoicebook}{wxchoicebook} in action. Test each of the controls, their diff --git a/include/wx/bookctrl.h b/include/wx/bookctrl.h index 49952ecb2c..115f9dce20 100644 --- a/include/wx/bookctrl.h +++ b/include/wx/bookctrl.h @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// // Name: wx/bookctrl.h -// Purpose: wxBookCtrl: common base class for wxList/Tree/Notebook +// Purpose: wxBookCtrlBase: common base class for wxList/Tree/Notebook // Author: Vadim Zeitlin // Modified by: // Created: 19.08.03 @@ -32,26 +32,26 @@ WX_DEFINE_EXPORTED_ARRAY_PTR(wxWindow *, wxArrayPages); class WXDLLEXPORT wxImageList; // ---------------------------------------------------------------------------- -// wxBookCtrl +// wxBookCtrlBase // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxBookCtrl : public wxControl +class WXDLLEXPORT wxBookCtrlBase : public wxControl { public: // construction // ------------ - wxBookCtrl() + wxBookCtrlBase() { Init(); } - wxBookCtrl(wxWindow *parent, - wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxEmptyString) + wxBookCtrlBase(wxWindow *parent, + wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString) { Init(); @@ -67,7 +67,7 @@ public: const wxString& name = wxEmptyString); // dtor - virtual ~wxBookCtrl(); + virtual ~wxBookCtrlBase(); // accessors @@ -84,7 +84,7 @@ public: { int n = GetSelection(); return n == wxNOT_FOUND ? NULL - : wx_const_cast(wxBookCtrl *, this)->GetPage(n); + : wx_const_cast(wxBookCtrlBase *, this)->GetPage(n); } // get the currently selected page or wxNOT_FOUND if none @@ -208,18 +208,18 @@ protected: bool m_ownsImageList; - DECLARE_NO_COPY_CLASS(wxBookCtrl) + DECLARE_NO_COPY_CLASS(wxBookCtrlBase) }; // ---------------------------------------------------------------------------- -// wxBookCtrlEvent: page changing events generated by derived classes +// wxBookCtrlBaseEvent: page changing events generated by derived classes // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxBookCtrlEvent : public wxNotifyEvent +class WXDLLEXPORT wxBookCtrlBaseEvent : public wxNotifyEvent { public: - wxBookCtrlEvent(wxEventType commandType = wxEVT_NULL, int winid = 0, - int nSel = -1, int nOldSel = -1) + wxBookCtrlBaseEvent(wxEventType commandType = wxEVT_NULL, int winid = 0, + int nSel = -1, int nOldSel = -1) : wxNotifyEvent(commandType, winid) { m_nSel = nSel; @@ -239,6 +239,35 @@ private: m_nOldSel; // previously selected page }; +// make a default book control for given platform +#if defined(__WXMSW__) && defined(__SMARTPHONE__) + #include "wx\choicebook.h" + #define wxBookCtrl wxChoicebook + #define wxBookCtrlEvent wxChoicebookEvent + #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED + #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING + #define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_CHOICEBOOK_PAGE_CHANGED(id, fn) + #define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_CHOICEBOOK_PAGE_CHANGING(id, fn) + #define wxBC_TOP wxNB_TOP + #define wxBC_BOTTOM wxNB_BOTTOM + #define wxBC_LEFT wxNB_LEFT + #define wxBC_RIGHT wxNB_RIGHT + #define wxBC_DEFAULT wxNB_DEFAULT +#else + #include "wx\notebook.h" + #define wxBookCtrl wxNotebook + #define wxBookCtrlEvent wxNotebookEvent + #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED + #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING + #define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_NOTEBOOK_PAGE_CHANGED(id, fn) + #define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_NOTEBOOK_PAGE_CHANGING(id, fn) + #define wxBC_TOP wxCHB_TOP + #define wxBC_BOTTOM wxCHB_BOTTOM + #define wxBC_LEFT wxCHB_LEFT + #define wxBC_RIGHT wxCHB_RIGHT + #define wxBC_DEFAULT wxCHB_DEFAULT +#endif + #endif // wxUSE_BOOKCTRL #endif // _WX_BOOKCTRL_H_ diff --git a/include/wx/choicebk.h b/include/wx/choicebk.h index db67bd1220..93338894e8 100644 --- a/include/wx/choicebk.h +++ b/include/wx/choicebk.h @@ -28,7 +28,7 @@ class WXDLLEXPORT wxChoice; // wxChoicebook // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxChoicebook : public wxBookCtrl +class WXDLLEXPORT wxChoicebook : public wxBookCtrlBase { public: wxChoicebook() @@ -107,12 +107,12 @@ private: // choicebook event class and related stuff // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxChoicebookEvent : public wxBookCtrlEvent +class WXDLLEXPORT wxChoicebookEvent : public wxBookCtrlBaseEvent { public: wxChoicebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, int nSel = -1, int nOldSel = -1) - : wxBookCtrlEvent(commandType, id, nSel, nOldSel) + : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) { } diff --git a/include/wx/listbook.h b/include/wx/listbook.h index 40e2976093..1b292be686 100644 --- a/include/wx/listbook.h +++ b/include/wx/listbook.h @@ -43,7 +43,7 @@ class WXDLLEXPORT wxStaticLine; // wxListbook // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxListbook : public wxBookCtrl +class WXDLLEXPORT wxListbook : public wxBookCtrlBase { public: wxListbook() @@ -129,12 +129,12 @@ private: // listbook event class and related stuff // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxListbookEvent : public wxBookCtrlEvent +class WXDLLEXPORT wxListbookEvent : public wxBookCtrlBaseEvent { public: wxListbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND) - : wxBookCtrlEvent(commandType, id, nSel, nOldSel) + : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel) { } diff --git a/include/wx/notebook.h b/include/wx/notebook.h index 81ac3b615d..6dbfbe7d82 100644 --- a/include/wx/notebook.h +++ b/include/wx/notebook.h @@ -47,7 +47,7 @@ typedef wxWindow wxNotebookPage; // so far, any window can be a page // wxNotebookBase: define wxNotebook interface // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxNotebookBase : public wxBookCtrl +class WXDLLEXPORT wxNotebookBase : public wxBookCtrlBase { public: // ctors @@ -62,8 +62,8 @@ public: long style = 0, const wxString& name = wxNOTEBOOK_NAME) ; - // wxNotebook-specific additions to wxBookCtrl interface - // ----------------------------------------------------- + // wxNotebook-specific additions to wxBookCtrlBase interface + // --------------------------------------------------------- // get the number of rows for a control with wxNB_MULTILINE style (not all // versions support it - they will always return 1 then) @@ -95,12 +95,12 @@ protected: // notebook event class and related stuff // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxNotebookEvent : public wxBookCtrlEvent +class WXDLLEXPORT wxNotebookEvent : public wxBookCtrlBaseEvent { public: wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int winid = 0, int nSel = -1, int nOldSel = -1) - : wxBookCtrlEvent(commandType, winid, nSel, nOldSel) + : wxBookCtrlBaseEvent(commandType, winid, nSel, nOldSel) { } diff --git a/include/wx/sizer.h b/include/wx/sizer.h index 820c325028..e13f202903 100644 --- a/include/wx/sizer.h +++ b/include/wx/sizer.h @@ -644,7 +644,7 @@ private: #if WXWIN_COMPATIBILITY_2_4 // NB: wxBookCtrlSizer and wxNotebookSizer are deprecated, they -// don't do anything. wxBookCtrl::DoGetBestSize does the job now. +// don't do anything. wxBookCtrlBase::DoGetBestSize does the job now. // ---------------------------------------------------------------------------- // wxBookCtrlSizer @@ -654,14 +654,14 @@ private: // this sizer works with wxNotebook/wxListbook/... and sizes the control to // fit its pages -class WXDLLEXPORT wxBookCtrl; +class WXDLLEXPORT wxBookCtrlBase; class WXDLLEXPORT wxBookCtrlSizer : public wxSizer { public: - wxDEPRECATED( wxBookCtrlSizer(wxBookCtrl *bookctrl) ); + wxDEPRECATED( wxBookCtrlSizer(wxBookCtrlBase *bookctrl) ); - wxBookCtrl *GetControl() const { return m_bookctrl; } + wxBookCtrlBase *GetControl() const { return m_bookctrl; } virtual void RecalcSizes(); virtual wxSize CalcMin(); @@ -671,7 +671,7 @@ protected: // and still have warning-free build of the library itself: wxBookCtrlSizer() {} - wxBookCtrl *m_bookctrl; + wxBookCtrlBase *m_bookctrl; private: DECLARE_CLASS(wxBookCtrlSizer) @@ -681,7 +681,7 @@ private: #if wxUSE_NOTEBOOK -// before wxBookCtrl we only had wxNotebookSizer, keep it for backwards +// before wxBookCtrlBase we only had wxNotebookSizer, keep it for backwards // compatibility class WXDLLEXPORT wxNotebook; diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 4fea525155..b8a1827dbd 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -23,7 +23,7 @@ #include "wx/spinbutt.h" #endif #include "wx/tglbtn.h" -#include "wx/notebook.h" +#include "wx/bookctrl.h" #include "wx/imaglist.h" #include "wx/artprov.h" @@ -88,8 +88,8 @@ public: void OnRadioButton1( wxCommandEvent &event ); void OnRadioButton2( wxCommandEvent &event ); void OnSetFont( wxCommandEvent &event ); - void OnPageChanged( wxNotebookEvent &event ); - void OnPageChanging( wxNotebookEvent &event ); + void OnPageChanged( wxBookCtrlEvent &event ); + void OnPageChanging( wxBookCtrlEvent &event ); void OnSliderUpdate( wxCommandEvent &event ); void OnUpdateLabel( wxCommandEvent &event ); #if wxUSE_SPINBTN @@ -142,7 +142,7 @@ public: wxCheckBox *m_checkbox; wxTextCtrl *m_text; - wxNotebook *m_notebook; + wxBookCtrl *m_book; wxStaticText *m_label; @@ -355,7 +355,7 @@ bool MyApp::OnInit() // MyPanel //---------------------------------------------------------------------- -const int ID_NOTEBOOK = 1000; +const int ID_BOOK = 1000; const int ID_LISTBOX = 130; const int ID_LISTBOX_SEL_NUM = 131; @@ -420,8 +420,8 @@ const int ID_SIZER_CHECKBIG = 206; BEGIN_EVENT_TABLE(MyPanel, wxPanel) EVT_SIZE ( MyPanel::OnSize) -EVT_NOTEBOOK_PAGE_CHANGING(ID_NOTEBOOK, MyPanel::OnPageChanging) -EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, MyPanel::OnPageChanged) +EVT_BOOKCTRL_PAGE_CHANGING(ID_BOOK, MyPanel::OnPageChanging) +EVT_BOOKCTRL_PAGE_CHANGED(ID_BOOK, MyPanel::OnPageChanged) EVT_LISTBOX (ID_LISTBOX, MyPanel::OnListBox) EVT_LISTBOX (ID_LISTBOX_SORTED, MyPanel::OnListBox) EVT_LISTBOX_DCLICK(ID_LISTBOX, MyPanel::OnListBoxDoubleClick) @@ -542,7 +542,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_spintext = NULL; m_checkbox = NULL; m_text = NULL; - m_notebook = NULL; + m_book = NULL; m_label = NULL; m_text = new wxTextCtrl(this, wxID_ANY, _T("This is the log window.\n"), @@ -551,7 +551,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_logTargetOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_text)); - m_notebook = new wxNotebook(this, ID_NOTEBOOK); + m_book = new wxBookCtrl(this, ID_BOOK); wxString choices[] = { @@ -580,7 +580,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) imagelist-> Add( wxBitmap( text_xpm )); imagelist-> Add( wxBitmap( radio_xpm )); imagelist-> Add( wxBitmap( gauge_xpm )); - m_notebook->SetImageList(imagelist); + m_book->SetImageList(imagelist); #elif defined(__WXMSW__) // load images from resources enum @@ -600,12 +600,12 @@ 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(wxT("Couldn't load the image '%s' for the notebook page %d."), + wxLogWarning(wxT("Couldn't load the image '%s' for the book control page %d."), s_iconNames[n], n); } } - m_notebook->SetImageList(imagelist); + m_book->SetImageList(imagelist); #else // No images for now @@ -619,7 +619,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) #endif - wxPanel *panel = new wxPanel(m_notebook); + wxPanel *panel = new wxPanel(m_book); m_listbox = new wxListBox( panel, ID_LISTBOX, wxPoint(10,10), wxSize(120,70), 5, choices, wxLB_ALWAYS_SB ); @@ -658,10 +658,10 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) (void)new wxCheckBox( panel, ID_CHANGE_COLOUR, _T("&Toggle colour"), wxPoint(110,170) ); panel->SetCursor(wxCursor(wxCURSOR_HAND)); - m_notebook->AddPage(panel, _T("wxListBox"), true, Image_List); + m_book->AddPage(panel, _T("wxListBox"), true, Image_List); #if wxUSE_CHOICE - panel = new wxPanel(m_notebook); + panel = new wxPanel(m_book); 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 ); @@ -679,10 +679,10 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) (void)new wxButton( panel, ID_CHOICE_FONT, _T("Set &Italic font"), wxPoint(340,130), wxSize(140,30) ); (void)new wxCheckBox( panel, ID_CHOICE_ENABLE, _T("&Disable"), wxPoint(20,130), wxSize(140,30) ); - m_notebook->AddPage(panel, _T("wxChoice"), false, Image_Choice); + m_book->AddPage(panel, _T("wxChoice"), false, Image_Choice); #endif // wxUSE_CHOICE - panel = new wxPanel(m_notebook); + panel = new wxPanel(m_book); (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"), @@ -698,7 +698,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) (void)new wxButton( panel, ID_COMBO_DELETE, _T("D&elete selected item"), wxPoint(180,130), wxSize(140,30) ); (void)new wxButton( panel, ID_COMBO_FONT, _T("Set &Italic font"), wxPoint(340,130), wxSize(140,30) ); (void)new wxCheckBox( panel, ID_COMBO_ENABLE, _T("&Disable"), wxPoint(20,130), wxSize(140,30) ); - m_notebook->AddPage(panel, _T("wxComboBox"), false, Image_Combo); + m_book->AddPage(panel, _T("wxComboBox"), false, Image_Combo); wxString choices2[] = { @@ -708,7 +708,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) "Seventh", "Eighth", "Nineth", "Tenth" */ }; - panel = new wxPanel(m_notebook); + panel = new wxPanel(m_book); (void)new MyRadioBox( panel, ID_RADIOBOX, _T("&That"), wxPoint(10,160), wxDefaultSize, WXSIZEOF(choices2), choices2, 1, wxRA_SPECIFY_ROWS ); m_radio = new wxRadioBox( panel, ID_RADIOBOX, _T("T&his"), wxPoint(10,10), wxDefaultSize, WXSIZEOF(choices), choices, 1, wxRA_SPECIFY_COLS ); m_radio->SetForegroundColour(*wxRED); @@ -726,9 +726,9 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) wxRadioButton *rb = new wxRadioButton( panel, ID_RADIOBUTTON_1, _T("Radiobutton1"), wxPoint(210,170), wxDefaultSize, wxRB_GROUP ); rb->SetValue( false ); (void)new wxRadioButton( panel, ID_RADIOBUTTON_2, _T("&Radiobutton2"), wxPoint(340,170), wxDefaultSize ); - m_notebook->AddPage(panel, _T("wxRadioBox"), false, Image_Radio); + m_book->AddPage(panel, _T("wxRadioBox"), false, Image_Radio); - panel = new wxPanel(m_notebook); + panel = new wxPanel(m_book); (void)new wxStaticBox( panel, wxID_ANY, _T("&wxGauge and wxSlider"), wxPoint(10,10), wxSize(222,130) ); m_gauge = new wxGauge( panel, wxID_ANY, 200, wxPoint(18,50), wxSize(155, 30), wxGA_HORIZONTAL|wxNO_BORDER ); m_gauge->SetBackgroundColour(*wxGREEN); @@ -785,9 +785,9 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_spinctrl->SetValue(15); #endif // wxUSE_SPINCTRL - m_notebook->AddPage(panel, _T("wxGauge"), false, Image_Gauge); + m_book->AddPage(panel, _T("wxGauge"), false, Image_Gauge); - panel = new wxPanel(m_notebook); + panel = new wxPanel(m_book); #if !defined(__WXMOTIF__) // wxStaticBitmap not working under Motif yet. wxIcon icon = wxArtProvider::GetIcon(wxART_INFORMATION); @@ -846,18 +846,18 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) wxALIGN_RIGHT /*| wxST_NO_AUTORESIZE*/); m_label->SetForegroundColour( *wxBLUE ); - m_notebook->AddPage(panel, _T("wxBitmapXXX")); + m_book->AddPage(panel, _T("wxBitmapXXX")); // sizer - panel = new wxPanel(m_notebook); + panel = new wxPanel(m_book); panel->SetAutoLayout( true ); wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL ); wxStaticBoxSizer *csizer = 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")); check1->SetValue (true); @@ -877,13 +877,13 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) checkBig = new wxCheckBox (panel, ID_SIZER_CHECKBIG, _T("Big")); checkBig->SetValue (true); csizer->Add (checkBig); - + sizer->Add (csizer); m_hsizer = new wxBoxSizer( wxHORIZONTAL ); m_buttonSizer = new wxBoxSizer (wxVERTICAL); - + 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 (tab order 3)") ); @@ -904,7 +904,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) panel->SetSizer( sizer ); - m_notebook->AddPage(panel, _T("wxSizer")); + m_book->AddPage(panel, _T("wxSizer")); } void MyPanel::OnSize( wxSizeEvent& WXUNUSED(event) ) @@ -913,11 +913,11 @@ void MyPanel::OnSize( wxSizeEvent& WXUNUSED(event) ) int y = 0; GetClientSize( &x, &y ); - if (m_notebook) m_notebook->SetSize( 2, 2, x-4, y*2/3-4 ); + if (m_book) m_book->SetSize( 2, 2, x-4, y*2/3-4 ); if (m_text) m_text->SetSize( 2, y*2/3+2, x-4, y/3-4 ); } -void MyPanel::OnPageChanging( wxNotebookEvent &event ) +void MyPanel::OnPageChanging( wxBookCtrlEvent &event ) { int selOld = event.GetOldSelection(); if ( selOld == 2 ) @@ -934,16 +934,16 @@ void MyPanel::OnPageChanging( wxNotebookEvent &event ) } } - *m_text << _T("Notebook selection is being changed from ") << selOld + *m_text << _T("Book selection is being changed from ") << selOld << _T(" to ") << event.GetSelection() - << _T(" (current page from notebook is ") - << m_notebook->GetSelection() << _T(")\n"); + << _T(" (current page from book is ") + << m_book->GetSelection() << _T(")\n"); } -void MyPanel::OnPageChanged( wxNotebookEvent &event ) +void MyPanel::OnPageChanged( wxBookCtrlEvent &event ) { - *m_text << _T("Notebook selection is now ") << event.GetSelection() - << _T(" (from notebook: ") << m_notebook->GetSelection() + *m_text << _T("Book selection is now ") << event.GetSelection() + << _T(" (from book: ") << m_book->GetSelection() << _T(")\n"); } @@ -1418,13 +1418,13 @@ void MyPanel::OnUpdateShowProgress( wxUpdateUIEvent& event ) void MyPanel::OnShowProgress( wxCommandEvent& WXUNUSED(event) ) { int max = m_spinbutton->GetValue(); - + if ( max <= 0 ) { wxLogError(_T("You must set positive range!")); return; } - + wxProgressDialog dialog(_T("Progress dialog example"), _T("An informative message"), max, // range @@ -1503,7 +1503,7 @@ MyPanel::~MyPanel() //wxLog::RemoveTraceMask(_T("focus")); delete wxLog::SetActiveTarget(m_logTargetOld); - delete m_notebook->GetImageList(); + delete m_book->GetImageList(); } //---------------------------------------------------------------------- diff --git a/samples/notebook/notebook.cpp b/samples/notebook/notebook.cpp index e15d1c5f46..a7fdeea343 100644 --- a/samples/notebook/notebook.cpp +++ b/samples/notebook/notebook.cpp @@ -44,7 +44,7 @@ bool MyApp::OnInit() return true; } -wxPanel *CreateUserCreatedPage(wxBookCtrl *parent) +wxPanel *CreateUserCreatedPage(wxBookCtrlBase *parent) { wxPanel *panel = new wxPanel(parent); @@ -54,7 +54,7 @@ wxPanel *CreateUserCreatedPage(wxBookCtrl *parent) return panel; } -wxPanel *CreateRadioButtonsPage(wxBookCtrl *parent) +wxPanel *CreateRadioButtonsPage(wxBookCtrlBase *parent) { wxPanel *panel = new wxPanel(parent); @@ -79,7 +79,7 @@ wxPanel *CreateRadioButtonsPage(wxBookCtrl *parent) return panel; } -wxPanel *CreateVetoPage(wxBookCtrl *parent) +wxPanel *CreateVetoPage(wxBookCtrlBase *parent) { wxPanel *panel = new wxPanel(parent); @@ -89,7 +89,7 @@ wxPanel *CreateVetoPage(wxBookCtrl *parent) return panel; } -wxPanel *CreateBigButtonPage(wxBookCtrl *parent) +wxPanel *CreateBigButtonPage(wxBookCtrlBase *parent) { wxPanel *panel = new wxPanel(parent); @@ -103,7 +103,7 @@ wxPanel *CreateBigButtonPage(wxBookCtrl *parent) } -wxPanel *CreateInsertPage(wxBookCtrl *parent) +wxPanel *CreateInsertPage(wxBookCtrlBase *parent) { wxPanel *panel = new wxPanel(parent); @@ -114,7 +114,7 @@ wxPanel *CreateInsertPage(wxBookCtrl *parent) return panel; } -int GetIconIndex(wxBookCtrl* bookCtrl) +int GetIconIndex(wxBookCtrlBase* bookCtrl) { if (bookCtrl && bookCtrl->GetImageList()) { @@ -128,7 +128,7 @@ int GetIconIndex(wxBookCtrl* bookCtrl) return -1; } -void CreateInitialPages(wxBookCtrl *parent) +void CreateInitialPages(wxBookCtrlBase *parent) { // Create and add some panels to the notebook @@ -147,7 +147,7 @@ void CreateInitialPages(wxBookCtrl *parent) parent->SetSelection(1); } -wxPanel *CreatePage(wxBookCtrl *parent, const wxString&pageName) +wxPanel *CreatePage(wxBookCtrlBase *parent, const wxString&pageName) { if ( @@ -413,7 +413,7 @@ void MyFrame::RecreateBooks() ShowCurrentBook(); } -wxBookCtrl *MyFrame::GetCurrentBook() +wxBookCtrlBase *MyFrame::GetCurrentBook() { switch (m_type) { @@ -483,7 +483,7 @@ END_EVENT_TABLE() void MyFrame::OnType(wxCommandEvent& event) { - wxBookCtrl *currBook = GetCurrentBook(); + wxBookCtrlBase *currBook = GetCurrentBook(); m_type = event.GetId(); @@ -524,7 +524,7 @@ void MyFrame::OnAddPage(wxCommandEvent& WXUNUSED(event)) { static unsigned s_pageAdded = 0; - wxBookCtrl *currBook = GetCurrentBook(); + wxBookCtrlBase *currBook = GetCurrentBook(); if ( currBook ) { @@ -543,7 +543,7 @@ void MyFrame::OnInsertPage(wxCommandEvent& WXUNUSED(event)) { static unsigned s_pageIns = 0; - wxBookCtrl *currBook = GetCurrentBook(); + wxBookCtrlBase *currBook = GetCurrentBook(); if ( currBook ) { @@ -559,7 +559,7 @@ void MyFrame::OnInsertPage(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnDeleteCurPage(wxCommandEvent& WXUNUSED(event)) { - wxBookCtrl *currBook = GetCurrentBook(); + wxBookCtrlBase *currBook = GetCurrentBook(); if ( currBook ) { @@ -574,7 +574,7 @@ void MyFrame::OnDeleteCurPage(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnDeleteLastPage(wxCommandEvent& WXUNUSED(event)) { - wxBookCtrl *currBook = GetCurrentBook(); + wxBookCtrlBase *currBook = GetCurrentBook(); if ( currBook ) { @@ -589,7 +589,7 @@ void MyFrame::OnDeleteLastPage(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnNextPage(wxCommandEvent& WXUNUSED(event)) { - wxBookCtrl *currBook = GetCurrentBook(); + wxBookCtrlBase *currBook = GetCurrentBook(); if ( currBook ) { @@ -601,9 +601,9 @@ void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) ) { static int s_nPages = wxNOT_FOUND; static int s_nSel = wxNOT_FOUND; - static wxBookCtrl *s_currBook = NULL; + static wxBookCtrlBase *s_currBook = NULL; - wxBookCtrl *currBook = GetCurrentBook(); + wxBookCtrlBase *currBook = GetCurrentBook(); int nPages = currBook ? currBook->GetPageCount() : 0; int nSel = currBook ? currBook->GetSelection() : wxNOT_FOUND; @@ -643,7 +643,7 @@ void MyFrame::OnBook(wxBookEvent& event) else if (eventType == wxEVT_PAGE_CHANGING) \ { \ int idx = event.GetOldSelection(); \ - wxBookCtrl *book = (wxBookCtrl *)event.GetEventObject(); \ + wxBookCtrlBase *book = (wxBookCtrlBase *)event.GetEventObject(); \ if ( idx != wxNOT_FOUND && book && book->GetPageText(idx) == VETO_PAGE_NAME ) \ { \ if \ diff --git a/samples/notebook/notebook.h b/samples/notebook/notebook.h index 777ba33404..1eac27735d 100644 --- a/samples/notebook/notebook.h +++ b/samples/notebook/notebook.h @@ -60,7 +60,7 @@ public: void OnIdle(wxIdleEvent& event); - wxBookCtrl *GetCurrentBook(); + wxBookCtrlBase *GetCurrentBook(); private: wxLog *m_logTargetOld; diff --git a/samples/widgets/button.cpp b/samples/widgets/button.cpp index a1f33a0eb9..11e0e9e6e5 100644 --- a/samples/widgets/button.cpp +++ b/samples/widgets/button.cpp @@ -77,7 +77,7 @@ enum class ButtonWidgetsPage : public WidgetsPage { public: - ButtonWidgetsPage(wxNotebook *notebook, wxImageList *imaglist); + ButtonWidgetsPage(wxBookCtrl *book, wxImageList *imaglist); virtual ~ButtonWidgetsPage(){}; virtual wxControl *GetWidget() const { return m_button; } @@ -139,9 +139,9 @@ END_EVENT_TABLE() IMPLEMENT_WIDGETS_PAGE(ButtonWidgetsPage, _T("Button")); -ButtonWidgetsPage::ButtonWidgetsPage(wxNotebook *notebook, - wxImageList *imaglist) - : WidgetsPage(notebook) +ButtonWidgetsPage::ButtonWidgetsPage(wxBookCtrl *book, + wxImageList *imaglist) + : WidgetsPage(book) { imaglist->Add(wxBitmap(button_xpm)); diff --git a/samples/widgets/checkbox.cpp b/samples/widgets/checkbox.cpp index 250fb53614..d0c53b5734 100644 --- a/samples/widgets/checkbox.cpp +++ b/samples/widgets/checkbox.cpp @@ -73,7 +73,7 @@ enum class CheckBoxWidgetsPage : public WidgetsPage { public: - CheckBoxWidgetsPage(wxNotebook *notebook, wxImageList *imaglist); + CheckBoxWidgetsPage(wxBookCtrl *book, wxImageList *imaglist); virtual ~CheckBoxWidgetsPage(){}; virtual wxControl *GetWidget() const { return m_checkbox; } @@ -149,9 +149,9 @@ END_EVENT_TABLE() IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, wxT("CheckBox")); -CheckBoxWidgetsPage::CheckBoxWidgetsPage(wxNotebook *notebook, - wxImageList *imaglist) - : WidgetsPage(notebook) +CheckBoxWidgetsPage::CheckBoxWidgetsPage(wxBookCtrl *book, + wxImageList *imaglist) + : WidgetsPage(book) { imaglist->Add(wxBitmap(checkbox_xpm)); diff --git a/samples/widgets/combobox.cpp b/samples/widgets/combobox.cpp index 875d02296a..9bfdc11157 100644 --- a/samples/widgets/combobox.cpp +++ b/samples/widgets/combobox.cpp @@ -84,7 +84,7 @@ enum class ComboboxWidgetsPage : public WidgetsPage { public: - ComboboxWidgetsPage(wxNotebook *notebook, wxImageList *imaglist); + ComboboxWidgetsPage(wxBookCtrl *book, wxImageList *imaglist); virtual wxControl *GetWidget() const { return m_combobox; } @@ -190,9 +190,9 @@ END_EVENT_TABLE() IMPLEMENT_WIDGETS_PAGE(ComboboxWidgetsPage, _T("Combobox")); -ComboboxWidgetsPage::ComboboxWidgetsPage(wxNotebook *notebook, - wxImageList *imaglist) - : WidgetsPage(notebook) +ComboboxWidgetsPage::ComboboxWidgetsPage(wxBookCtrl *book, + wxImageList *imaglist) + : WidgetsPage(book) { // init everything m_chkSort = diff --git a/samples/widgets/gauge.cpp b/samples/widgets/gauge.cpp index 54610ac03b..372d0817b7 100644 --- a/samples/widgets/gauge.cpp +++ b/samples/widgets/gauge.cpp @@ -71,7 +71,7 @@ enum class GaugeWidgetsPage : public WidgetsPage { public: - GaugeWidgetsPage(wxNotebook *notebook, wxImageList *imaglist); + GaugeWidgetsPage(wxBookCtrl *book, wxImageList *imaglist); virtual ~GaugeWidgetsPage(); virtual wxControl *GetWidget() const { return m_gauge; } @@ -158,9 +158,9 @@ END_EVENT_TABLE() IMPLEMENT_WIDGETS_PAGE(GaugeWidgetsPage, _T("Gauge")); -GaugeWidgetsPage::GaugeWidgetsPage(wxNotebook *notebook, - wxImageList *imaglist) - : WidgetsPage(notebook) +GaugeWidgetsPage::GaugeWidgetsPage(wxBookCtrl *book, + wxImageList *imaglist) + :WidgetsPage(book) { imaglist->Add(wxBitmap(gauge_xpm)); diff --git a/samples/widgets/listbox.cpp b/samples/widgets/listbox.cpp index a4416dcff1..686cbe4021 100644 --- a/samples/widgets/listbox.cpp +++ b/samples/widgets/listbox.cpp @@ -76,7 +76,7 @@ enum class ListboxWidgetsPage : public WidgetsPage { public: - ListboxWidgetsPage(wxNotebook *notebook, wxImageList *imaglist); + ListboxWidgetsPage(wxBookCtrl *book, wxImageList *imaglist); virtual wxControl *GetWidget() const { return m_lbox; } @@ -193,9 +193,9 @@ END_EVENT_TABLE() IMPLEMENT_WIDGETS_PAGE(ListboxWidgetsPage, _T("Listbox")); -ListboxWidgetsPage::ListboxWidgetsPage(wxNotebook *notebook, +ListboxWidgetsPage::ListboxWidgetsPage(wxBookCtrl *book, wxImageList *imaglist) - : WidgetsPage(notebook) + : WidgetsPage(book) { imaglist->Add(wxBitmap(listbox_xpm)); diff --git a/samples/widgets/notebook.cpp b/samples/widgets/notebook.cpp index 6e8c9b7709..736e43f8fb 100644 --- a/samples/widgets/notebook.cpp +++ b/samples/widgets/notebook.cpp @@ -24,6 +24,8 @@ #pragma hdrstop #endif +#if wxUSE_NOTEBOOK + // for all others, include the necessary headers #ifndef WX_PRECOMP #include "wx/app.h" @@ -44,7 +46,6 @@ #include "wx/artprov.h" #include "widgets.h" -#if 1 #include "icons/notebook.xpm" // ---------------------------------------------------------------------------- @@ -78,11 +79,6 @@ enum Orient Orient_Max }; -// old versions of wxWidgets don't define this style -#ifndef wxNB_TOP - #define wxNB_TOP (0) -#endif - // ---------------------------------------------------------------------------- // NotebookWidgetsPage // ---------------------------------------------------------------------------- @@ -395,7 +391,7 @@ void NotebookWidgetsPage::CreateNotebook() m_notebook->AddPage(CreateNewPage(), old_note->GetPageText(n), false, - m_chkImages->GetValue() ? + m_chkImages->GetValue() ? GetIconIndex() : -1); } @@ -548,4 +544,4 @@ void NotebookWidgetsPage::OnPageChanged(wxNotebookEvent& event) event.Skip(); } -#endif +#endif // wxUSE_NOTEBOOK diff --git a/samples/widgets/radiobox.cpp b/samples/widgets/radiobox.cpp index b3af3419ad..ebb3f78086 100644 --- a/samples/widgets/radiobox.cpp +++ b/samples/widgets/radiobox.cpp @@ -24,6 +24,8 @@ #pragma hdrstop #endif +#if wxUSE_RADIOBOX + // for all others, include the necessary headers #ifndef WX_PRECOMP #include "wx/log.h" @@ -39,7 +41,7 @@ #include "wx/sizer.h" #include "widgets.h" -#if 1 + #include "icons/radiobox.xpm" // ---------------------------------------------------------------------------- @@ -76,7 +78,7 @@ static const unsigned int DEFAULT_MAJOR_DIM = 3; class RadioWidgetsPage : public WidgetsPage { public: - RadioWidgetsPage(wxNotebook *notebook, wxImageList *imaglist); + RadioWidgetsPage(wxBookCtrl *book, wxImageList *imaglist); virtual ~RadioWidgetsPage(){}; virtual wxControl *GetWidget() const { return m_radio; } @@ -154,9 +156,9 @@ END_EVENT_TABLE() IMPLEMENT_WIDGETS_PAGE(RadioWidgetsPage, _T("Radio")); -RadioWidgetsPage::RadioWidgetsPage(wxNotebook *notebook, - wxImageList *imaglist) - : WidgetsPage(notebook) +RadioWidgetsPage::RadioWidgetsPage(wxBookCtrl *book, + wxImageList *imaglist) + : WidgetsPage(book) { imaglist->Add(wxBitmap(radio_xpm)); @@ -455,4 +457,4 @@ void RadioWidgetsPage::OnUpdateUIReset(wxUpdateUIEvent& event) event.Enable(enable); } -#endif +#endif // wxUSE_RADIOBOX diff --git a/samples/widgets/slider.cpp b/samples/widgets/slider.cpp index 2c5344eb03..ec8cb751ec 100644 --- a/samples/widgets/slider.cpp +++ b/samples/widgets/slider.cpp @@ -24,6 +24,8 @@ #pragma hdrstop #endif +#if wxUSE_SLIDER + // for all others, include the necessary headers #ifndef WX_PRECOMP #include "wx/log.h" @@ -44,7 +46,7 @@ #include "wx/sizer.h" #include "widgets.h" -#if wxUSE_SLIDER + #include "icons/slider.xpm" // ---------------------------------------------------------------------------- @@ -87,7 +89,7 @@ enum class SliderWidgetsPage : public WidgetsPage { public: - SliderWidgetsPage(wxNotebook *notebook, wxImageList *imaglist); + SliderWidgetsPage(wxBookCtrl *book, wxImageList *imaglist); virtual ~SliderWidgetsPage(){}; virtual wxControl *GetWidget() const { return m_slider; } @@ -197,9 +199,9 @@ END_EVENT_TABLE() IMPLEMENT_WIDGETS_PAGE(SliderWidgetsPage, _T("Slider")); -SliderWidgetsPage::SliderWidgetsPage(wxNotebook *notebook, - wxImageList *imaglist) - : WidgetsPage(notebook) +SliderWidgetsPage::SliderWidgetsPage(wxBookCtrl *book, + wxImageList *imaglist) + : WidgetsPage(book) { imaglist->Add(wxBitmap(slider_xpm)); @@ -600,5 +602,4 @@ void SliderWidgetsPage::OnSlider(wxScrollEvent& event) event.GetPosition()); } -#endif - // wxUSE_SLIDER +#endif // wxUSE_SLIDER diff --git a/samples/widgets/spinbtn.cpp b/samples/widgets/spinbtn.cpp index 7b63513959..d0c53b37bf 100644 --- a/samples/widgets/spinbtn.cpp +++ b/samples/widgets/spinbtn.cpp @@ -24,6 +24,8 @@ #pragma hdrstop #endif +#if wxUSE_SPINBTN + // for all others, include the necessary headers #ifndef WX_PRECOMP #include "wx/log.h" @@ -42,7 +44,7 @@ #include "wx/sizer.h" #include "widgets.h" -#if wxUSE_SPINBTN + #include "icons/spinbtn.xpm" // ---------------------------------------------------------------------------- @@ -71,7 +73,7 @@ enum class SpinBtnWidgetsPage : public WidgetsPage { public: - SpinBtnWidgetsPage(wxNotebook *notebook, wxImageList *imaglist); + SpinBtnWidgetsPage(wxBookCtrl *book, wxImageList *imaglist); virtual ~SpinBtnWidgetsPage(){}; virtual wxControl *GetWidget() const { return m_spinbtn; } @@ -164,9 +166,9 @@ END_EVENT_TABLE() IMPLEMENT_WIDGETS_PAGE(SpinBtnWidgetsPage, _T("Spin")); -SpinBtnWidgetsPage::SpinBtnWidgetsPage(wxNotebook *notebook, +SpinBtnWidgetsPage::SpinBtnWidgetsPage(wxBookCtrl *book, wxImageList *imaglist) - : WidgetsPage(notebook) + : WidgetsPage(book) { m_chkVert = NULL; m_chkWrap = NULL; diff --git a/samples/widgets/static.cpp b/samples/widgets/static.cpp index 0b401aabbf..63cfb0d583 100644 --- a/samples/widgets/static.cpp +++ b/samples/widgets/static.cpp @@ -139,7 +139,7 @@ END_EVENT_TABLE() class StaticWidgetsPage : public WidgetsPage { public: - StaticWidgetsPage(wxNotebook *notebook, wxImageList *imaglist); + StaticWidgetsPage(wxBookCtrl *book, wxImageList *imaglist); virtual ~StaticWidgetsPage(){}; virtual wxControl *GetWidget() const { return m_statText; } @@ -205,9 +205,9 @@ END_EVENT_TABLE() IMPLEMENT_WIDGETS_PAGE(StaticWidgetsPage, _T("Static")); -StaticWidgetsPage::StaticWidgetsPage(wxNotebook *notebook, - wxImageList *imaglist) - : WidgetsPage(notebook) +StaticWidgetsPage::StaticWidgetsPage(wxBookCtrl *book, + wxImageList *imaglist) + : WidgetsPage(book) { imaglist->Add(wxBitmap(statbox_xpm)); diff --git a/samples/widgets/textctrl.cpp b/samples/widgets/textctrl.cpp index 0a278daed1..21a4f36f7c 100644 --- a/samples/widgets/textctrl.cpp +++ b/samples/widgets/textctrl.cpp @@ -113,7 +113,7 @@ class TextWidgetsPage : public WidgetsPage { public: // ctor(s) and dtor - TextWidgetsPage(wxNotebook *notebook, wxImageList *imaglist); + TextWidgetsPage(wxBookCtrl *book, wxImageList *imaglist); virtual ~TextWidgetsPage(){}; virtual wxControl *GetWidget() const { return m_text; } @@ -310,8 +310,8 @@ IMPLEMENT_WIDGETS_PAGE(TextWidgetsPage, _T("Text")); // TextWidgetsPage creation // ---------------------------------------------------------------------------- -TextWidgetsPage::TextWidgetsPage(wxNotebook *notebook, wxImageList *imaglist) - : WidgetsPage(notebook) +TextWidgetsPage::TextWidgetsPage(wxBookCtrl *book, wxImageList *imaglist) + : WidgetsPage(book) { imaglist->Add(wxBitmap(text_xpm)); diff --git a/samples/widgets/widgets.cpp b/samples/widgets/widgets.cpp index e5a145b11a..62f9724543 100644 --- a/samples/widgets/widgets.cpp +++ b/samples/widgets/widgets.cpp @@ -39,7 +39,7 @@ #include "wx/textctrl.h" #endif -#include "wx/notebook.h" +#include "wx/bookctrl.h" #include "wx/sizer.h" #include "wx/colordlg.h" @@ -94,8 +94,8 @@ protected: void OnSetBgCol(wxCommandEvent& event); #endif // wxUSE_MENUS - // initialize the notebook: add all pages to it - void InitNotebook(); + // initialize the book: add all pages to it + void InitBook(); private: // the panel containing everything @@ -109,8 +109,8 @@ private: wxLog *m_logTarget; #endif // wxUSE_LOG - // the notebook containing the test pages - wxNotebook *m_notebook; + // the book containing the test pages + wxBookCtrl *m_book; // and the image list for it wxImageList *m_imaglist; @@ -267,7 +267,7 @@ WidgetsFrame::WidgetsFrame(const wxString& title) m_lboxLog = (wxListBox *)NULL; m_logTarget = (wxLog *)NULL; #endif // wxUSE_LOG - m_notebook = (wxNotebook *)NULL; + m_book = (wxBookCtrl *)NULL; m_imaglist = (wxImageList *)NULL; #if wxUSE_MENUS @@ -288,12 +288,12 @@ WidgetsFrame::WidgetsFrame(const wxString& title) wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL); - // we have 2 panes: notebook which pages demonstrating the controls in the + // we have 2 panes: book which pages demonstrating the controls in the // upper one and the log window with some buttons in the lower - m_notebook = new wxNotebook(m_panel, wxID_ANY, wxDefaultPosition, - wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN); - InitNotebook(); + m_book = new wxBookCtrl(m_panel, wxID_ANY, wxDefaultPosition, + wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN|wxBC_DEFAULT); + InitBook(); // the lower one only has the log listbox and a button to clear it #if wxUSE_LOG @@ -320,7 +320,7 @@ WidgetsFrame::WidgetsFrame(const wxString& title) sizerDown->Add(sizerBtns, 0, wxALL | wxALIGN_RIGHT, 5); // put everything together - sizerTop->Add(m_notebook, 1, wxGROW | (wxALL & ~(wxTOP | wxBOTTOM)), 10); + sizerTop->Add(m_book, 1, wxGROW | (wxALL & ~(wxTOP | wxBOTTOM)), 10); sizerTop->Add(0, 5, 0, wxGROW); // spacer in between sizerTop->Add(sizerDown, 0, wxGROW | (wxALL & ~wxTOP), 10); @@ -338,19 +338,19 @@ WidgetsFrame::WidgetsFrame(const wxString& title) #endif } -void WidgetsFrame::InitNotebook() +void WidgetsFrame::InitBook() { m_imaglist = new wxImageList(32, 32); ArrayWidgetsPage pages; wxArrayString labels; - // we need to first create all pages and only then add them to the notebook + // we need to first create all pages and only then add them to the book // as we need the image list first WidgetsPageInfo *info = WidgetsPage::ms_widgetPages; while ( info ) { - WidgetsPage *page = (*info->GetCtor())(m_notebook, m_imaglist); + WidgetsPage *page = (*info->GetCtor())(m_book, m_imaglist); pages.Add(page); labels.Add(info->GetLabel()); @@ -358,18 +358,18 @@ void WidgetsFrame::InitNotebook() info = info->GetNext(); } - m_notebook->SetImageList(m_imaglist); + m_book->SetImageList(m_imaglist); // now do add them size_t count = pages.GetCount(); for ( size_t n = 0; n < count; n++ ) { - m_notebook->AddPage( - pages[n], - labels[n], - false, // don't select - n // image id - ); + m_book->AddPage( + pages[n], + labels[n], + false, // don't select + n // image id + ); } } @@ -407,7 +407,7 @@ void WidgetsFrame::OnSetFgCol(wxCommandEvent& WXUNUSED(event)) m_colFg = col; - WidgetsPage *page = wxStaticCast(m_notebook->GetCurrentPage(), WidgetsPage); + WidgetsPage *page = wxStaticCast(m_book->GetCurrentPage(), WidgetsPage); page->GetWidget()->SetForegroundColour(m_colFg); page->GetWidget()->Refresh(); } @@ -420,7 +420,7 @@ void WidgetsFrame::OnSetBgCol(wxCommandEvent& WXUNUSED(event)) m_colBg = col; - WidgetsPage *page = wxStaticCast(m_notebook->GetCurrentPage(), WidgetsPage); + WidgetsPage *page = wxStaticCast(m_book->GetCurrentPage(), WidgetsPage); page->GetWidget()->SetBackgroundColour(m_colBg); page->GetWidget()->Refresh(); } @@ -492,8 +492,8 @@ WidgetsPageInfo::WidgetsPageInfo(Constructor ctor, const wxChar *label) // WidgetsPage // ---------------------------------------------------------------------------- -WidgetsPage::WidgetsPage(wxNotebook *notebook) - : wxPanel(notebook, wxID_ANY, +WidgetsPage::WidgetsPage(wxBookCtrl *book) + : wxPanel(book, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE | wxCLIP_CHILDREN | diff --git a/samples/widgets/widgets.h b/samples/widgets/widgets.h index 47ffc41c9b..d20c536108 100644 --- a/samples/widgets/widgets.h +++ b/samples/widgets/widgets.h @@ -13,7 +13,7 @@ #define _WX_SAMPLE_WIDGETS_H_ class WXDLLEXPORT wxCheckBox; -class WXDLLEXPORT wxNotebook; +class WXDLLEXPORT wxBookCtrl; class WXDLLEXPORT wxSizer; class WXDLLEXPORT wxTextCtrl; @@ -25,13 +25,13 @@ class WidgetsPageInfo; #include "wx/imaglist.h" // ---------------------------------------------------------------------------- -// WidgetsPage: a notebook page demonstrating some widget +// WidgetsPage: a book page demonstrating some widget // ---------------------------------------------------------------------------- class WidgetsPage : public wxPanel { public: - WidgetsPage(wxNotebook *notebook); + WidgetsPage(wxBookCtrl *book); // return the control shown by this page virtual wxControl *GetWidget() const = 0; @@ -74,7 +74,7 @@ public: class WidgetsPageInfo { public: - typedef WidgetsPage *(*Constructor)(wxNotebook *notebook, + typedef WidgetsPage *(*Constructor)(wxBookCtrl *book, wxImageList *imaglist); // our ctor @@ -108,9 +108,9 @@ private: // and this one must be inserted somewhere in the source file #define IMPLEMENT_WIDGETS_PAGE(classname, label) \ - WidgetsPage *wxCtorFor##classname(wxNotebook *notebook, \ + WidgetsPage *wxCtorFor##classname(wxBookCtrl *book, \ wxImageList *imaglist) \ - { return new classname(notebook, imaglist); } \ + { return new classname(book, imaglist); } \ WidgetsPageInfo classname:: \ ms_info##classname(wxCtorFor##classname, label) diff --git a/src/common/bookctrl.cpp b/src/common/bookctrl.cpp index 4a4617b51a..a9082315a9 100644 --- a/src/common/bookctrl.cpp +++ b/src/common/bookctrl.cpp @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// // Name: common/bookctrl.cpp -// Purpose: wxBookCtrl implementation +// Purpose: wxBookCtrlBase implementation // Author: Vadim Zeitlin // Modified by: // Created: 19.08.03 @@ -42,14 +42,14 @@ // constructors and destructors // ---------------------------------------------------------------------------- -void wxBookCtrl::Init() +void wxBookCtrlBase::Init() { m_imageList = NULL; m_ownsImageList = false; } bool -wxBookCtrl::Create(wxWindow *parent, +wxBookCtrlBase::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, @@ -68,7 +68,7 @@ wxBookCtrl::Create(wxWindow *parent, ); } -wxBookCtrl::~wxBookCtrl() +wxBookCtrlBase::~wxBookCtrlBase() { if ( m_ownsImageList ) { @@ -81,7 +81,7 @@ wxBookCtrl::~wxBookCtrl() // image list // ---------------------------------------------------------------------------- -void wxBookCtrl::SetImageList(wxImageList *imageList) +void wxBookCtrlBase::SetImageList(wxImageList *imageList) { if ( m_ownsImageList ) { @@ -94,7 +94,7 @@ void wxBookCtrl::SetImageList(wxImageList *imageList) m_imageList = imageList; } -void wxBookCtrl::AssignImageList(wxImageList* imageList) +void wxBookCtrlBase::AssignImageList(wxImageList* imageList) { SetImageList(imageList); @@ -105,12 +105,12 @@ void wxBookCtrl::AssignImageList(wxImageList* imageList) // geometry // ---------------------------------------------------------------------------- -void wxBookCtrl::SetPageSize(const wxSize& size) +void wxBookCtrlBase::SetPageSize(const wxSize& size) { SetClientSize(CalcSizeFromPage(size)); } -wxSize wxBookCtrl::DoGetBestSize() const +wxSize wxBookCtrlBase::DoGetBestSize() const { wxSize bestSize; @@ -140,15 +140,15 @@ wxSize wxBookCtrl::DoGetBestSize() const // ---------------------------------------------------------------------------- bool -wxBookCtrl::InsertPage(size_t nPage, - wxWindow *page, - const wxString& WXUNUSED(text), - bool WXUNUSED(bSelect), - int WXUNUSED(imageId)) +wxBookCtrlBase::InsertPage(size_t nPage, + wxWindow *page, + const wxString& WXUNUSED(text), + bool WXUNUSED(bSelect), + int WXUNUSED(imageId)) { - wxCHECK_MSG( page, false, _T("NULL page in wxBookCtrl::InsertPage()") ); + wxCHECK_MSG( page, false, _T("NULL page in wxBookCtrlBase::InsertPage()") ); wxCHECK_MSG( nPage <= m_pages.size(), false, - _T("invalid page index in wxBookCtrl::InsertPage()") ); + _T("invalid page index in wxBookCtrlBase::InsertPage()") ); m_pages.Insert(page, nPage); InvalidateBestSize(); @@ -156,7 +156,7 @@ wxBookCtrl::InsertPage(size_t nPage, return true; } -bool wxBookCtrl::DeletePage(size_t nPage) +bool wxBookCtrlBase::DeletePage(size_t nPage) { wxWindow *page = DoRemovePage(nPage); if ( !page ) @@ -167,10 +167,10 @@ bool wxBookCtrl::DeletePage(size_t nPage) return true; } -wxWindow *wxBookCtrl::DoRemovePage(size_t nPage) +wxWindow *wxBookCtrlBase::DoRemovePage(size_t nPage) { wxCHECK_MSG( nPage < m_pages.size(), NULL, - _T("invalid page index in wxBookCtrl::DoRemovePage()") ); + _T("invalid page index in wxBookCtrlBase::DoRemovePage()") ); wxWindow *pageRemoved = m_pages[nPage]; m_pages.RemoveAt(nPage); @@ -179,7 +179,7 @@ wxWindow *wxBookCtrl::DoRemovePage(size_t nPage) return pageRemoved; } -int wxBookCtrl::GetNextPage(bool forward) const +int wxBookCtrlBase::GetNextPage(bool forward) const { int nPage; diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index c88d50f4ee..93f988572e 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -1655,7 +1655,7 @@ IMPLEMENT_CLASS(wxNotebookSizer, wxBookCtrlSizer) #if wxUSE_BOOKCTRL -wxBookCtrlSizer::wxBookCtrlSizer(wxBookCtrl *bookctrl) +wxBookCtrlSizer::wxBookCtrlSizer(wxBookCtrlBase *bookctrl) : m_bookctrl(bookctrl) { wxASSERT_MSG( bookctrl, wxT("wxBookCtrlSizer needs a control") ); diff --git a/src/generic/choicbkg.cpp b/src/generic/choicbkg.cpp index 15390adec2..c40ba14fe4 100644 --- a/src/generic/choicbkg.cpp +++ b/src/generic/choicbkg.cpp @@ -64,7 +64,7 @@ const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING = wxNewEventType(); const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED = wxNewEventType(); const int wxID_CHOICEBOOKCHOICE = wxNewId(); -BEGIN_EVENT_TABLE(wxChoicebook, wxBookCtrl) +BEGIN_EVENT_TABLE(wxChoicebook, wxBookCtrlBase) EVT_SIZE(wxChoicebook::OnSize) EVT_CHOICE(wxID_CHOICEBOOKCHOICE, wxChoicebook::OnChoiceSelected) END_EVENT_TABLE() @@ -276,7 +276,7 @@ void wxChoicebook::SetImageList(wxImageList *imageList) { // TODO: can be implemented in form of static bitmap near choice control - wxBookCtrl::SetImageList(imageList); + wxBookCtrlBase::SetImageList(imageList); } // ---------------------------------------------------------------------------- @@ -334,7 +334,7 @@ wxChoicebook::InsertPage(size_t n, bool bSelect, int imageId) { - if ( !wxBookCtrl::InsertPage(n, page, text, bSelect, imageId) ) + if ( !wxBookCtrlBase::InsertPage(n, page, text, bSelect, imageId) ) return false; m_choice->Insert(text, n); @@ -369,7 +369,7 @@ wxChoicebook::InsertPage(size_t n, wxWindow *wxChoicebook::DoRemovePage(size_t page) { const int page_count = GetPageCount(); - wxWindow *win = wxBookCtrl::DoRemovePage(page); + wxWindow *win = wxBookCtrlBase::DoRemovePage(page); if ( win ) { @@ -399,7 +399,7 @@ wxWindow *wxChoicebook::DoRemovePage(size_t page) bool wxChoicebook::DeleteAllPages() { m_choice->Clear(); - return wxBookCtrl::DeleteAllPages(); + return wxBookCtrlBase::DeleteAllPages(); } // ---------------------------------------------------------------------------- diff --git a/src/generic/listbkg.cpp b/src/generic/listbkg.cpp index 3fc2953c17..517227b3a5 100644 --- a/src/generic/listbkg.cpp +++ b/src/generic/listbkg.cpp @@ -62,7 +62,7 @@ const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING = wxNewEventType(); const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED = wxNewEventType(); const int wxID_LISTBOOKLISTVIEW = wxNewId(); -BEGIN_EVENT_TABLE(wxListbook, wxBookCtrl) +BEGIN_EVENT_TABLE(wxListbook, wxBookCtrlBase) EVT_SIZE(wxListbook::OnSize) EVT_LIST_ITEM_SELECTED(wxID_LISTBOOKLISTVIEW, wxListbook::OnListSelected) END_EVENT_TABLE() @@ -334,7 +334,7 @@ void wxListbook::SetImageList(wxImageList *imageList) { m_list->SetImageList(imageList, wxIMAGE_LIST_NORMAL); - wxBookCtrl::SetImageList(imageList); + wxBookCtrlBase::SetImageList(imageList); } // ---------------------------------------------------------------------------- @@ -393,7 +393,7 @@ wxListbook::InsertPage(size_t n, bool bSelect, int imageId) { - if ( !wxBookCtrl::InsertPage(n, page, text, bSelect, imageId) ) + if ( !wxBookCtrlBase::InsertPage(n, page, text, bSelect, imageId) ) return false; m_list->InsertItem(n, text, imageId); @@ -429,7 +429,7 @@ wxListbook::InsertPage(size_t n, wxWindow *wxListbook::DoRemovePage(size_t page) { const int page_count = GetPageCount(); - wxWindow *win = wxBookCtrl::DoRemovePage(page); + wxWindow *win = wxBookCtrlBase::DoRemovePage(page); if ( win ) { @@ -459,7 +459,7 @@ wxWindow *wxListbook::DoRemovePage(size_t page) bool wxListbook::DeleteAllPages() { m_list->DeleteAllItems(); - return wxBookCtrl::DeleteAllPages(); + return wxBookCtrlBase::DeleteAllPages(); } // ---------------------------------------------------------------------------- -- 2.47.2