Class · aurore
aurore::Label
On this page
#include <aurore/views/label.hpp>
class aurore::Label : public aurore::ViewDescription
Some text. The Label will automatically grow as much as possible. If there is enough space, the label dimensions will fit the text. If there is not enough horizontal space available, it will wrap and expand its height. If there is not enough vertical space available to wrap, the text will be truncated instead. The truncated text will animate if the Label or one of its parents is focused. Animation will be disabled if the alignment is other than LEFT. Warning: to wrap, the label width MUST be constrained
Constructors 2
An empty label in the default font, size and colour.
label.hpp:68Functions 42
virtual void draw( NVGcontext *vg,float x,float y,float width,float height,Style style,FrameContext *ctx) overrideCalled by frame() to draw the view onscreen. Views should not draw outside of their bounds (they may be clipped if they do so).
Overrides aurore::View::draw
virtual void onParentFocusGained(View *focusedView) override Fired when focus is gained on this view's parent, or the parent of the parent...
Overrides aurore::View::onParentFocusGained
virtual void onParentFocusLost(View *focusedView) override Fired when focus is lost on one of this view's parents. Works similarly to onParentFocusGained().
Overrides aurore::View::onParentFocusLost
Sets the text of the label.
label.hpp:81void setHorizontalAlign(HorizontalAlign align) Sets the alignment of the text inside the view. Will not move the view, only the text inside.
Default is CENTER.
label.hpp:90void setVerticalAlign(VerticalAlign align) Sets the alignment of the text inside the view. Will not move the view, only the text inside.
Only applies to single-line labels.
Default is CENTER.
label.hpp:101The font size asked, in layout units (drawn times the font scale).
label.hpp:104false: this label keeps its size whatever the font scale.
label.hpp:114This label drawn at most max times its size, whatever the scale (with a scale of 1, as asked: nothing changes).
A single line its box is too narrow for, at a scale above 1: drawn smaller until it fits, never below the size asked (then cut as before), rather than wrapped. Nothing changes at a scale of 1.
label.hpp:121With shrinkToFit: drawn as small as size, under the size asked and at any scale, before being cut (0, the default: the size asked).
The size it is drawn at, and the same before any shrinking to fit (what the text is measured at).
label.hpp:129nanovg's quality for the glyphs (1 by default).
label.hpp:132The height of a line, as a multiple of the font size.
label.hpp:134The text's colour (setThemeColor follows a theme key instead).
label.hpp:136The font this label is drawn with (the app's default one unless set): by its id, or by the name it was loaded under (Application::loadFont*). A name not loaded leaves the font as it was. XML: fontFamily="name".
label.hpp:141The font id the label draws with.
label.hpp:145The font size asked, before the font scale.
label.hpp:147The whole text, as set (not cut to fit).
label.hpp:153virtual bool getStyleProperty( const std::string &name,StyleValue *value) overrideThe style properties the states and transitions work on, by name: backgroundColor, borderColor, lineColor (colours), borderThickness, cornerRadius, alpha, scale (numbers); a Label adds textColor, a Rectangle color, a Button textColor. Only properties that are drawn, never laid out. A subclass adds its own by overriding both and calling the base for the others.
Overrides aurore::View::getStyleProperty
virtual bool setStyleProperty( const std::string &name,const StyleValue &value) overrideSets the view's text, for bind="text: …"; false when it has none.
Overrides aurore::View::setBoundText
Called on every view of the screens when the text scale changes (Application::setTextScale): a view that measures text marks itself dirty here.
Overrides aurore::View::onTextScaleChanged
void bindText(Observable< std::string > &text) Its own Observable: the label shows its value, now and at each change, as long as it lives.
label.hpp:162The text as laid out does not fit: it is drawn cut, with an ellipsis.
label.hpp:164Set by the measure function: the width the text needs on one line.
label.hpp:170Set by the measure function: the width of the ellipsis.
label.hpp:172If an "animated" label is too large to fit its bounds, the full text will be displayed in a scrolling animation instead of being truncated with an ellipsis ("...").
Unless the autoAnimate flag is set to false, a label will automatically be set to "animated" if it is focused or if one of its parent is.
label.hpp:182Controls whether focus changes automatically animates the label or not. Doesn't stop the ongoing animation should there be one.
label.hpp:188A single-line label will not wrap and increase its height, even if the remaining vertical space allows it.
Instead, it will always be truncated (if too large) to fit the horizontal space.
label.hpp:196Internal flag set by the measure function.
label.hpp:204Draws a blinking edit cursor before the byte cursor (CursorPosition::END: at the end; UNSET: none).
Also the functions of aurore::View (221).
Static functions 4
Every label drawn scale times its size (1 by default), but those that keep theirs (setFontScaled(false)). It can change at any time: the labels then need laying out again (their nodes marked dirty). getFontSize() gives the size asked. Application::setTextScale does both.
static View * create() Makes a label for XML (<aurore:Label>).
Simplified Chinese to Traditional Chinese
label.hpp:209Static attributes 2
STConverter() applied to Traditional Chinese text.
label.hpp:211The font scale (setFontScale())
label.hpp:212Protected functions 9
virtual AccessibilityRole getDefaultAccessibilityRole() override The view's own role and label when the app gave none.
Overrides aurore::View::getDefaultAccessibilityRole
the text's width as drawn
label.hpp:231Protected attributes 27
setShrinkToFitMin
label.hpp:228from onLayout, when shrinkToFit
label.hpp:229the text's width at that scale
label.hpp:230should it animate?
label.hpp:245currently animating?
label.hpp:246Read from Aurore's headers by Doxygen at each build · library/include