15 #define GETTEXT_DOMAIN "wesnoth-lib" 31 {
"always", scrollbar_mode::ALWAYS_VISIBLE },
32 {
"never", scrollbar_mode::ALWAYS_INVISIBLE },
33 {
"auto", scrollbar_mode::AUTO_VISIBLE },
34 {
"initial_auto", scrollbar_mode::AUTO_VISIBLE_FIRST_RUN },
39 if(v_align ==
"top") {
41 }
else if(v_align ==
"bottom") {
44 if(!v_align.empty() && v_align !=
"center") {
45 ERR_GUI_E <<
"Invalid vertical alignment '" << v_align
46 <<
"' falling back to 'center'.\n";
54 if(h_align ==
"left") {
56 }
else if(h_align ==
"right") {
59 if(!h_align.empty() && h_align !=
"center") {
60 ERR_GUI_E <<
"Invalid horizontal alignment '" << h_align
61 <<
"' falling back to 'center'.\n";
67 unsigned get_border(
const std::vector<std::string>& borders)
70 for(
const auto & border : borders)
74 }
else if(border ==
"top") {
76 }
else if(border ==
"bottom") {
78 }
else if(border ==
"left") {
80 }
else if(border ==
"right") {
91 const unsigned v_flags =
get_v_align(cfg[
"vertical_alignment"]);
92 const unsigned h_flags =
get_h_align(cfg[
"horizontal_alignment"]);
95 if(cfg[
"vertical_grow"].to_bool()) {
98 if(!(cfg[
"vertical_alignment"]).empty()) {
99 ERR_GUI_P <<
"vertical_grow and vertical_alignment " 100 "can't be combined, alignment is ignored.\n";
106 if(cfg[
"horizontal_grow"].to_bool()) {
109 if(!(cfg[
"horizontal_alignment"]).empty()) {
110 ERR_GUI_P <<
"horizontal_grow and horizontal_alignment " 111 "can't be combined, alignment is ignored.\n";
122 if(scrollbar_mode.empty()) {
127 ERR_GUI_E <<
"Invalid scrollbar mode '" << scrollbar_mode <<
"'." 128 <<
"Falling back to 'initial_auto'." << std::endl;
138 const std::string&
id)
140 if(!retval_id.empty()) {
145 ERR_GUI_E <<
"Window builder: retval_id '" << retval_id
146 <<
"' is unknown.\n";
Define the common log macros for the gui toolkit.
static const unsigned BORDER_TOP
unsigned read_flags(const config &cfg)
Returns the placement/resize flags.
static const unsigned BORDER_ALL
unsigned get_border(const std::vector< std::string > &borders)
Returns the border flags.
int get_retval(const std::string &retval_id, const int retval, const std::string &id)
Returns the return value for a widget.
Definitions for the interface to Wesnoth Markup Language (WML).
static std::map< std::string, scrollbar_mode > scrollbar_mode_map
static const unsigned HORIZONTAL_ALIGN_RIGHT
static const unsigned BORDER_BOTTOM
static const unsigned VERTICAL_ALIGN_TOP
scrollbar_container::scrollbar_mode scrollbar_mode
static const unsigned BORDER_RIGHT
static const unsigned VERTICAL_ALIGN_CENTER
static const unsigned HORIZONTAL_ALIGN_CENTER
static const unsigned HORIZONTAL_GROW_SEND_TO_CLIENT
static const unsigned VERTICAL_GROW_SEND_TO_CLIENT
scrollbar_mode get_scrollbar_mode(const std::string &scrollbar_mode)
Returns the scrollbar mode flags.
unsigned get_v_align(const std::string &v_align)
Returns the vertical alignment.
static const unsigned VERTICAL_ALIGN_BOTTOM
static retval get_retval_by_id(const std::string &id)
Gets the retval for the default buttons.
std::vector< std::string > split(const config_attribute_value &val)
retval
Default window/dialog return values.
static const unsigned HORIZONTAL_ALIGN_LEFT
A config object defines a single node in a WML file, with access to child nodes.
unsigned get_h_align(const std::string &h_align)
Returns the horizontal alignment.
static const unsigned BORDER_LEFT
Contains the implementation details for lexical_cast and shouldn't be used directly.