-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);
-
- // 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());
- }
-}
-