#include <canvas_private.hpp>
Public Member Functions | |
| text_shape (const config &cfg, wfl::action_function_symbol_table &functions) | |
| Constructor. More... | |
| text_shape (const point &origin, font::family_class family, const unsigned size, font::pango_text::FONT_STYLE style, const std::string &align, const unsigned wrap_width) | |
| t_string | get_text () const |
| void | set_text (const t_string &text) |
| std::pair< std::size_t, std::size_t > | add_text (const t_string &text) |
| void | add_attribute (const std::string &attr_name, const std::string &extra_data="", std::size_t start=PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING, std::size_t end=PANGO_ATTR_INDEX_TO_TEXT_END) |
| void | add_attributes (font::attribute_list &&other_attrs) |
| void | add_attributes_from (text_shape &tshape2, const unsigned attr_start) |
| void | set_wrap_width (const unsigned wrap_width) |
| void | draw (wfl::map_formula_callable &variables) override |
| Draws the canvas. More... | |
Public Member Functions inherited from gui2::canvas::shape | |
| shape ()=default | |
| 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... | |
| config::attribute_value | text_ |
| The text to draw. More... | |
| bool | parse_text_as_formula_ |
| Whether to parse text_ as WFL formula. 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... | |
| typed_formula< int > | highlight_start_ |
| Start offset for highlight. More... | |
| typed_formula< int > | highlight_end_ |
| End offset for highlight. More... | |
| typed_formula< color_t > | highlight_color_ |
| The color to be used for highlighting. More... | |
| float | line_spacing_ |
| Spacing between lines. More... | |
| typed_formula< bool > | outline_ |
| Whether to apply a text outline. More... | |
| wfl::formula | actions_formula_ |
| Any extra WFL actions to execute. More... | |
| font::attribute_list | text_attributes_ |
| Any custom Pango text attributes. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from gui2::rect_bounded_shape | |
| rect_bounded_shape (const rect &bounds) | |
| rect_bounded_shape (const point &origin, const std::string &w_f, const std::string &h_f) | |
| rect_bounded_shape (const config &cfg) | |
| Constructor. More... | |
Protected Attributes inherited from gui2::rect_bounded_shape | |
| 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... | |
Definition at line 266 of file canvas_private.hpp.
|
explicit |
Constructor.
| cfg | The config object to define the text. |
| functions | WFL functions to execute. |
Definition at line 485 of file canvas.cpp.
| gui2::text_shape::text_shape | ( | const point & | origin, |
| font::family_class | family, | ||
| const unsigned | size, | ||
| font::pango_text::FONT_STYLE | style, | ||
| const std::string & | align, | ||
| const unsigned | wrap_width | ||
| ) |
Definition at line 514 of file canvas.cpp.
| void gui2::text_shape::add_attribute | ( | const std::string & | attr_name, |
| const std::string & | extra_data = "", |
||
| std::size_t | start = PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING, |
||
| std::size_t | end = PANGO_ATTR_INDEX_TO_TEXT_END |
||
| ) |
Definition at line 565 of file canvas.cpp.
References font::add_attribute_bg_color(), font::add_attribute_fg_color(), font::add_attribute_font_family(), font::add_attribute_image_shape(), font::add_attribute_line_height(), font::add_attribute_size(), font::add_attribute_style(), font::add_attribute_underline(), font::add_attribute_weight(), font::decode_family_class(), gui2::decode_text_style(), gui2::decode_text_weight(), font::GOOD_COLOR, font::NORMAL_COLOR, editor::start(), utils::stod(), utils::stoi(), font::string_to_color(), text_attributes_, and WRN_GUI_D.
Referenced by gui2::rich_label::add_text_with_attribute().
| void gui2::text_shape::add_attributes | ( | font::attribute_list && | other_attrs | ) |
| void gui2::text_shape::add_attributes_from | ( | text_shape & | tshape2, |
| const unsigned | attr_start | ||
| ) |
Definition at line 610 of file canvas.cpp.
References font::attribute_list::splice_into(), and text_attributes_.
| std::pair< std::size_t, std::size_t > gui2::text_shape::add_text | ( | const t_string & | text | ) |
Definition at line 552 of file canvas.cpp.
References get_text(), set_text(), t_string::size(), and editor::start().
Referenced by gui2::rich_label::add_text_with_attribute().
|
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 615 of file canvas.cpp.
References actions_formula_, wfl::map_formula_callable::add(), font::add_attribute_bg_color(), font::pango_text::apply_attributes(), wfl::variant::as_bool(), wfl::variant::as_int(), draw::blit(), characters_per_line_, font::pango_text::clear_attributes(), color_, DBG_GUI_D, wfl::formula::evaluate(), wfl::variant::execute_variant(), wfl::formula_callable::fake_ptr(), 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(), highlight_color_, highlight_end_, highlight_start_, line_spacing_, link_aware_, link_color_, maximum_height_, maximum_width_, outline_, parse_text_as_formula_, wfl::formula_callable::query_value(), font::pango_text::render_and_get_texture(), font::pango_text::set_add_outline(), 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_line_spacing(), 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(), config_attribute_value::t_str(), text_, text_alignment_, text_attributes_, text_markup_, w, texture::w(), gui2::rect_bounded_shape::w_, gui2::rect_bounded_shape::x_, and gui2::rect_bounded_shape::y_.
Referenced by gui2::rich_label::setup_text_renderer().
| t_string gui2::text_shape::get_text | ( | ) | const |
Definition at line 544 of file canvas.cpp.
References config_attribute_value::t_str(), and text_.
Referenced by gui2::rich_label::add_link(), add_text(), and gui2::rich_label::setup_text_renderer().
| void gui2::text_shape::set_text | ( | const t_string & | text | ) |
| void gui2::text_shape::set_wrap_width | ( | const unsigned | wrap_width | ) |
Definition at line 561 of file canvas.cpp.
References maximum_width_, and gui2::typed_formula< T >::set_value().
|
private |
Any extra WFL actions to execute.
Definition at line 355 of file canvas_private.hpp.
Referenced by draw().
|
private |
The number of characters per line.
Definition at line 334 of file canvas_private.hpp.
Referenced by draw().
|
private |
|
private |
|
private |
|
private |
|
private |
The color to be used for highlighting.
Definition at line 346 of file canvas_private.hpp.
Referenced by draw().
|
private |
|
private |
Start offset for highlight.
Definition at line 340 of file canvas_private.hpp.
Referenced by draw().
|
private |
|
private |
The link aware switch of the text.
Definition at line 325 of file canvas_private.hpp.
Referenced by draw().
|
private |
The link color of the text.
Definition at line 328 of file canvas_private.hpp.
Referenced by draw().
|
private |
The maximum height for the text.
Definition at line 337 of file canvas_private.hpp.
Referenced by draw().
|
private |
The maximum width for the text.
Definition at line 331 of file canvas_private.hpp.
Referenced by draw(), and set_wrap_width().
|
private |
Whether to apply a text outline.
Definition at line 352 of file canvas_private.hpp.
Referenced by draw().
|
private |
Whether to parse text_ as WFL formula.
Definition at line 319 of file canvas_private.hpp.
Referenced by draw().
|
private |
The text to draw.
Definition at line 316 of file canvas_private.hpp.
Referenced by draw(), get_text(), and set_text().
|
private |
|
private |
Any custom Pango text attributes.
Definition at line 358 of file canvas_private.hpp.
Referenced by add_attribute(), add_attributes_from(), and draw().
|
private |
The text markup switch of the text.
Definition at line 322 of file canvas_private.hpp.
Referenced by draw().