#include <canvas_private.hpp>
Public Member Functions | |
text_shape (const config &cfg) | |
Constructor. More... | |
void | draw (wfl::map_formula_callable &variables) override |
Draws the canvas. More... | |
![]() | |
shape (const config &cfg) | |
virtual | ~shape () |
bool | immutable () const |
Private Attributes | |
font::family_class | font_family_ |
The text font family. More... | |
typed_formula< unsigned > | font_size_ |
The font size of the text. More... | |
font::pango_text::FONT_STYLE | font_style_ |
The style of the text. More... | |
typed_formula< PangoAlignment > | text_alignment_ |
The alignment of the text. More... | |
typed_formula< color_t > | color_ |
The color of the text. More... | |
typed_formula< t_string > | text_ |
The text to draw. More... | |
typed_formula< bool > | text_markup_ |
The text markup switch of the text. More... | |
typed_formula< bool > | link_aware_ |
The link aware switch of the text. More... | |
typed_formula< color_t > | link_color_ |
The link color of the text. More... | |
typed_formula< int > | maximum_width_ |
The maximum width for the text. More... | |
unsigned | characters_per_line_ |
The number of characters per line. More... | |
typed_formula< int > | maximum_height_ |
The maximum height for the text. More... | |
Additional Inherited Members | |
![]() | |
rect_bounded_shape (const config &cfg) | |
Constructor. More... | |
![]() | |
typed_formula< int > | x_ |
The x coordinate of the rectangle. More... | |
typed_formula< int > | y_ |
The y coordinate of the rectangle. More... | |
typed_formula< int > | w_ |
The width of the rectangle. More... | |
typed_formula< int > | h_ |
The height of the rectangle. More... | |
Key | Type | Default | Description |
---|---|---|---|
font_family | font_style | "sans" | The font family used for the text. |
font_size | f_unsigned | mandatory | The size of the text font. |
font_style | f_unsigned | "" | The style of the text. |
text_alignment | f_unsigned | "left" | The alignment of the text. |
color | color | "" | The color of the text. |
text | f_tstring | "" | The text to draw (translatable). |
text_markup | f_bool | false | Can the text have mark-up? |
text_link_aware | f_bool | false | Is the text link aware? |
text_link_color | string | "#ffff00" | The color of links in the text. |
maximum_width | f_int | -1 | The maximum width the text is allowed to be. |
maximum_height | f_int | -1 | The maximum height the text is allowed to be. |
debug | string | "" | Debug message to show upon creation this message is not stored. |
NOTE alignment could only be done with the formulas, but now with the text_alignment flag as well, older widgets might still use the formulas and not all widgets may expose the text alignment yet and when exposed not use it yet.
Variables:
Key | Type | Description |
---|---|---|
text_width | unsigned | The width of the rendered text. |
text_height | unsigned | The height of the rendered text. |
Also the general variables are available, see line_shape
Definition at line 402 of file canvas_private.hpp.
|
explicit |
Constructor.
cfg | The config object to define the text. |
Definition at line 397 of file canvas.cpp.
References _(), DBG_GUI_P, debug, font_size_, gui2::typed_formula< T >::has_formula(), and VALIDATE.
|
overridevirtual |
Draws the canvas.
variables | The canvas can have formulas in it's definition, this parameter contains the values for these formulas. |
Implements gui2::canvas::shape.
Definition at line 422 of file canvas.cpp.
References wfl::map_formula_callable::add(), wfl::variant::as_int(), draw::blit(), characters_per_line_, color_, DBG_GUI_D, t_string::empty(), font_family_, font_size_, font_style_, font::pango_text::get_size(), font::get_text_renderer(), texture::h(), h, gui2::rect_bounded_shape::h_, wfl::formula_callable::has_key(), link_aware_, link_color_, maximum_height_, maximum_width_, wfl::formula_callable::query_value(), font::pango_text::render_and_get_texture(), font::pango_text::set_alignment(), font::pango_text::set_characters_per_line(), font::pango_text::set_ellipse_mode(), font::pango_text::set_family_class(), font::pango_text::set_font_size(), font::pango_text::set_font_style(), font::pango_text::set_foreground_color(), font::pango_text::set_link_aware(), font::pango_text::set_link_color(), font::pango_text::set_maximum_height(), font::pango_text::set_maximum_width(), font::pango_text::set_text(), text_, text_alignment_, text_markup_, w, texture::w(), gui2::rect_bounded_shape::w_, gui2::rect_bounded_shape::x_, and gui2::rect_bounded_shape::y_.
|
private |
The number of characters per line.
Definition at line 446 of file canvas_private.hpp.
Referenced by draw().
|
private |
|
private |
|
private |
The font size of the text.
Definition at line 419 of file canvas_private.hpp.
Referenced by draw(), and text_shape().
|
private |
|
private |
The link aware switch of the text.
Definition at line 437 of file canvas_private.hpp.
Referenced by draw().
|
private |
The link color of the text.
Definition at line 440 of file canvas_private.hpp.
Referenced by draw().
|
private |
The maximum height for the text.
Definition at line 449 of file canvas_private.hpp.
Referenced by draw().
|
private |
The maximum width for the text.
Definition at line 443 of file canvas_private.hpp.
Referenced by draw().
|
private |
|
private |
|
private |
The text markup switch of the text.
Definition at line 434 of file canvas_private.hpp.
Referenced by draw().