summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-08 11:55:49 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-11 10:03:28 +0900
commitf17f17c5f54a8cd7e81dbe3f10611b969db113d0 (patch)
treecd34035dd25fe6b4cfa6f32e75295ce413284775 /svtools
parentbebe347c53dcc3b86eefb29af1a1a57d982274d6 (diff)
refactor svtools - BrowseBox to use RenderContext
Change-Id: I2532b772d1bfff268a8f60a4d59dad5c8960352a
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/brwbox/brwbox2.cxx75
1 files changed, 35 insertions, 40 deletions
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
index c5c2a504202e..f4e6fc960b05 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -612,13 +612,13 @@ void BrowseBox::Resize()
-void BrowseBox::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect )
+void BrowseBox::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
{
// initializations
- if ( !bBootstrapped && IsReallyVisible() )
- BrowseBox::StateChanged( StateChangedType::InitShow );
- if ( pCols->empty() )
+ if (!bBootstrapped && IsReallyVisible())
+ BrowseBox::StateChanged(StateChangedType::InitShow);
+ if (pCols->empty())
return;
BrowserColumn *pFirstCol = (*pCols)[ 0 ];
@@ -626,43 +626,41 @@ void BrowseBox::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle&
bool bHeaderBar = getDataWindow()->pHeaderBar.get() != NULL;
// draw delimitational lines
- if ( !getDataWindow()->bNoHScroll )
- DrawLine( Point( 0, aHScroll->GetPosPixel().Y() ),
- Point( GetOutputSizePixel().Width(),
- aHScroll->GetPosPixel().Y() ) );
+ if (!getDataWindow()->bNoHScroll)
+ rRenderContext.DrawLine(Point(0, aHScroll->GetPosPixel().Y()),
+ Point(GetOutputSizePixel().Width(),
+ aHScroll->GetPosPixel().Y()));
- if ( nTitleLines )
+ if (nTitleLines)
{
- if ( !bHeaderBar )
- DrawLine( Point( 0, GetTitleHeight() - 1 ),
- Point( GetOutputSizePixel().Width(),
- GetTitleHeight() - 1 ) );
- else if ( bHandleCol )
- DrawLine( Point( 0, GetTitleHeight() - 1 ),
- Point( pFirstCol->Width(), GetTitleHeight() - 1 ) );
+ if (!bHeaderBar)
+ rRenderContext.DrawLine(Point(0, GetTitleHeight() - 1),
+ Point(rRenderContext.GetOutputSizePixel().Width(),
+ GetTitleHeight() - 1));
+ else if (bHandleCol)
+ rRenderContext.DrawLine(Point(0, GetTitleHeight() - 1),
+ Point(pFirstCol->Width(), GetTitleHeight() - 1));
}
// Title Bar
// If there is a handle column and if the header bar is available, only
// take the HandleColumn into account
- if ( nTitleLines && (!bHeaderBar || bHandleCol) )
+ if (nTitleLines && (!bHeaderBar || bHandleCol))
{
// iterate through columns to redraw
long nX = 0;
size_t nCol;
- for ( nCol = 0;
- nCol < pCols->size() && nX < rRect.Right();
- ++nCol )
+ for (nCol = 0; nCol < pCols->size() && nX < rRect.Right(); ++nCol)
{
// skip invisible columns between frozen and scrollable area
- if ( nCol < nFirstCol && !(*pCols)[ nCol ]->IsFrozen() )
+ if (nCol < nFirstCol && !(*pCols)[nCol]->IsFrozen())
nCol = nFirstCol;
// only the handle column?
if (bHeaderBar && bHandleCol && nCol > 0)
break;
- BrowserColumn *pCol = (*pCols)[ nCol ];
+ BrowserColumn* pCol = (*pCols)[nCol];
// draw the column and increment position
if ( pCol->Width() > 4 )
@@ -670,16 +668,16 @@ void BrowseBox::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle&
ButtonFrame aButtonFrame( Point( nX, 0 ),
Size( pCol->Width()-1, GetTitleHeight()-1 ),
pCol->Title(), false, false, !IsEnabled());
- aButtonFrame.Draw( *this );
- DrawLine( Point( nX + pCol->Width() - 1, 0 ),
- Point( nX + pCol->Width() - 1, GetTitleHeight()-1 ) );
+ aButtonFrame.Draw(rRenderContext);
+ rRenderContext.DrawLine(Point(nX + pCol->Width() - 1, 0),
+ Point(nX + pCol->Width() - 1, GetTitleHeight() - 1));
}
else
{
- Color aOldFillColor = GetFillColor();
- SetFillColor( Color( COL_BLACK ) );
- DrawRect( Rectangle( Point( nX, 0 ), Size( pCol->Width(), GetTitleHeight() - 1 ) ) );
- SetFillColor( aOldFillColor );
+ rRenderContext.Push(PushFlags::FILLCOLOR);
+ rRenderContext.SetFillColor(Color(COL_BLACK));
+ rRenderContext.DrawRect(Rectangle(Point(nX, 0), Size(pCol->Width(), GetTitleHeight() - 1)));
+ rRenderContext.Pop();
}
// skip column
@@ -689,17 +687,14 @@ void BrowseBox::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle&
// retouching
if ( !bHeaderBar && nCol == pCols->size() )
{
- const StyleSettings &rSettings = GetSettings().GetStyleSettings();
- Color aColFace( rSettings.GetFaceColor() );
- Color aOldFillColor = GetFillColor();
- Color aOldLineColor = GetLineColor();
- SetFillColor( aColFace );
- SetLineColor( aColFace );
- DrawRect( Rectangle(
- Point( nX, 0 ),
- Point( rRect.Right(), GetTitleHeight() - 2 ) ) );
- SetFillColor( aOldFillColor);
- SetLineColor( aOldLineColor);
+ const StyleSettings &rSettings = rRenderContext.GetSettings().GetStyleSettings();
+ Color aColFace(rSettings.GetFaceColor());
+ rRenderContext.Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
+ rRenderContext.SetFillColor(aColFace);
+ rRenderContext.SetLineColor(aColFace);
+ rRenderContext.DrawRect(Rectangle(Point(nX, 0),
+ Point(rRect.Right(), GetTitleHeight() - 2 )));
+ rRenderContext.Pop();
}
}
}