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

add DrawHandle to DecorationView

Change-Id: Ie063071cc57d756fd5da20a15533a6857940f676
üst 19dc7225
...@@ -73,8 +73,7 @@ private: ...@@ -73,8 +73,7 @@ private:
OutputDevice* mpOutDev; OutputDevice* mpOutDev;
public: public:
DecorationView( OutputDevice* pOutDev ) DecorationView(OutputDevice* pOutDev);
{ mpOutDev = pOutDev; }
void DrawSymbol( const Rectangle& rRect, SymbolType eType, void DrawSymbol( const Rectangle& rRect, SymbolType eType,
const Color& rColor, sal_uInt16 nStyle = 0 ); const Color& rColor, sal_uInt16 nStyle = 0 );
...@@ -86,6 +85,7 @@ public: ...@@ -86,6 +85,7 @@ public:
Rectangle DrawFrame( const Rectangle& rRect, sal_uInt16 nStyle = FRAME_DRAW_OUT ); Rectangle DrawFrame( const Rectangle& rRect, sal_uInt16 nStyle = FRAME_DRAW_OUT );
Rectangle DrawButton( const Rectangle& rRect, sal_uInt16 nStyle ); Rectangle DrawButton( const Rectangle& rRect, sal_uInt16 nStyle );
void DrawSeparator( const Point& rStart, const Point& rStop, bool bVertical = true ); void DrawSeparator( const Point& rStart, const Point& rStop, bool bVertical = true );
void DrawHandle(const Rectangle& rRectangle, bool bVertical = true);
}; };
#endif // INCLUDED_VCL_DECOVIEW_HXX #endif // INCLUDED_VCL_DECOVIEW_HXX
......
...@@ -822,7 +822,11 @@ void ImplDrawFrame( OutputDevice *const pDev, Rectangle& rRect, ...@@ -822,7 +822,11 @@ void ImplDrawFrame( OutputDevice *const pDev, Rectangle& rRect,
} }
} }
} } // end anonymous namespace
DecorationView::DecorationView(OutputDevice* pOutDev) :
mpOutDev(pOutDev)
{}
void DecorationView::DrawSymbol( const Rectangle& rRect, SymbolType eType, void DecorationView::DrawSymbol( const Rectangle& rRect, SymbolType eType,
const Color& rColor, sal_uInt16 nStyle ) const Color& rColor, sal_uInt16 nStyle )
...@@ -1081,4 +1085,45 @@ void DecorationView::DrawSeparator( const Point& rStart, const Point& rStop, boo ...@@ -1081,4 +1085,45 @@ void DecorationView::DrawSeparator( const Point& rStart, const Point& rStop, boo
mpOutDev->Pop(); mpOutDev->Pop();
} }
void DecorationView::DrawHandle(const Rectangle& rRect, bool bVertical)
{
const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings();
Size aOutputSize = rRect.GetSize();
mpOutDev->SetLineColor(rStyleSettings.GetDarkShadowColor());
mpOutDev->SetFillColor(rStyleSettings.GetDarkShadowColor());
sal_Int32 nNumberOfPoints = 3;
long nHalfWidth = aOutputSize.Width() / 2.0f;
long nHalfHeight = aOutputSize.Height() / 2.0f;
float fDistance = bVertical ? aOutputSize.Height() : aOutputSize.Width();
fDistance /= (nNumberOfPoints + 1);
long nRadius = bVertical ? aOutputSize.Width() : aOutputSize.Height();
nRadius /= (nNumberOfPoints + 2);
for (long i = 1; i <= nNumberOfPoints; i++)
{
Rectangle aLocation;
if (bVertical)
{
aLocation = Rectangle(nHalfWidth - nRadius,
std::round(fDistance * i) - nRadius,
nHalfWidth + nRadius,
std::round(fDistance * i) + nRadius);
}
else
{
aLocation = Rectangle(std::round(fDistance * i) - nRadius,
nHalfHeight - nRadius,
std::round(fDistance * i) + nRadius,
nHalfHeight + nRadius);
}
mpOutDev->DrawEllipse(aLocation);
}
}
/* 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