An attempt to make the notebook sizer report its size
correctly under Windows, otherwise you get a huge gap at the bottom if fitting to the content of the page. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20631 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -36,6 +36,12 @@
|
|||||||
#include "wx/imaglist.h"
|
#include "wx/imaglist.h"
|
||||||
#include "wx/notebook.h"
|
#include "wx/notebook.h"
|
||||||
|
|
||||||
|
#if defined(__WXMSW__) && !((defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) && !defined(__CYGWIN10__))
|
||||||
|
#include "wx/msw/private.h"
|
||||||
|
#include <commctrl.h>
|
||||||
|
#include "wx/msw/winundef.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -92,6 +98,28 @@ wxSize wxNotebookBase::CalcSizeFromPage(const wxSize& sizePage)
|
|||||||
// course, totally bogus - just like the original code was
|
// course, totally bogus - just like the original code was
|
||||||
wxSize sizeTotal = sizePage;
|
wxSize sizeTotal = sizePage;
|
||||||
|
|
||||||
|
// Slightly less bogus, at least under Windows.
|
||||||
|
// We need to make getting tab size part of the wxWindows API.
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
wxSize tabSize(0, 0);
|
||||||
|
if (GetPageCount() > 0)
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
TabCtrl_GetItemRect((HWND) GetHWND(), 0, & rect);
|
||||||
|
tabSize.x = rect.right - rect.left;
|
||||||
|
tabSize.y = rect.bottom - rect.top;
|
||||||
|
}
|
||||||
|
if ( HasFlag(wxNB_LEFT) || HasFlag(wxNB_RIGHT) )
|
||||||
|
{
|
||||||
|
sizeTotal.x += tabSize.x + 7;
|
||||||
|
sizeTotal.y += 7;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sizeTotal.x += 7;
|
||||||
|
sizeTotal.y += tabSize.y + 7;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if ( HasFlag(wxNB_LEFT) || HasFlag(wxNB_RIGHT) )
|
if ( HasFlag(wxNB_LEFT) || HasFlag(wxNB_RIGHT) )
|
||||||
{
|
{
|
||||||
sizeTotal.x += 90;
|
sizeTotal.x += 90;
|
||||||
@@ -102,6 +130,7 @@ wxSize wxNotebookBase::CalcSizeFromPage(const wxSize& sizePage)
|
|||||||
sizeTotal.x += 10;
|
sizeTotal.x += 10;
|
||||||
sizeTotal.y += 40;
|
sizeTotal.y += 40;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return sizeTotal;
|
return sizeTotal;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user