diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-17 22:56:46 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-18 11:22:49 +0900 |
commit | b4bbb5e5d7b31caad2fbcc00382ad27df3c81001 (patch) | |
tree | 8ac345712ff92a9b33a7d54651ed27ad88f1ec67 /sfx2 | |
parent | 2ca7795a6a723c701f295323fcc3f6c52ad37976 (diff) |
refactor how font, fg. and bg. are applied in widgets/controls
- Move vcl::RenderContext to outdev.
- Change some methods on vcl::Window to accept RenderContext
as parameter.
- Add ApplySettings to vcl::Window - This method is called before
painting. Refactor existing classes that use InitSettings to
have ApplySettings or mark the classes to be refactored later.
- Add RenderSettings for adding defered settings to rendering.
This is similar to ApplySettings but for more ad-hoc calls.
Change-Id: I4ea58461f3b6b08ccfa3e0ddd1a4a3e04f8c4f45
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/thumbnailview.cxx | 32 | ||||
-rw-r--r-- | sfx2/source/dialog/titledockwin.cxx | 31 |
2 files changed, 28 insertions, 35 deletions
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index d5a14b223886..ba6f706a76fd 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -187,34 +187,36 @@ void ThumbnailView::ImplDeleteItems() mpStartSelRange = mFilteredItemList.end(); } +void ThumbnailView::ApplySettings(vcl::RenderContext& rRenderContext) +{ + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + + ApplyControlFont(*this, rStyleSettings.GetAppFont()); + ApplyControlForeground(*this, rStyleSettings.GetButtonTextColor()); + rRenderContext.SetTextFillColor(); + Color aColor = rStyleSettings.GetFieldColor(); + rRenderContext.SetBackground(aColor); +} + void ThumbnailView::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if ( bFont ) + if (bFont) { - vcl::Font aFont; - aFont = rStyleSettings.GetAppFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); + ApplyControlFont(*this, rStyleSettings.GetAppFont()); } - if ( bForeground || bFont ) + if (bForeground || bFont) { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetButtonTextColor(); - SetTextColor( aColor ); + ApplyControlForeground(*this, rStyleSettings.GetButtonTextColor()); SetTextFillColor(); } - if ( bBackground ) + if (bBackground) { Color aColor = rStyleSettings.GetFieldColor(); - SetBackground( aColor ); + SetBackground(aColor); } delete mpItemAttrs; diff --git a/sfx2/source/dialog/titledockwin.cxx b/sfx2/source/dialog/titledockwin.cxx index 8b579dfa6eb5..91623bfe6105 100644 --- a/sfx2/source/dialog/titledockwin.cxx +++ b/sfx2/source/dialog/titledockwin.cxx @@ -140,31 +140,22 @@ namespace sfx2 onLayoutDone(); } + void TitledDockingWindow::ApplySettings(vcl::RenderContext& rRenderContext) + { + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + + // Font + ApplyControlFont(rRenderContext, rStyleSettings.GetAppFont()); + + // Color + ApplyControlForeground(rRenderContext, rStyleSettings.GetButtonTextColor()); + rRenderContext.SetTextFillColor(); + } void TitledDockingWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& i_rArea) { const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); - // Setup defaults - { - // Font - vcl::Font aFont = rStyleSettings.GetAppFont(); - if (IsControlFont()) - aFont.Merge(GetControlFont()); - SetZoomedPointFont(aFont); - - // Color. - Color aColor; - - if (IsControlForeground()) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetButtonTextColor(); - - rRenderContext.SetTextColor(aColor); - rRenderContext.SetTextFillColor(); - } - if (m_bLayoutPending) impl_layout(); |