diff options
author | Philipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM> | 2011-01-06 15:27:01 +0100 |
---|---|---|
committer | Philipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM> | 2011-01-06 15:27:01 +0100 |
commit | 9d264d2667daa4284d08afe0e4e93d0c67efa85e (patch) | |
tree | 627d24cac0b7aa03d07bcaedb63c201852385709 /vcl/source | |
parent | 98e9b844f2f2038d69ae159ee67cc6c3ba7d1a76 (diff) |
vcl118: #i116120# cope with too small geometries
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/control/tabctrl.cxx | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index e9696aa8c492..7b9e2dcb08f9 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -461,15 +461,18 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ) Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight ) { Size aWinSize = Control::GetOutputSizePixel(); - if ( nWidth == -1 ) + if ( nWidth < 0 ) nWidth = aWinSize.Width(); - if ( nHeight == -1 ) + if ( nHeight < 0 ) nHeight = aWinSize.Height(); if ( mpTabCtrlData->maItemList.empty() ) { - return Rectangle( Point( TAB_OFFSET, TAB_OFFSET ), - Size( nWidth-TAB_OFFSET*2, nHeight-TAB_OFFSET*2 ) ); + long nW = nWidth-TAB_OFFSET*2; + long nH = nHeight-TAB_OFFSET*2; + return (nW > 0 && nH > 0) + ? Rectangle( Point( TAB_OFFSET, TAB_OFFSET ), Size( nW, nH ) ) + : Rectangle(); } if ( nItemPos == TAB_PAGERECT ) @@ -481,9 +484,11 @@ Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight nLastPos = 0; Rectangle aRect = ImplGetTabRect( nLastPos, nWidth, nHeight ); - aRect = Rectangle( Point( TAB_OFFSET, aRect.Bottom()+TAB_OFFSET ), - Size( nWidth-TAB_OFFSET*2, - nHeight-aRect.Bottom()-TAB_OFFSET*2 ) ); + long nW = nWidth-TAB_OFFSET*2; + long nH = nHeight-aRect.Bottom()-TAB_OFFSET*2; + aRect = (nW > 0 && nH > 0) + ? Rectangle( Point( TAB_OFFSET, aRect.Bottom()+TAB_OFFSET ), Size( nW, nH ) ) + : Rectangle(); return aRect; } |