Kaydet (Commit) 85b7494e authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

refactor ScTabSplitter to use RenderContext

Change-Id: I0822bf2fc8752efa16add193b2860c6f9f9668e3
üst 763858b2
...@@ -24,11 +24,11 @@ ...@@ -24,11 +24,11 @@
#include <vcl/settings.hxx> #include <vcl/settings.hxx>
ScTabSplitter::ScTabSplitter( vcl::Window* pParent, WinBits nWinStyle, ScViewData* pData ) : ScTabSplitter::ScTabSplitter( vcl::Window* pParent, WinBits nWinStyle, ScViewData* pData ) :
Splitter( pParent, nWinStyle ), Splitter(pParent, nWinStyle),
pViewData(pData) pViewData(pData)
{ {
SetFixed(false); SetFixed(false);
EnableRTL( false ); EnableRTL(false);
} }
ScTabSplitter::~ScTabSplitter() ScTabSplitter::~ScTabSplitter()
...@@ -54,10 +54,10 @@ void ScTabSplitter::SetFixed(bool bSet) ...@@ -54,10 +54,10 @@ void ScTabSplitter::SetFixed(bool bSet)
SetPointer(POINTER_VSPLIT); SetPointer(POINTER_VSPLIT);
} }
void ScTabSplitter::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect ) void ScTabSplitter::Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect )
{ {
const Color oldFillCol = GetFillColor(); rRenderContext.Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
const Color oldLineCol = GetLineColor(); const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
if (IsHorizontal()) if (IsHorizontal())
{ {
...@@ -65,24 +65,25 @@ void ScTabSplitter::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectang ...@@ -65,24 +65,25 @@ void ScTabSplitter::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectang
{ {
case SC_SPLIT_NONE: case SC_SPLIT_NONE:
{ {
SetLineColor(GetSettings().GetStyleSettings().GetShadowColor()); rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
SetFillColor(GetSettings().GetStyleSettings().GetShadowColor()); rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom())); rRenderContext.DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
// Draw handle // Draw handle
SetLineColor(Color(COL_BLACK)); rRenderContext.SetLineColor(Color(COL_BLACK));
SetFillColor(Color(COL_BLACK)); rRenderContext.SetFillColor(Color(COL_BLACK));
const long xc = rRect.Right()+rRect.Left(); const long xc = rRect.Right() + rRect.Left();
const long h4 = rRect.GetHeight()/4; const long h4 = rRect.GetHeight() / 4;
// First xc fraction is truncated, second one is rounded. This will draw a centered line // First xc fraction is truncated, second one is rounded. This will draw a centered line
// in handlers with odd width and a centered rectangle in those with even width. // in handlers with odd width and a centered rectangle in those with even width.
DrawRect(Rectangle(Point(xc/2, rRect.Top()+h4), Point((xc+1)/2, rRect.Bottom()-h4))); rRenderContext.DrawRect(Rectangle(Point(xc / 2, rRect.Top() + h4),
Point((xc + 1) / 2, rRect.Bottom() - h4)));
break; break;
} }
case SC_SPLIT_NORMAL: case SC_SPLIT_NORMAL:
SetLineColor(GetSettings().GetStyleSettings().GetShadowColor()); rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
SetFillColor(GetSettings().GetStyleSettings().GetShadowColor()); rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom())); rRenderContext.DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
break; break;
case SC_SPLIT_FIX: case SC_SPLIT_FIX:
// Nothing to draw // Nothing to draw
...@@ -95,24 +96,25 @@ void ScTabSplitter::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectang ...@@ -95,24 +96,25 @@ void ScTabSplitter::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectang
{ {
case SC_SPLIT_NONE: case SC_SPLIT_NONE:
{ {
SetLineColor(GetSettings().GetStyleSettings().GetShadowColor()); rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
SetFillColor(GetSettings().GetStyleSettings().GetShadowColor()); rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom())); rRenderContext.DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
// Draw handle // Draw handle
SetLineColor(Color(COL_BLACK)); rRenderContext.SetLineColor(Color(COL_BLACK));
SetFillColor(Color(COL_BLACK)); rRenderContext.SetFillColor(Color(COL_BLACK));
const long yc = rRect.Top()+rRect.Bottom(); const long yc = rRect.Top() + rRect.Bottom();
const long w4 = rRect.GetWidth()/4; const long w4 = rRect.GetWidth() / 4;
// First yc fraction is truncated, second one is rounded. This will draw a centered line // First yc fraction is truncated, second one is rounded. This will draw a centered line
// in handlers with odd height and a centered rectangle in those with even height. // in handlers with odd height and a centered rectangle in those with even height.
DrawRect(Rectangle(Point(rRect.Left()+w4, yc/2), Point(rRect.Right()-w4, (yc+1)/2))); DrawRect(Rectangle(Point(rRect.Left() + w4, yc / 2),
Point(rRect.Right() - w4, (yc + 1) / 2)));
break; break;
} }
case SC_SPLIT_NORMAL: case SC_SPLIT_NORMAL:
SetLineColor(GetSettings().GetStyleSettings().GetShadowColor()); rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
SetFillColor(GetSettings().GetStyleSettings().GetShadowColor()); rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom())); rRenderContext.DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
break; break;
case SC_SPLIT_FIX: case SC_SPLIT_FIX:
// Nothing to draw // Nothing to draw
...@@ -120,8 +122,7 @@ void ScTabSplitter::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectang ...@@ -120,8 +122,7 @@ void ScTabSplitter::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectang
} }
} }
SetFillColor(oldFillCol); rRenderContext.Pop();
SetLineColor(oldLineCol);
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment