include/vcl/menu.hxx | 2 - include/vcl/settings.hxx | 10 ++++++ vcl/aqua/source/window/salframe.cxx | 1 vcl/source/app/settings.cxx | 6 +++ vcl/source/window/menu.cxx | 42 ++++++++++++++++++++------ vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 8 +++- vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx | 2 + vcl/unx/kde/salnativewidgets-kde.cxx | 17 +++++++++- vcl/unx/kde4/KDESalFrame.cxx | 14 +++++++- vcl/unx/kde4/KDESalGraphics.cxx | 10 ++++++ vcl/win/source/gdi/salnativewidgets-luna.cxx | 21 +++++++++++-- vcl/win/source/window/salframe.cxx | 3 + 12 files changed, 118 insertions(+), 18 deletions(-)
New commits: commit c891d0b3d8810815bdb1ed4fe793bb10ff7c541b Author: Isamu Mogi <[email protected]> Date: Fri May 24 09:47:20 2013 +0900 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 <[email protected]> Tested-by: David Tardon <[email protected]> Signed-off-by: LuboÅ¡ LuÅák <[email protected]> diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index 85b9a14..e1923ac 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 fee3ff1..be1fb61 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 5434e7c..9caeae9 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. commit 570af5e91cb72c2e344aa97fac92224d4c7344a7 Author: Isamu Mogi <[email protected]> Date: Fri May 24 20:12:23 2013 +0900 vcl: Implement drawing CTRL_MENUBAR and PART_MENU_ITEM on KDE Currently, menubar's background is drawn in window's background color and no menubar's specific background color. To fix this, The patch calls QStyle::drawControl() with QStyle::CE_MenuBarEmptyArea. Change-Id: I89b9decc016a926a0f00b9663ec1a5bce81daac1 Reviewed-on: https://gerrit.libreoffice.org/4025 Reviewed-by: David Tardon <[email protected]> Tested-by: David Tardon <[email protected]> Signed-off-by: LuboÅ¡ LuÅák <[email protected]> diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 2e9e33f..5434e7c 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -308,6 +308,9 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, } else if (part == PART_ENTIRE_CONTROL) { + QStyleOptionMenuItem option; + draw( QStyle::CE_MenuBarEmptyArea, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); } else { commit dd6ad434999dc5ca1877e0a6b0f1cc435ebd4cf9 Author: Isamu Mogi <[email protected]> Date: Fri May 24 09:27:26 2013 +0900 vcl: Add sink effect (QStyle::State_Sunken) to menubar on KDE A selected menubar item of cleanlooks, gtk+ and plastique styles becomes closer to standard looks by passing QStyle::State_Sunken with QStyle::CE_MenuBarItem to QStyle::drawControl(). It is currently not documented on QT developmet resources. But these styles interpret that. Change-Id: Ic7835bf0bf7af374ebdf8330d15b462d056de8a5 Reviewed-on: https://gerrit.libreoffice.org/4017 Reviewed-by: David Tardon <[email protected]> Tested-by: David Tardon <[email protected]> Signed-off-by: LuboÅ¡ LuÅák <[email protected]> diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index a9115ee..2e9e33f 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -300,6 +300,9 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, if ( nControlState & CTRL_STATE_ROLLOVER ) option.state |= QStyle::State_Selected; + if ( nControlState & CTRL_STATE_SELECTED ) // Passing State_Sunken is currently not documented. + option.state |= QStyle::State_Sunken; // But some kinds of QStyle interpret it. + draw( QStyle::CE_MenuBarItem, &option, m_image, vclStateValue2StateFlag(nControlState, value) ); } commit 65aba2fd729af52a56abb598a07c9d341adb738a Author: Isamu Mogi <[email protected]> Date: Fri May 17 11:00:39 2013 +0000 Add mouse rollover effect to menubar on KDE and Windows - Add mouse rollover handling code to vcl::MenuBarWindow and vcl::Menu - Add member variable of rollover color to StyleSettings and ImplStyleData - Add rollover color definitions for each platforms Change-Id: I9ececd8a7089918ac63c5f2027c0c2f361a9d227 Reviewed-on: https://gerrit.libreoffice.org/3856 Reviewed-by: Fridrich Strba <[email protected]> Tested-by: Fridrich Strba <[email protected]> Signed-off-by: LuboÅ¡ LuÅák <[email protected]> diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index d0f0c0c..38f301d 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -155,7 +155,7 @@ protected: SAL_DLLPRIVATE sal_uInt16 ImplGetFirstVisible() const; SAL_DLLPRIVATE sal_uInt16 ImplGetPrevVisible( sal_uInt16 nPos ) const; SAL_DLLPRIVATE sal_uInt16 ImplGetNextVisible( sal_uInt16 nPos ) const; - SAL_DLLPRIVATE void ImplPaint( Window* pWin, sal_uInt16 nBorder, long nOffY = 0, MenuItemData* pThisDataOnly = 0, sal_Bool bHighlighted = sal_False, bool bLayout = false ) const; + SAL_DLLPRIVATE void ImplPaint( Window* pWin, sal_uInt16 nBorder, long nOffY = 0, MenuItemData* pThisDataOnly = 0, sal_Bool bHighlighted = sal_False, bool bLayout = false, bool bRollover = false ) const; SAL_DLLPRIVATE void ImplSelect(); SAL_DLLPRIVATE void ImplCallHighlight( sal_uInt16 nHighlightItem ); SAL_DLLPRIVATE void ImplCallEventListeners( sal_uLong nEvent, sal_uInt16 nPos ); diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx index 2c861cd..4a7cdf8 100644 --- a/include/vcl/settings.hxx +++ b/include/vcl/settings.hxx @@ -278,12 +278,14 @@ private: Color maLightColor; Color maLinkColor; Color maMenuBarColor; + Color maMenuBarRolloverColor; Color maMenuBorderColor; Color maMenuColor; Color maMenuHighlightColor; Color maMenuHighlightTextColor; Color maMenuTextColor; Color maMenuBarTextColor; + Color maMenuBarRolloverTextColor; Color maMonoColor; Color maRadioCheckTextColor; Color maShadowColor; @@ -581,6 +583,10 @@ public: { CopyData(); mpData->maMenuBarColor = rColor; } const Color& GetMenuBarColor() const { return mpData->maMenuBarColor; } + void SetMenuBarRolloverColor( const Color& rColor ) + { CopyData(); mpData->maMenuBarRolloverColor = rColor; } + const Color& GetMenuBarRolloverColor() const + { return mpData->maMenuBarRolloverColor; } void SetMenuBorderColor( const Color& rColor ) { CopyData(); mpData->maMenuBorderColor = rColor; } const Color& GetMenuBorderColor() const @@ -593,6 +599,10 @@ public: { CopyData(); mpData->maMenuBarTextColor = rColor; } const Color& GetMenuBarTextColor() const { return mpData->maMenuBarTextColor; } + void SetMenuBarRolloverTextColor( const Color& rColor ) + { CopyData(); mpData->maMenuBarRolloverTextColor = rColor; } + const Color& GetMenuBarRolloverTextColor() const + { return mpData->maMenuBarRolloverTextColor; } void SetMenuHighlightColor( const Color& rColor ) { CopyData(); mpData->maMenuHighlightColor = rColor; } const Color& GetMenuHighlightColor() const diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index cb31f56..c2a66e3 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -1314,6 +1314,7 @@ void AquaSalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.GetMenuTextColor(), mpWindow ) ); aStyleSettings.SetMenuTextColor( aMenuTextColor ); aStyleSettings.SetMenuBarTextColor( aMenuTextColor ); + aStyleSettings.SetMenuBarRolloverTextColor( aMenuTextColor ); aStyleSettings.SetCursorBlinkTime( 500 ); diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 94f1752..d62966b 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -282,12 +282,14 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) : maLightColor( rData.maLightColor ), maLinkColor( rData.maLinkColor ), maMenuBarColor( rData.maMenuBarColor ), + maMenuBarRolloverColor( rData.maMenuBarRolloverColor ), maMenuBorderColor( rData.maMenuBorderColor ), maMenuColor( rData.maMenuColor ), maMenuHighlightColor( rData.maMenuHighlightColor ), maMenuHighlightTextColor( rData.maMenuHighlightTextColor ), maMenuTextColor( rData.maMenuTextColor ), maMenuBarTextColor( rData.maMenuBarTextColor ), + maMenuBarRolloverTextColor( rData.maMenuBarRolloverTextColor ), maMonoColor( rData.maMonoColor ), maRadioCheckTextColor( rData.maRadioCheckTextColor ), maShadowColor( rData.maShadowColor ), @@ -420,9 +422,11 @@ void ImplStyleData::SetStandardStyles() maDeactiveBorderColor = Color( COL_LIGHTGRAY ); maMenuColor = Color( COL_LIGHTGRAY ); maMenuBarColor = Color( COL_LIGHTGRAY ); + maMenuBarRolloverColor = Color( COL_BLUE ); maMenuBorderColor = Color( COL_LIGHTGRAY ); maMenuTextColor = Color( COL_BLACK ); maMenuBarTextColor = Color( COL_BLACK ); + maMenuBarRolloverTextColor = Color( COL_WHITE ); maMenuHighlightColor = Color( COL_BLUE ); maMenuHighlightTextColor = Color( COL_WHITE ); maHighlightColor = Color( COL_BLUE ); @@ -930,9 +934,11 @@ sal_Bool StyleSettings::operator ==( const StyleSettings& rSet ) const (mpData->maDeactiveBorderColor == rSet.mpData->maDeactiveBorderColor) && (mpData->maMenuColor == rSet.mpData->maMenuColor) && (mpData->maMenuBarColor == rSet.mpData->maMenuBarColor) && + (mpData->maMenuBarRolloverColor == rSet.mpData->maMenuBarRolloverColor) && (mpData->maMenuBorderColor == rSet.mpData->maMenuBorderColor) && (mpData->maMenuTextColor == rSet.mpData->maMenuTextColor) && (mpData->maMenuBarTextColor == rSet.mpData->maMenuBarTextColor) && + (mpData->maMenuBarRolloverTextColor == rSet.mpData->maMenuBarRolloverTextColor) && (mpData->maMenuHighlightColor == rSet.mpData->maMenuHighlightColor) && (mpData->maMenuHighlightTextColor == rSet.mpData->maMenuHighlightTextColor) && (mpData->maHighlightColor == rSet.mpData->maHighlightColor) && diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index d9d8438..9b4b32f 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2613,7 +2613,7 @@ static String getShortenedString( const String& i_rLong, Window* i_pWin, long i_ return aNonMnem; } -void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder, long nStartY, MenuItemData* pThisItemOnly, sal_Bool bHighlighted, bool bLayout ) const +void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder, long nStartY, MenuItemData* pThisItemOnly, sal_Bool bHighlighted, bool bLayout, bool bRollover ) const { // for symbols: nFontHeight x nFontHeight long nFontHeight = pWin->GetTextHeight(); @@ -2648,8 +2648,13 @@ void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder, long nStartY, MenuItemDa MenuItemData* pData = pItemList->GetDataFromPos( n ); if ( ImplIsVisible( n ) && ( !pThisItemOnly || ( pData == pThisItemOnly ) ) ) { - if ( pThisItemOnly && bHighlighted ) - pWin->SetTextColor( rSettings.GetMenuHighlightTextColor() ); + if ( pThisItemOnly ) + { + if ( bIsMenuBar && bRollover ) + pWin->SetTextColor( rSettings.GetMenuBarRolloverTextColor() ); + else if ( bHighlighted ) + pWin->SetTextColor( rSettings.GetMenuHighlightTextColor() ); + } Point aPos( aTopLeft ); aPos.Y() += nBorder; @@ -5391,7 +5396,7 @@ void MenuBarWindow::MouseButtonDown( const MouseEvent& rMEvt ) { mbAutoPopup = sal_True; sal_uInt16 nEntry = ImplFindEntry( rMEvt.GetPosPixel() ); - if ( ( nEntry != ITEMPOS_INVALID ) && ( nEntry != nHighlightedItem ) ) + if ( ( nEntry != ITEMPOS_INVALID ) && !pActivePopup ) { ChangeHighlightItem( nEntry, sal_False ); } @@ -5408,10 +5413,15 @@ void MenuBarWindow::MouseButtonUp( const MouseEvent& ) void MenuBarWindow::MouseMove( const MouseEvent& rMEvt ) { - // only highlight during Move if if was already highlighted. - if ( rMEvt.IsSynthetic() || rMEvt.IsLeaveWindow() || rMEvt.IsEnterWindow() || ( nHighlightedItem == ITEMPOS_INVALID ) ) + if ( rMEvt.IsSynthetic() || rMEvt.IsEnterWindow() ) return; + if ( rMEvt.IsLeaveWindow() && !pActivePopup ) + { + ChangeHighlightItem( ITEMPOS_INVALID, sal_False ); + return; + } + if( bIgnoreFirstMove ) { bIgnoreFirstMove = sal_False; @@ -5421,7 +5431,12 @@ void MenuBarWindow::MouseMove( const MouseEvent& rMEvt ) sal_uInt16 nEntry = ImplFindEntry( rMEvt.GetPosPixel() ); if ( ( nEntry != ITEMPOS_INVALID ) && ( nEntry != nHighlightedItem ) ) + { + if ( ! pActivePopup ) + mbAutoPopup = sal_False; + ChangeHighlightItem( nEntry, sal_False ); + } } void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, sal_Bool bSelectEntry, sal_Bool bAllowRestoreFocus, sal_Bool bDefaultToDocument) @@ -5525,6 +5540,7 @@ void MenuBarWindow::HighlightItem( sal_uInt16 nPos, sal_Bool bHighlight ) Rectangle aRect = Rectangle( Point( nX, 1 ), Size( pData->aSz.Width(), GetOutputSizePixel().Height()-2 ) ); Push( PUSH_CLIPREGION ); IntersectClipRegion( aRect ); + bool bRollover = bHighlight && ( !pActivePopup && !mbAutoPopup ); if ( bHighlight ) { if( IsNativeControlSupported( CTRL_MENUBAR, PART_MENU_ITEM ) && @@ -5550,15 +5566,23 @@ void MenuBarWindow::HighlightItem( sal_uInt16 nPos, sal_Bool bHighlight ) ImplAddNWFSeparator( this, aControlValue ); // draw selected item + ControlState nState = CTRL_STATE_ENABLED; + if ( bRollover ) + nState |= CTRL_STATE_ROLLOVER; + else + nState |= CTRL_STATE_SELECTED; DrawNativeControl( CTRL_MENUBAR, PART_MENU_ITEM, aRect, - CTRL_STATE_ENABLED | CTRL_STATE_SELECTED, + nState, aControlValue, OUString() ); } else { - SetFillColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() ); + if ( bRollover ) + SetFillColor( GetSettings().GetStyleSettings().GetMenuBarRolloverColor() ); + else + SetFillColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() ); SetLineColor(); DrawRect( aRect ); } @@ -5588,7 +5612,7 @@ void MenuBarWindow::HighlightItem( sal_uInt16 nPos, sal_Bool bHighlight ) Erase( aRect ); } Pop(); - pMenu->ImplPaint( this, 0, 0, pData, bHighlight ); + pMenu->ImplPaint( this, 0, 0, pData, bHighlight, false, bRollover ); } return; } diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 29f7542..7e16bfb 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -3061,7 +3061,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKMenubar( if( nPart == PART_MENU_ITEM ) { - if( nState & (CTRL_STATE_SELECTED|CTRL_STATE_ROLLOVER) ) + if( nState & CTRL_STATE_SELECTED ) { gtk_widget_style_get( gWidgetData[m_nXScreen].gMenuItemMenubarWidget, "selected_shadow_type", &selected_shadow_type, @@ -3106,7 +3106,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKMenubar( else if( nPart == PART_MENU_ITEM ) { - if( nState & (CTRL_STATE_SELECTED|CTRL_STATE_ROLLOVER) ) + if( nState & CTRL_STATE_SELECTED ) { gtk_paint_box( gWidgetData[m_nXScreen].gMenuItemMenubarWidget->style, gdkDrawable, @@ -3860,6 +3860,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) aBackColor = getColor( pMenubarStyle->bg[GTK_STATE_NORMAL] ); aStyleSet.SetMenuBarColor( aBackColor ); + aStyleSet.SetMenuBarRolloverColor( aBackColor ); aBackColor = getColor( pMenuStyle->bg[GTK_STATE_NORMAL] ); aTextColor = getColor( pMenuTextStyle->fg[GTK_STATE_NORMAL] ); aStyleSet.SetMenuColor( aBackColor ); @@ -3867,13 +3868,16 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) aTextColor = getColor( pMenubarStyle->fg[GTK_STATE_NORMAL] ); aStyleSet.SetMenuBarTextColor( aTextColor ); + aStyleSet.SetMenuBarRolloverTextColor( aTextColor ); #if OSL_DEBUG_LEVEL > 1 std::fprintf( stderr, "==\n" ); std::fprintf( stderr, "MenuColor = %x (%d)\n", (int)aStyleSet.GetMenuColor().GetColor(), aStyleSet.GetMenuColor().GetLuminance() ); std::fprintf( stderr, "MenuTextColor = %x (%d)\n", (int)aStyleSet.GetMenuTextColor().GetColor(), aStyleSet.GetMenuTextColor().GetLuminance() ); std::fprintf( stderr, "MenuBarColor = %x (%d)\n", (int)aStyleSet.GetMenuBarColor().GetColor(), aStyleSet.GetMenuBarColor().GetLuminance() ); + std::fprintf( stderr, "MenuBarRolloverColor = %x (%d)\n", (int)aStyleSet.GetMenuBarRolloverColor().GetColor(), aStyleSet.GetMenuRolloverBarColor().GetLuminance() ); std::fprintf( stderr, "MenuBarTextColor = %x (%d)\n", (int)aStyleSet.GetMenuBarTextColor().GetColor(), aStyleSet.GetMenuBarTextColor().GetLuminance() ); + std::fprintf( stderr, "MenuBarRolloverTextColor = %x (%d)\n", (int)aStyleSet.GetMenuBarRolloverTextColor().GetColor(), aStyleSet.GetMenuBarRolloverTextColor().GetLuminance() ); std::fprintf( stderr, "LightColor = %x (%d)\n", (int)aStyleSet.GetLightColor().GetColor(), aStyleSet.GetLightColor().GetLuminance() ); std::fprintf( stderr, "ShadowColor = %x (%d)\n", (int)aStyleSet.GetShadowColor().GetColor(), aStyleSet.GetShadowColor().GetLuminance() ); std::fprintf( stderr, "DarkShadowColor = %x (%d)\n", (int)aStyleSet.GetDarkShadowColor().GetColor(), aStyleSet.GetDarkShadowColor().GetLuminance() ); diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index d098cd1..8b9f2d2 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -1175,10 +1175,12 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) gtk_style_context_get_background_color( mpMenuBarStyle, GTK_STATE_FLAG_NORMAL, &background_color ); aBackColor = getColor( background_color ); aStyleSet.SetMenuBarColor( aBackColor ); + aStyleSet.SetMenuBarRolloverColor( aBackColor ); gtk_style_context_get_color( mpMenuBarStyle, GTK_STATE_FLAG_NORMAL, &text_color ); aTextColor = getColor( text_color ); aStyleSet.SetMenuBarTextColor( aTextColor ); + aStyleSet.SetMenuBarRolloverTextColor( aTextColor ); // menu items gtk_style_context_get_color( mpMenuStyle, GTK_STATE_FLAG_NORMAL, &color ); diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index ea013ca..85b9a14 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -777,6 +777,9 @@ 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 ) + nStyle |= QStyle::Style_Active; + if ( nStyle & QStyle::Style_Selected ) nStyle |= QStyle::Style_Active | QStyle::Style_Down | QStyle::Style_HasFocus; @@ -1983,6 +1986,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) 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" ) || @@ -1998,10 +2002,15 @@ 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; - + 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 d25ee46..fee3ff1 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -303,14 +303,21 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) 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; + style.SetMenuBarRolloverTextColor( aMenuFore ); + } // Font aFont = toFont( pMenuBar->font(), rSettings.GetUILanguageTag().getLocale() ); diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 1512da2..a9115ee 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -297,6 +297,9 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, if (part == PART_MENU_ITEM) { QStyleOptionMenuItem option; + if ( nControlState & CTRL_STATE_ROLLOVER ) + option.state |= QStyle::State_Selected; + draw( QStyle::CE_MenuBarItem, &option, m_image, vclStateValue2StateFlag(nControlState, value) ); } diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index 07f0fb9..796cbb3 100644 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -973,10 +973,24 @@ sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, } else if( nPart == PART_MENU_ITEM ) { - if( (nState & CTRL_STATE_ENABLED) ) - iState = (nState & CTRL_STATE_SELECTED) ? MBI_HOT : MBI_NORMAL; + if( nState & CTRL_STATE_ENABLED ) + { + if( nState & CTRL_STATE_SELECTED ) + iState = MBI_PUSHED; + else if( nState & CTRL_STATE_ROLLOVER ) + iState = MBI_HOT; + else + iState = MBI_NORMAL; + } else - iState = (nState & CTRL_STATE_SELECTED) ? MBI_DISABLEDHOT : MBI_DISABLED; + { + if( nState & CTRL_STATE_SELECTED ) + iState = MBI_DISABLEDPUSHED; + else if( nState & CTRL_STATE_ROLLOVER ) + iState = MBI_DISABLEDHOT; + else + iState = MBI_DISABLED; + } return ImplDrawTheme( hTheme, hDC, MENU_BARITEM, iState, rc, aCaption ); } } @@ -1506,6 +1520,7 @@ void WinSalGraphics::updateSettingsNative( AllSettings& rSettings ) { // in aero menuitem highlight text is drawn in the same color as normal aStyleSettings.SetMenuHighlightTextColor( aStyleSettings.GetMenuTextColor() ); + aStyleSettings.SetMenuBarRolloverTextColor( aStyleSettings.GetMenuTextColor() ); pSVData->maNWFData.mnMenuFormatBorderX = 2; pSVData->maNWFData.mnMenuFormatBorderY = 2; pSVData->maNWFData.maMenuBarHighlightTextColor = aStyleSettings.GetMenuTextColor(); diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 574519c..8ced16c 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -2774,11 +2774,13 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) GetSalData()->mbThemeMenuSupport = FALSE; aStyleSettings.SetMenuColor( ImplWinColorToSal( GetSysColor( COLOR_MENU ) ) ); aStyleSettings.SetMenuBarColor( aStyleSettings.GetMenuColor() ); + aStyleSettings.SetMenuBarRolloverColor( aStyleSettings.GetHighlightColor() ); aStyleSettings.SetMenuBorderColor( aStyleSettings.GetLightBorderColor() ); // overriden below for flat menus aStyleSettings.SetUseFlatBorders( FALSE ); aStyleSettings.SetUseFlatMenus( FALSE ); aStyleSettings.SetMenuTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) ); aStyleSettings.SetMenuBarTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) ); + aStyleSettings.SetMenuBarRolloverTextColor( ImplWinColorToSal( GetSysColor( COLOR_HIGHLIGHTTEXT ) ) ); aStyleSettings.SetActiveColor( ImplWinColorToSal( GetSysColor( COLOR_ACTIVECAPTION ) ) ); aStyleSettings.SetActiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_CAPTIONTEXT ) ) ); aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTION ) ) ); @@ -2793,6 +2795,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetUseFlatMenus( TRUE ); aStyleSettings.SetMenuBarColor( ImplWinColorToSal( GetSysColor( COLOR_MENUBAR ) ) ); aStyleSettings.SetMenuHighlightColor( ImplWinColorToSal( GetSysColor( COLOR_MENUHILIGHT ) ) ); + aStyleSettings.SetMenuBarRolloverColor( ImplWinColorToSal( GetSysColor( COLOR_MENUHILIGHT ) ) ); aStyleSettings.SetMenuBorderColor( ImplWinColorToSal( GetSysColor( COLOR_3DSHADOW ) ) ); // flat borders for our controls etc. as well in this mode (ie, no 3d borders)
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
