summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-04-27 14:04:13 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-04-27 17:22:33 +0200
commit42494bfdd029c69cca7f0979a0ed3ab920efe45e (patch)
tree90c9fdbeebf6bc106f617691e060de8a692daec5
parent1d7349476b98dff8038ad44f7806fd404b68c993 (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>
-rw-r--r--include/vcl/settings.hxx3
-rw-r--r--vcl/source/app/settings.cxx16
-rw-r--r--vcl/source/control/button.cxx14
-rw-r--r--vcl/unx/gtk/salnativewidgets-gtk.cxx1
-rw-r--r--vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx15
-rw-r--r--vcl/unx/kde4/KDESalFrame.cxx1
-rw-r--r--vcl/unx/kde5/KDE5SalFrame.cxx1
-rw-r--r--vcl/win/window/salframe.cxx1
8 files changed, 49 insertions, 3 deletions
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index b8cc012414ce..491831e147d9 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -276,6 +276,9 @@ public:
void SetButtonRolloverTextColor( const Color& rColor );
const Color& GetButtonRolloverTextColor() const;
+ void SetButtonPressedRolloverTextColor( const Color& rColor );
+ const Color& GetButtonPressedRolloverTextColor() const;
+
void SetRadioCheckTextColor( const Color& rColor );
const Color& GetRadioCheckTextColor() const;
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() );