Kaydet (Commit) a6a2cc8f authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski Kaydeden (comit) Tomaž Vajngerl

Fix wizard step text styling

Moves all the SetTextColor handing into ApplySettings and just
changes the ControlBackground depending on step state.

Change-Id: I96234b6353afada7bc77e2f641a160c1cf25f48d
Reviewed-on: https://gerrit.libreoffice.org/58857
Tested-by: Jenkins
Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst 757b2438
...@@ -42,9 +42,6 @@ namespace svt ...@@ -42,9 +42,6 @@ namespace svt
virtual void GetFocus() override; virtual void GetFocus() override;
virtual void LoseFocus() override; virtual void LoseFocus() override;
void DeactivateHyperMode(vcl::Font aFont, const Color aColor);
void ActivateHyperMode(vcl::Font aFont, const Color aColor);
void implInit(); void implInit();
using FixedText::CalcMinimumSize; using FixedText::CalcMinimumSize;
...@@ -55,6 +52,7 @@ namespace svt ...@@ -55,6 +52,7 @@ namespace svt
virtual void dispose() override; virtual void dispose() override;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
void SetID( sal_Int16 ID ); void SetID( sal_Int16 ID );
sal_Int16 GetID() const; sal_Int16 GetID() const;
......
...@@ -77,56 +77,33 @@ namespace svt ...@@ -77,56 +77,33 @@ namespace svt
void HyperLabel::ToggleBackgroundColor( const Color& _rGBColor ) void HyperLabel::ToggleBackgroundColor( const Color& _rGBColor )
{ {
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
SetControlBackground( _rGBColor ); SetControlBackground( _rGBColor );
if (_rGBColor == COL_TRANSPARENT)
SetTextColor( rStyleSettings.GetFieldTextColor( ) );
else
SetTextColor( rStyleSettings.GetHighlightTextColor( ) );
} }
void HyperLabel::MouseMove( const MouseEvent& rMEvt ) void HyperLabel::MouseMove( const MouseEvent& rMEvt )
{ {
vcl::Font aFont = GetControlFont( ); vcl::Font aFont = GetControlFont( );
const Color aColor = GetTextColor();
if (rMEvt.IsLeaveWindow()) bool bHyperMode = false;
{ if (!rMEvt.IsLeaveWindow() && IsEnabled() && m_pImpl->bInteractive)
DeactivateHyperMode(aFont, aColor);
}
else
{ {
Point aPoint = GetPointerPosPixel(); Point aPoint = GetPointerPosPixel();
if (aPoint.X() < m_pImpl->m_aMinSize.Width()) if (aPoint.X() < m_pImpl->m_aMinSize.Width())
{ bHyperMode = true;
if ( IsEnabled() && (m_pImpl->bInteractive) )
{
ActivateHyperMode( aFont, aColor);
return;
}
}
DeactivateHyperMode(aFont, aColor);
} }
}
void HyperLabel::ActivateHyperMode(vcl::Font aFont, const Color aColor) m_pImpl->m_bHyperMode = bHyperMode;
{ if (bHyperMode)
aFont.SetUnderline(LINESTYLE_SINGLE); {
m_pImpl->m_bHyperMode = true; aFont.SetUnderline(LINESTYLE_SINGLE);
SetPointer( PointerStyle::RefHand ); SetPointer(PointerStyle::RefHand);
SetControlFont( aFont); }
SetTextColor( aColor); else
{
} aFont.SetUnderline(LINESTYLE_NONE);
SetPointer(PointerStyle::Arrow);
void HyperLabel::DeactivateHyperMode(vcl::Font aFont, const Color aColor) }
{ SetControlFont(aFont);
m_pImpl->m_bHyperMode = false;
aFont.SetUnderline(LINESTYLE_NONE);
SetPointer( PointerStyle::Arrow );
SetControlFont( aFont);
SetTextColor( aColor);
} }
void HyperLabel::MouseButtonDown( const MouseEvent& ) void HyperLabel::MouseButtonDown( const MouseEvent& )
...@@ -193,28 +170,32 @@ namespace svt ...@@ -193,28 +170,32 @@ namespace svt
SetText(_rText); SetText(_rText);
} }
void HyperLabel::ApplySettings(vcl::RenderContext& rRenderContext)
{
FixedText::ApplySettings(rRenderContext);
const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
if (GetControlBackground() == COL_TRANSPARENT)
rRenderContext.SetTextColor(rStyleSettings.GetFieldTextColor());
else
rRenderContext.SetTextColor(rStyleSettings.GetHighlightTextColor());
}
void HyperLabel::DataChanged( const DataChangedEvent& rDCEvt ) void HyperLabel::DataChanged( const DataChangedEvent& rDCEvt )
{ {
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
FixedText::DataChanged( rDCEvt ); FixedText::DataChanged( rDCEvt );
if ((( rDCEvt.GetType() == DataChangedEventType::SETTINGS ) || if ((( rDCEvt.GetType() == DataChangedEventType::SETTINGS ) ||
( rDCEvt.GetType() == DataChangedEventType::DISPLAY )) && ( rDCEvt.GetType() == DataChangedEventType::DISPLAY )) &&
( rDCEvt.GetFlags() & AllSettingsFlags::STYLE )) ( rDCEvt.GetFlags() & AllSettingsFlags::STYLE ))
{ {
const Color& rGBColor = GetControlBackground(); const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
if (rGBColor == COL_TRANSPARENT) if (GetControlBackground() != COL_TRANSPARENT)
SetTextColor( rStyleSettings.GetFieldTextColor( ) );
else
{
SetControlBackground(rStyleSettings.GetHighlightColor()); SetControlBackground(rStyleSettings.GetHighlightColor());
SetTextColor( rStyleSettings.GetHighlightTextColor( ) );
}
Invalidate(); Invalidate();
} }
} }
} // namespace svt } // namespace svt
......
...@@ -41,7 +41,8 @@ class IDLabel : public FixedText ...@@ -41,7 +41,8 @@ class IDLabel : public FixedText
{ {
public: public:
IDLabel( vcl::Window* _pParent, WinBits _nWinStyle ); IDLabel( vcl::Window* _pParent, WinBits _nWinStyle );
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
}; };
class RoadmapItem : public RoadmapTypes class RoadmapItem : public RoadmapTypes
...@@ -664,7 +665,6 @@ RoadmapItem::RoadmapItem(ORoadmap& _rParent, const Size& _rItemPlayground) ...@@ -664,7 +665,6 @@ RoadmapItem::RoadmapItem(ORoadmap& _rParent, const Size& _rItemPlayground)
: m_aItemPlayground(_rItemPlayground) : m_aItemPlayground(_rItemPlayground)
{ {
mpID = VclPtr<IDLabel>::Create( &_rParent, WB_WORDBREAK ); mpID = VclPtr<IDLabel>::Create( &_rParent, WB_WORDBREAK );
mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
mpID->Show(); mpID->Show();
mpDescription = VclPtr<HyperLabel>::Create( &_rParent, WB_NOTABSTOP | WB_WORDBREAK ); mpDescription = VclPtr<HyperLabel>::Create( &_rParent, WB_NOTABSTOP | WB_WORDBREAK );
mpDescription->Show(); mpDescription->Show();
...@@ -760,15 +760,9 @@ bool RoadmapItem::IsEnabled() const ...@@ -760,15 +760,9 @@ bool RoadmapItem::IsEnabled() const
void RoadmapItem::ToggleBackgroundColor(const Color& _rGBColor) void RoadmapItem::ToggleBackgroundColor(const Color& _rGBColor)
{ {
if (_rGBColor == COL_TRANSPARENT) if (_rGBColor == COL_TRANSPARENT)
{ mpID->SetControlBackground();
mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
mpID->SetControlBackground( COL_TRANSPARENT );
}
else else
{
mpID->SetControlBackground( mpID->GetSettings().GetStyleSettings().GetHighlightColor() ); mpID->SetControlBackground( mpID->GetSettings().GetStyleSettings().GetHighlightColor() );
mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetHighlightTextColor( ) );
}
mpDescription->ToggleBackgroundColor(_rGBColor); mpDescription->ToggleBackgroundColor(_rGBColor);
} }
...@@ -811,22 +805,28 @@ IDLabel::IDLabel(vcl::Window* _pParent, WinBits _nWinStyle) ...@@ -811,22 +805,28 @@ IDLabel::IDLabel(vcl::Window* _pParent, WinBits _nWinStyle)
{ {
} }
void IDLabel::ApplySettings(vcl::RenderContext& rRenderContext)
{
FixedText::ApplySettings(rRenderContext);
const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
if (GetControlBackground() == COL_TRANSPARENT)
rRenderContext.SetTextColor(rStyleSettings.GetFieldTextColor());
else
rRenderContext.SetTextColor(rStyleSettings.GetHighlightTextColor());
}
void IDLabel::DataChanged(const DataChangedEvent& rDCEvt) void IDLabel::DataChanged(const DataChangedEvent& rDCEvt)
{ {
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
FixedText::DataChanged( rDCEvt ); FixedText::DataChanged( rDCEvt );
if ((( rDCEvt.GetType() == DataChangedEventType::SETTINGS ) || if ((( rDCEvt.GetType() == DataChangedEventType::SETTINGS ) ||
( rDCEvt.GetType() == DataChangedEventType::DISPLAY )) && ( rDCEvt.GetType() == DataChangedEventType::DISPLAY )) &&
( rDCEvt.GetFlags() & AllSettingsFlags::STYLE )) ( rDCEvt.GetFlags() & AllSettingsFlags::STYLE ))
{ {
const Color& rGBColor = GetControlBackground(); const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
if (rGBColor == COL_TRANSPARENT) if (GetControlBackground() != COL_TRANSPARENT)
SetTextColor( rStyleSettings.GetFieldTextColor( ) );
else
{
SetControlBackground(rStyleSettings.GetHighlightColor()); SetControlBackground(rStyleSettings.GetHighlightColor());
SetTextColor( rStyleSettings.GetHighlightTextColor( ) );
}
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