diff options
-rw-r--r-- | xbmc/guilib/GUILabel.cpp | 11 | ||||
-rw-r--r-- | xbmc/guilib/GUILabel.h | 11 |
2 files changed, 19 insertions, 3 deletions
diff --git a/xbmc/guilib/GUILabel.cpp b/xbmc/guilib/GUILabel.cpp index bd06c0bc82..3a14cc639f 100644 --- a/xbmc/guilib/GUILabel.cpp +++ b/xbmc/guilib/GUILabel.cpp @@ -52,6 +52,15 @@ bool CGUILabel::SetScrolling(bool scrolling) return changed; } +bool CGUILabel::SetOverflow(OVER_FLOW overflow) +{ + bool changed = m_overflowType != overflow; + + m_overflowType = overflow; + + return changed; +} + bool CGUILabel::SetColor(CGUILabel::COLOR color) { bool changed = m_color != color; @@ -112,7 +121,7 @@ void CGUILabel::Render() } else align |= XBFONT_TRUNCATED; - m_textLayout.Render(posX, posY, m_label.angle, color, m_label.shadowColor, align, m_renderRect.Width(), renderSolid); + m_textLayout.Render(posX, posY, m_label.angle, color, m_label.shadowColor, align, m_overflowType == OVER_FLOW_CLIP ? m_textLayout.GetTextWidth() : m_renderRect.Width(), renderSolid); } } diff --git a/xbmc/guilib/GUILabel.h b/xbmc/guilib/GUILabel.h index 760ac4910b..5b7c8f4d34 100644 --- a/xbmc/guilib/GUILabel.h +++ b/xbmc/guilib/GUILabel.h @@ -90,8 +90,9 @@ public: */ enum OVER_FLOW { OVER_FLOW_TRUNCATE = 0, OVER_FLOW_SCROLL, - OVER_FLOW_WRAP }; - + OVER_FLOW_WRAP, + OVER_FLOW_CLIP }; + CGUILabel(float posX, float posY, float width, float height, const CLabelInfo& labelInfo, OVER_FLOW overflow = OVER_FLOW_TRUNCATE); virtual ~CGUILabel(void); @@ -144,6 +145,12 @@ public: */ bool SetScrolling(bool scrolling); + /*! \brief Set how this label should handle overflowing text. + \param overflow the overflow type + \sa OVER_FLOW + */ + bool SetOverflow(OVER_FLOW overflow); + /*! \brief Set this label invalid. Forces an update of the control */ void SetInvalid(); |