15 #define GETTEXT_DOMAIN "wesnoth-lib"
58 return TTF_STYLE_BOLD;
59 }
else if(style ==
"italic") {
60 return TTF_STYLE_ITALIC;
61 }
else if(style ==
"underline") {
62 return TTF_STYLE_UNDERLINE;
63 }
else if(style.empty() || style ==
"normal") {
64 return TTF_STYLE_NORMAL;
67 ERR_GUI_G <<
"Unknown style '" << style <<
"' using 'normal' instead."
70 return TTF_STYLE_NORMAL;
78 while(fields.size() < 4)
79 fields.push_back(
"0");
82 for(
int i = 0;
i < 4; ++
i) {
86 result |= lexical_cast_default<int>(fields[
i]);
94 if(alignment ==
"center") {
95 return PANGO_ALIGN_CENTER;
96 }
else if(alignment ==
"right") {
97 return PANGO_ALIGN_RIGHT;
99 if(!alignment.empty() && alignment !=
"left") {
100 ERR_GUI_E <<
"Invalid text alignment '" << alignment
101 <<
"' falling back to 'left'.\n";
103 return PANGO_ALIGN_LEFT;
110 case PANGO_ALIGN_LEFT:
112 case PANGO_ALIGN_RIGHT:
114 case PANGO_ALIGN_CENTER:
120 throw "Control should not reach this point.";
129 vgettext(
"Mandatory widget '$id' hasn't been defined.", symbols));
152 SDL_GetMouseState(&x, &y);
159 return text.substr(0, 15);
Define the common log macros for the gui toolkit.
std::string encode_text_alignment(const PangoAlignment alignment)
Converts a text alignment to its string representation.
unsigned decode_font_style(const std::string &style)
Converts a font style string to a font style.
GLint GLint GLint GLint GLint GLint y
unsigned gamemap_width
The size of the map area, if not available equal to the screen size.
PangoAlignment decode_text_alignment(const std::string &alignment)
Converts a text alignment string to a text alignment.
SDL_Rect create_rect(const tpoint &origin, const tpoint &size)
Creates a rectangle.
A class inherited from ttext_box that displays its input as stars.
std::map< std::string, t_string > string_map
tpoint get_mouse_position()
Returns the current mouse position.
static size_t id
Ids for the timers.
bool init()
Initializes the gui subsystems.
unsigned gamemap_x_offset
The offset between the left edge of the screen and the gamemap.
std::string debug_truncate(const std::string &text)
Returns a truncated version of the text.
GLint GLint GLint GLint GLint x
unsigned screen_width
The screen resolution should be available for all widgets since their drawing method will depend on i...
boost::uint32_t decode_color(const std::string &color)
Converts a color string to a color.
SDL_Rect create_rect(const int x, const int y, const int w, const int h)
Creates an empty SDL_Rect.
Contains the SDL_Rect helper code.
void load_settings()
Loads the setting for the theme.
std::vector< std::string > split(std::string const &val, const char c, const int flags)
Splits a (comma-)separated string into a vector of pieces.
void get_screen_size_variables(game_logic::map_formula_callable &variable)
Gets a formula object with the screen size.
GLsizei const GLcharARB ** string
t_string missing_widget(const std::string &id)
Returns a default error message if a mandatory widget is omitted.