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