16 #define GETTEXT_DOMAIN "wesnoth-lib"
36 static const std::map<std::string, font::pango_text::FONT_STYLE> font_style_map {
47 if(
const auto i = font_style_map.find(style);
i != font_style_map.end()) {
51 ERR_GUI_G <<
"Unknown style '" << style <<
"', using 'normal' instead.";
62 if(alignment ==
"center") {
63 return PANGO_ALIGN_CENTER;
64 }
else if(alignment ==
"right") {
65 return PANGO_ALIGN_RIGHT;
68 if(!alignment.empty() && alignment !=
"left") {
69 ERR_GUI_E <<
"Invalid text alignment '" << alignment <<
"', falling back to 'left'.";
72 return PANGO_ALIGN_LEFT;
78 case PANGO_ALIGN_LEFT:
80 case PANGO_ALIGN_RIGHT:
82 case PANGO_ALIGN_CENTER:
88 throw "Control should not reach this point.";
93 return t_string(
VGETTEXT(
"Mandatory widget '$id' hasn't been defined.", {{
"id",
id}}));
121 return text.substr(0, 15);
Define the common log macros for the gui toolkit.
unsigned screen_width
The screen resolution and pixel pitch should be available for all widgets since their drawing method ...
const unsigned screen_pitch_microns
screen_pitch_microns is deprecated.
unsigned gamemap_x_offset
The offset between the left edge of the screen and the gamemap.
unsigned gamemap_width
The size of the map area, if not available equal to the screen size.
void get_screen_size_variables(wfl::map_formula_callable &variable)
Gets a formula object with the screen size.
color_t decode_color(const std::string &color)
Converts a color string to a color.
t_string missing_widget(const std::string &id)
Returns a default error message if a mandatory widget is omitted.
point get_mouse_position()
Returns the current mouse position.
std::string_view debug_truncate(std::string_view text)
Returns a truncated version of the text.
font::pango_text::FONT_STYLE decode_font_style(const std::string &style)
Converts a font style string to a font style.
PangoAlignment decode_text_alignment(const std::string &alignment)
Converts a text alignment string to a text alignment.
std::string encode_text_alignment(const PangoAlignment alignment)
Converts a text alignment to its string representation.
point get_mouse_location()
Returns the current mouse location in draw space.
Contains the SDL_Rect helper code.
This file contains the settings handling of the widget library.
The basic class for representing 8-bit RGB or RGBA colour values.
static color_t from_rgba_string(const std::string &c)
Creates a new color_t object from a string variable in "R,G,B,A" format.