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

refactor ToolPanelDrawer to use RenderContext

Change-Id: Iee3d2801a257f26673cae5abf5614ed4382b5e6b
üst 373edbd7
...@@ -56,10 +56,10 @@ namespace svt ...@@ -56,10 +56,10 @@ namespace svt
} }
void DrawerVisualization::Paint( vcl::RenderContext& rRenderContext, const Rectangle& i_rBoundingBox ) void DrawerVisualization::Paint(vcl::RenderContext& rRenderContext, const Rectangle& i_rBoundingBox)
{ {
Window::Paint(rRenderContext, i_rBoundingBox); Window::Paint(rRenderContext, i_rBoundingBox);
m_rDrawer.Paint(); m_rDrawer.Paint(rRenderContext);
} }
...@@ -105,29 +105,25 @@ namespace svt ...@@ -105,29 +105,25 @@ namespace svt
} }
void ToolPanelDrawer::Paint() void ToolPanelDrawer::Paint(vcl::RenderContext& rRenderContext)
{ {
m_pPaintDevice->SetMapMode( GetMapMode() ); m_pPaintDevice->SetMapMode(rRenderContext.GetMapMode());
m_pPaintDevice->SetOutputSize( GetOutputSizePixel() ); m_pPaintDevice->SetOutputSize(rRenderContext.GetOutputSizePixel());
m_pPaintDevice->SetSettings( GetSettings() ); m_pPaintDevice->SetSettings(rRenderContext.GetSettings());
m_pPaintDevice->SetDrawMode( GetDrawMode() ); m_pPaintDevice->SetDrawMode(rRenderContext.GetDrawMode());
const Rectangle aTextBox( impl_calcTextBoundingBox() ); const Rectangle aTextBox(impl_calcTextBoundingBox());
impl_paintBackground( impl_calcTitleBarBox( aTextBox ) ); impl_paintBackground(impl_calcTitleBarBox(aTextBox));
Rectangle aFocusBox( impl_paintExpansionIndicator( aTextBox ) ); Rectangle aFocusBox(impl_paintExpansionIndicator(aTextBox));
m_pPaintDevice->DrawText( aTextBox, GetText(), impl_getTextStyle() ); m_pPaintDevice->DrawText(aTextBox, GetText(), impl_getTextStyle());
aFocusBox.Union( aTextBox ); aFocusBox.Union(aTextBox);
aFocusBox.Left() += 2; aFocusBox.Left() += 2;
impl_paintFocusIndicator( aFocusBox ); impl_paintFocusIndicator(aFocusBox);
m_aVisualization->DrawOutDev( rRenderContext.DrawOutDev(Point(), GetOutputSizePixel(), Point(), GetOutputSizePixel(), *m_pPaintDevice);
Point(), GetOutputSizePixel(),
Point(), GetOutputSizePixel(),
*m_pPaintDevice
);
} }
......
...@@ -24,15 +24,10 @@ ...@@ -24,15 +24,10 @@
#include <vcl/virdev.hxx> #include <vcl/virdev.hxx>
#include <vcl/vclptr.hxx> #include <vcl/vclptr.hxx>
namespace svt namespace svt
{ {
class ToolPanelDrawer; class ToolPanelDrawer;
//= DrawerVisualization
/** serves a single purpose - let ZoomText read the drawers ... /** serves a single purpose - let ZoomText read the drawers ...
Strange enough, ZoomText does not read the drawers when they get the focus (in none of the combinations Strange enough, ZoomText does not read the drawers when they get the focus (in none of the combinations
...@@ -45,32 +40,31 @@ namespace svt ...@@ -45,32 +40,31 @@ namespace svt
class DrawerVisualization : public vcl::Window class DrawerVisualization : public vcl::Window
{ {
public: public:
DrawerVisualization( ToolPanelDrawer& i_rParent ); DrawerVisualization(ToolPanelDrawer& i_rParent);
protected: protected:
// Window overridables // Window overridables
virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& i_rBoundingBox ) SAL_OVERRIDE; virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& i_rBoundingBox) SAL_OVERRIDE;
private: private:
ToolPanelDrawer& m_rDrawer; ToolPanelDrawer& m_rDrawer;
}; };
//= ToolPanelDrawer
class ToolPanelDrawer : public vcl::Window class ToolPanelDrawer : public vcl::Window
{ {
public: public:
ToolPanelDrawer( vcl::Window& i_rParent, const OUString& i_rTitle ); ToolPanelDrawer(vcl::Window& i_rParent, const OUString& i_rTitle);
virtual ~ToolPanelDrawer(); virtual ~ToolPanelDrawer();
virtual void dispose() SAL_OVERRIDE; virtual void dispose() SAL_OVERRIDE;
long GetPreferredHeightPixel() const; long GetPreferredHeightPixel() const;
void SetExpanded( const bool i_bExpanded ); void SetExpanded(const bool i_bExpanded);
bool IsExpanded() const { return m_bExpanded; } bool IsExpanded() const
{
return m_bExpanded;
}
void Paint(); void Paint(vcl::RenderContext& rRenderContext);
protected: protected:
// Window overridables // Window overridables
...@@ -97,16 +91,13 @@ namespace svt ...@@ -97,16 +91,13 @@ namespace svt
using Window::Paint; using Window::Paint;
private: private:
ScopedVclPtr< VirtualDevice > m_pPaintDevice; ScopedVclPtr<VirtualDevice> m_pPaintDevice;
VclPtr<DrawerVisualization> m_aVisualization; VclPtr<DrawerVisualization> m_aVisualization;
bool m_bFocused; bool m_bFocused : 1;
bool m_bExpanded; bool m_bExpanded : 1;
}; };
} // namespace svt } // namespace svt
#endif // INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELDRAWER_HXX #endif // INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELDRAWER_HXX
/* 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