- return true;
-}
-
-// ----------------------------------------------------------------------------
-// wxChoicebook geometry management
-// ----------------------------------------------------------------------------
-
-wxSize wxChoicebook::GetChoiceSize() const
-{
- const wxSize sizeClient = GetClientSize(),
- sizeChoice = m_choice->GetBestSize();
-
- 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->GetSize();
-
- wxRect rectPage(wxPoint(0, 0), GetClientSize());
- switch ( GetWindowStyle() & wxCHB_ALIGN_MASK )
- {
- default:
- wxFAIL_MSG( _T("unexpected wxChoicebook alignment") );
- // fall through
-
- case wxCHB_TOP:
- rectPage.y = sizeChoice.y + MARGIN;
- // fall through
-
- case wxCHB_BOTTOM:
- rectPage.height -= sizeChoice.y + MARGIN;
- break;
-
- case wxCHB_LEFT:
- rectPage.x = sizeChoice.x + MARGIN;
- // fall through
-
- case wxCHB_RIGHT:
- rectPage.width -= sizeChoice.x + MARGIN;
- 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.x, posChoice.y);
- m_choice->SetSize(sizeChoice.x, sizeChoice.y);