diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-01-13 14:11:09 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-01-14 21:31:32 +0900 |
commit | 1149232c70d3f0383984091df597f3419045ba19 (patch) | |
tree | b13d89b17fb8d07e34ef9799ad7a24e77e287107 /sfx2/source/dialog | |
parent | dc265e3b104de6a3882d25b7b808daf99425d9ee (diff) |
infobar: reuse gathering the dark/light colors from settings
Change-Id: I923221f502c4efd200f77d5c73f03d124490ee39
Diffstat (limited to 'sfx2/source/dialog')
-rw-r--r-- | sfx2/source/dialog/infobar.cxx | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx index 70e75e5ec512..7cd0ebee684d 100644 --- a/sfx2/source/dialog/infobar.cxx +++ b/sfx2/source/dialog/infobar.cxx @@ -37,6 +37,21 @@ const long INFO_BAR_BASE_HEIGHT = 40; const BColor constLightColor(1.0, 1.0, 191.0 / 255.0); const BColor constDarkColor(217.0 / 255.0, 217.0 / 255.0, 78.0 / 255.0); +void lclDetermineLightDarkColor(BColor& rLightColor, BColor& rDarkColor) +{ + const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); + if (rSettings.GetHighContrastMode()) + { + rLightColor = rSettings.GetLightColor().getBColor(); + rDarkColor = rSettings.GetDialogTextColor().getBColor(); + } + else + { + rLightColor = constLightColor; + rDarkColor = constDarkColor; + } +} + class SfxCloseButton : public PushButton { public: @@ -58,15 +73,9 @@ void SfxCloseButton::Paint(const Rectangle&) Primitive2DSequence aSeq(2); - BColor aLightColor(constLightColor); - BColor aDarkColor(constDarkColor); - - const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); - if (rSettings.GetHighContrastMode()) - { - aLightColor = rSettings.GetLightColor().getBColor(); - aDarkColor = rSettings.GetDialogTextColor().getBColor(); - } + BColor aLightColor; + BColor aDarkColor; + lclDetermineLightDarkColor(aLightColor, aDarkColor); // Light background B2DPolygon aPolygon; @@ -150,15 +159,9 @@ void SfxInfoBarWindow::Paint(const Rectangle& rPaintRect) Primitive2DSequence aSeq(2); - BColor aLightColor(constLightColor); - BColor aDarkColor(constDarkColor); - - const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); - if (rSettings.GetHighContrastMode()) - { - aLightColor = rSettings.GetLightColor().getBColor(); - aDarkColor = rSettings.GetDialogTextColor().getBColor(); - } + BColor aLightColor; + BColor aDarkColor; + lclDetermineLightDarkColor(aLightColor, aDarkColor); // Update the label background color m_pMessage->SetBackground(Wallpaper(Color(aLightColor))); |