The Battle for Wesnoth  1.19.7+dev
Public Member Functions | Private Attributes | List of all members
gui2::text_shape Class Reference

#include <canvas_private.hpp>

Inheritance diagram for gui2::text_shape:

Public Member Functions

 text_shape (const config &cfg, wfl::action_function_symbol_table &functions)
 Constructor. More...
 
void draw (wfl::map_formula_callable &variables) override
 Draws the canvas. More...
 
- Public Member Functions inherited from gui2::canvas::shape
 shape (const config &cfg)
 
virtual ~shape ()
 
bool immutable () const
 

Private Attributes

config cfg_
 the source config More...
 
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_tcolor_
 The color of the text. More...
 
typed_formula< t_stringtext_
 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_tlink_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...
 
std::string highlight_start_
 Start and end offsets for highlight. More...
 
std::string highlight_end_
 
typed_formula< color_thighlight_color_
 The color to be used for highlighting. More...
 
std::string attr_start_
 Generic start and end offsets for various attributes. More...
 
std::string attr_end_
 
std::string attr_name_
 The attribute type Possible values : color/foreground, bgcolor/background, font_size/size, bold, italic, underline The first three require extra data the color for the first two, and font size for the last. More...
 
std::string attr_data_
 extra data for the attribute, if any More...
 
typed_formula< bool > outline_
 Whether to apply a text outline. More...
 
wfl::formula actions_formula_
 Any extra WFL actions to execute. More...
 

Additional Inherited Members

- Protected Member Functions inherited from gui2::rect_bounded_shape
 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...
 

Detailed Description

Definition at line 235 of file canvas_private.hpp.

Constructor & Destructor Documentation

◆ text_shape()

gui2::text_shape::text_shape ( const config cfg,
wfl::action_function_symbol_table functions 
)
explicit

Constructor.

Parameters
cfgThe config object to define the text.
functionsWFL functions to execute.

Definition at line 396 of file canvas.cpp.

References DBG_GUI_P, and debug.

Member Function Documentation

◆ draw()

void gui2::text_shape::draw ( wfl::map_formula_callable variables)
overridevirtual

Draws the canvas.

Parameters
variablesThe canvas can have formulas in it's definition, this parameter contains the values for these formulas.

Implements gui2::canvas::shape.

Definition at line 427 of file canvas.cpp.

References actions_formula_, wfl::map_formula_callable::add(), font::pango_text::add_attribute_bg_color(), font::pango_text::add_attribute_fg_color(), font::pango_text::add_attribute_font_family(), font::pango_text::add_attribute_size(), font::pango_text::add_attribute_style(), font::pango_text::add_attribute_underline(), font::pango_text::add_attribute_weight(), wfl::variant::as_bool(), wfl::variant::as_int(), draw::blit(), cfg_, characters_per_line_, config::child_range(), font::pango_text::clear_attribute_list(), color_, DBG_GUI_D, gui2::decode_text_style(), gui2::decode_text_weight(), t_string::empty(), wfl::formula::evaluate(), wfl::variant::execute_variant(), wfl::formula_callable::fake_ptr(), font_family_, font::FONT_SANS_SERIF, font_size_, font_style_, font::get_font_families(), font::pango_text::get_size(), font::get_text_renderer(), font::GOOD_COLOR, texture::h(), h, gui2::rect_bounded_shape::h_, wfl::formula_callable::has_key(), highlight_color_, highlight_end_, highlight_start_, i, link_aware_, link_color_, maximum_height_, maximum_width_, font::NORMAL_COLOR, outline_, 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_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(), t_string::size(), font::SIZE_NORMAL, utils::split(), editor::start(), font::string_to_color(), text_, text_alignment_, text_markup_, w, texture::w(), gui2::rect_bounded_shape::w_, gui2::rect_bounded_shape::x_, and gui2::rect_bounded_shape::y_.

Member Data Documentation

◆ actions_formula_

wfl::formula gui2::text_shape::actions_formula_
private

Any extra WFL actions to execute.

Definition at line 316 of file canvas_private.hpp.

Referenced by draw().

◆ attr_data_

std::string gui2::text_shape::attr_data_
private

extra data for the attribute, if any

Definition at line 310 of file canvas_private.hpp.

◆ attr_end_

std::string gui2::text_shape::attr_end_
private

Definition at line 297 of file canvas_private.hpp.

◆ attr_name_

std::string gui2::text_shape::attr_name_
private

The attribute type Possible values : color/foreground, bgcolor/background, font_size/size, bold, italic, underline The first three require extra data the color for the first two, and font size for the last.

Definition at line 307 of file canvas_private.hpp.

◆ attr_start_

std::string gui2::text_shape::attr_start_
private

Generic start and end offsets for various attributes.

Definition at line 296 of file canvas_private.hpp.

◆ cfg_

config gui2::text_shape::cfg_
private

the source config

Definition at line 250 of file canvas_private.hpp.

Referenced by draw().

◆ characters_per_line_

unsigned gui2::text_shape::characters_per_line_
private

The number of characters per line.

Definition at line 283 of file canvas_private.hpp.

Referenced by draw().

◆ color_

typed_formula<color_t> gui2::text_shape::color_
private

The color of the text.

Definition at line 265 of file canvas_private.hpp.

Referenced by draw().

◆ font_family_

font::family_class gui2::text_shape::font_family_
private

The text font family.

Definition at line 253 of file canvas_private.hpp.

Referenced by draw().

◆ font_size_

typed_formula<unsigned> gui2::text_shape::font_size_
private

The font size of the text.

Definition at line 256 of file canvas_private.hpp.

Referenced by draw().

◆ font_style_

font::pango_text::FONT_STYLE gui2::text_shape::font_style_
private

The style of the text.

Definition at line 259 of file canvas_private.hpp.

Referenced by draw().

◆ highlight_color_

typed_formula<color_t> gui2::text_shape::highlight_color_
private

The color to be used for highlighting.

Definition at line 293 of file canvas_private.hpp.

Referenced by draw().

◆ highlight_end_

std::string gui2::text_shape::highlight_end_
private

Definition at line 290 of file canvas_private.hpp.

Referenced by draw().

◆ highlight_start_

std::string gui2::text_shape::highlight_start_
private

Start and end offsets for highlight.

Definition at line 289 of file canvas_private.hpp.

Referenced by draw().

◆ link_aware_

typed_formula<bool> gui2::text_shape::link_aware_
private

The link aware switch of the text.

Definition at line 274 of file canvas_private.hpp.

Referenced by draw().

◆ link_color_

typed_formula<color_t> gui2::text_shape::link_color_
private

The link color of the text.

Definition at line 277 of file canvas_private.hpp.

Referenced by draw().

◆ maximum_height_

typed_formula<int> gui2::text_shape::maximum_height_
private

The maximum height for the text.

Definition at line 286 of file canvas_private.hpp.

Referenced by draw().

◆ maximum_width_

typed_formula<int> gui2::text_shape::maximum_width_
private

The maximum width for the text.

Definition at line 280 of file canvas_private.hpp.

Referenced by draw().

◆ outline_

typed_formula<bool> gui2::text_shape::outline_
private

Whether to apply a text outline.

Definition at line 313 of file canvas_private.hpp.

Referenced by draw().

◆ text_

typed_formula<t_string> gui2::text_shape::text_
private

The text to draw.

Definition at line 268 of file canvas_private.hpp.

Referenced by draw().

◆ text_alignment_

typed_formula<PangoAlignment> gui2::text_shape::text_alignment_
private

The alignment of the text.

Definition at line 262 of file canvas_private.hpp.

Referenced by draw().

◆ text_markup_

typed_formula<bool> gui2::text_shape::text_markup_
private

The text markup switch of the text.

Definition at line 271 of file canvas_private.hpp.

Referenced by draw().


The documentation for this class was generated from the following files: