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

refactor TitledDockingWindow to use RenderContext

Change-Id: Ie30f61871b27d84c1fbb570d5ae9a8cfaa901d28
üst 35cae855
...@@ -141,25 +141,47 @@ namespace sfx2 ...@@ -141,25 +141,47 @@ namespace sfx2
} }
void TitledDockingWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& i_rArea ) void TitledDockingWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& i_rArea)
{ {
if ( m_bLayoutPending ) const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
// Setup defaults
{
// Font
vcl::Font aFont = rStyleSettings.GetAppFont();
if (IsControlFont())
aFont.Merge(GetControlFont());
SetZoomedPointFont(aFont);
// Color.
Color aColor;
if (IsControlForeground())
aColor = GetControlForeground();
else
aColor = rStyleSettings.GetButtonTextColor();
rRenderContext.SetTextColor(aColor);
rRenderContext.SetTextFillColor();
}
if (m_bLayoutPending)
impl_layout(); impl_layout();
SfxDockingWindow::Paint(rRenderContext, i_rArea); SfxDockingWindow::Paint(rRenderContext, i_rArea);
Push( PushFlags::FONT | PushFlags::FILLCOLOR | PushFlags::LINECOLOR ); rRenderContext.Push(PushFlags::FONT | PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
SetFillColor( GetSettings().GetStyleSettings().GetDialogColor() ); rRenderContext.SetFillColor(rStyleSettings.GetDialogColor());
SetLineColor(); rRenderContext.SetLineColor();
// bold font // bold font
vcl::Font aFont( GetFont() ); vcl::Font aFont(rRenderContext.GetFont());
aFont.SetWeight( WEIGHT_BOLD ); aFont.SetWeight(WEIGHT_BOLD);
SetFont( aFont ); rRenderContext.SetFont(aFont);
// Set border values. // Set border values.
Size aWindowSize( GetOutputSizePixel() ); Size aWindowSize(rRenderContext.GetOutputSizePixel());
int nOuterLeft = 0; int nOuterLeft = 0;
int nInnerLeft = nOuterLeft + m_aBorder.Left() - 1; int nInnerLeft = nOuterLeft + m_aBorder.Left() - 1;
int nOuterRight = aWindowSize.Width() - 1; int nOuterRight = aWindowSize.Width() - 1;
...@@ -169,42 +191,38 @@ namespace sfx2 ...@@ -169,42 +191,38 @@ namespace sfx2
int nInnerBottom = nOuterBottom - m_aBorder.Bottom() + 1; int nInnerBottom = nOuterBottom - m_aBorder.Bottom() + 1;
// Paint title bar background. // Paint title bar background.
Rectangle aTitleBarBox( Rectangle( Rectangle aTitleBarBox(Rectangle(nOuterLeft, 0, nOuterRight, nInnerTop - 1));
nOuterLeft, rRenderContext.DrawRect(aTitleBarBox);
0,
nOuterRight, if (nInnerLeft > nOuterLeft)
nInnerTop-1 rRenderContext.DrawRect(Rectangle(nOuterLeft, nInnerTop, nInnerLeft, nInnerBottom));
) ); if (nOuterRight > nInnerRight)
DrawRect( aTitleBarBox ); rRenderContext.DrawRect(Rectangle(nInnerRight, nInnerTop, nOuterRight, nInnerBottom));
if (nInnerBottom < nOuterBottom)
if ( nInnerLeft > nOuterLeft ) rRenderContext.DrawRect(Rectangle(nOuterLeft, nInnerBottom, nOuterRight, nOuterBottom));
DrawRect( Rectangle( nOuterLeft, nInnerTop, nInnerLeft, nInnerBottom ) );
if ( nOuterRight > nInnerRight )
DrawRect( Rectangle( nInnerRight, nInnerTop, nOuterRight, nInnerBottom ) );
if ( nInnerBottom < nOuterBottom )
DrawRect( Rectangle( nOuterLeft, nInnerBottom, nOuterRight, nOuterBottom ) );
// Paint bevel border. // Paint bevel border.
SetFillColor(); rRenderContext.SetFillColor();
SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() ); rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
if ( m_aBorder.Top() > 0 ) if (m_aBorder.Top() > 0)
DrawLine( Point( nInnerLeft, nInnerTop ), Point( nInnerLeft, nInnerBottom ) ); rRenderContext.DrawLine(Point(nInnerLeft, nInnerTop), Point(nInnerLeft, nInnerBottom));
if ( m_aBorder.Left() > 0 ) if (m_aBorder.Left() > 0)
DrawLine( Point( nInnerLeft, nInnerTop ), Point( nInnerRight, nInnerTop ) ); rRenderContext.DrawLine(Point(nInnerLeft, nInnerTop), Point(nInnerRight, nInnerTop));
SetLineColor( GetSettings().GetStyleSettings().GetLightColor() ); rRenderContext.SetLineColor(rStyleSettings.GetLightColor());
if ( m_aBorder.Bottom() > 0 ) if (m_aBorder.Bottom() > 0)
DrawLine( Point( nInnerRight, nInnerBottom ), Point( nInnerLeft, nInnerBottom ) ); rRenderContext.DrawLine(Point(nInnerRight, nInnerBottom), Point(nInnerLeft, nInnerBottom));
if ( m_aBorder.Right() > 0 ) if (m_aBorder.Right() > 0)
DrawLine( Point( nInnerRight, nInnerBottom ), Point( nInnerRight, nInnerTop ) ); rRenderContext.DrawLine(Point(nInnerRight, nInnerBottom), Point(nInnerRight, nInnerTop));
// Paint title bar text. // Paint title bar text.
SetLineColor( GetSettings().GetStyleSettings().GetActiveTextColor() ); rRenderContext.SetLineColor(rStyleSettings.GetActiveTextColor());
aTitleBarBox.Left() += 3; aTitleBarBox.Left() += 3;
DrawText( aTitleBarBox, impl_getTitle(), TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); rRenderContext.DrawText(aTitleBarBox, impl_getTitle(),
TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK);
// Restore original values of the output device. // Restore original values of the output device.
Pop(); rRenderContext.Pop();
} }
...@@ -276,7 +294,6 @@ namespace sfx2 ...@@ -276,7 +294,6 @@ namespace sfx2
SfxDockingWindow::StateChanged( i_nType ); SfxDockingWindow::StateChanged( i_nType );
} }
//------------------------------------------------------------------------------------------------------------------
void TitledDockingWindow::EndDocking( const Rectangle& i_rRect, bool i_bFloatMode ) void TitledDockingWindow::EndDocking( const Rectangle& i_rRect, bool i_bFloatMode )
{ {
SfxDockingWindow::EndDocking( i_rRect, i_bFloatMode ); SfxDockingWindow::EndDocking( i_rRect, i_bFloatMode );
...@@ -299,23 +316,6 @@ namespace sfx2 ...@@ -299,23 +316,6 @@ namespace sfx2
case DataChangedEventType::FONTS: case DataChangedEventType::FONTS:
case DataChangedEventType::FONTSUBSTITUTION: case DataChangedEventType::FONTSUBSTITUTION:
{ {
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
// Font.
vcl::Font aFont = rStyleSettings.GetAppFont();
if ( IsControlFont() )
aFont.Merge( GetControlFont() );
SetZoomedPointFont( aFont );
// Color.
Color aColor;
if ( IsControlForeground() )
aColor = GetControlForeground();
else
aColor = rStyleSettings.GetButtonTextColor();
SetTextColor( aColor );
SetTextFillColor();
impl_scheduleLayout(); impl_scheduleLayout();
Invalidate(); Invalidate();
} }
......
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