summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsamu Mogi <saturday6c@gmail.com>2013-05-24 09:47:20 +0900
committerLuboš Luňák <l.lunak@suse.cz>2013-05-27 13:36:21 +0200
commitc891d0b3d8810815bdb1ed4fe793bb10ff7c541b (patch)
tree95ef6b25c6e2941ab1c77f756655ec318aac9831
parent570af5e91cb72c2e344aa97fac92224d4c7344a7 (diff)
vcl: Check SH_MenuBar_MouseTracking when menubar is drawn on KDE
If QStyle::SH_MenuBar_MouseTracking is 0, it makes a mouse rollover effect minimize. By this, a menubar item of CDE and Motif styles becomes closer to standard behavior. Change-Id: I87dccbd30bf7b9f0d82d1a6e67355c1b25d22dc8 Reviewed-on: https://gerrit.libreoffice.org/4018 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com> Signed-off-by: Luboš Luňák <l.lunak@suse.cz>
-rw-r--r--vcl/unx/kde/salnativewidgets-kde.cxx18
-rw-r--r--vcl/unx/kde4/KDESalFrame.cxx15
-rw-r--r--vcl/unx/kde4/KDESalGraphics.cxx3
3 files changed, 23 insertions, 13 deletions
diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx
index 85b9a148552c..e1923ac39502 100644
--- a/vcl/unx/kde/salnativewidgets-kde.cxx
+++ b/vcl/unx/kde/salnativewidgets-kde.cxx
@@ -777,7 +777,8 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
int nMenuItem = ( nStyle & QStyle::Style_Enabled )? m_nMenuBarEnabledItem: m_nMenuBarDisabledItem;
QMenuItem *pMenuItem = static_cast<QMenuBar*>( pWidget )->findItem( nMenuItem );
- if ( nStyle & QStyle::Style_MouseOver )
+ if ( ( nStyle & QStyle::Style_MouseOver )
+ && kapp->style().styleHint( QStyle::SH_MenuBar_MouseTracking ) )
nStyle |= QStyle::Style_Active;
if ( nStyle & QStyle::Style_Selected )
@@ -1984,9 +1985,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
aStyleSettings.SetMenuBarTextColor( aMenuFore );
aStyleSettings.SetMenuColor( aMenuBack );
aStyleSettings.SetMenuBarColor( aMenuBack );
-
aStyleSettings.SetMenuHighlightColor( toColor ( qMenuCG.highlight() ) );
- aStyleSettings.SetMenuBarRolloverColor( toColor ( qMenuCG.highlight() ) );
// Menu items higlight text color, theme specific
if ( kapp->style().inherits( "HighContrastStyle" ) ||
@@ -2002,15 +2001,22 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
// set special menubar higlight text color
if ( kapp->style().inherits( "HighContrastStyle" ) )
- {
ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = toColor( qMenuCG.highlightedText() );
- aStyleSettings.SetMenuBarRolloverTextColor( toColor( qMenuCG.highlightedText() ) );
+ else
+ ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = aMenuFore;
+
+ // set menubar rollover color
+ if ( kapp->style().styleHint( QStyle::SH_MenuBar_MouseTracking ) )
+ {
+ aStyleSettings.SetMenuBarRolloverColor( toColor ( qMenuCG.highlight() ) );
+ aStyleSettings.SetMenuBarRolloverTextColor( ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor );
}
else
{
- ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = aMenuFore;
+ aStyleSettings.SetMenuBarRolloverColor( aMenuBack );
aStyleSettings.SetMenuBarRolloverTextColor( aMenuFore );
}
+
// Font
aFont = toFont( pMenuBar->font(), rSettings.GetUILanguageTag().getLocale() );
aStyleSettings.SetMenuFont( aFont );
diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx
index fee3ff128d90..be1fb61d28ff 100644
--- a/vcl/unx/kde4/KDESalFrame.cxx
+++ b/vcl/unx/kde4/KDESalFrame.cxx
@@ -301,21 +301,24 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
style.SetMenuBarTextColor( aMenuFore );
style.SetMenuColor( aMenuBack );
style.SetMenuBarColor( aMenuBack );
-
style.SetMenuHighlightColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) );
- style.SetMenuBarRolloverColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) );
-
style.SetMenuHighlightTextColor( aMenuFore );
// set special menubar higlight text color
if ( kapp->style()->inherits( "HighContrastStyle" ) )
- {
ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = toColor( qMenuCG.color( QPalette::HighlightedText ) );
- style.SetMenuBarRolloverTextColor( toColor( qMenuCG.color( QPalette::HighlightedText ) ) );
+ else
+ ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = aMenuFore;
+
+ // set menubar rollover color
+ if ( pMenuBar->style()->styleHint( QStyle::SH_MenuBar_MouseTracking ) )
+ {
+ style.SetMenuBarRolloverColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) );
+ style.SetMenuBarRolloverTextColor( ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor );
}
else
{
- ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = aMenuFore;
+ style.SetMenuBarRolloverColor( aMenuBack );
style.SetMenuBarRolloverTextColor( aMenuFore );
}
diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index 5434e7c227ec..9caeae9b3f3a 100644
--- a/vcl/unx/kde4/KDESalGraphics.cxx
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -297,7 +297,8 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
if (part == PART_MENU_ITEM)
{
QStyleOptionMenuItem option;
- if ( nControlState & CTRL_STATE_ROLLOVER )
+ if ( ( nControlState & CTRL_STATE_ROLLOVER )
+ && kapp->style()->styleHint( QStyle::SH_MenuBar_MouseTracking ) )
option.state |= QStyle::State_Selected;
if ( nControlState & CTRL_STATE_SELECTED ) // Passing State_Sunken is currently not documented.