diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-22 17:51:44 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-23 18:55:39 +0900 |
commit | 4f5fe008a3d5f0b5ddfa656299306cff9d57d802 (patch) | |
tree | 9bca9fd7b61d5698b200400e90efa7504bfcab84 /vcl/source/control/fixed.cxx | |
parent | c110c506c3c9c9f50b55acd5c6927e2865888d44 (diff) |
use ApplySettings instead of ImplInitSettings is called
Change-Id: I30cbfe1906d5d59db93a354ca1d1862c4b5e631a
Diffstat (limited to 'vcl/source/control/fixed.cxx')
-rw-r--r-- | vcl/source/control/fixed.cxx | 249 |
1 files changed, 123 insertions, 126 deletions
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 4588596286ed..55b8b0c6a6a8 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -84,7 +84,7 @@ void FixedText::ImplInit( vcl::Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, NULL ); - ImplInitSettings( true, true, true ); + ApplySettings(*this); } WinBits FixedText::ImplInitStyle( WinBits nStyle ) @@ -104,35 +104,6 @@ const Color& FixedText::GetCanonicalTextColor( const StyleSettings& _rStyle ) co return ( GetStyle() & WB_INFO ) ? _rStyle.GetInfoTextColor() : _rStyle.GetLabelTextColor(); } -void FixedText::ImplInitSettings( bool bFont, - bool bForeground, bool bBackground ) -{ - Control::ImplInitSettings( bFont, bForeground ); - - if ( bBackground ) - { - vcl::Window* pParent = GetParent(); - if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) - { - EnableChildTransparentMode( true ); - SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( true ); - SetBackground(); - } - else - { - EnableChildTransparentMode( false ); - SetParentClipMode( 0 ); - SetPaintTransparent( false ); - - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( pParent->GetBackground() ); - } - } -} - FixedText::FixedText( vcl::Window* pParent, WinBits nStyle ) : Control(WINDOW_FIXEDTEXT) , m_nMaxWidthChars(-1) @@ -232,6 +203,31 @@ void FixedText::ImplDraw(OutputDevice* pDev, sal_uLong nDrawFlags, bFillLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL); } +void FixedText::ApplySettings(vcl::RenderContext& rRenderContext) +{ + Control::ApplySettings(rRenderContext); + + vcl::Window* pParent = GetParent(); + if (pParent->IsChildTransparentModeEnabled() && !IsControlBackground()) + { + EnableChildTransparentMode(true); + SetParentClipMode(PARENTCLIPMODE_NOCLIP); + SetPaintTransparent(true); + rRenderContext.SetBackground(); + } + else + { + EnableChildTransparentMode(false); + SetParentClipMode(0); + SetPaintTransparent(false); + + if (IsControlBackground()) + rRenderContext.SetBackground(GetControlBackground()); + else + rRenderContext.SetBackground(pParent->GetBackground()); + } +} + void FixedText::Paint( vcl::RenderContext& rRenderContext, const Rectangle& ) { ImplDraw(&rRenderContext, 0, Point(), GetOutputSizePixel()); @@ -240,7 +236,7 @@ void FixedText::Paint( vcl::RenderContext& rRenderContext, const Rectangle& ) void FixedText::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) { - ImplInitSettings( true, true, true ); + ApplySettings(*pDev); Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -298,24 +294,24 @@ void FixedText::StateChanged( StateChangedType nType ) if ( (GetPrevStyle() & FIXEDTEXT_VIEW_STYLE) != (GetStyle() & FIXEDTEXT_VIEW_STYLE) ) { - ImplInitSettings( true, false, false ); + ApplySettings(*this); Invalidate(); } } else if ( (nType == StateChangedType::Zoom) || (nType == StateChangedType::ControlFont) ) { - ImplInitSettings( true, false, false ); + ApplySettings(*this); Invalidate(); } else if ( nType == StateChangedType::ControlForeground ) { - ImplInitSettings( false, true, false ); + ApplySettings(*this); Invalidate(); } else if ( nType == StateChangedType::ControlBackground ) { - ImplInitSettings( false, false, true ); + ApplySettings(*this); Invalidate(); } } @@ -329,7 +325,7 @@ void FixedText::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { - ImplInitSettings( true, true, true ); + ApplySettings(*this); Invalidate(); } } @@ -390,7 +386,7 @@ Size FixedText::GetOptimalSize() const void FixedText::FillLayoutData() const { mpControlData->mpLayoutData = new vcl::ControlLayoutData(); - ImplDraw( const_cast<FixedText*>(this), 0, Point(), GetOutputSizePixel(), true ); + const_cast<FixedText*>(this)->Invalidate(); } void FixedText::setMaxWidthChars(sal_Int32 nWidth) @@ -476,9 +472,13 @@ SelectableFixedText::SelectableFixedText(vcl::Window* pParent, WinBits nStyle) // read-only SetReadOnly(); // make it transparent + SetPaintTransparent(true); SetControlBackground(); - SetBackground(); - SetPaintTransparent( true ); +} + +void SelectableFixedText::ApplySettings(vcl::RenderContext& rRenderContext) +{ + rRenderContext.SetBackground(); } void SelectableFixedText::LoseFocus() @@ -492,7 +492,7 @@ void FixedLine::ImplInit( vcl::Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, NULL ); - ImplInitSettings( true, true, true ); + ApplySettings(*this); } WinBits FixedLine::ImplInitStyle( WinBits nStyle ) @@ -512,35 +512,6 @@ const Color& FixedLine::GetCanonicalTextColor( const StyleSettings& _rStyle ) co return _rStyle.GetGroupTextColor(); } -void FixedLine::ImplInitSettings( bool bFont, - bool bForeground, bool bBackground ) -{ - Control::ImplInitSettings( bFont, bForeground ); - - if ( bBackground ) - { - vcl::Window* pParent = GetParent(); - if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) - { - EnableChildTransparentMode( true ); - SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( true ); - SetBackground(); - } - else - { - EnableChildTransparentMode( false ); - SetParentClipMode( 0 ); - SetPaintTransparent( false ); - - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( pParent->GetBackground() ); - } - } -} - void FixedLine::ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout) { Size aOutSize = rRenderContext.GetOutputSizePixel(); @@ -633,12 +604,37 @@ FixedLine::FixedLine( vcl::Window* pParent, const ResId& rResId ) : Show(); } -void FixedLine::FillLayoutData() const +void FixedLine::FillLayoutData() const { mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<FixedLine*>(this)->Invalidate(); } +void FixedLine::ApplySettings(vcl::RenderContext& rRenderContext) +{ + Control::ApplySettings(rRenderContext); + + vcl::Window* pParent = GetParent(); + if (pParent->IsChildTransparentModeEnabled() && !IsControlBackground()) + { + EnableChildTransparentMode(true); + SetParentClipMode(PARENTCLIPMODE_NOCLIP); + SetPaintTransparent(true); + rRenderContext.SetBackground(); + } + else + { + EnableChildTransparentMode(false); + SetParentClipMode(0); + SetPaintTransparent(false); + + if (IsControlBackground()) + rRenderContext.SetBackground(GetControlBackground()); + else + rRenderContext.SetBackground(pParent->GetBackground()); + } +} + void FixedLine::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) { ImplDraw(rRenderContext); @@ -676,17 +672,17 @@ void FixedLine::StateChanged( StateChangedType nType ) (nType == StateChangedType::Style) || (nType == StateChangedType::ControlFont) ) { - ImplInitSettings( true, false, false ); + ApplySettings(*this); Invalidate(); } else if ( nType == StateChangedType::ControlForeground ) { - ImplInitSettings( false, true, false ); + ApplySettings(*this); Invalidate(); } else if ( nType == StateChangedType::ControlBackground ) { - ImplInitSettings( false, false, true ); + ApplySettings(*this); Invalidate(); } } @@ -700,7 +696,7 @@ void FixedLine::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { - ImplInitSettings( true, true, true ); + ApplySettings(*this); Invalidate(); } } @@ -714,7 +710,7 @@ void FixedBitmap::ImplInit( vcl::Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, NULL ); - ImplInitSettings(); + ApplySettings(*this); } WinBits FixedBitmap::ImplInitStyle( WinBits nStyle ) @@ -724,29 +720,6 @@ WinBits FixedBitmap::ImplInitStyle( WinBits nStyle ) return nStyle; } -void FixedBitmap::ImplInitSettings() -{ - vcl::Window* pParent = GetParent(); - if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) - { - EnableChildTransparentMode( true ); - SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( true ); - SetBackground(); - } - else - { - EnableChildTransparentMode( false ); - SetParentClipMode( 0 ); - SetPaintTransparent( false ); - - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( pParent->GetBackground() ); - } -} - FixedBitmap::FixedBitmap( vcl::Window* pParent, WinBits nStyle ) : Control( WINDOW_FIXEDBITMAP ) { @@ -771,6 +744,29 @@ void FixedBitmap::ImplDraw( OutputDevice* pDev, sal_uLong /* nDrawFlags */, } } +void FixedBitmap::ApplySettings(vcl::RenderContext& rRenderContext) +{ + vcl::Window* pParent = GetParent(); + if (pParent->IsChildTransparentModeEnabled() && !IsControlBackground()) + { + EnableChildTransparentMode(true); + SetParentClipMode(PARENTCLIPMODE_NOCLIP); + SetPaintTransparent(true); + rRenderContext.SetBackground(); + } + else + { + EnableChildTransparentMode(false); + SetParentClipMode(0); + SetPaintTransparent(false); + + if (IsControlBackground()) + rRenderContext.SetBackground(GetControlBackground()); + else + rRenderContext.SetBackground(pParent->GetBackground()); + } +} + void FixedBitmap::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) { ImplDraw(&rRenderContext, 0, Point(), GetOutputSizePixel()); @@ -823,7 +819,7 @@ void FixedBitmap::StateChanged( StateChangedType nType ) } else if ( nType == StateChangedType::ControlBackground ) { - ImplInitSettings(); + ApplySettings(*this); Invalidate(); } } @@ -835,7 +831,7 @@ void FixedBitmap::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { - ImplInitSettings(); + ApplySettings(*this); Invalidate(); } } @@ -852,7 +848,7 @@ void FixedImage::ImplInit( vcl::Window* pParent, WinBits nStyle ) nStyle = ImplInitStyle( nStyle ); mbInUserDraw = false; Control::ImplInit( pParent, nStyle, NULL ); - ImplInitSettings(); + ApplySettings(*this); } WinBits FixedImage::ImplInitStyle( WinBits nStyle ) @@ -862,29 +858,6 @@ WinBits FixedImage::ImplInitStyle( WinBits nStyle ) return nStyle; } -void FixedImage::ImplInitSettings() -{ - vcl::Window* pParent = GetParent(); - if ( pParent && pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) - { - EnableChildTransparentMode( true ); - SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( true ); - SetBackground(); - } - else - { - EnableChildTransparentMode( false ); - SetParentClipMode( 0 ); - SetPaintTransparent( false ); - - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else if ( pParent ) - SetBackground( pParent->GetBackground() ); - } -} - void FixedImage::ImplLoadRes( const ResId& rResId ) { Control::ImplLoadRes( rResId ); @@ -941,6 +914,30 @@ void FixedImage::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, } } +void FixedImage::ApplySettings(vcl::RenderContext& rRenderContext) +{ + vcl::Window* pParent = GetParent(); + if (pParent && pParent->IsChildTransparentModeEnabled() && !IsControlBackground()) + { + EnableChildTransparentMode(true); + SetParentClipMode(PARENTCLIPMODE_NOCLIP); + SetPaintTransparent(true); + rRenderContext.SetBackground(); + } + else + { + EnableChildTransparentMode(false); + SetParentClipMode(0); + SetPaintTransparent(false); + + if (IsControlBackground()) + rRenderContext.SetBackground(GetControlBackground()); + else if (pParent) + rRenderContext.SetBackground(pParent->GetBackground()); + } +} + + void FixedImage::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) { ImplDraw(&rRenderContext, 0, Point(), GetOutputSizePixel()); @@ -998,7 +995,7 @@ void FixedImage::StateChanged( StateChangedType nType ) } else if ( nType == StateChangedType::ControlBackground ) { - ImplInitSettings(); + ApplySettings(*this); Invalidate(); } } @@ -1010,7 +1007,7 @@ void FixedImage::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { - ImplInitSettings(); + ApplySettings(*this); Invalidate(); } } |