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/source/app/settings.cxx                |   52 +++++++++++++++++++++++++++++
 vcl/source/control/button.cxx              |   13 +++++--
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx  |    4 ++
 vcl/win/window/salframe.cxx                |    3 +
 10 files changed, 140 insertions(+), 3 deletions(-)

New commits:
commit 8a425fbd9c6b75b09672e0ce18f43162d9eda360
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sat Jan 19 07:49:24 2019 -0500
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Sat Nov 9 17:35:21 2019 +0100

    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 <qui...@gmail.com>

diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index 2f0334a5bed8..75894432f05d 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -251,6 +251,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 136832dce5bf..eb76209040b8 100644
--- a/toolkit/source/awt/stylesettings.cxx
+++ b/toolkit/source/awt/stylesettings.cxx
@@ -239,6 +239,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 );
@@ -252,6 +266,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/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() );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to