summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2019-01-19 07:49:24 -0500
committerTomaž Vajngerl <quikee@gmail.com>2019-11-09 17:35:21 +0100
commit8a425fbd9c6b75b09672e0ce18f43162d9eda360 (patch)
tree7f862bf2c494aeef555eb5fb612908c94f81b6eb /vcl
parenta0ebc6f898992dbc0da9f252911da867dfdfd741 (diff)
custom widgets: support custom action button text colors
Change-Id: I314183a1d6434c043183a600740c786e22a67503 Reviewed-on: https://gerrit.libreoffice.org/82276 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/headless/CustomWidgetDraw.cxx3
-rw-r--r--vcl/inc/WidgetThemeLibrary.hxx3
-rw-r--r--vcl/source/app/settings.cxx52
-rw-r--r--vcl/source/control/button.cxx13
-rw-r--r--vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx4
-rw-r--r--vcl/win/window/salframe.cxx3
6 files changed, 75 insertions, 3 deletions
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index 9e49390b0f3a..677c575b96bb 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -342,7 +342,10 @@ bool CustomWidgetDraw::updateSettings(AllSettings& rSettings)
aStyleSet.SetShadowColor(aStyle.maShadowColor);
aStyleSet.SetDarkShadowColor(aStyle.maDarkShadowColor);
aStyleSet.SetButtonTextColor(aStyle.maButtonTextColor);
+ aStyleSet.SetActionButtonTextColor(aStyle.maActionButtonTextColor);
+ aStyleSet.SetDefaultActionButtonTextColor(aStyle.maDefaultActionButtonTextColor);
aStyleSet.SetButtonRolloverTextColor(aStyle.maButtonRolloverTextColor);
+ aStyleSet.SetActionButtonRolloverTextColor(aStyle.maActionButtonRolloverTextColor);
aStyleSet.SetRadioCheckTextColor(aStyle.maRadioCheckTextColor);
aStyleSet.SetGroupTextColor(aStyle.maGroupTextColor);
aStyleSet.SetLabelTextColor(aStyle.maLabelTextColor);
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index ed4260226a80..404d93159aee 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -25,6 +25,9 @@ struct WidgetDrawStyle
uint32_t maShadowColor;
uint32_t maDarkShadowColor;
uint32_t maButtonTextColor;
+ uint32_t maDefaultActionButtonTextColor;
+ uint32_t maActionButtonTextColor;
+ uint32_t maActionButtonRolloverTextColor;
uint32_t maButtonRolloverTextColor;
uint32_t maRadioCheckTextColor;
uint32_t maGroupTextColor;
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 837a42499c7e..a621f6c61fd4 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -82,6 +82,9 @@ struct ImplStyleData
Color maActiveTextColor;
Color maAlternatingRowColor;
Color maButtonTextColor;
+ Color maDefaultActionButtonTextColor;
+ Color maActionButtonTextColor;
+ Color maActionButtonRolloverTextColor;
Color maButtonRolloverTextColor;
Color maButtonPressedRolloverTextColor;
Color maCheckedColor;
@@ -483,6 +486,9 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
maActiveTextColor( rData.maActiveTextColor ),
maAlternatingRowColor( rData.maAlternatingRowColor ),
maButtonTextColor( rData.maButtonTextColor ),
+ maDefaultActionButtonTextColor( rData.maDefaultActionButtonTextColor ),
+ maActionButtonTextColor( rData.maActionButtonTextColor ),
+ maActionButtonRolloverTextColor( rData.maActionButtonRolloverTextColor ),
maButtonRolloverTextColor( rData.maButtonRolloverTextColor ),
maButtonPressedRolloverTextColor( rData.maButtonPressedRolloverTextColor ),
maCheckedColor( rData.maCheckedColor ),
@@ -620,6 +626,9 @@ void ImplStyleData::SetStandardStyles()
maShadowColor = COL_GRAY;
maDarkShadowColor = COL_BLACK;
maButtonTextColor = COL_BLACK;
+ maDefaultActionButtonTextColor = COL_BLACK;
+ maActionButtonTextColor = COL_BLACK;
+ maActionButtonRolloverTextColor = COL_BLACK;
maButtonRolloverTextColor = COL_BLACK;
maButtonPressedRolloverTextColor = COL_BLACK;
maRadioCheckTextColor = COL_BLACK;
@@ -778,6 +787,45 @@ StyleSettings::GetButtonTextColor() const
}
void
+StyleSettings::SetDefaultActionButtonTextColor( const Color& rColor )
+{
+ CopyData();
+ mxData->maDefaultActionButtonTextColor = rColor;
+}
+
+const Color&
+StyleSettings::GetDefaultActionButtonTextColor() const
+{
+ return mxData->maDefaultActionButtonTextColor;
+}
+
+void
+StyleSettings::SetActionButtonTextColor( const Color& rColor )
+{
+ CopyData();
+ mxData->maActionButtonTextColor = rColor;
+}
+
+const Color&
+StyleSettings::GetActionButtonTextColor() const
+{
+ return mxData->maActionButtonTextColor;
+}
+
+void
+StyleSettings::SetActionButtonRolloverTextColor( const Color& rColor )
+{
+ CopyData();
+ mxData->maActionButtonRolloverTextColor = rColor;
+}
+
+const Color&
+StyleSettings::GetActionButtonRolloverTextColor() const
+{
+ return mxData->maActionButtonRolloverTextColor;
+}
+
+void
StyleSettings::SetButtonRolloverTextColor( const Color& rColor )
{
CopyData();
@@ -2220,6 +2268,10 @@ bool StyleSettings::operator ==( const StyleSettings& rSet ) const
(mxData->maShadowColor == rSet.mxData->maShadowColor) &&
(mxData->maDarkShadowColor == rSet.mxData->maDarkShadowColor) &&
(mxData->maButtonTextColor == rSet.mxData->maButtonTextColor) &&
+ (mxData->maDefaultActionButtonTextColor == rSet.mxData->maDefaultActionButtonTextColor) &&
+ (mxData->maActionButtonTextColor == rSet.mxData->maActionButtonTextColor) &&
+ (mxData->maButtonRolloverTextColor == rSet.mxData->maButtonRolloverTextColor) &&
+ (mxData->maActionButtonRolloverTextColor == rSet.mxData->maActionButtonRolloverTextColor) &&
(mxData->maRadioCheckTextColor == rSet.mxData->maRadioCheckTextColor) &&
(mxData->maGroupTextColor == rSet.mxData->maGroupTextColor) &&
(mxData->maLabelTextColor == rSet.mxData->maLabelTextColor) &&
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index ce37b5b358f6..4c6f535669e3 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -777,7 +777,8 @@ void PushButton::ImplDrawPushButtonContent(OutputDevice* pDev, DrawFlags nDrawFl
if (nButtonFlags & DrawButtonFlags::Pressed)
aColor = rStyleSettings.GetButtonPressedRolloverTextColor();
else
- aColor = rStyleSettings.GetButtonRolloverTextColor();
+ aColor = isAction() ? rStyleSettings.GetActionButtonRolloverTextColor()
+ : rStyleSettings.GetButtonRolloverTextColor();
}
else if ( IsControlForeground() )
aColor = GetControlForeground();
@@ -786,10 +787,16 @@ void PushButton::ImplDrawPushButtonContent(OutputDevice* pDev, DrawFlags nDrawFl
if (nButtonFlags & DrawButtonFlags::Pressed)
aColor = rStyleSettings.GetButtonPressedRolloverTextColor();
else
- aColor = rStyleSettings.GetButtonRolloverTextColor();
+ aColor = isAction() ? rStyleSettings.GetActionButtonRolloverTextColor()
+ : rStyleSettings.GetButtonRolloverTextColor();
}
else
- aColor = rStyleSettings.GetButtonTextColor();
+ {
+ aColor = isAction() ? ((ImplGetButtonState() & DrawButtonFlags::Default)
+ ? rStyleSettings.GetDefaultActionButtonTextColor()
+ : rStyleSettings.GetActionButtonTextColor())
+ : rStyleSettings.GetButtonTextColor();
+ }
pDev->SetTextColor( aColor );
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 57fff4c6a473..5680ddf71bc2 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -2999,6 +2999,8 @@ bool GtkSalGraphics::updateSettings(AllSettings& rSettings)
::Color aTextColor = getColor( text_color );
aStyleSet.SetDialogTextColor( aTextColor );
aStyleSet.SetButtonTextColor( aTextColor );
+ aStyleSet.SetDefaultActionButtonTextColor(aTextColor);
+ aStyleSet.SetActionButtonTextColor(aTextColor);
aStyleSet.SetRadioCheckTextColor( aTextColor );
aStyleSet.SetGroupTextColor( aTextColor );
aStyleSet.SetLabelTextColor( aTextColor );
@@ -3025,6 +3027,8 @@ bool 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.SetActionButtonRolloverTextColor(aTextColor);
aStyleSet.SetFieldRolloverTextColor( aTextColor );
aContextState.restore();
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 6f7971f01c33..a57e67ce8896 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2608,6 +2608,9 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
aStyleSettings.SetDialogTextColor( aStyleSettings.GetButtonTextColor() );
aStyleSettings.SetButtonTextColor( ImplWinColorToSal( GetSysColor( COLOR_BTNTEXT ) ) );
+ aStyleSettings.SetDefaultActionButtonTextColor( ImplWinColorToSal( GetSysColor( COLOR_BTNTEXT ) ) );
+ aStyleSettings.SetActionButtonTextColor( aStyleSettings.GetDefaultActionButtonTextColor() );
+ aStyleSettings.SetActionButtonRolloverTextColor( aStyleSettings.GetActionButtonTextColor() );
aStyleSettings.SetButtonRolloverTextColor( aStyleSettings.GetButtonTextColor() );
aStyleSettings.SetButtonPressedRolloverTextColor( aStyleSettings.GetButtonTextColor() );
aStyleSettings.SetTabTextColor( aStyleSettings.GetButtonTextColor() );