diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-06-12 15:59:18 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-09-28 08:48:27 +0100 |
commit | e92085454730a661e4e7bee8c75314e7a3a2914b (patch) | |
tree | 47580b0e06c6c694c5a37b1268891ea8d939bfbb /vcl/source/control/tabctrl.cxx | |
parent | 8f6fa7220e606dee23dd5ba7b40a507b1cdd98c0 (diff) |
consider tab widths even in empty tab pages
Diffstat (limited to 'vcl/source/control/tabctrl.cxx')
-rw-r--r-- | vcl/source/control/tabctrl.cxx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index a64884052045..4afaa3e880dc 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -2135,17 +2135,18 @@ Size TabControl::GetOptimalSize(WindowSizeType eType) const { Size aOptimalPageSize(0, 0); Size aOptimalTabSize(0, 0); + long nTotalTabWidths = 0; for( std::vector< ImplTabItem >::const_iterator it = mpTabCtrlData->maItemList.begin(); it != mpTabCtrlData->maItemList.end(); ++it ) { + Size aPageSize; const TabPage *pPage = it->mpTabPage; - if (!pPage) - { + if (pPage) + aPageSize = pPage->GetOptimalSize(eType); + else fprintf(stderr, "nuisance, page not inserted yet :-(\n"); - continue; - } - Size aPageSize(pPage->GetOptimalSize(eType)); + if (aPageSize.Width() > aOptimalPageSize.Width()) aOptimalPageSize.Width() = aPageSize.Width(); if (aPageSize.Height() > aOptimalPageSize.Height()) @@ -2156,11 +2157,15 @@ Size TabControl::GetOptimalSize(WindowSizeType eType) const Size aTabSize = pThis->ImplGetItemSize(pItem, LONG_MAX); if (aTabSize.Height() > aOptimalTabSize.Height()) aOptimalTabSize.Height() = aTabSize.Height(); + nTotalTabWidths += aTabSize.Width(); } Size aOptimalSize(aOptimalPageSize); aOptimalSize.Height() += aOptimalTabSize.Height(); + if (nTotalTabWidths > aOptimalSize.Width()) + aOptimalSize.Width() = nTotalTabWidths; + aOptimalSize.Width() += TAB_OFFSET * 2; aOptimalSize.Height() += TAB_OFFSET * 2; |