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

refactor svtools - BrowseBox to use RenderContext

Change-Id: I2532b772d1bfff268a8f60a4d59dad5c8960352a
üst bebe347c
...@@ -612,13 +612,13 @@ void BrowseBox::Resize() ...@@ -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 // initializations
if ( !bBootstrapped && IsReallyVisible() ) if (!bBootstrapped && IsReallyVisible())
BrowseBox::StateChanged( StateChangedType::InitShow ); BrowseBox::StateChanged(StateChangedType::InitShow);
if ( pCols->empty() ) if (pCols->empty())
return; return;
BrowserColumn *pFirstCol = (*pCols)[ 0 ]; BrowserColumn *pFirstCol = (*pCols)[ 0 ];
...@@ -626,43 +626,41 @@ void BrowseBox::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& ...@@ -626,43 +626,41 @@ void BrowseBox::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle&
bool bHeaderBar = getDataWindow()->pHeaderBar.get() != NULL; bool bHeaderBar = getDataWindow()->pHeaderBar.get() != NULL;
// draw delimitational lines // draw delimitational lines
if ( !getDataWindow()->bNoHScroll ) if (!getDataWindow()->bNoHScroll)
DrawLine( Point( 0, aHScroll->GetPosPixel().Y() ), rRenderContext.DrawLine(Point(0, aHScroll->GetPosPixel().Y()),
Point( GetOutputSizePixel().Width(), Point(GetOutputSizePixel().Width(),
aHScroll->GetPosPixel().Y() ) ); aHScroll->GetPosPixel().Y()));
if ( nTitleLines ) if (nTitleLines)
{ {
if ( !bHeaderBar ) if (!bHeaderBar)
DrawLine( Point( 0, GetTitleHeight() - 1 ), rRenderContext.DrawLine(Point(0, GetTitleHeight() - 1),
Point( GetOutputSizePixel().Width(), Point(rRenderContext.GetOutputSizePixel().Width(),
GetTitleHeight() - 1 ) ); GetTitleHeight() - 1));
else if ( bHandleCol ) else if (bHandleCol)
DrawLine( Point( 0, GetTitleHeight() - 1 ), rRenderContext.DrawLine(Point(0, GetTitleHeight() - 1),
Point( pFirstCol->Width(), GetTitleHeight() - 1 ) ); Point(pFirstCol->Width(), GetTitleHeight() - 1));
} }
// Title Bar // Title Bar
// If there is a handle column and if the header bar is available, only // If there is a handle column and if the header bar is available, only
// take the HandleColumn into account // take the HandleColumn into account
if ( nTitleLines && (!bHeaderBar || bHandleCol) ) if (nTitleLines && (!bHeaderBar || bHandleCol))
{ {
// iterate through columns to redraw // iterate through columns to redraw
long nX = 0; long nX = 0;
size_t nCol; size_t nCol;
for ( nCol = 0; for (nCol = 0; nCol < pCols->size() && nX < rRect.Right(); ++nCol)
nCol < pCols->size() && nX < rRect.Right();
++nCol )
{ {
// skip invisible columns between frozen and scrollable area // skip invisible columns between frozen and scrollable area
if ( nCol < nFirstCol && !(*pCols)[ nCol ]->IsFrozen() ) if (nCol < nFirstCol && !(*pCols)[nCol]->IsFrozen())
nCol = nFirstCol; nCol = nFirstCol;
// only the handle column? // only the handle column?
if (bHeaderBar && bHandleCol && nCol > 0) if (bHeaderBar && bHandleCol && nCol > 0)
break; break;
BrowserColumn *pCol = (*pCols)[ nCol ]; BrowserColumn* pCol = (*pCols)[nCol];
// draw the column and increment position // draw the column and increment position
if ( pCol->Width() > 4 ) if ( pCol->Width() > 4 )
...@@ -670,16 +668,16 @@ void BrowseBox::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& ...@@ -670,16 +668,16 @@ void BrowseBox::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle&
ButtonFrame aButtonFrame( Point( nX, 0 ), ButtonFrame aButtonFrame( Point( nX, 0 ),
Size( pCol->Width()-1, GetTitleHeight()-1 ), Size( pCol->Width()-1, GetTitleHeight()-1 ),
pCol->Title(), false, false, !IsEnabled()); pCol->Title(), false, false, !IsEnabled());
aButtonFrame.Draw( *this ); aButtonFrame.Draw(rRenderContext);
DrawLine( Point( nX + pCol->Width() - 1, 0 ), rRenderContext.DrawLine(Point(nX + pCol->Width() - 1, 0),
Point( nX + pCol->Width() - 1, GetTitleHeight()-1 ) ); Point(nX + pCol->Width() - 1, GetTitleHeight() - 1));
} }
else else
{ {
Color aOldFillColor = GetFillColor(); rRenderContext.Push(PushFlags::FILLCOLOR);
SetFillColor( Color( COL_BLACK ) ); rRenderContext.SetFillColor(Color(COL_BLACK));
DrawRect( Rectangle( Point( nX, 0 ), Size( pCol->Width(), GetTitleHeight() - 1 ) ) ); rRenderContext.DrawRect(Rectangle(Point(nX, 0), Size(pCol->Width(), GetTitleHeight() - 1)));
SetFillColor( aOldFillColor ); rRenderContext.Pop();
} }
// skip column // skip column
...@@ -689,17 +687,14 @@ void BrowseBox::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& ...@@ -689,17 +687,14 @@ void BrowseBox::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle&
// retouching // retouching
if ( !bHeaderBar && nCol == pCols->size() ) if ( !bHeaderBar && nCol == pCols->size() )
{ {
const StyleSettings &rSettings = GetSettings().GetStyleSettings(); const StyleSettings &rSettings = rRenderContext.GetSettings().GetStyleSettings();
Color aColFace( rSettings.GetFaceColor() ); Color aColFace(rSettings.GetFaceColor());
Color aOldFillColor = GetFillColor(); rRenderContext.Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
Color aOldLineColor = GetLineColor(); rRenderContext.SetFillColor(aColFace);
SetFillColor( aColFace ); rRenderContext.SetLineColor(aColFace);
SetLineColor( aColFace ); rRenderContext.DrawRect(Rectangle(Point(nX, 0),
DrawRect( Rectangle( Point(rRect.Right(), GetTitleHeight() - 2 )));
Point( nX, 0 ), rRenderContext.Pop();
Point( rRect.Right(), GetTitleHeight() - 2 ) ) );
SetFillColor( aOldFillColor);
SetLineColor( aOldLineColor);
} }
} }
} }
......
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