-wxSize wxTreebook::GetTreeSize() const
-{
- const wxSize sizeClient = GetClientSize(),
- sizeBorder = m_tree->GetSize() - m_tree->GetClientSize(),
- sizeTree = m_tree->GetBestSize() + sizeBorder;
-
- wxSize size;
-
- size.x = sizeTree.x;
- size.y = sizeClient.y;
-
- return size;
-}
-
-wxRect wxTreebook::GetPageRect() const
-{
- const wxSize sizeTree = m_tree->GetSize();
-
- wxPoint pt;
- wxRect rectPage(pt, GetClientSize());
- switch ( GetWindowStyle() & wxTBK_ALIGN_MASK )
- {
- default:
- wxFAIL_MSG( _T("unexpected wxTreebook alignment") );
- // fall through
-
- case wxTBK_LEFT:
- rectPage.x = sizeTree.x; // + MARGIN;
- // fall through
-
- case wxTBK_RIGHT:
- rectPage.width -= sizeTree.x; // + MARGIN;
- break;
- }
-
- return rectPage;
-}
-
-void wxTreebook::OnSize(wxSizeEvent& event)
-{
- event.Skip();
-
- if ( !m_tree )
- {
- // we're not fully created yet
- return;
- }
-
- // resize the list control and the page area to fit inside our new size
- const wxSize sizeClient = GetClientSize(),
- sizeBorder = m_tree->GetSize() - m_tree->GetClientSize(),
- sizeTree = GetTreeSize();
-
- m_tree->SetClientSize( sizeTree.x - sizeBorder.x, sizeTree.y - sizeBorder.y );
-
- const wxSize sizeNew = m_tree->GetSize();
- wxPoint posTree;
- switch ( GetWindowStyle() & wxTBK_ALIGN_MASK )
- {
- default:
- wxFAIL_MSG( _T("unexpected wxTreebook alignment") );
- // fall through
-
- case wxTBK_LEFT:
- // posTree is already ok
- break;
-
- case wxTBK_RIGHT:
- posTree.x = sizeClient.x - sizeNew.x;
- break;
- }
-
- if ( m_tree->GetPosition() != posTree )
- m_tree->Move(posTree);
-
- // resize the currently shown page
- wxTreebookPage *page = DoGetCurrentPage();
- if ( page )
- {
- wxRect rectPage = GetPageRect();
- page->SetSize(rectPage);
- }
-}
-