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

refactor SvResizeWindow to use RenderContext

Change-Id: I3c986ff077a6183b6067c5a16a226954fa84b44c
üst 795a9b32
......@@ -106,31 +106,31 @@ void SvResizeHelper::FillMoveRectsPixel( Rectangle aRects[ 4 ] ) const
|*
|* Description
*************************************************************************/
void SvResizeHelper::Draw( OutputDevice * pDev )
void SvResizeHelper::Draw(vcl::RenderContext& rRenderContext)
{
pDev->Push();
pDev->SetMapMode( MapMode() );
rRenderContext.Push();
rRenderContext.SetMapMode( MapMode() );
Color aColBlack;
Color aFillColor( COL_LIGHTGRAY );
pDev->SetFillColor( aFillColor );
pDev->SetLineColor();
rRenderContext.SetFillColor( aFillColor );
rRenderContext.SetLineColor();
Rectangle aMoveRects[ 4 ];
Rectangle aMoveRects[ 4 ];
FillMoveRectsPixel( aMoveRects );
sal_uInt16 i;
for( i = 0; i < 4; i++ )
pDev->DrawRect( aMoveRects[ i ] );
if( bResizeable )
for (i = 0; i < 4; i++)
rRenderContext.DrawRect(aMoveRects[i]);
if (bResizeable)
{
// draw handles
pDev->SetFillColor( aColBlack );
Rectangle aRects[ 8 ];
FillHandleRectsPixel( aRects );
for( i = 0; i < 8; i++ )
pDev->DrawRect( aRects[ i ] );
rRenderContext.SetFillColor(aColBlack);
Rectangle aRects[ 8 ];
FillHandleRectsPixel(aRects);
for (i = 0; i < 8; i++)
rRenderContext.DrawRect( aRects[ i ] );
}
pDev->Pop();
rRenderContext.Pop();
}
/*************************************************************************
......@@ -612,9 +612,9 @@ void SvResizeWindow::Resize()
|*
|* Description
*************************************************************************/
void SvResizeWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle & /*rRect*/ )
void SvResizeWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle & /*rRect*/ )
{
m_aResizer.Draw( this );
m_aResizer.Draw(rRenderContext);
}
bool SvResizeWindow::PreNotify( NotifyEvent& rEvt )
......
......@@ -33,31 +33,46 @@ class SvResizeHelper
Point aSelPos;
bool bResizeable;
public:
SvResizeHelper();
SvResizeHelper();
void SetResizeable( bool b ) { bResizeable = b; }
short GetGrab() const { return nGrab; }
void SetBorderPixel( const Size & rBorderP )
{ aBorder = rBorderP; }
const Size & GetBorderPixel() const { return aBorder; }
const Rectangle & GetOuterRectPixel() const
{ return aOuter; }
void SetOuterRectPixel( const Rectangle & rRect )
{ aOuter = rRect; }
Rectangle GetInnerRectPixel() const
{
Rectangle aRect( aOuter );
aRect.Top() += aBorder.Height();
aRect.Left() += aBorder.Width();
aRect.Bottom() -= aBorder.Height();
aRect.Right() -= aBorder.Width();
return aRect;
}
void SetResizeable(bool b)
{
bResizeable = b;
}
short GetGrab() const
{
return nGrab;
}
void SetBorderPixel(const Size & rBorderP)
{
aBorder = rBorderP;
}
const Size& GetBorderPixel() const
{
return aBorder;
}
const Rectangle& GetOuterRectPixel() const
{
return aOuter;
}
void SetOuterRectPixel(const Rectangle& rRect)
{
aOuter = rRect;
}
Rectangle GetInnerRectPixel() const
{
Rectangle aRect( aOuter );
aRect.Top() += aBorder.Height();
aRect.Left() += aBorder.Width();
aRect.Bottom() -= aBorder.Height();
aRect.Right() -= aBorder.Width();
return aRect;
}
// Clockwise, start at upper left
void FillHandleRectsPixel( Rectangle aRects[ 8 ] ) const;
void FillMoveRectsPixel( Rectangle aRects[ 4 ] ) const;
void Draw( OutputDevice * );
void Draw(vcl::RenderContext& rRenderContext);
void InvalidateBorder( vcl::Window * );
bool SelectBegin( vcl::Window *, const Point & rPos );
short SelectMove( vcl::Window * pWin, const Point & rPos );
......
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