- return true;
-}
-
-// ----------------------------------------------------------------------------
-// wxChoicebook geometry management
-// ----------------------------------------------------------------------------
-
-wxSize wxChoicebook::GetChoiceSize() const
-{
- const wxSize sizeClient = GetClientSize(),
- sizeChoice = m_choice->GetBestFittingSize();
-
- wxSize size;
- if ( IsVertical() )
- {
- size.x = sizeClient.x;
- size.y = sizeChoice.y;
- }
- else // left/right aligned
- {
- size.x = sizeChoice.x;
- size.y = sizeClient.y;
- }
-
- return size;
-}
-
-wxRect wxChoicebook::GetPageRect() const
-{
- const wxSize sizeChoice = m_choice->GetBestFittingSize();
-
- wxPoint pt;
- wxRect rectPage(pt, GetClientSize());
- switch ( GetWindowStyle() & wxCHB_ALIGN_MASK )
- {
- default:
- wxFAIL_MSG( _T("unexpected wxChoicebook alignment") );
- // fall through
-
- case wxCHB_TOP:
- rectPage.y = sizeChoice.y + GetInternalBorder();
- // fall through
-
- case wxCHB_BOTTOM:
- rectPage.height -= sizeChoice.y + GetInternalBorder();
- break;
-
- case wxCHB_LEFT:
- rectPage.x = sizeChoice.x + GetInternalBorder();
- // fall through
-
- case wxCHB_RIGHT:
- rectPage.width -= sizeChoice.x + GetInternalBorder();
- break;
- }
-
- return rectPage;
-}
-
-void wxChoicebook::OnSize(wxSizeEvent& event)
-{
- event.Skip();
-
- if ( !m_choice )
- {
- // we're not fully created yet
- return;
- }
-
- // resize the choice control and the page area to fit inside our new size
- const wxSize sizeClient = GetClientSize(),
- sizeChoice = GetChoiceSize();
-
- 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);
- m_choice->SetSize(sizeChoice);
-
- // resize the currently shown page
- if ( m_selection != wxNOT_FOUND )
- {
- wxWindow *page = m_pages[m_selection];
- wxCHECK_RET( page, _T("NULL page in wxChoicebook?") );
- page->SetSize(GetPageRect());
- }
-}
-
-wxSize wxChoicebook::CalcSizeFromPage(const wxSize& sizePage) const
-{
- // we need to add the size of the choice control and the border between
- const wxSize sizeChoice = GetChoiceSize();