Class for rendering text labels. Handles alignment and rendering of text within a control.
More...
|
| CGUILabel (float posX, float posY, float width, float height, const CLabelInfo &labelInfo, OVER_FLOW overflow=OVER_FLOW_TRUNCATE) |
|
| CGUILabel (const CGUILabel &label) |
|
virtual | ~CGUILabel ()=default |
|
bool | Process (unsigned int currentTime) |
| Process the label.
|
|
void | Render () |
| Render the label on screen.
|
|
bool | SetMaxRect (float x, float y, float w, float h) |
| Set the maximal extent of the label Sets the maximal size and positioning that the label may render in. Note that textwidth> can override this, and <textoffsetx> and <textoffsety> may also allow the label to be moved outside this rectangle.
|
|
bool | SetAlign (uint32_t align) |
|
bool | SetText (const std::string &label) |
| Set the text to be displayed in the label Updates the label control and recomputes final position and size.
|
|
bool | SetTextW (const std::wstring &label) |
| Set the text to be displayed in the label Updates the label control and recomputes final position and size.
|
|
bool | SetStyledText (const vecText &text, const std::vector< KODI::UTILS::COLOR::Color > &colors) |
| Set styled text to be displayed in the label Updates the label control and recomputes final position and size.
|
|
bool | SetColor (COLOR color) |
| Set the color to use for the label Sets the color to be used for this label. Takes effect at the next render.
|
|
void | SetRenderRect (const CRect &rect) |
| Set the final layout of the current text Overrides the calculated layout of the current text, forcing a particular size and position.
|
|
bool | SetScrolling (bool scrolling) |
| Set whether or not this label control should scroll.
|
|
void | SetScrollLoopCount (unsigned int loopCount) |
| Set max. text scroll count.
|
|
bool | SetOverflow (OVER_FLOW overflow) |
| Set how this label should handle overflowing text.
|
|
void | SetInvalid () |
| Set this label invalid. Forces an update of the control.
|
|
bool | UpdateColors () |
| Update this labels colors.
|
|
const CRect & | GetRenderRect () const |
| Returns the precalculated final layout of the current text.
|
|
float | GetTextWidth () const |
| Returns the precalculated full width of the current text, regardless of layout.
|
|
float | GetMaxWidth () const |
| Returns the maximal width that this label can render into.
|
|
float | CalcTextWidth (const std::wstring &text) const |
| Calculates the width of some text.
|
|
const CLabelInfo & | GetLabelInfo () const |
|
CLabelInfo & | GetLabelInfo () |
|
Class for rendering text labels. Handles alignment and rendering of text within a control.
,
Check a left aligned and right aligned label for overlap and cut the labels off so that no overlap occurs.
If a left-aligned label occupies some of the same space on screen as a right-aligned label, then we may be able to correct for this by restricting the width of one or both of them. This routine checks two labels to see whether they satisfy this assumption and, if so, adjusts the render rect of both labels so that they no longer do so. The order of the two labels is not important, but we do assume that the left-aligned label is also the left-most on screen, and that the right-aligned label is the right most on-screen, so that they overlap due to the fact that one or both of the labels are longer than anticipated. In the following diagram, [R...[R R] refers to the maximal allowed and actual space occupied by the right label. Similarly, [L L]...L] refers to the maximal and actual space occupied by the left label. | refers to the central cutting point, i.e. the point that would divide the maximal allowed overlap perfectly in two. There are 3 scenarios to consider:
cut [L [R...[R L].|..........L] R] left label ends to the left of the cut -> just crop the left label. [L [R.....[R | L]..L] R] both left and right labels occupy more than the cut allows, so crop both. [L [R..........|.[R L]..L] R] right label ends to the right of the cut -> just crop the right label.
- Parameters
-
label1 | First label to check |
label2 | Second label to check |