Permalink
Browse files

allow <width>auto</width> for label controls, and ensure dirty-region…

…s works with them. Part of #13887
  • Loading branch information...
1 parent 88e6ffa commit 1fe1a800338d662bd98196ed9f8dc6a70fa88212 Jonathan Marshall committed Jan 4, 2013
Showing with 6 additions and 3 deletions.
  1. +6 −3 xbmc/guilib/GUILabelControl.cpp
@@ -103,7 +103,7 @@ void CGUILabelControl::UpdateInfo(const CGUIListItem *item)
bool changed = false;
- changed |= m_label.SetMaxRect(m_posX, m_posY, m_width, m_height);
+ changed |= m_label.SetMaxRect(m_posX, m_posY, GetWidth(), m_height);
changed |= m_label.SetText(label);
if (changed)
@@ -115,7 +115,7 @@ void CGUILabelControl::Process(unsigned int currentTime, CDirtyRegionList &dirty
bool changed = false;
changed |= m_label.SetColor(IsDisabled() ? CGUILabel::COLOR_DISABLED : CGUILabel::COLOR_TEXT);
- changed |= m_label.SetMaxRect(m_posX, m_posY, m_width, m_height);
+ changed |= m_label.SetMaxRect(m_posX, m_posY, GetWidth(), m_height);
changed |= m_label.Process(currentTime);
if (changed)
@@ -172,7 +172,10 @@ void CGUILabelControl::SetAlignment(uint32_t align)
float CGUILabelControl::GetWidth() const
{
if (m_minWidth && m_minWidth != m_width)
- return CLAMP(m_label.GetTextWidth(), m_minWidth, m_width);
+ {
+ float maxWidth = m_width ? m_width : m_label.GetTextWidth();
+ return CLAMP(m_label.GetTextWidth(), m_minWidth, maxWidth);
+ }
return m_width;
}

0 comments on commit 1fe1a80

Please sign in to comment.