include/vcl/settings.hxx              |    3 +++
 vcl/source/app/salvtables.cxx         |    3 ++-
 vcl/source/app/settings.cxx           |   18 ++++++++++++++++++
 vcl/unx/gtk3/gtkinst.cxx              |    2 +-
 vcl/unx/gtk3/salnativewidgets-gtk.cxx |    5 +++++
 5 files changed, 29 insertions(+), 2 deletions(-)

New commits:
commit 39076309c6583e62f6ee8e1558074a54b797637a
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Apr 7 17:05:28 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Apr 7 23:59:26 2022 +0200

    Related: tdf#148448 add a separate WarningColor settings
    
    instead of a hard-coded yellow. For gtk we can use the named color
    "warning_color" to populate it: 
https://docs.gtk.org/gtk4/css-properties.html
    
    Change-Id: I538bffdc0f6286c78a08cef649fa8a074a6510ef
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132684
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index 523fe6bc13f9..6795150819a7 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -345,6 +345,9 @@ public:
     void                            SetDisableColor( const Color& rColor );
     const Color&                    GetDisableColor() const;
 
+    void                            SetWarningColor( const Color& rColor );
+    const Color&                    GetWarningColor() const;
+
     void                            SetHelpColor( const Color& rColor );
     const Color&                    GetHelpColor() const;
 
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index c21d66a15d0a..88b50c50c203 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -5727,7 +5727,8 @@ void SalInstanceLabel::set_label_type(weld::LabelType 
eType)
             break;
         case weld::LabelType::Warning:
             m_xLabel->SetControlForeground();
-            m_xLabel->SetControlBackground(COL_YELLOW);
+            m_xLabel->SetControlBackground(
+                m_xLabel->GetSettings().GetStyleSettings().GetWarningColor());
             break;
         case weld::LabelType::Error:
             m_xLabel->SetControlForeground();
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 9660efc09c53..122b2ae6f576 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -131,6 +131,7 @@ struct ImplStyleData
     Color                           maMonoColor;
     Color                           maRadioCheckTextColor;
     Color                           maShadowColor;
+    Color                           maWarningColor;
     Color                           maVisitedLinkColor;
     Color                           maToolTextColor;
     Color                           maWindowColor;
@@ -551,6 +552,7 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
     maMonoColor( rData.maMonoColor ),
     maRadioCheckTextColor( rData.maRadioCheckTextColor ),
     maShadowColor( rData.maShadowColor ),
+    maWarningColor( rData.maWarningColor ),
     maVisitedLinkColor( rData.maVisitedLinkColor ),
     maToolTextColor( rData.maToolTextColor ),
     maWindowColor( rData.maWindowColor ),
@@ -651,6 +653,8 @@ void ImplStyleData::SetStandardStyles()
     maShadowColor               = COL_GRAY;
     maDarkShadowColor           = COL_BLACK;
 
+    maWarningColor              = COL_YELLOW;
+
     maDefaultButtonTextColor                      = COL_BLACK;
     maButtonTextColor                             = COL_BLACK;
     maDefaultActionButtonTextColor                = COL_BLACK;
@@ -784,6 +788,19 @@ StyleSettings::GetLightBorderColor() const
     return mxData->maLightBorderColor;
 }
 
+void
+StyleSettings::SetWarningColor( const Color& rColor )
+{
+    CopyData();
+    mxData->maWarningColor = rColor;
+}
+
+const Color&
+StyleSettings::GetWarningColor() const
+{
+    return mxData->maWarningColor;
+}
+
 void
 StyleSettings::SetShadowColor( const Color& rColor )
 {
@@ -2429,6 +2446,7 @@ bool StyleSettings::operator ==( const StyleSettings& 
rSet ) const
          (mxData->maLightBorderColor        == 
rSet.mxData->maLightBorderColor)         &&
          (mxData->maShadowColor             == rSet.mxData->maShadowColor)     
         &&
          (mxData->maDarkShadowColor         == rSet.mxData->maDarkShadowColor) 
         &&
+         (mxData->maWarningColor            == rSet.mxData->maWarningColor)    
         &&
          (mxData->maButtonTextColor         == rSet.mxData->maButtonTextColor) 
         &&
          (mxData->maDefaultActionButtonTextColor == 
rSet.mxData->maDefaultActionButtonTextColor) &&
          (mxData->maActionButtonTextColor   == 
rSet.mxData->maActionButtonTextColor)    &&
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 4875bc64e7d7..ff024e662037 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -16909,7 +16909,7 @@ public:
                 gtk_label_set_attributes(m_pLabel, nullptr);
                 break;
             case weld::LabelType::Warning:
-                set_text_background_color(COL_YELLOW);
+                
set_text_background_color(Application::GetSettings().GetStyleSettings().GetWarningColor());
                 break;
             case weld::LabelType::Error:
                 
set_text_background_color(Application::GetSettings().GetStyleSettings().GetHighlightColor());
diff --git a/vcl/unx/gtk3/salnativewidgets-gtk.cxx 
b/vcl/unx/gtk3/salnativewidgets-gtk.cxx
index e2cef41100ec..df40af50ef6b 100644
--- a/vcl/unx/gtk3/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/salnativewidgets-gtk.cxx
@@ -2413,6 +2413,11 @@ bool GtkSalGraphics::updateSettings(AllSettings& 
rSettings)
         aStyleSet.SetActiveColor( aHighlightColor );
         aStyleSet.SetActiveTextColor( aHighlightTextColor );
 
+        // warning color
+        GdkRGBA warning_color;
+        if (gtk_style_context_lookup_color(pCStyle, "warning_color", 
&warning_color))
+            aStyleSet.SetWarningColor(getColor(warning_color));
+
         // field background color
         style_context_set_state(pCStyle, GTK_STATE_FLAG_NORMAL);
         ::Color aBackFieldColor = style_context_get_background_color(pCStyle);

Reply via email to