From 60ec3e58b834a230e1d2d364cdfe6e20f3cb604f Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Fri, 11 Jan 2002 14:34:38 +0000 Subject: [PATCH] Move notebook size code for mac to mac/notebook.cpp git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13506 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/mac/notebook.h | 3 +++ src/common/nbkbase.cpp | 11 ----------- src/mac/carbon/notebmac.cpp | 35 +++++++++++++++++++++++++++++++++++ src/mac/notebmac.cpp | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 11 deletions(-) diff --git a/include/wx/mac/notebook.h b/include/wx/mac/notebook.h index 188bde8cfb..de06aa8331 100644 --- a/include/wx/mac/notebook.h +++ b/include/wx/mac/notebook.h @@ -83,6 +83,9 @@ public: virtual void SetPadding(const wxSize& padding); // sets the size of the tabs (assumes all tabs are the same size) virtual void SetTabSize(const wxSize& sz); + + // calculate size for wxNotebookSizer + wxSize CalcSizeFromPage(const wxSize& sizePage); /* // get number of pages in the dialog diff --git a/src/common/nbkbase.cpp b/src/common/nbkbase.cpp index ccc78efd57..527fcc27db 100644 --- a/src/common/nbkbase.cpp +++ b/src/common/nbkbase.cpp @@ -92,26 +92,15 @@ wxSize wxNotebookBase::CalcSizeFromPage(const wxSize& sizePage) // course, totally bogus - just like the original code was wxSize sizeTotal = sizePage; - // Mac has large notebook borders. - if ( HasFlag(wxNB_LEFT) || HasFlag(wxNB_RIGHT) ) { sizeTotal.x += 90; -#ifdef __WXMAC__ - sizeTotal.y += 28; -#else sizeTotal.y += 10; -#endif } else { -#ifdef __WXMAC__ - sizeTotal.x += 34; // This is OK for Aqua. - sizeTotal.y += 46; -#else sizeTotal.x += 10; sizeTotal.y += 40; -#endif } return sizeTotal; diff --git a/src/mac/carbon/notebmac.cpp b/src/mac/carbon/notebmac.cpp index aa5351acc5..f9bf5dc999 100644 --- a/src/mac/carbon/notebmac.cpp +++ b/src/mac/carbon/notebmac.cpp @@ -143,6 +143,41 @@ wxNotebook::~wxNotebook() m_macControl = NULL ; } +wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) +{ + wxSize sizeTotal = sizePage; + + int major,minor; + wxGetOsVersion( &major, &minor ); + + // Mac has large notebook borders. Aqua even more so. + + if ( HasFlag(wxNB_LEFT) || HasFlag(wxNB_RIGHT) ) + { + sizeTotal.x += 90; + + if (major >= 10) + sizeTotal.y += 28; + else + sizeTotal.y += 20; + } + else + { + if (major >= 10) + { + sizeTotal.x += 34; + sizeTotal.y += 46; + } + else + { + sizeTotal.x += 22; + sizeTotal.y += 44; + } + } + + return sizeTotal; +} + // ---------------------------------------------------------------------------- // wxNotebook accessors // ---------------------------------------------------------------------------- diff --git a/src/mac/notebmac.cpp b/src/mac/notebmac.cpp index aa5351acc5..f9bf5dc999 100644 --- a/src/mac/notebmac.cpp +++ b/src/mac/notebmac.cpp @@ -143,6 +143,41 @@ wxNotebook::~wxNotebook() m_macControl = NULL ; } +wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) +{ + wxSize sizeTotal = sizePage; + + int major,minor; + wxGetOsVersion( &major, &minor ); + + // Mac has large notebook borders. Aqua even more so. + + if ( HasFlag(wxNB_LEFT) || HasFlag(wxNB_RIGHT) ) + { + sizeTotal.x += 90; + + if (major >= 10) + sizeTotal.y += 28; + else + sizeTotal.y += 20; + } + else + { + if (major >= 10) + { + sizeTotal.x += 34; + sizeTotal.y += 46; + } + else + { + sizeTotal.x += 22; + sizeTotal.y += 44; + } + } + + return sizeTotal; +} + // ---------------------------------------------------------------------------- // wxNotebook accessors // ---------------------------------------------------------------------------- -- 2.45.2