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
virtual void GetFocus() override;
virtual void LoseFocus() override;
void DeactivateHyperMode(vcl::Font aFont, const Color aColor);
void ActivateHyperMode(vcl::Font aFont, const Color aColor);
void implInit();
using FixedText::CalcMinimumSize;
......@@ -55,6 +52,7 @@ namespace svt
virtual void dispose() override;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
void SetID( sal_Int16 ID );
sal_Int16 GetID() const;
......
......@@ -77,56 +77,33 @@ namespace svt
void HyperLabel::ToggleBackgroundColor( const Color& _rGBColor )
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
SetControlBackground( _rGBColor );
if (_rGBColor == COL_TRANSPARENT)
SetTextColor( rStyleSettings.GetFieldTextColor( ) );
else
SetTextColor( rStyleSettings.GetHighlightTextColor( ) );
}
void HyperLabel::MouseMove( const MouseEvent& rMEvt )
{
vcl::Font aFont = GetControlFont( );
const Color aColor = GetTextColor();
if (rMEvt.IsLeaveWindow())
{
DeactivateHyperMode(aFont, aColor);
}
else
bool bHyperMode = false;
if (!rMEvt.IsLeaveWindow() && IsEnabled() && m_pImpl->bInteractive)
{
Point aPoint = GetPointerPosPixel();
if (aPoint.X() < m_pImpl->m_aMinSize.Width())
{
if ( IsEnabled() && (m_pImpl->bInteractive) )
{
ActivateHyperMode( aFont, aColor);
return;
}
}
DeactivateHyperMode(aFont, aColor);
bHyperMode = true;
}
}
void HyperLabel::ActivateHyperMode(vcl::Font aFont, const Color aColor)
{
aFont.SetUnderline(LINESTYLE_SINGLE);
m_pImpl->m_bHyperMode = true;
SetPointer( PointerStyle::RefHand );
SetControlFont( aFont);
SetTextColor( aColor);
}
void HyperLabel::DeactivateHyperMode(vcl::Font aFont, const Color aColor)
{
m_pImpl->m_bHyperMode = false;
aFont.SetUnderline(LINESTYLE_NONE);
SetPointer( PointerStyle::Arrow );
SetControlFont( aFont);
SetTextColor( aColor);
m_pImpl->m_bHyperMode = bHyperMode;
if (bHyperMode)
{
aFont.SetUnderline(LINESTYLE_SINGLE);
SetPointer(PointerStyle::RefHand);
}
else
{
aFont.SetUnderline(LINESTYLE_NONE);
SetPointer(PointerStyle::Arrow);
}
SetControlFont(aFont);
}
void HyperLabel::MouseButtonDown( const MouseEvent& )
......@@ -193,28 +170,32 @@ namespace svt
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 )
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
FixedText::DataChanged( rDCEvt );
if ((( rDCEvt.GetType() == DataChangedEventType::SETTINGS ) ||
( rDCEvt.GetType() == DataChangedEventType::DISPLAY )) &&
( rDCEvt.GetFlags() & AllSettingsFlags::STYLE ))
{
const Color& rGBColor = GetControlBackground();
if (rGBColor == COL_TRANSPARENT)
SetTextColor( rStyleSettings.GetFieldTextColor( ) );
else
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
if (GetControlBackground() != COL_TRANSPARENT)
SetControlBackground(rStyleSettings.GetHighlightColor());
SetTextColor( rStyleSettings.GetHighlightTextColor( ) );
}
Invalidate();
}
}
} // namespace svt
......
......@@ -41,7 +41,8 @@ class IDLabel : public FixedText
{
public:
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
......@@ -664,7 +665,6 @@ RoadmapItem::RoadmapItem(ORoadmap& _rParent, const Size& _rItemPlayground)
: m_aItemPlayground(_rItemPlayground)
{
mpID = VclPtr<IDLabel>::Create( &_rParent, WB_WORDBREAK );
mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
mpID->Show();
mpDescription = VclPtr<HyperLabel>::Create( &_rParent, WB_NOTABSTOP | WB_WORDBREAK );
mpDescription->Show();
......@@ -760,15 +760,9 @@ bool RoadmapItem::IsEnabled() const
void RoadmapItem::ToggleBackgroundColor(const Color& _rGBColor)
{
if (_rGBColor == COL_TRANSPARENT)
{
mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
mpID->SetControlBackground( COL_TRANSPARENT );
}
mpID->SetControlBackground();
else
{
mpID->SetControlBackground( mpID->GetSettings().GetStyleSettings().GetHighlightColor() );
mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetHighlightTextColor( ) );
}
mpDescription->ToggleBackgroundColor(_rGBColor);
}
......@@ -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)
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
FixedText::DataChanged( rDCEvt );
if ((( rDCEvt.GetType() == DataChangedEventType::SETTINGS ) ||
( rDCEvt.GetType() == DataChangedEventType::DISPLAY )) &&
( rDCEvt.GetFlags() & AllSettingsFlags::STYLE ))
{
const Color& rGBColor = GetControlBackground();
if (rGBColor == COL_TRANSPARENT)
SetTextColor( rStyleSettings.GetFieldTextColor( ) );
else
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
if (GetControlBackground() != COL_TRANSPARENT)
SetControlBackground(rStyleSettings.GetHighlightColor());
SetTextColor( rStyleSettings.GetHighlightTextColor( ) );
}
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