The Battle for Wesnoth  1.19.0-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)
 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

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...
 
typed_formula< int > highlight_start_
 Start and end offsets for highlight. More...
 
typed_formula< int > highlight_end_
 
typed_formula< color_thighlight_color_
 The color to be used for highlighting. More...
 
typed_formula< bool > outline_
 Whether to apply a text outline. 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

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.

Constructor & Destructor Documentation

◆ text_shape()

gui2::text_shape::text_shape ( const config cfg)
explicit

Constructor.

Parameters
cfgThe config object to define the text.

Definition at line 398 of file canvas.cpp.

References _(), DBG_GUI_P, debug, font_size_, gui2::typed_formula< T >::has_formula(), and VALIDATE.

Member Function Documentation

◆ draw()

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

Member Data Documentation

◆ characters_per_line_

unsigned gui2::text_shape::characters_per_line_
private

The number of characters per line.

Definition at line 446 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 428 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 416 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 419 of file canvas_private.hpp.

Referenced by draw(), and text_shape().

◆ font_style_

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

The style of the text.

Definition at line 422 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 456 of file canvas_private.hpp.

Referenced by draw().

◆ highlight_end_

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

Definition at line 453 of file canvas_private.hpp.

Referenced by draw().

◆ highlight_start_

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

Start and end offsets for highlight.

Definition at line 452 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 437 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 440 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 449 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 443 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 459 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 431 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 425 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 434 of file canvas_private.hpp.

Referenced by draw().


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