[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - include/vcl offapi/com toolkit/source vcl/headless vcl/inc vcl/qt5 vcl/source vcl/unx vcl/win
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Wed Nov 13 20:46:28 UTC 2019
include/vcl/settings.hxx | 9 +++++
offapi/com/sun/star/awt/XStyleSettings.idl | 9 +++++
toolkit/source/awt/stylesettings.cxx | 41 ++++++++++++++++++++++
toolkit/source/awt/stylesettings.hxx | 6 +++
vcl/headless/CustomWidgetDraw.cxx | 3 +
vcl/inc/WidgetThemeLibrary.hxx | 3 +
vcl/qt5/Qt5Frame.cxx | 3 +
vcl/source/app/settings.cxx | 52 +++++++++++++++++++++++++++++
vcl/source/control/button.cxx | 13 +++++--
vcl/unx/gtk/salnativewidgets-gtk.cxx | 3 +
vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 4 ++
vcl/unx/kde4/KDESalFrame.cxx | 3 +
vcl/win/window/salframe.cxx | 3 +
13 files changed, 149 insertions(+), 3 deletions(-)
New commits:
commit aa3240f97b5cd018013dae20bbb01d47dca67290
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Jan 19 07:49:24 2019 -0500
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Wed Nov 13 21:45:44 2019 +0100
custom widgets: support custom action button text colors
Reviewed-on: https://gerrit.libreoffice.org/82276
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
(cherry picked from commit 8a425fbd9c6b75b09672e0ce18f43162d9eda360)
Change-Id: I314183a1d6434c043183a600740c786e22a67503
Reviewed-on: https://gerrit.libreoffice.org/82383
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index 94b35515149a..4cdef3a00b1e 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -270,6 +270,15 @@ public:
void SetButtonTextColor( const Color& rColor );
const Color& GetButtonTextColor() const;
+ void SetDefaultActionButtonTextColor( const Color& rColor );
+ const Color& GetDefaultActionButtonTextColor() const;
+
+ void SetActionButtonTextColor( const Color& rColor );
+ const Color& GetActionButtonTextColor() const;
+
+ void SetActionButtonRolloverTextColor( const Color& rColor );
+ const Color& GetActionButtonRolloverTextColor() const;
+
void SetButtonRolloverTextColor( const Color& rColor );
const Color& GetButtonRolloverTextColor() const;
diff --git a/offapi/com/sun/star/awt/XStyleSettings.idl b/offapi/com/sun/star/awt/XStyleSettings.idl
index 47a55d6e4e62..6150033787c9 100644
--- a/offapi/com/sun/star/awt/XStyleSettings.idl
+++ b/offapi/com/sun/star/awt/XStyleSettings.idl
@@ -61,9 +61,18 @@ interface XStyleSettings
/// specifies the color to use for text on buttons which are hovered with the mouse
[attribute] ::com::sun::star::util::Color ButtonRolloverTextColor;
+ /// specifies the color to use for text on action buttons which are hovered with the mouse
+ [attribute] ::com::sun::star::util::Color ActionButtonRolloverTextColor;
+
/// specifies the color to use for text on buttons
[attribute] ::com::sun::star::util::Color ButtonTextColor;
+ /// specifies the color to use for text on a default action buttons
+ [attribute] ::com::sun::star::util::Color DefaultActionButtonTextColor;
+
+ /// specifies the color to use for text on action buttons
+ [attribute] ::com::sun::star::util::Color ActionButtonTextColor;
+
[attribute] ::com::sun::star::util::Color CheckedColor;
diff --git a/toolkit/source/awt/stylesettings.cxx b/toolkit/source/awt/stylesettings.cxx
index 22cce1247cc6..3f6701766270 100644
--- a/toolkit/source/awt/stylesettings.cxx
+++ b/toolkit/source/awt/stylesettings.cxx
@@ -237,6 +237,20 @@ namespace toolkit
}
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getActionButtonRolloverTextColor()
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetActionButtonRolloverTextColor );
+ }
+
+
+ void SAL_CALL WindowStyleSettings::setActionButtonRolloverTextColor( ::sal_Int32 _buttonrollovertextcolor )
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetActionButtonRolloverTextColor, _buttonrollovertextcolor );
+ }
+
+
::sal_Int32 SAL_CALL WindowStyleSettings::getButtonTextColor()
{
StyleMethodGuard aGuard( *m_pData );
@@ -250,6 +264,33 @@ namespace toolkit
lcl_setStyleColor( *m_pData, &StyleSettings::SetButtonTextColor, _buttontextcolor );
}
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getDefaultActionButtonTextColor()
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetDefaultActionButtonTextColor );
+ }
+
+
+ void SAL_CALL WindowStyleSettings::setDefaultActionButtonTextColor( ::sal_Int32 _buttontextcolor )
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetDefaultActionButtonTextColor, _buttontextcolor );
+ }
+
+
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getActionButtonTextColor()
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetActionButtonTextColor );
+ }
+
+
+ void SAL_CALL WindowStyleSettings::setActionButtonTextColor( ::sal_Int32 _buttontextcolor )
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetActionButtonTextColor, _buttontextcolor );
+ }
+
::sal_Int32 SAL_CALL WindowStyleSettings::getCheckedColor()
{
diff --git a/toolkit/source/awt/stylesettings.hxx b/toolkit/source/awt/stylesettings.hxx
index 0bc28cd1dad4..9799119b2a83 100644
--- a/toolkit/source/awt/stylesettings.hxx
+++ b/toolkit/source/awt/stylesettings.hxx
@@ -62,8 +62,14 @@ namespace toolkit
virtual void SAL_CALL setActiveTextColor( ::sal_Int32 _activetextcolor ) override;
virtual ::sal_Int32 SAL_CALL getButtonRolloverTextColor() override;
virtual void SAL_CALL setButtonRolloverTextColor( ::sal_Int32 _buttonrollovertextcolor ) override;
+ virtual ::sal_Int32 SAL_CALL getActionButtonRolloverTextColor() override;
+ virtual void SAL_CALL setActionButtonRolloverTextColor( ::sal_Int32 _buttonrollovertextcolor ) override;
virtual ::sal_Int32 SAL_CALL getButtonTextColor() override;
virtual void SAL_CALL setButtonTextColor( ::sal_Int32 _buttontextcolor ) override;
+ virtual ::sal_Int32 SAL_CALL getDefaultActionButtonTextColor() override;
+ virtual void SAL_CALL setDefaultActionButtonTextColor( ::sal_Int32 _buttontextcolor ) override;
+ virtual ::sal_Int32 SAL_CALL getActionButtonTextColor() override;
+ virtual void SAL_CALL setActionButtonTextColor( ::sal_Int32 _buttontextcolor ) override;
virtual ::sal_Int32 SAL_CALL getCheckedColor() override;
virtual void SAL_CALL setCheckedColor( ::sal_Int32 _checkedcolor ) override;
virtual ::sal_Int32 SAL_CALL getDarkShadowColor() override;
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/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 761f77dae3b5..7f322bf9982e 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -1015,6 +1015,9 @@ void Qt5Frame::UpdateSettings(AllSettings& rSettings)
// Buttons
style.SetButtonTextColor(aButn);
+ style.SetDefaultActionButtonTextColor(aButn);
+ style.SetActionButtonTextColor(aButn);
+ style.SetActionButtonRolloverTextColor(aButn);
style.SetButtonRolloverTextColor(aButn);
style.SetButtonPressedRolloverTextColor(aButn);
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 60c422b26619..a742aea809f7 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -84,6 +84,9 @@ struct ImplStyleData
Color maActiveTextColor;
Color maAlternatingRowColor;
Color maButtonTextColor;
+ Color maDefaultActionButtonTextColor;
+ Color maActionButtonTextColor;
+ Color maActionButtonRolloverTextColor;
Color maButtonRolloverTextColor;
Color maButtonPressedRolloverTextColor;
Color maCheckedColor;
@@ -487,6 +490,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 ),
@@ -625,6 +631,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;
@@ -783,6 +792,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();
@@ -2246,6 +2294,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 2bc529c21117..845c397b0eef 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -850,7 +850,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();
@@ -859,10 +860,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/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx
index dd3ad70b0a49..2b11c4a2e175 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -3792,6 +3792,9 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
aStyleSet.SetFieldTextColor( aTextColor );
aTextColor = getColor( pStyle->fg[GTK_STATE_NORMAL] );
aStyleSet.SetButtonTextColor( aTextColor );
+ aStyleSet.SetDefaultActionButtonTextColor( aTextColor );
+ aStyleSet.SetActionButtonTextColor( aTextColor );
+ aStyleSet.SetActionButtonRolloverTextColor( aTextColor );
aStyleSet.SetRadioCheckTextColor( aTextColor );
aStyleSet.SetGroupTextColor( aTextColor );
aStyleSet.SetLabelTextColor( aTextColor );
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index c768fe808126..752a4bd459fd 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -2964,6 +2964,8 @@ void 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 );
@@ -2990,6 +2992,8 @@ 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.SetActionButtonRolloverTextColor(aTextColor);
aStyleSet.SetFieldRolloverTextColor( aTextColor );
aContextState.restore();
diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx
index c92551fe6ca2..f79752ce9e89 100644
--- a/vcl/unx/kde4/KDESalFrame.cxx
+++ b/vcl/unx/kde4/KDESalFrame.cxx
@@ -252,6 +252,9 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
// Buttons
style.SetButtonTextColor( aButn );
+ style.SetDefaultActionButtonTextColor( aButn );
+ style.SetActionButtonTextColor( aButn );
+ style.SetActionButtonRolloverTextColor( aButn );
style.SetButtonRolloverTextColor( aButn );
style.SetButtonPressedRolloverTextColor( aButn );
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index cf1cf6375e01..fec1382f9967 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2620,6 +2620,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() );
More information about the Libreoffice-commits
mailing list