- wxPoint posChoice;
- switch ( GetWindowStyle() & wxCHB_ALIGN_MASK )
- {
- default:
- wxFAIL_MSG( _T("unexpected wxChoicebook alignment") );
- // fall through
-
- case wxCHB_TOP:
- case wxCHB_LEFT:
- // posChoice is already ok
- break;
-
- case wxCHB_BOTTOM:
- posChoice.y = sizeClient.y - sizeChoice.y;
- break;
-
- case wxCHB_RIGHT:
- posChoice.x = sizeClient.x - sizeChoice.x;
- break;
- }
-
- m_choice->Move(posChoice.x, posChoice.y);
- m_choice->SetSize(sizeChoice.x, sizeChoice.y);
-
- // we should always have some selection if possible
- if ( m_selection == wxNOT_FOUND && GetPageCount() )
- {
- SetSelection(0);
- }
-
- if ( m_selection != wxNOT_FOUND )
- {
- wxWindow *page = m_pages[m_selection];
- wxCHECK_RET( page, _T("NULL page in wxChoicebook?") );
-
- page->SetSize(GetPageRect());
- if ( !page->IsShown() )
- {
- page->Show();
- }
- }
-}
-
-wxSize wxChoicebook::CalcSizeFromPage(const wxSize& sizePage) const
-{
- // we need to add the size of the choice control and the margin
- const wxSize sizeChoice = GetChoiceSize();
-
- wxSize size = sizePage;
- if ( IsVertical() )
- {
- size.y += sizeChoice.y + MARGIN;
- }
- else // left/right aligned
- {
- size.x += sizeChoice.x + MARGIN;
- }
-
- return size;
+ m_controlSizer = new wxBoxSizer(IsVertical() ? wxHORIZONTAL : wxVERTICAL);
+ m_controlSizer->Add(m_bookctrl, 1, (IsVertical() ? wxALIGN_CENTRE_VERTICAL : wxALIGN_CENTRE) |wxGROW, 0);
+ mainSizer->Add(m_controlSizer, 0, (IsVertical() ? (int) wxGROW : (int) wxALIGN_CENTRE_VERTICAL)|wxALL, m_controlMargin);
+ SetSizer(mainSizer);
+ return true;