From adbf2d732fe5f254f45ab27530e4f9c044cb385f Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Thu, 24 Jun 2004 11:58:06 +0000 Subject: [PATCH] deprecated wxBookCtrlSizer and wxNotebookSizer, they are no longer needed git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28002 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/src/xrc/xh_notbk.cpp | 5 +---- docs/changes.txt | 3 +++ include/wx/sizer.h | 20 ++++++++++++++++---- samples/display/display.cpp | 9 +++++---- samples/layout/layout.cpp | 3 +-- samples/widgets/widgets.cpp | 3 +-- src/common/sizer.cpp | 25 ++++++++++++++++--------- src/html/helpfrm.cpp | 3 +-- src/xrc/xh_notbk.cpp | 5 +---- 9 files changed, 45 insertions(+), 31 deletions(-) diff --git a/contrib/src/xrc/xh_notbk.cpp b/contrib/src/xrc/xh_notbk.cpp index e97598a225..1a0c7b14b4 100644 --- a/contrib/src/xrc/xh_notbk.cpp +++ b/contrib/src/xrc/xh_notbk.cpp @@ -88,10 +88,7 @@ wxObject *wxNotebookXmlHandler::DoCreateResource() m_isInside = old_ins; m_notebook = old_par; - if (GetBool(wxT("usenotebooksizer"), false)) - return new wxNotebookSizer(nb); - else - return nb; + return nb; } } diff --git a/docs/changes.txt b/docs/changes.txt index d6efbf31c2..35cb4de59d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -59,6 +59,9 @@ INCOMPATIBLE CHANGES SINCE 2.4.x - Identical functionality of wxFileDialog::ParseWildcard, wxGenericDirCtrl::ParseFilter, Motif and MSW parsing native dialogs is now accessible in ::wxParseCommonDialogsFilter +- wxNotebookSizer and wxBookCtrlSizer are now deprecated -- the are no longer + needed, you can treat wxNotebook as any other control and put it directly + into the sizer that was wxNotebookSizer's parent sizer in old code. diff --git a/include/wx/sizer.h b/include/wx/sizer.h index ce907346bb..804c618dbd 100644 --- a/include/wx/sizer.h +++ b/include/wx/sizer.h @@ -518,6 +518,11 @@ private: #endif // wxUSE_STATBOX + +#if WXWIN_COMPATIBILITY_2_4 +// NB: wxBookCtrlSizer and wxNotebookSizer are deprecated, they +// don't do anything. wxBookCtrl::DoGetBestSize does the job now. + // ---------------------------------------------------------------------------- // wxBookCtrlSizer // ---------------------------------------------------------------------------- @@ -531,14 +536,18 @@ class WXDLLEXPORT wxBookCtrl; class WXDLLEXPORT wxBookCtrlSizer : public wxSizer { public: - wxBookCtrlSizer(wxBookCtrl *bookctrl); + wxDEPRECATED( wxBookCtrlSizer(wxBookCtrl *bookctrl) ); + wxBookCtrl *GetControl() const { return m_bookctrl; } + virtual void RecalcSizes(); virtual wxSize CalcMin(); - wxBookCtrl *GetControl() const { return m_bookctrl; } - protected: + // this protected ctor lets us mark the real one above as deprecated + // and still has warning-free build of the library itself: + wxBookCtrlSizer() {} + wxBookCtrl *m_bookctrl; private: @@ -556,7 +565,7 @@ class WXDLLEXPORT wxNotebook; class WXDLLEXPORT wxNotebookSizer : public wxBookCtrlSizer { public: - wxNotebookSizer(wxNotebook *nb); + wxDEPRECATED( wxNotebookSizer(wxNotebook *nb) ); wxNotebook *GetNotebook() const { return (wxNotebook *)m_bookctrl; } @@ -569,5 +578,8 @@ private: #endif // wxUSE_BOOKCTRL +#endif // WXWIN_COMPATIBILITY_2_4 + + #endif // __WXSIZER_H__ diff --git a/samples/display/display.cpp b/samples/display/display.cpp index 47fe984393..22a94cf0b6 100644 --- a/samples/display/display.cpp +++ b/samples/display/display.cpp @@ -293,10 +293,11 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, (unsigned long)nDpy)); } - wxNotebookSizer *notebookSizer = new wxNotebookSizer(m_notebook); - panel->SetSizer(notebookSizer); - notebookSizer->Fit(this); - notebookSizer->SetSizeHints(this); + wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL); + sizer->Add(m_notebook, 1, wxEXPAND); + panel->SetSizer(sizer); + sizer->Fit(this); + sizer->SetSizeHints(this); } wxString MyFrame::VideoModeToText(const wxVideoMode& mode) diff --git a/samples/layout/layout.cpp b/samples/layout/layout.cpp index ad7d19a860..5a7e7a8c59 100644 --- a/samples/layout/layout.cpp +++ b/samples/layout/layout.cpp @@ -326,8 +326,7 @@ MySizerDialog::MySizerDialog(wxWindow *parent, const wxChar *title) wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); wxNotebook *notebook = new wxNotebook( this, wxID_ANY ); - wxNotebookSizer *nbs = new wxNotebookSizer( notebook ); - topsizer->Add( nbs, 1, wxGROW ); + topsizer->Add( notebook, 1, wxGROW ); wxButton *button = new wxButton( this, wxID_OK, _T("OK") ); topsizer->Add( button, 0, wxALIGN_RIGHT | wxALL, 10 ); diff --git a/samples/widgets/widgets.cpp b/samples/widgets/widgets.cpp index 27ff78f92c..c31cd567c3 100644 --- a/samples/widgets/widgets.cpp +++ b/samples/widgets/widgets.cpp @@ -253,7 +253,6 @@ WidgetsFrame::WidgetsFrame(const wxString& title) m_notebook = new wxNotebook(m_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN); InitNotebook(); - wxSizer *sizerUp = new wxNotebookSizer(m_notebook); // the lower one only has the log listbox and a button to clear it wxSizer *sizerDown = new wxStaticBoxSizer( @@ -273,7 +272,7 @@ WidgetsFrame::WidgetsFrame(const wxString& title) sizerDown->Add(sizerBtns, 0, wxALL | wxALIGN_RIGHT, 5); // put everything together - sizerTop->Add(sizerUp, 1, wxGROW | (wxALL & ~(wxTOP | wxBOTTOM)), 10); + sizerTop->Add(m_notebook, 1, wxGROW | (wxALL & ~(wxTOP | wxBOTTOM)), 10); sizerTop->Add(0, 5, 0, wxGROW); // spacer in between sizerTop->Add(sizerDown, 0, wxGROW | (wxALL & ~wxTOP), 10); diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index 7123f19c6a..de1f1c2164 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -24,8 +24,10 @@ #include "wx/sizer.h" #include "wx/utils.h" #include "wx/statbox.h" -#include "wx/notebook.h" #include "wx/listimpl.cpp" +#if WXWIN_COMPATIBILITY_2_4 + #include "wx/notebook.h" +#endif #ifdef __WXMAC__ # include "wx/mac/uma.h" @@ -41,12 +43,6 @@ IMPLEMENT_CLASS(wxBoxSizer, wxSizer) #if wxUSE_STATBOX IMPLEMENT_CLASS(wxStaticBoxSizer, wxBoxSizer) #endif -#if wxUSE_BOOKCTRL -IMPLEMENT_CLASS(wxBookCtrlSizer, wxSizer) -#if wxUSE_NOTEBOOK -IMPLEMENT_CLASS(wxNotebookSizer, wxBookCtrlSizer) -#endif // wxUSE_NOTEBOOK -#endif // wxUSE_BOOKCTRL WX_DEFINE_EXPORTED_LIST( wxSizerItemList ); @@ -1643,10 +1639,20 @@ void wxStaticBoxSizer::ShowItems( bool show ) #endif // wxUSE_STATBOX + +#if WXWIN_COMPATIBILITY_2_4 + // ---------------------------------------------------------------------------- // wxNotebookSizer // ---------------------------------------------------------------------------- +#if wxUSE_BOOKCTRL +IMPLEMENT_CLASS(wxBookCtrlSizer, wxSizer) +#if wxUSE_NOTEBOOK +IMPLEMENT_CLASS(wxNotebookSizer, wxBookCtrlSizer) +#endif // wxUSE_NOTEBOOK +#endif // wxUSE_BOOKCTRL + #if wxUSE_BOOKCTRL wxBookCtrlSizer::wxBookCtrlSizer(wxBookCtrl *bookctrl) @@ -1698,14 +1704,15 @@ wxSize wxBookCtrlSizer::CalcMin() return wxSize( maxX, maxY ) + sizeBorder; } - #if wxUSE_NOTEBOOK wxNotebookSizer::wxNotebookSizer(wxNotebook *nb) - : wxBookCtrlSizer(nb) { + wxASSERT_MSG( nb, wxT("wxNotebookSizer needs a control") ); + m_bookctrl = nb; } #endif // wxUSE_NOTEBOOOK #endif // wxUSE_BOOKCTRL +#endif // WXWIN_COMPATIBILITY_2_4 diff --git a/src/html/helpfrm.cpp b/src/html/helpfrm.cpp index 83991409d8..6cb88dfe1b 100644 --- a/src/html/helpfrm.cpp +++ b/src/html/helpfrm.cpp @@ -307,10 +307,9 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, m_NavigPan = new wxPanel(m_Splitter, wxID_ANY); m_NavigNotebook = new wxNotebook(m_NavigPan, wxID_HTML_NOTEBOOK, wxDefaultPosition, wxDefaultSize); - wxNotebookSizer *nbs = new wxNotebookSizer(m_NavigNotebook); navigSizer = new wxBoxSizer(wxVERTICAL); - navigSizer->Add(nbs, 1, wxEXPAND); + navigSizer->Add(m_NavigNotebook, 1, wxEXPAND); m_NavigPan->SetSizer(navigSizer); } diff --git a/src/xrc/xh_notbk.cpp b/src/xrc/xh_notbk.cpp index e97598a225..1a0c7b14b4 100644 --- a/src/xrc/xh_notbk.cpp +++ b/src/xrc/xh_notbk.cpp @@ -88,10 +88,7 @@ wxObject *wxNotebookXmlHandler::DoCreateResource() m_isInside = old_ins; m_notebook = old_par; - if (GetBool(wxT("usenotebooksizer"), false)) - return new wxNotebookSizer(nb); - else - return nb; + return nb; } } -- 2.45.2