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 /vcl/source/control/edit.cxx | |
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 'vcl/source/control/edit.cxx')
-rw-r--r-- | vcl/source/control/edit.cxx | 58 |
1 files changed, 42 insertions, 16 deletions
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 227c7fe63cb4..9449e49f9c2c 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -394,44 +394,70 @@ void Edit::ImplModified() Modify(); } -void Edit::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) +void Edit::ApplySettings(vcl::RenderContext& rRenderContext) +{ + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + + vcl::Font aFont = rStyleSettings.GetFieldFont(); + ApplyControlFont(rRenderContext, aFont); + + ImplClearLayoutData(); + + Color aTextColor = rStyleSettings.GetFieldTextColor(); + ApplyControlForeground(rRenderContext, aTextColor); + + if (ImplUseNativeBorder(GetStyle()) || IsPaintTransparent()) + { + // Transparent background + rRenderContext.SetBackground(); + rRenderContext.SetFillColor(); + } + else if (IsControlBackground()) + { + rRenderContext.SetBackground(GetControlBackground()); + rRenderContext.SetFillColor(GetControlBackground()); + } + else + { + rRenderContext.SetBackground(rStyleSettings.GetFieldColor()); + rRenderContext.SetFillColor(rStyleSettings.GetFieldColor()); + } +} + +void Edit::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if ( bFont ) + if (bFont) { vcl::Font aFont = rStyleSettings.GetFieldFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); + ApplyControlFont(*this, aFont); ImplClearLayoutData(); } - if ( bFont || bForeground ) + if (bFont || bForeground) { Color aTextColor = rStyleSettings.GetFieldTextColor(); - if ( IsControlForeground() ) - aTextColor = GetControlForeground(); - SetTextColor( aTextColor ); + ApplyControlForeground(*this, aTextColor); } - if ( bBackground ) + if (bBackground) { - if ( ImplUseNativeBorder( GetStyle() ) || IsPaintTransparent() ) + if (ImplUseNativeBorder(GetStyle()) || IsPaintTransparent()) { // Transparent background SetBackground(); SetFillColor(); } - else if ( IsControlBackground() ) + else if (IsControlBackground()) { - SetBackground( GetControlBackground() ); - SetFillColor( GetControlBackground() ); + SetBackground(GetControlBackground()); + SetFillColor(GetControlBackground()); } else { - SetBackground( rStyleSettings.GetFieldColor() ); - SetFillColor( rStyleSettings.GetFieldColor() ); + SetBackground(rStyleSettings.GetFieldColor()); + SetFillColor(rStyleSettings.GetFieldColor()); } } } |