Commit 303493a9 authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Draw the separator for toolbuttons with separte popup menu on hover or focus

The only difference between the new instant-popup buttons and these when
flat is the color of the arrow, which is not a very good indicator. So
on hover, also draw the separator between the menu button and the main
button for these toolbuttons on hover or when it has focus, which makes
things a little clearer.
parent 3bc6636c
......@@ -3888,10 +3888,8 @@ namespace Breeze
// store state
const State& state( option->state );
const bool autoRaise( state & State_AutoRaise );
// do nothing for autoraise buttons
if( autoRaise || !(toolButtonOption->subControls & SC_ToolButtonMenu) ) return true;
if( !(toolButtonOption->subControls & SC_ToolButtonMenu) ) return true;
// store palette and rect
const auto& palette( option->palette );
......@@ -3902,6 +3900,7 @@ namespace Breeze
const bool hasFocus( enabled && ( state & ( State_HasFocus | State_Sunken ) ) );
const bool mouseOver( enabled && ( state & State_MouseOver ) );
const bool sunken( enabled && ( state & State_Sunken ) );
const bool flat( state & State_AutoRaise );
// update animation state
// mouse over takes precedence over focus
......@@ -3922,14 +3921,20 @@ namespace Breeze
frameRect = visualRect( option, frameRect );
// render
_helper->renderButtonFrame( painter, frameRect, background, outline, shadow, hasFocus, sunken );
if ( !flat )
{
_helper->renderButtonFrame( painter, frameRect, background, outline, shadow, hasFocus, sunken );
}
// also render separator
auto separatorRect( rect.adjusted( 0, 2, -2, -2 ) );
separatorRect.setWidth( 1 );
separatorRect = visualRect( option, separatorRect );
if( sunken ) separatorRect.translate( 1, 1 );
_helper->renderSeparator( painter, separatorRect, outline, true );
if ( !flat || mouseOver || hasFocus )
{
_helper->renderSeparator( painter, separatorRect, outline, true );
}
return true;
......@@ -6038,7 +6043,7 @@ namespace Breeze
{
copy.rect = menuRect;
if( !flat ) drawPrimitive( PE_IndicatorButtonDropDown, &copy, painter, widget );
drawPrimitive( PE_IndicatorButtonDropDown, &copy, painter, widget );
if( sunken && !flat ) copy.rect.translate( 1, 1 );
drawPrimitive( PE_IndicatorArrowDown, &copy, painter, widget );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment