summaryrefslogtreecommitdiff
path: root/vcl/source/control/ilstbox.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-17 22:56:46 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-18 11:22:49 +0900
commitb4bbb5e5d7b31caad2fbcc00382ad27df3c81001 (patch)
tree8ac345712ff92a9b33a7d54651ed27ad88f1ec67 /vcl/source/control/ilstbox.cxx
parent2ca7795a6a723c701f295323fcc3f6c52ad37976 (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/ilstbox.cxx')
-rw-r--r--vcl/source/control/ilstbox.cxx126
1 files changed, 95 insertions, 31 deletions
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 296e923671ca..40bba26acc1c 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -47,35 +47,6 @@
using namespace ::com::sun::star;
-void ImplInitFieldSettings( vcl::Window* pWin, bool bFont, bool bForeground, bool bBackground )
-{
- const StyleSettings& rStyleSettings = pWin->GetSettings().GetStyleSettings();
-
- if ( bFont )
- {
- vcl::Font aFont = rStyleSettings.GetFieldFont();
- if ( pWin->IsControlFont() )
- aFont.Merge( pWin->GetControlFont() );
- pWin->SetZoomedPointFont( aFont );
- }
-
- if ( bFont || bForeground )
- {
- Color aTextColor = rStyleSettings.GetFieldTextColor();
- if ( pWin->IsControlForeground() )
- aTextColor = pWin->GetControlForeground();
- pWin->SetTextColor( aTextColor );
- }
-
- if ( bBackground )
- {
- if( pWin->IsControlBackground() )
- pWin->SetBackground( pWin->GetControlBackground() );
- else
- pWin->SetBackground( rStyleSettings.GetFieldColor() );
- }
-}
-
void ImplInitDropDownButton( PushButton* pButton )
{
if ( pButton->GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_SPINUPDOWN )
@@ -546,9 +517,53 @@ void ImplListBoxWindow::dispose()
Control::dispose();
}
-void ImplListBoxWindow::ImplInitSettings( bool bFont, bool bForeground, bool bBackground )
+void ImplListBoxWindow::ApplySettings(vcl::RenderContext& rRenderContext)
{
- ImplInitFieldSettings( this, bFont, bForeground, bBackground );
+ const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
+
+ vcl::Font aFont = rStyleSettings.GetFieldFont();
+ if (IsControlFont())
+ aFont.Merge(GetControlFont());
+ SetZoomedPointFont(rRenderContext, aFont);
+
+ Color aTextColor = rStyleSettings.GetFieldTextColor();
+ if (IsControlForeground())
+ aTextColor = GetControlForeground();
+ rRenderContext.SetTextColor(aTextColor);
+
+ if (IsControlBackground())
+ rRenderContext.SetBackground(GetControlBackground());
+ else
+ rRenderContext.SetBackground(rStyleSettings.GetFieldColor());
+}
+
+void ImplListBoxWindow::ImplInitSettings(bool bFont, bool bForeground, bool bBackground)
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if (bFont)
+ {
+ vcl::Font aFont = rStyleSettings.GetFieldFont();
+ if (IsControlFont())
+ aFont.Merge(GetControlFont());
+ SetZoomedPointFont(*this, aFont);
+ }
+
+ if (bFont || bForeground)
+ {
+ Color aTextColor = rStyleSettings.GetFieldTextColor();
+ if (IsControlForeground())
+ aTextColor = GetControlForeground();
+ SetTextColor( aTextColor );
+ }
+
+ if (bBackground)
+ {
+ if (IsControlBackground())
+ SetBackground(GetControlBackground());
+ else
+ SetBackground(rStyleSettings.GetFieldColor());
+ }
}
void ImplListBoxWindow::ImplCalcMetrics()
@@ -2770,6 +2785,55 @@ void ImplWin::ImplDraw( bool bLayout )
}
}
+void ImplWin::ApplySettings(vcl::RenderContext& rRenderContext)
+{
+ const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
+
+ vcl::Font aFont = rStyleSettings.GetFieldFont();
+ if (IsControlFont())
+ aFont.Merge(GetControlFont());
+ SetZoomedPointFont(rRenderContext, aFont);
+
+ Color aTextColor = rStyleSettings.GetFieldTextColor();
+ if (IsControlForeground())
+ aTextColor = GetControlForeground();
+ rRenderContext.SetTextColor(aTextColor);
+
+ if (IsControlBackground())
+ rRenderContext.SetBackground(GetControlBackground());
+ else
+ rRenderContext.SetBackground(rStyleSettings.GetFieldColor());
+}
+
+void ImplWin::ImplInitSettings(bool bFont, bool bForeground, bool bBackground)
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if (bFont)
+ {
+ vcl::Font aFont = rStyleSettings.GetFieldFont();
+ if (IsControlFont())
+ aFont.Merge(GetControlFont());
+ SetZoomedPointFont(*this, aFont);
+ }
+
+ if (bFont || bForeground)
+ {
+ Color aTextColor = rStyleSettings.GetFieldTextColor();
+ if (IsControlForeground())
+ aTextColor = GetControlForeground();
+ SetTextColor( aTextColor );
+ }
+
+ if (bBackground)
+ {
+ if (IsControlBackground())
+ SetBackground(GetControlBackground());
+ else
+ SetBackground(rStyleSettings.GetFieldColor());
+ }
+}
+
void ImplWin::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& )
{
ImplDraw();