Minor formatting improvements in GUI2.
These improvements are done in preparation to use clang format on the gui directory.
This commit is contained in:
parent
5fe1dbf883
commit
2cc2f3b248
27 changed files with 269 additions and 277 deletions
|
@ -299,14 +299,6 @@ private:
|
|||
unsigned thickness_;
|
||||
};
|
||||
|
||||
tline::tline(const config& cfg)
|
||||
: x1_(cfg["x1"])
|
||||
, y1_(cfg["y1"])
|
||||
, x2_(cfg["x2"])
|
||||
, y2_(cfg["y2"])
|
||||
, color_(decode_color(cfg["color"]))
|
||||
, thickness_(cfg["thickness"])
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUICanvasWML
|
||||
*
|
||||
|
@ -335,10 +327,10 @@ tline::tline(const config& cfg)
|
|||
* width & unsigned & The width of the canvas. $
|
||||
* height & unsigned & The height of the canvas. $
|
||||
* text & tstring & The text to render on the widget. $
|
||||
* text_maximum_width & unsigned & The maximum width available for the text
|
||||
* on the widget. $
|
||||
* text_maximum_height & unsigned & The maximum height available for the text
|
||||
* on the widget. $
|
||||
* text_maximum_width & unsigned & The maximum width available for the
|
||||
* text on the widget. $
|
||||
* text_maximum_height & unsigned & The maximum height available for the
|
||||
* text on the widget. $
|
||||
* text_wrap_mode & int & When the text doesn't fit in the
|
||||
* available width there are several ways
|
||||
* to fix that. This variable holds the
|
||||
|
@ -363,11 +355,11 @@ tline::tline(const config& cfg)
|
|||
* gamemapx_offset & unsigned & The distance between left edge of the
|
||||
* screen and the game map. $
|
||||
* gamemap_width & unsigned & The usable width of the Wesnoth gamemap,
|
||||
* if no gamemap shown it's the same value as
|
||||
* screen_width. $
|
||||
* gamemap_height & unsigned & The usable height of the Wesnoth gamemap,
|
||||
* if no gamemap shown it's the same value as
|
||||
* screen_height. $
|
||||
* if no gamemap shown it's the same value
|
||||
* as screen_width. $
|
||||
* gamemap_height & unsigned & The usable height of the Wesnoth
|
||||
* gamemap, if no gamemap shown it's the
|
||||
* same value as screen_height. $
|
||||
*
|
||||
* mouse_x & unsigned & The x coordinate of the mouse pointer. $
|
||||
* mouse_y & unsigned & The y coordinate of the mouse pointer. $
|
||||
|
@ -469,7 +461,8 @@ tline::tline(const config& cfg)
|
|||
* boolean value. $
|
||||
* string & A text. $
|
||||
* tstring & A translatable string. $
|
||||
* f_tstring & Formula returning a translatable string. $
|
||||
* f_tstring & Formula returning a translatable string.
|
||||
* $
|
||||
* function & A string containing a set of function
|
||||
* definition for the formula language. $
|
||||
*
|
||||
|
@ -479,7 +472,8 @@ tline::tline(const config& cfg)
|
|||
* component, green component, blue
|
||||
* component and alpha. A color of 0 is not
|
||||
* available. An alpha of 255 is fully
|
||||
* transparent. Omitted values are set to 0. $
|
||||
* transparent. Omitted values are set to
|
||||
* 0. $
|
||||
*
|
||||
* font_style & A string which contains the style of the
|
||||
* font:
|
||||
|
@ -618,6 +612,14 @@ tline::tline(const config& cfg)
|
|||
* @end{table}
|
||||
*/
|
||||
|
||||
tline::tline(const config& cfg)
|
||||
: x1_(cfg["x1"])
|
||||
, y1_(cfg["y1"])
|
||||
, x2_(cfg["x2"])
|
||||
, y2_(cfg["y2"])
|
||||
, color_(decode_color(cfg["color"]))
|
||||
, thickness_(cfg["thickness"])
|
||||
{
|
||||
const std::string& debug = (cfg["debug"]);
|
||||
if(!debug.empty()) {
|
||||
DBG_GUI_P << "Line: found debug message '" << debug << "'.\n";
|
||||
|
@ -714,15 +716,6 @@ private:
|
|||
Uint32 fill_color_;
|
||||
};
|
||||
|
||||
trectangle::trectangle(const config& cfg)
|
||||
: x_(cfg["x"])
|
||||
, y_(cfg["y"])
|
||||
, w_(cfg["w"])
|
||||
, h_(cfg["h"])
|
||||
, border_thickness_(cfg["border_thickness"])
|
||||
, border_color_(decode_color(cfg["border_color"]))
|
||||
, fill_color_(decode_color(cfg["fill_color"]))
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUICanvasWML
|
||||
*
|
||||
|
@ -735,8 +728,10 @@ trectangle::trectangle(const config& cfg)
|
|||
*
|
||||
* Keys:
|
||||
* @begin{table}{config}
|
||||
* x & f_unsigned & 0 & The x coordinate of the top left corner. $
|
||||
* y & f_unsigned & 0 & The y coordinate of the top left corner. $
|
||||
* x & f_unsigned & 0 & The x coordinate of the top left corner.
|
||||
* $
|
||||
* y & f_unsigned & 0 & The y coordinate of the top left corner.
|
||||
* $
|
||||
* w & f_unsigned & 0 & The width of the rectangle. $
|
||||
* h & f_unsigned & 0 & The height of the rectangle. $
|
||||
* border_thickness & unsigned & 0 &
|
||||
|
@ -754,6 +749,15 @@ trectangle::trectangle(const config& cfg)
|
|||
* See [[#general_variables|Line]].
|
||||
*
|
||||
*/
|
||||
trectangle::trectangle(const config& cfg)
|
||||
: x_(cfg["x"])
|
||||
, y_(cfg["y"])
|
||||
, w_(cfg["w"])
|
||||
, h_(cfg["h"])
|
||||
, border_thickness_(cfg["border_thickness"])
|
||||
, border_color_(decode_color(cfg["border_color"]))
|
||||
, fill_color_(decode_color(cfg["fill_color"]))
|
||||
{
|
||||
if(border_color_ == 0) {
|
||||
border_thickness_ = 0;
|
||||
}
|
||||
|
@ -860,12 +864,6 @@ private:
|
|||
|
||||
};
|
||||
|
||||
tcircle::tcircle(const config& cfg)
|
||||
: x_(cfg["x"])
|
||||
, y_(cfg["y"])
|
||||
, radius_(cfg["radius"])
|
||||
, color_(decode_color(cfg["color"]))
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUICanvasWML
|
||||
*
|
||||
|
@ -893,7 +891,12 @@ tcircle::tcircle(const config& cfg)
|
|||
* Drawing outside the area will result in unpredictable results including
|
||||
* crashing. (That should be fixed, when encountered.)
|
||||
*/
|
||||
|
||||
tcircle::tcircle(const config& cfg)
|
||||
: x_(cfg["x"])
|
||||
, y_(cfg["y"])
|
||||
, radius_(cfg["radius"])
|
||||
, color_(decode_color(cfg["color"]))
|
||||
{
|
||||
const std::string& debug = (cfg["debug"]);
|
||||
if(!debug.empty()) {
|
||||
DBG_GUI_P << "Circle: found debug message '" << debug << "'.\n";
|
||||
|
@ -1011,17 +1014,6 @@ private:
|
|||
tformula<bool> vertical_mirror_;
|
||||
};
|
||||
|
||||
timage::timage(const config& cfg)
|
||||
: x_(cfg["x"])
|
||||
, y_(cfg["y"])
|
||||
, w_(cfg["w"])
|
||||
, h_(cfg["h"])
|
||||
, src_clip_()
|
||||
, image_()
|
||||
, image_name_(cfg["name"])
|
||||
, resize_mode_(get_resize_mode(cfg["resize_mode"]))
|
||||
, vertical_mirror_(cfg["vertical_mirror"])
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUICanvasWML
|
||||
*
|
||||
|
@ -1031,8 +1023,10 @@ timage::timage(const config& cfg)
|
|||
*
|
||||
* Keys:
|
||||
* @begin{table}{config}
|
||||
* x & f_unsigned & 0 & The x coordinate of the top left corner. $
|
||||
* y & f_unsigned & 0 & The y coordinate of the top left corner. $
|
||||
* x & f_unsigned & 0 & The x coordinate of the top left corner.
|
||||
* $
|
||||
* y & f_unsigned & 0 & The y coordinate of the top left corner.
|
||||
* $
|
||||
* w & f_unsigned & 0 & The width of the image, if not zero the
|
||||
* image will be scaled to the desired
|
||||
* width. $
|
||||
|
@ -1043,7 +1037,8 @@ timage::timage(const config& cfg)
|
|||
* Determines how an image is scaled to fit
|
||||
* the wanted size. $
|
||||
* vertical_mirror & f_bool & false &
|
||||
* Mirror the image over the vertical axis. $
|
||||
* Mirror the image over the vertical axis.
|
||||
* $
|
||||
* name & f_string & "" & The name of the image. $
|
||||
* debug & string & "" & Debug message to show upon creation
|
||||
* this message is not stored. $
|
||||
|
@ -1075,7 +1070,17 @@ timage::timage(const config& cfg)
|
|||
* @end{table}
|
||||
* Also the general variables are available, see [[#general_variables|Line]].
|
||||
*/
|
||||
|
||||
timage::timage(const config& cfg)
|
||||
: x_(cfg["x"])
|
||||
, y_(cfg["y"])
|
||||
, w_(cfg["w"])
|
||||
, h_(cfg["h"])
|
||||
, src_clip_()
|
||||
, image_()
|
||||
, image_name_(cfg["name"])
|
||||
, resize_mode_(get_resize_mode(cfg["resize_mode"]))
|
||||
, vertical_mirror_(cfg["vertical_mirror"])
|
||||
{
|
||||
const std::string& debug = (cfg["debug"]);
|
||||
if(!debug.empty()) {
|
||||
DBG_GUI_P << "Image: found debug message '" << debug << "'.\n";
|
||||
|
@ -1297,22 +1302,6 @@ private:
|
|||
tformula<int> maximum_height_;
|
||||
};
|
||||
|
||||
ttext::ttext(const config& cfg)
|
||||
: x_(cfg["x"])
|
||||
, y_(cfg["y"])
|
||||
, w_(cfg["w"])
|
||||
, h_(cfg["h"])
|
||||
, font_size_(cfg["font_size"])
|
||||
, font_style_(decode_font_style(cfg["font_style"]))
|
||||
, text_alignment_(cfg["text_alignment"])
|
||||
, color_(decode_color(cfg["color"]))
|
||||
, text_(cfg["text"])
|
||||
, text_markup_(cfg["text_markup"], false)
|
||||
, maximum_width_(cfg["maximum_width"], -1)
|
||||
, characters_per_line_(cfg["text_characters_per_line"])
|
||||
, maximum_height_(cfg["maximum_height"], -1)
|
||||
{
|
||||
|
||||
/*WIKI
|
||||
* @page = GUICanvasWML
|
||||
*
|
||||
|
@ -1322,8 +1311,9 @@ ttext::ttext(const config& cfg)
|
|||
*
|
||||
* Keys:
|
||||
* @begin{table}{config}
|
||||
* x & f_unsigned & 0 & The x coordinate of the top left corner. $
|
||||
* y & f_unsigned & 0 & The y coordinate of the top left corner. $
|
||||
* x & f_unsigned & 0 & The x coordinate of the top left corner.
|
||||
* $
|
||||
* y & f_unsigned & 0 & The y coordinate of the top left corner.
|
||||
* w & f_unsigned & 0 & The width of the text's bounding
|
||||
* rectangle. $
|
||||
* h & f_unsigned & 0 & The height of the text's bounding
|
||||
|
@ -1357,6 +1347,21 @@ ttext::ttext(const config& cfg)
|
|||
* @end{parent}{name="generic/state/draw/"}
|
||||
*/
|
||||
|
||||
ttext::ttext(const config& cfg)
|
||||
: x_(cfg["x"])
|
||||
, y_(cfg["y"])
|
||||
, w_(cfg["w"])
|
||||
, h_(cfg["h"])
|
||||
, font_size_(cfg["font_size"])
|
||||
, font_style_(decode_font_style(cfg["font_style"]))
|
||||
, text_alignment_(cfg["text_alignment"])
|
||||
, color_(decode_color(cfg["color"]))
|
||||
, text_(cfg["text"])
|
||||
, text_markup_(cfg["text_markup"], false)
|
||||
, maximum_width_(cfg["maximum_width"], -1)
|
||||
, characters_per_line_(cfg["text_characters_per_line"])
|
||||
, maximum_height_(cfg["maximum_height"], -1)
|
||||
{
|
||||
VALIDATE(font_size_, _("Text has a font size of 0."));
|
||||
|
||||
const std::string& debug = (cfg["debug"]);
|
||||
|
@ -1553,6 +1558,7 @@ void tcanvas::parse_cfg(const config& cfg)
|
|||
/***** ***** ***** ***** ***** SHAPE ***** ***** ***** ***** *****/
|
||||
|
||||
} // namespace gui2
|
||||
|
||||
/*WIKI
|
||||
* @page = GUICanvasWML
|
||||
* @order = ZZZZZZ_footer
|
||||
|
|
|
@ -23,21 +23,6 @@
|
|||
|
||||
namespace gui2 {
|
||||
|
||||
tresolution_definition_::tresolution_definition_(const config& cfg)
|
||||
: window_width(cfg["window_width"])
|
||||
, window_height(cfg["window_height"])
|
||||
, min_width(cfg["min_width"])
|
||||
, min_height(cfg["min_height"])
|
||||
, default_width(cfg["default_width"])
|
||||
, default_height(cfg["default_height"])
|
||||
, max_width(cfg["max_width"])
|
||||
, max_height(cfg["max_height"])
|
||||
, text_extra_width(cfg["text_extra_width"])
|
||||
, text_extra_height(cfg["text_extra_height"])
|
||||
, text_font_size(cfg["text_font_size"])
|
||||
, text_font_style(decode_font_style(cfg["text_font_style"]))
|
||||
, state()
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIToolkitWML
|
||||
* @order = 1_widget
|
||||
|
@ -100,15 +85,25 @@ tresolution_definition_::tresolution_definition_(const config& cfg)
|
|||
* @end{parent}{name=generic/widget_definition/}
|
||||
*/
|
||||
|
||||
tresolution_definition_::tresolution_definition_(const config& cfg)
|
||||
: window_width(cfg["window_width"])
|
||||
, window_height(cfg["window_height"])
|
||||
, min_width(cfg["min_width"])
|
||||
, min_height(cfg["min_height"])
|
||||
, default_width(cfg["default_width"])
|
||||
, default_height(cfg["default_height"])
|
||||
, max_width(cfg["max_width"])
|
||||
, max_height(cfg["max_height"])
|
||||
, text_extra_width(cfg["text_extra_width"])
|
||||
, text_extra_height(cfg["text_extra_height"])
|
||||
, text_font_size(cfg["text_font_size"])
|
||||
, text_font_style(decode_font_style(cfg["text_font_style"]))
|
||||
, state()
|
||||
{
|
||||
DBG_GUI_P << "Parsing resolution "
|
||||
<< window_width << ", " << window_height << '\n';
|
||||
}
|
||||
|
||||
tcontrol_definition::tcontrol_definition(const config& cfg)
|
||||
: id(cfg["id"])
|
||||
, description(cfg["description"].t_str())
|
||||
, resolutions()
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1
|
||||
|
@ -132,7 +127,11 @@ tcontrol_definition::tcontrol_definition(const config& cfg)
|
|||
* @end{tag}{name=widget_definition}
|
||||
* @end{parent}{name="generic/"}
|
||||
*/
|
||||
|
||||
tcontrol_definition::tcontrol_definition(const config& cfg)
|
||||
: id(cfg["id"])
|
||||
, description(cfg["description"].t_str())
|
||||
, resolutions()
|
||||
{
|
||||
VALIDATE(!id.empty(), missing_mandatory_wml_key("control", "id"));
|
||||
VALIDATE(!description.empty()
|
||||
, missing_mandatory_wml_key("control", "description"));
|
||||
|
|
|
@ -28,9 +28,6 @@ tbutton_definition::tbutton_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
tbutton_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_button
|
||||
|
@ -59,7 +56,9 @@ tbutton_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="button_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
|
||||
tbutton_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
{
|
||||
// Note the order should be the same as the enum tstate in button.hpp.
|
||||
state.push_back(tstate_definition(cfg.child("state_enabled")));
|
||||
state.push_back(tstate_definition(cfg.child("state_disabled")));
|
||||
|
|
|
@ -28,9 +28,6 @@ tdrawing_definition::tdrawing_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
tdrawing_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_drawing
|
||||
|
@ -55,6 +52,9 @@ tdrawing_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="drawing_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
tdrawing_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
{
|
||||
/*
|
||||
* Note the order should be the same as the enum tstate in drawing.hpp.
|
||||
* Normally the [draw] section is in the config, but for this widget the
|
||||
|
|
|
@ -30,13 +30,6 @@ thorizontal_scrollbar_definition::
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
thorizontal_scrollbar_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, minimum_positioner_length(cfg["minimum_positioner_length"])
|
||||
, maximum_positioner_length(cfg["maximum_positioner_length"])
|
||||
, left_offset(cfg["left_offset"])
|
||||
, right_offset(cfg["right_offset"])
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_vertical_scrollbar
|
||||
|
@ -85,7 +78,13 @@ thorizontal_scrollbar_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="horizontal_scrollbar_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
|
||||
thorizontal_scrollbar_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, minimum_positioner_length(cfg["minimum_positioner_length"])
|
||||
, maximum_positioner_length(cfg["maximum_positioner_length"])
|
||||
, left_offset(cfg["left_offset"])
|
||||
, right_offset(cfg["right_offset"])
|
||||
{
|
||||
VALIDATE(
|
||||
minimum_positioner_length
|
||||
, missing_mandatory_wml_key(
|
||||
|
|
|
@ -28,9 +28,6 @@ timage_definition::timage_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
timage_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_image
|
||||
|
@ -54,6 +51,9 @@ timage_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="image_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
timage_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
{
|
||||
// Note the order should be the same as the enum tstate in image.hpp.
|
||||
state.push_back(tstate_definition(cfg.child("state_enabled")));
|
||||
}
|
||||
|
|
|
@ -28,10 +28,6 @@ tlabel_definition::tlabel_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
|
||||
tlabel_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_label
|
||||
|
@ -58,6 +54,9 @@ tlabel_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="label_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
tlabel_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
{
|
||||
// Note the order should be the same as the enum tstate is label.hpp.
|
||||
state.push_back(tstate_definition(cfg.child("state_enabled")));
|
||||
state.push_back(tstate_definition(cfg.child("state_disabled")));
|
||||
|
|
|
@ -30,10 +30,6 @@ tlistbox_definition::tlistbox_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
tlistbox_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, grid(NULL)
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_listbox
|
||||
|
@ -107,6 +103,10 @@ tlistbox_definition::tresolution::tresolution(const config& cfg)
|
|||
* @macro = horizontal_listbox_description
|
||||
* The definition of a horizontal listbox is the same as for a normal listbox.
|
||||
*/
|
||||
tlistbox_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, grid(NULL)
|
||||
{
|
||||
// Note the order should be the same as the enum tstate in listbox.hpp.
|
||||
state.push_back(tstate_definition(cfg.child("state_enabled")));
|
||||
state.push_back(tstate_definition(cfg.child("state_disabled")));
|
||||
|
|
|
@ -28,9 +28,6 @@ tminimap_definition::tminimap_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
tminimap_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_minimap
|
||||
|
@ -50,6 +47,9 @@ tminimap_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="minimap_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
tminimap_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
{
|
||||
// Note the order should be the same as the enum tstate in minimap.hpp.
|
||||
state.push_back(tstate_definition(cfg.child("state_enabled")));
|
||||
}
|
||||
|
|
|
@ -30,10 +30,6 @@ tmulti_page_definition::tmulti_page_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
tmulti_page_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, grid(NULL)
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_multi_page
|
||||
|
@ -55,7 +51,10 @@ tmulti_page_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{parent}{name="gui/"}
|
||||
* A multipage has no states.
|
||||
*/
|
||||
|
||||
tmulti_page_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, grid(NULL)
|
||||
{
|
||||
const config &child = cfg.child("grid");
|
||||
VALIDATE(child, _("No grid defined."));
|
||||
|
||||
|
|
|
@ -28,13 +28,6 @@ tpanel_definition::tpanel_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
tpanel_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, top_border(cfg["top_border"])
|
||||
, bottom_border(cfg["bottom_border"])
|
||||
, left_border(cfg["left_border"])
|
||||
, right_border(cfg["right_border"])
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_panel
|
||||
|
@ -73,7 +66,13 @@ tpanel_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="panel_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
|
||||
tpanel_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, top_border(cfg["top_border"])
|
||||
, bottom_border(cfg["bottom_border"])
|
||||
, left_border(cfg["left_border"])
|
||||
, right_border(cfg["right_border"])
|
||||
{
|
||||
// The panel needs to know the order.
|
||||
state.push_back(tstate_definition(cfg.child("background")));
|
||||
state.push_back(tstate_definition(cfg.child("foreground")));
|
||||
|
|
|
@ -28,9 +28,6 @@ tprogress_bar_definition::tprogress_bar_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
tprogress_bar_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_progress_bar
|
||||
|
@ -53,7 +50,9 @@ tprogress_bar_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="progress_bar_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
|
||||
tprogress_bar_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
{
|
||||
// Note the order should be the same as the enum tstate in progress_bar.hpp.
|
||||
state.push_back(tstate_definition(cfg.child("state_enabled")));
|
||||
}
|
||||
|
|
|
@ -28,9 +28,6 @@ trepeating_button_definition::trepeating_button_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
trepeating_button_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_repeating_button
|
||||
|
@ -59,6 +56,9 @@ trepeating_button_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="repeating_button_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
trepeating_button_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
{
|
||||
// Note the order should be the same as the enum tstate in
|
||||
// repeating_button.hpp.
|
||||
state.push_back(tstate_definition(cfg.child("state_enabled")));
|
||||
|
|
|
@ -30,10 +30,6 @@ tscroll_label_definition::tscroll_label_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
tscroll_label_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, grid(NULL)
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_scroll_label
|
||||
|
@ -76,6 +72,10 @@ tscroll_label_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="scroll_label_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
tscroll_label_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, grid(NULL)
|
||||
{
|
||||
// Note the order should be the same as the enum tstate is scroll_label.hpp.
|
||||
state.push_back(tstate_definition(cfg.child("state_enabled")));
|
||||
state.push_back(tstate_definition(cfg.child("state_disabled")));
|
||||
|
|
|
@ -30,10 +30,6 @@ tscrollbar_panel_definition::tscrollbar_panel_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
tscrollbar_panel_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, grid()
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_scrollbar_panel
|
||||
|
@ -59,6 +55,10 @@ tscrollbar_panel_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="scrollbar_panel_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
tscrollbar_panel_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, grid()
|
||||
{
|
||||
// The panel needs to know the order.
|
||||
state.push_back(tstate_definition(cfg.child("background")));
|
||||
state.push_back(tstate_definition(cfg.child("foreground")));
|
||||
|
|
|
@ -29,13 +29,6 @@ tslider_definition::tslider_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
tslider_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, minimum_positioner_length(cfg["minimum_positioner_length"])
|
||||
, maximum_positioner_length(cfg["maximum_positioner_length"])
|
||||
, left_offset(cfg["left_offset"])
|
||||
, right_offset(cfg["right_offset"])
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_slider
|
||||
|
@ -83,6 +76,13 @@ tslider_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="slider_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
tslider_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, minimum_positioner_length(cfg["minimum_positioner_length"])
|
||||
, maximum_positioner_length(cfg["maximum_positioner_length"])
|
||||
, left_offset(cfg["left_offset"])
|
||||
, right_offset(cfg["right_offset"])
|
||||
{
|
||||
VALIDATE(minimum_positioner_length
|
||||
, missing_mandatory_wml_key(
|
||||
"resolution"
|
||||
|
|
|
@ -28,9 +28,6 @@ tspacer_definition::tspacer_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
tspacer_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_spacer
|
||||
|
@ -45,6 +42,9 @@ tspacer_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="spacer_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
tspacer_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace gui2
|
||||
|
|
|
@ -30,10 +30,6 @@ tstacked_widget_definition::tstacked_widget_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
tstacked_widget_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, grid(NULL)
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_stacked_widget
|
||||
|
@ -54,7 +50,10 @@ tstacked_widget_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="stacked_widget_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
|
||||
tstacked_widget_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, grid(NULL)
|
||||
{
|
||||
// Add a dummy state since every widget needs a state.
|
||||
static config dummy ("draw");
|
||||
state.push_back(tstate_definition(dummy));
|
||||
|
|
|
@ -28,11 +28,6 @@ ttext_box_definition::ttext_box_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
ttext_box_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, text_x_offset(cfg["text_x_offset"])
|
||||
, text_y_offset(cfg["text_y_offset"])
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_text_box
|
||||
|
@ -69,6 +64,11 @@ ttext_box_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="text_box_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
ttext_box_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, text_x_offset(cfg["text_x_offset"])
|
||||
, text_y_offset(cfg["text_y_offset"])
|
||||
{
|
||||
// Note the order should be the same as the enum tstate in text_box.hpp.
|
||||
state.push_back(tstate_definition(cfg.child("state_enabled")));
|
||||
state.push_back(tstate_definition(cfg.child("state_disabled")));
|
||||
|
|
|
@ -28,9 +28,6 @@ ttoggle_button_definition::ttoggle_button_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
ttoggle_button_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_toggle_button
|
||||
|
@ -66,7 +63,9 @@ ttoggle_button_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="toggle_button_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
|
||||
ttoggle_button_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
{
|
||||
// Note the order should be the same as the enum tstate in
|
||||
// toggle_button.hpp.
|
||||
state.push_back(tstate_definition(cfg.child("state_enabled")));
|
||||
|
|
|
@ -28,13 +28,6 @@ ttoggle_panel_definition::ttoggle_panel_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
ttoggle_panel_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, top_border(cfg["top_border"])
|
||||
, bottom_border(cfg["bottom_border"])
|
||||
, left_border(cfg["left_border"])
|
||||
, right_border(cfg["right_border"])
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_toggle_panel
|
||||
|
@ -84,6 +77,13 @@ ttoggle_panel_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="toggle_panel_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
ttoggle_panel_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, top_border(cfg["top_border"])
|
||||
, bottom_border(cfg["bottom_border"])
|
||||
, left_border(cfg["left_border"])
|
||||
, right_border(cfg["right_border"])
|
||||
{
|
||||
// Note the order should be the same as the enum tstate in toggle_panel.hpp.
|
||||
state.push_back(tstate_definition(cfg.child("state_enabled")));
|
||||
state.push_back(tstate_definition(cfg.child("state_disabled")));
|
||||
|
|
|
@ -30,10 +30,6 @@ ttree_view_definition::ttree_view_definition(const config& cfg)
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
ttree_view_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, grid(NULL)
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_tree_view
|
||||
|
@ -59,7 +55,10 @@ ttree_view_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="tree_view_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
|
||||
ttree_view_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, grid(NULL)
|
||||
{
|
||||
// Note the order should be the same as the enum tstate is listbox.hpp.
|
||||
state.push_back(tstate_definition(cfg.child("state_enabled")));
|
||||
state.push_back(tstate_definition(cfg.child("state_disabled")));
|
||||
|
|
|
@ -30,13 +30,6 @@ tvertical_scrollbar_definition::tvertical_scrollbar_definition(
|
|||
load_resolutions<tresolution>(cfg);
|
||||
}
|
||||
|
||||
tvertical_scrollbar_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, minimum_positioner_length(cfg["minimum_positioner_length"])
|
||||
, maximum_positioner_length(cfg["maximum_positioner_length"])
|
||||
, top_offset(cfg["top_offset"])
|
||||
, bottom_offset(cfg["bottom_offset"])
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_vertical_scrollbar
|
||||
|
@ -85,7 +78,13 @@ tvertical_scrollbar_definition::tresolution::tresolution(const config& cfg)
|
|||
* @end{tag}{name="vertical_scrollbar_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
|
||||
tvertical_scrollbar_definition::tresolution::tresolution(const config& cfg)
|
||||
: tresolution_definition_(cfg)
|
||||
, minimum_positioner_length(cfg["minimum_positioner_length"])
|
||||
, maximum_positioner_length(cfg["maximum_positioner_length"])
|
||||
, top_offset(cfg["top_offset"])
|
||||
, bottom_offset(cfg["bottom_offset"])
|
||||
{
|
||||
VALIDATE(minimum_positioner_length
|
||||
, missing_mandatory_wml_key(
|
||||
"resolution"
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
|
||||
namespace gui2 {
|
||||
|
||||
twindow_definition::twindow_definition(const config& cfg)
|
||||
: tcontrol_definition(cfg)
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIWidgetDefinitionWML
|
||||
* @order = 1_window
|
||||
|
@ -42,7 +39,9 @@ twindow_definition::twindow_definition(const config& cfg)
|
|||
* @end{tag}{name="window_definition"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
|
||||
twindow_definition::twindow_definition(const config& cfg)
|
||||
: tcontrol_definition(cfg)
|
||||
{
|
||||
DBG_GUI_P << "Parsing window " << id << '\n';
|
||||
|
||||
load_resolutions<tresolution>(cfg);
|
||||
|
|
|
@ -224,8 +224,6 @@ tbuilder_widget_ptr create_builder_widget(const config& cfg)
|
|||
ERROR_LOG(false);
|
||||
}
|
||||
|
||||
const std::string& twindow_builder::read(const config& cfg)
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIToolkitWML
|
||||
* @order = 1_window
|
||||
|
@ -247,7 +245,8 @@ const std::string& twindow_builder::read(const config& cfg)
|
|||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const std::string& twindow_builder::read(const config& cfg)
|
||||
{
|
||||
id_ = cfg["id"].str();
|
||||
description_ = cfg["description"].str();
|
||||
|
||||
|
@ -265,29 +264,6 @@ const std::string& twindow_builder::read(const config& cfg)
|
|||
return id_;
|
||||
}
|
||||
|
||||
twindow_builder::tresolution::tresolution(const config& cfg) :
|
||||
window_width(cfg["window_width"]),
|
||||
window_height(cfg["window_height"]),
|
||||
automatic_placement(cfg["automatic_placement"].to_bool(true)),
|
||||
x(cfg["x"]),
|
||||
y(cfg["y"]),
|
||||
width(cfg["width"]),
|
||||
height(cfg["height"]),
|
||||
reevaluate_best_size(cfg["reevaluate_best_size"]),
|
||||
functions(),
|
||||
vertical_placement(
|
||||
implementation::get_v_align(cfg["vertical_placement"])),
|
||||
horizontal_placement(
|
||||
implementation::get_h_align(cfg["horizontal_placement"])),
|
||||
maximum_width(cfg["maximum_width"]),
|
||||
maximum_height(cfg["maximum_height"]),
|
||||
click_dismiss(cfg["click_dismiss"].to_bool()),
|
||||
definition(cfg["definition"]),
|
||||
linked_groups(),
|
||||
tooltip(cfg.child_or_empty("tooltip")),
|
||||
helptip(cfg.child_or_empty("helptip")),
|
||||
grid(0)
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIToolkitWML
|
||||
* @order = 1_window
|
||||
|
@ -392,7 +368,29 @@ twindow_builder::tresolution::tresolution(const config& cfg) :
|
|||
* @end{tag}{name="helptip"}
|
||||
* @end{parent}{name=gui/window/resolution/}
|
||||
*/
|
||||
|
||||
twindow_builder::tresolution::tresolution(const config& cfg) :
|
||||
window_width(cfg["window_width"]),
|
||||
window_height(cfg["window_height"]),
|
||||
automatic_placement(cfg["automatic_placement"].to_bool(true)),
|
||||
x(cfg["x"]),
|
||||
y(cfg["y"]),
|
||||
width(cfg["width"]),
|
||||
height(cfg["height"]),
|
||||
reevaluate_best_size(cfg["reevaluate_best_size"]),
|
||||
functions(),
|
||||
vertical_placement(
|
||||
implementation::get_v_align(cfg["vertical_placement"])),
|
||||
horizontal_placement(
|
||||
implementation::get_h_align(cfg["horizontal_placement"])),
|
||||
maximum_width(cfg["maximum_width"]),
|
||||
maximum_height(cfg["maximum_height"]),
|
||||
click_dismiss(cfg["click_dismiss"].to_bool()),
|
||||
definition(cfg["definition"]),
|
||||
linked_groups(),
|
||||
tooltip(cfg.child_or_empty("tooltip")),
|
||||
helptip(cfg.child_or_empty("helptip")),
|
||||
grid(0)
|
||||
{
|
||||
if(!cfg["functions"].empty()) {
|
||||
game_logic::formula(cfg["functions"], &functions).evaluate();
|
||||
}
|
||||
|
@ -448,16 +446,6 @@ twindow_builder::tresolution::ttip::ttip(const config& cfg)
|
|||
, missing_mandatory_wml_key("[window][resolution][tip]", "id"));
|
||||
}
|
||||
|
||||
tbuilder_grid::tbuilder_grid(const config& cfg) :
|
||||
tbuilder_widget(cfg),
|
||||
rows(0),
|
||||
cols(0),
|
||||
row_grow_factor(),
|
||||
col_grow_factor(),
|
||||
flags(),
|
||||
border_size(),
|
||||
widgets()
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIToolkitWML
|
||||
* @order = 2_cell
|
||||
|
@ -520,6 +508,16 @@ tbuilder_grid::tbuilder_grid(const config& cfg) :
|
|||
* @end{parent}{name="gui/window/resolution/"}
|
||||
*
|
||||
*/
|
||||
tbuilder_grid::tbuilder_grid(const config& cfg) :
|
||||
tbuilder_widget(cfg),
|
||||
rows(0),
|
||||
cols(0),
|
||||
row_grow_factor(),
|
||||
col_grow_factor(),
|
||||
flags(),
|
||||
border_size(),
|
||||
widgets()
|
||||
{
|
||||
log_scope2(log_gui_parse, "Window builder: parsing a grid");
|
||||
|
||||
FOREACH(const AUTO& row, cfg.child_range("row")) {
|
||||
|
@ -629,6 +627,7 @@ void tbuilder_grid::build(tgrid& grid, const treplacements& replacements) const
|
|||
}
|
||||
|
||||
} // namespace gui2
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIToolkitWML
|
||||
* @order = ZZZZZZ_footer
|
||||
|
|
|
@ -71,7 +71,6 @@ twidget* tbuilder_drawing::build() const
|
|||
* @end{macro}
|
||||
*/
|
||||
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWidgetInstanceWML
|
||||
* @order = 2_drawing
|
||||
|
|
|
@ -156,8 +156,6 @@ private:
|
|||
std::vector<ttip> tips_;
|
||||
};
|
||||
|
||||
const std::string& tgui_definition::read(const config& cfg)
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIToolkitWML
|
||||
* @order = 1
|
||||
|
@ -268,44 +266,7 @@ const std::string& tgui_definition::read(const config& cfg)
|
|||
* @end{tag}{name=gui}
|
||||
* @end{parent}{name="/"}
|
||||
*/
|
||||
id = cfg["id"].str();
|
||||
description = cfg["description"];
|
||||
|
||||
VALIDATE(!id.empty(), missing_mandatory_wml_key("gui", "id"));
|
||||
VALIDATE(!description.empty(), missing_mandatory_wml_key("gui", "description"));
|
||||
|
||||
DBG_GUI_P << "Parsing gui " << id << '\n';
|
||||
|
||||
/***** Control definitions *****/
|
||||
|
||||
FOREACH(AUTO& widget_type, registred_widget_type()) {
|
||||
widget_type.second(*this, widget_type.first, cfg, NULL);
|
||||
}
|
||||
|
||||
/***** Window types *****/
|
||||
FOREACH(const AUTO& w, cfg.child_range("window")) {
|
||||
std::pair<std::string, twindow_builder> child;
|
||||
child.first = child.second.read(w);
|
||||
window_types.insert(child);
|
||||
}
|
||||
|
||||
if(id == "default") {
|
||||
// The default gui needs to define all window types since we're the
|
||||
// fallback in case another gui doesn't define the window type.
|
||||
for(std::vector<std::string>::const_iterator itor
|
||||
= registered_window_types().begin()
|
||||
; itor != registered_window_types().end()
|
||||
; ++itor) {
|
||||
|
||||
const std::string error_msg("Window not defined in WML: '" +
|
||||
*itor +
|
||||
"'. Perhaps a mismatch between data and source versions."
|
||||
" Try --data-dir <trunk-dir>" );
|
||||
VALIDATE(window_types.find(*itor) != window_types.end(), error_msg );
|
||||
}
|
||||
}
|
||||
|
||||
/***** settings *****/
|
||||
/*WIKI
|
||||
* @page = GUIToolkitWML
|
||||
* @order = 1
|
||||
|
@ -364,6 +325,46 @@ const std::string& tgui_definition::read(const config& cfg)
|
|||
* @end{tag}{name="tip"}
|
||||
* @end{parent}{name="gui/"}
|
||||
*/
|
||||
const std::string& tgui_definition::read(const config& cfg)
|
||||
{
|
||||
id = cfg["id"].str();
|
||||
description = cfg["description"];
|
||||
|
||||
VALIDATE(!id.empty(), missing_mandatory_wml_key("gui", "id"));
|
||||
VALIDATE(!description.empty(), missing_mandatory_wml_key("gui", "description"));
|
||||
|
||||
DBG_GUI_P << "Parsing gui " << id << '\n';
|
||||
|
||||
/***** Control definitions *****/
|
||||
|
||||
FOREACH(AUTO& widget_type, registred_widget_type()) {
|
||||
widget_type.second(*this, widget_type.first, cfg, NULL);
|
||||
}
|
||||
|
||||
/***** Window types *****/
|
||||
FOREACH(const AUTO& w, cfg.child_range("window")) {
|
||||
std::pair<std::string, twindow_builder> child;
|
||||
child.first = child.second.read(w);
|
||||
window_types.insert(child);
|
||||
}
|
||||
|
||||
if(id == "default") {
|
||||
// The default gui needs to define all window types since we're the
|
||||
// fallback in case another gui doesn't define the window type.
|
||||
for(std::vector<std::string>::const_iterator itor
|
||||
= registered_window_types().begin()
|
||||
; itor != registered_window_types().end()
|
||||
; ++itor) {
|
||||
|
||||
const std::string error_msg("Window not defined in WML: '" +
|
||||
*itor +
|
||||
"'. Perhaps a mismatch between data and source versions."
|
||||
" Try --data-dir <trunk-dir>" );
|
||||
VALIDATE(window_types.find(*itor) != window_types.end(), error_msg );
|
||||
}
|
||||
}
|
||||
|
||||
/***** settings *****/
|
||||
|
||||
/**
|
||||
* @todo Regarding sounds:
|
||||
|
@ -505,9 +506,6 @@ void load_settings()
|
|||
current_gui->second.activate();
|
||||
}
|
||||
|
||||
tstate_definition::tstate_definition(const config &cfg) :
|
||||
canvas()
|
||||
{
|
||||
/*WIKI
|
||||
* @page = GUIToolkitWML
|
||||
* @order = 1_widget
|
||||
|
@ -526,7 +524,9 @@ tstate_definition::tstate_definition(const config &cfg) :
|
|||
* @end{parent}{name="generic/"}
|
||||
*
|
||||
*/
|
||||
|
||||
tstate_definition::tstate_definition(const config &cfg) :
|
||||
canvas()
|
||||
{
|
||||
const config &draw = *(cfg ? &cfg.child("draw") : &cfg);
|
||||
|
||||
VALIDATE(draw, _("No state or draw section defined."));
|
||||
|
|
Loading…
Add table
Reference in a new issue