diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-04-27 14:04:13 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-04-27 17:22:33 +0200 |
commit | 42494bfdd029c69cca7f0979a0ed3ab920efe45e (patch) | |
tree | 90c9fdbeebf6bc106f617691e060de8a692daec5 /vcl | |
parent | 1d7349476b98dff8038ad44f7806fd404b68c993 (diff) |
Resolves: tdf#117178 distinguish between pressed vs unpressed rollover
Change-Id: If7964c6584d83609ad08dca7e669b85dfadf036e
Reviewed-on: https://gerrit.libreoffice.org/53563
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/settings.cxx | 16 | ||||
-rw-r--r-- | vcl/source/control/button.cxx | 14 | ||||
-rw-r--r-- | vcl/unx/gtk/salnativewidgets-gtk.cxx | 1 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 15 | ||||
-rw-r--r-- | vcl/unx/kde4/KDESalFrame.cxx | 1 | ||||
-rw-r--r-- | vcl/unx/kde5/KDE5SalFrame.cxx | 1 | ||||
-rw-r--r-- | vcl/win/window/salframe.cxx | 1 |
7 files changed, 46 insertions, 3 deletions
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index f9eaf47ce645..3c5d150df79c 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -94,6 +94,7 @@ struct ImplStyleData Color maAlternatingRowColor; Color maButtonTextColor; Color maButtonRolloverTextColor; + Color maButtonPressedRolloverTextColor; Color maCheckedColor; Color maDarkShadowColor; Color maDeactiveBorderColor; @@ -562,6 +563,7 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) : maAlternatingRowColor( rData.maAlternatingRowColor ), maButtonTextColor( rData.maButtonTextColor ), maButtonRolloverTextColor( rData.maButtonRolloverTextColor ), + maButtonPressedRolloverTextColor( rData.maButtonPressedRolloverTextColor ), maCheckedColor( rData.maCheckedColor ), maDarkShadowColor( rData.maDarkShadowColor ), maDeactiveBorderColor( rData.maDeactiveBorderColor ), @@ -703,6 +705,7 @@ void ImplStyleData::SetStandardStyles() maDarkShadowColor = COL_BLACK; maButtonTextColor = COL_BLACK; maButtonRolloverTextColor = COL_BLACK; + maButtonPressedRolloverTextColor = COL_BLACK; maRadioCheckTextColor = COL_BLACK; maGroupTextColor = COL_BLACK; maLabelTextColor = COL_BLACK; @@ -876,6 +879,19 @@ StyleSettings::GetButtonRolloverTextColor() const } void +StyleSettings::SetButtonPressedRolloverTextColor( const Color& rColor ) +{ + CopyData(); + mxData->maButtonPressedRolloverTextColor = rColor; +} + +const Color& +StyleSettings::GetButtonPressedRolloverTextColor() const +{ + return mxData->maButtonPressedRolloverTextColor; +} + +void StyleSettings::SetRadioCheckTextColor( const Color& rColor ) { CopyData(); diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 4bdc10f40010..ebd5aaee80a9 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -836,11 +836,21 @@ void PushButton::ImplDrawPushButtonContent(OutputDevice* pDev, DrawFlags nDrawFl if ( nDrawFlags & DrawFlags::Mono ) aColor = COL_BLACK; else if( (nButtonFlags & DrawButtonFlags::Highlight) && IsNativeControlSupported(ControlType::Pushbutton, ControlPart::Entire) ) - aColor = rStyleSettings.GetButtonRolloverTextColor(); + { + if (nButtonFlags & DrawButtonFlags::Pressed) + aColor = rStyleSettings.GetButtonPressedRolloverTextColor(); + else + aColor = rStyleSettings.GetButtonRolloverTextColor(); + } else if ( IsControlForeground() ) aColor = GetControlForeground(); else if( nButtonFlags & DrawButtonFlags::Highlight ) - aColor = rStyleSettings.GetButtonRolloverTextColor(); + { + if (nButtonFlags & DrawButtonFlags::Pressed) + aColor = rStyleSettings.GetButtonPressedRolloverTextColor(); + else + aColor = rStyleSettings.GetButtonRolloverTextColor(); + } else aColor = rStyleSettings.GetButtonTextColor(); diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx index 11e67cbd3ae2..2bd434c862b0 100644 --- a/vcl/unx/gtk/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx @@ -3815,6 +3815,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) // mouse over text colors aTextColor = getColor( pStyle->fg[ GTK_STATE_PRELIGHT ] ); aStyleSet.SetButtonRolloverTextColor( aTextColor ); + aStyleSet.SetButtonPressedRolloverTextColor( aTextColor ); aStyleSet.SetFieldRolloverTextColor( aTextColor ); // background colors diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx index 04f5ac181c05..9ed8d7c96dc3 100644 --- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx @@ -2889,9 +2889,22 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) style_context_set_state(pStyle, GTK_STATE_FLAG_PRELIGHT); gtk_style_context_get_color(pStyle, gtk_style_context_get_state(pStyle), &text_color); aTextColor = getColor( text_color ); - aStyleSet.SetButtonRolloverTextColor( aTextColor ); aStyleSet.SetFieldRolloverTextColor( aTextColor ); + // button mouse over colors + { + GdkRGBA normal_button_rollover_text_color, pressed_button_rollover_text_color; + style_context_set_state(mpButtonStyle, GTK_STATE_FLAG_PRELIGHT); + gtk_style_context_get_color(mpButtonStyle, gtk_style_context_get_state(mpButtonStyle), &normal_button_rollover_text_color); + aTextColor = getColor(normal_button_rollover_text_color); + aStyleSet.SetButtonRolloverTextColor( aTextColor ); + style_context_set_state(mpButtonStyle, static_cast<GtkStateFlags>(GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_ACTIVE)); + gtk_style_context_get_color(mpButtonStyle, gtk_style_context_get_state(mpButtonStyle), &pressed_button_rollover_text_color); + aTextColor = getColor(pressed_button_rollover_text_color); + style_context_set_state(mpButtonStyle, GTK_STATE_FLAG_NORMAL); + aStyleSet.SetButtonPressedRolloverTextColor( aTextColor ); + } + // tooltip colors { GtkStyleContext *pCStyle = gtk_style_context_new(); diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index 769e456e8738..7dde568a23b1 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -258,6 +258,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) // Buttons style.SetButtonTextColor( aButn ); style.SetButtonRolloverTextColor( aButn ); + style.SetButtonPressedRolloverTextColor( aButn ); // Tabs style.SetTabTextColor( aButn ); diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx index 61b4113fa9d2..ab1fc1f67763 100644 --- a/vcl/unx/kde5/KDE5SalFrame.cxx +++ b/vcl/unx/kde5/KDE5SalFrame.cxx @@ -231,6 +231,7 @@ void KDE5SalFrame::UpdateSettings( AllSettings& rSettings ) // Buttons style.SetButtonTextColor( aButn ); style.SetButtonRolloverTextColor( aButn ); + style.SetButtonPressedRolloverTextColor( aButn ); // Tabs style.SetTabTextColor( aButn ); diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 7186fc2953e9..7dfe3c0a573d 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -2607,6 +2607,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetDialogTextColor( aStyleSettings.GetButtonTextColor() ); aStyleSettings.SetButtonTextColor( ImplWinColorToSal( GetSysColor( COLOR_BTNTEXT ) ) ); aStyleSettings.SetButtonRolloverTextColor( aStyleSettings.GetButtonTextColor() ); + aStyleSettings.SetButtonPressedRolloverTextColor( aStyleSettings.GetButtonTextColor() ); aStyleSettings.SetTabTextColor( aStyleSettings.GetButtonTextColor() ); aStyleSettings.SetTabRolloverTextColor( aStyleSettings.GetButtonTextColor() ); aStyleSettings.SetTabHighlightTextColor( aStyleSettings.GetButtonTextColor() ); |