diff options
Diffstat (limited to 'vcl/source/window/toolbox.cxx')
-rw-r--r-- | vcl/source/window/toolbox.cxx | 75 |
1 files changed, 58 insertions, 17 deletions
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index bb1f428c6626..8aa4926f5e1a 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -397,7 +397,7 @@ void ToolBox::ImplDrawGradientBackground( ToolBox* pThis, ImplDockingWindowWrapp Color startCol, endCol; startCol = pThis->GetSettings().GetStyleSettings().GetFaceGradientColor(); endCol = pThis->GetSettings().GetStyleSettings().GetFaceColor(); - if( endCol.IsDark() ) + if( pThis->GetSettings().GetStyleSettings().GetHighContrastMode() ) // no 'extreme' gradient when high contrast startCol = endCol; @@ -1901,37 +1901,78 @@ BOOL ToolBox::ImplCalcItem() nDefWidth = GetDefaultImageSize().Width(); nDefHeight = GetDefaultImageSize().Height(); + mnWinHeight = 0; // determine minimum size necessary in NWF - if( IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) { Rectangle aRect( Point( 0, 0 ), Size( nMinWidth, nMinHeight ) ); - Region aArrowReg = aRect; + Region aReg = aRect; ImplControlValue aVal; Region aNativeBounds, aNativeContent; - if( GetNativeControlRegion( CTRL_TOOLBAR, PART_BUTTON, - aArrowReg, + if( IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) + { + if( GetNativeControlRegion( CTRL_TOOLBAR, PART_BUTTON, + aReg, + CTRL_STATE_ENABLED | CTRL_STATE_ROLLOVER, + aVal, OUString(), + aNativeBounds, aNativeContent ) ) + { + aRect = aNativeBounds.GetBoundRect(); + if( aRect.GetWidth() > nMinWidth ) + nMinWidth = aRect.GetWidth(); + if( aRect.GetHeight() > nMinHeight ) + nMinHeight = aRect.GetHeight(); + if( nDropDownArrowWidth < nMinWidth ) + nDropDownArrowWidth = nMinWidth; + if( nMinWidth > mpData->mnMenuButtonWidth ) + mpData->mnMenuButtonWidth = nMinWidth; + else if( nMinWidth < TB_MENUBUTTON_SIZE ) + mpData->mnMenuButtonWidth = TB_MENUBUTTON_SIZE; + } + } + + // also calculate the area for comboboxes, drop down list boxes and spinfields + // as these are often inserted into toolboxes; set mnWinHeight to the + // greater of those values to prevent toolbar flickering (#i103385#) + aRect = Rectangle( Point( 0, 0 ), Size( nMinWidth, nMinHeight ) ); + aReg = aRect; + if( GetNativeControlRegion( CTRL_COMBOBOX, PART_ENTIRE_CONTROL, + aReg, + CTRL_STATE_ENABLED | CTRL_STATE_ROLLOVER, + aVal, OUString(), + aNativeBounds, aNativeContent ) ) + { + aRect = aNativeBounds.GetBoundRect(); + if( aRect.GetHeight() > mnWinHeight ) + mnWinHeight = aRect.GetHeight(); + } + aRect = Rectangle( Point( 0, 0 ), Size( nMinWidth, nMinHeight ) ); + aReg = aRect; + if( GetNativeControlRegion( CTRL_LISTBOX, PART_ENTIRE_CONTROL, + aReg, CTRL_STATE_ENABLED | CTRL_STATE_ROLLOVER, aVal, OUString(), aNativeBounds, aNativeContent ) ) { aRect = aNativeBounds.GetBoundRect(); - if( aRect.GetWidth() > nMinWidth ) - nMinWidth = aRect.GetWidth(); - if( aRect.GetHeight() > nMinHeight ) - nMinHeight = aRect.GetHeight(); - if( nDropDownArrowWidth < nMinWidth ) - nDropDownArrowWidth = nMinWidth; - if( nMinWidth > mpData->mnMenuButtonWidth ) - mpData->mnMenuButtonWidth = nMinWidth; - else if( nMinWidth < TB_MENUBUTTON_SIZE ) - mpData->mnMenuButtonWidth = TB_MENUBUTTON_SIZE; + if( aRect.GetHeight() > mnWinHeight ) + mnWinHeight = aRect.GetHeight(); + } + aRect = Rectangle( Point( 0, 0 ), Size( nMinWidth, nMinHeight ) ); + aReg = aRect; + if( GetNativeControlRegion( CTRL_SPINBOX, PART_ENTIRE_CONTROL, + aReg, + CTRL_STATE_ENABLED | CTRL_STATE_ROLLOVER, + aVal, OUString(), + aNativeBounds, aNativeContent ) ) + { + aRect = aNativeBounds.GetBoundRect(); + if( aRect.GetHeight() > mnWinHeight ) + mnWinHeight = aRect.GetHeight(); } } if ( ! mpData->m_aItems.empty() ) { - mnWinHeight = 0; - std::vector< ImplToolItem >::iterator it = mpData->m_aItems.begin(); while ( it != mpData->m_aItems.end() ) { |