added an extra pixel to the margin in CalcSizeFromPage() (patch 1498847)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39829 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-06-25 23:43:11 +00:00
parent 9ef3cca85b
commit 669c595daf

View File

@@ -594,26 +594,29 @@ void wxNotebook::SetTabSize(const wxSize& sz)
wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const
{ {
// we can't use TabCtrl_AdjustRect here because it only works for wxNB_TOP
wxSize sizeTotal = sizePage; wxSize sizeTotal = sizePage;
// We need to make getting tab size part of the wxWidgets API.
wxSize tabSize; wxSize tabSize;
if ( GetPageCount() > 0 ) if ( GetPageCount() > 0 )
{ {
RECT rect; RECT rect;
TabCtrl_GetItemRect((HWND) GetHWND(), 0, & rect); TabCtrl_GetItemRect(GetHwnd(), 0, &rect);
tabSize.x = rect.right - rect.left; tabSize.x = rect.right - rect.left;
tabSize.y = rect.bottom - rect.top; tabSize.y = rect.bottom - rect.top;
} }
if ( HasFlag(wxBK_LEFT) || HasFlag(wxBK_RIGHT) )
// add an extra margin in both directions
const int MARGIN = 8;
if ( IsVertical() )
{ {
sizeTotal.x += tabSize.x + 7; sizeTotal.x += MARGIN;
sizeTotal.y += 7; sizeTotal.y += tabSize.y + MARGIN;
} }
else else // horizontal layout
{ {
sizeTotal.x += 7; sizeTotal.x += tabSize.x + MARGIN;
sizeTotal.y += tabSize.y + 7; sizeTotal.y += MARGIN;
} }
return sizeTotal; return sizeTotal;