Improve sizer support in generic wxNotebook. Fix the widgets sample

to take advantage of it.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35328 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon 2005-08-28 08:00:25 +00:00
parent d30814cdf2
commit 6bae67261c
3 changed files with 19 additions and 1 deletions

View File

@ -126,6 +126,8 @@ public:
virtual void SetConstraintSizes(bool recurse = true);
virtual bool DoPhase(int nPhase);
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
// Implementation
// wxNotebook on Motif uses a generic wxTabView to implement itself.

View File

@ -327,7 +327,12 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
//style |= wxNB_NOPAGETHEME;
m_book = new wxBookCtrl(m_panel, wxID_ANY, wxDefaultPosition,
wxDefaultSize, style);
#ifdef __WXMOTIF__
wxSize(500, -1), // under Motif, height is a function of the width...
#else
wxDefaultSize,
#endif
style);
InitBook();
#ifndef __SMARTPHONE__

View File

@ -622,6 +622,17 @@ void wxNotebook::OnPaint(wxPaintEvent& WXUNUSED(event) )
m_tabView->Draw(dc);
}
wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const
{
// MBN: since the total tab height is really a function of the
// width, this should really call
// GetTotalTabHeightPretendingWidthIs(), but the current
// implementation will suffice, provided the wxNotebook has been
// created with a sensible initial width.
return wxSize( sizePage.x + 12,
sizePage.y + m_tabView->GetTotalTabHeight() + 6 + 4 );
}
wxRect wxNotebook::GetAvailableClientSize()
{
int cw, ch;