summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2016-10-09 16:35:57 +0000
committerJan-Marek Glogowski <glogow@fbihome.de>2016-12-20 14:19:18 +0100
commit3f94cf15f9bbb58bb1f4e5ca4cfa10e354c659e3 (patch)
treeb013addb7cf5120bcf148a4e5b52878ce0e21ff4
parent7ab2350d55ac6c222ae218435f7d56e59be3add5 (diff)
Fix focus and rollover for vcl::ListBox
Change-Id: I4fffd086a38b54c673a199ea0603d25ca54aacd1
-rw-r--r--vcl/source/control/imp_listbox.cxx27
1 files changed, 21 insertions, 6 deletions
diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx
index a09bdb98c9e8..2dd277a91ad3 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -2618,6 +2618,8 @@ void ImplWin::ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout)
if (!bLayout)
{
bool bNativeOK = false;
+ bool bHasFocus = HasFocus();
+ bool bIsEnabled = IsEnabled();
ControlState nState = ControlState::ENABLED;
if (rRenderContext.IsNativeControlSupported(ControlType::Listbox, ControlPart::Entire)
@@ -2629,9 +2631,11 @@ void ImplWin::ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout)
vcl::Window *pWin = GetParent();
ImplControlValue aControlValue;
- if ( !pWin->IsEnabled() )
+ bIsEnabled &= pWin->IsEnabled();
+ if ( !bIsEnabled )
nState &= ~ControlState::ENABLED;
- if ( pWin->HasFocus() )
+ bHasFocus |= pWin->HasFocus();
+ if ( bHasFocus )
nState |= ControlState::FOCUSED;
// The listbox is painted over the entire control including the
@@ -2667,12 +2671,23 @@ void ImplWin::ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout)
nState, aControlValue, OUString());
}
- if (IsEnabled())
+ if (bIsEnabled)
{
- if (HasFocus() && !ImplGetSVData()->maNWFData.mbDDListBoxNoTextArea)
+ if (bHasFocus && !ImplGetSVData()->maNWFData.mbDDListBoxNoTextArea)
{
- rRenderContext.SetTextColor( rStyleSettings.GetHighlightTextColor() );
- rRenderContext.SetFillColor( rStyleSettings.GetHighlightColor() );
+ if ( !ImplGetSVData()->maNWFData.mbNoFocusRects )
+ rRenderContext.SetFillColor( rStyleSettings.GetHighlightColor() );
+ else
+ {
+ rRenderContext.SetLineColor();
+ rRenderContext.SetFillColor();
+ }
+ Color aColor;
+ if( bNativeOK && (nState & ControlState::ROLLOVER) )
+ aColor = rStyleSettings.GetFieldRolloverTextColor();
+ else
+ aColor = rStyleSettings.GetHighlightTextColor();
+ rRenderContext.SetTextColor( aColor );
rRenderContext.DrawRect( maFocusRect );
}
else