diff options
author | Jonathan Marshall <jmarshall@never.you.mind> | 2012-07-01 22:30:55 +1200 |
---|---|---|
committer | Jonathan Marshall <jmarshall@never.you.mind> | 2012-07-01 22:30:55 +1200 |
commit | 0b51902e6bfec570c7357699314cd58bb2374516 (patch) | |
tree | cbe2e6879c0cf18e20929d30f80e99afb977fe38 | |
parent | 9c514ede6f2de7ac623242c28f6884d5ab00c982 (diff) |
[guilib] adds ability to set the overflow type to CLIP for a gui label
-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(); |