|
roo_display
API Documentation for roo_display
|
Like TextLabel, but does not own the text content.
More...
#include <text_label.h>
Public Member Functions | |
| template<typename String > | |
| StringViewLabel (String &label, const Font &font, const Color color, FillMode fill_mode=FillMode::kVisible) | |
| Construct from a string-like value without copying. | |
| StringViewLabel (roo::string_view label, const Font &font, Color color, FillMode fill_mode=FillMode::kVisible) | |
Construct from a string_view. | |
| void | drawTo (const Surface &s) const override |
| Draw this object's content, respecting the fill mode. | |
| Box | extents () const override |
| Return the bounding box encompassing all pixels that need to be drawn. | |
| Box | anchorExtents () const override |
| Return the bounds used for alignment. | |
| const Font & | font () const |
| Return the font used by the label. | |
| const GlyphMetrics & | metrics () const |
| Return cached string metrics. | |
| const roo::string_view | label () const |
| Return the label text view. | |
| const Color | color () const |
| Return the label color. | |
| const FillMode | fill_mode () const |
| Return the fill mode. | |
| void | setColor (Color color) |
| Set the label color. | |
| void | setFillMode (FillMode fill_mode) |
| Set the fill mode. | |
Public Member Functions inherited from roo_display::Drawable | |
| virtual | ~Drawable () |
Additional Inherited Members | |
Static Public Member Functions inherited from roo_display::Drawable | |
| static const Drawable * | Empty () |
| A singleton representing a no-op drawable with no bounding box. | |
Like TextLabel, but does not own the text content.
Uses no dynamic allocation. Ideal for string literals or temporary labels.
Definition at line 111 of file text_label.h.
|
inline |
Construct from a string-like value without copying.
Definition at line 115 of file text_label.h.
|
inline |
Construct from a string_view.
Definition at line 121 of file text_label.h.
|
inlineoverridevirtual |
Return the bounds used for alignment.
Defaults to extents(). Some drawables (notably text labels) may want different alignment bounds.
This method is called during a transaction and must not block or perform I/O.
Reimplemented from roo_display::Drawable.
Definition at line 139 of file text_label.h.
References roo_display::GlyphMetrics::advance(), roo_display::ascent, roo_display::descent, font(), roo_display::linegap, and metrics().
Return the label color.
Definition at line 151 of file text_label.h.
Referenced by drawTo(), roo_display::ClippedStringViewLabel::drawTo(), and setColor().
Draw this object's content, respecting the fill mode.
If s.fill_mode() == FillMode::kExtents, the method must fill the entire (clipped) extents() rectangle (using s.bgcolor() for transparent parts).
The default implementation fills the clipped extents() rectangle with bgcolor and then calls drawInteriorTo(). That can cause flicker, so override this method if a better implementation is possible.
The implementation must respect surface parameters, particularly clip_box(), and must not draw outside it. The surface clip box is pre-clipped to fit within this drawable's extents().
Reimplemented from roo_display::Drawable.
Definition at line 129 of file text_label.h.
References color(), roo_display::Font::drawHorizontalString(), fill_mode(), font(), roo_display::kExtents, and label().
|
inlineoverridevirtual |
Return the bounding box encompassing all pixels that need to be drawn.
This method is called during a transaction and must not block or perform I/O.
Implements roo_display::Drawable.
Definition at line 137 of file text_label.h.
References roo_display::GlyphMetrics::screen_extents().
Return the fill mode.
Definition at line 153 of file text_label.h.
Referenced by drawTo(), roo_display::ClippedStringViewLabel::drawTo(), and setFillMode().
Return the font used by the label.
Definition at line 145 of file text_label.h.
Referenced by anchorExtents(), drawTo(), and roo_display::ClippedStringViewLabel::drawTo().
|
inline |
Return the label text view.
Definition at line 149 of file text_label.h.
Referenced by drawTo(), and roo_display::ClippedStringViewLabel::drawTo().
|
inline |
Return cached string metrics.
Definition at line 147 of file text_label.h.
Referenced by anchorExtents(), and roo_display::ClippedStringViewLabel::extents().