The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
window_builder.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2016 by Mark de Wever <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #define GETTEXT_DOMAIN "wesnoth-lib"
16 
18 
19 #include "asserts.hpp"
20 #include "gettext.hpp"
21 #include "gui/core/log.hpp"
24 #include "gui/widgets/button.hpp"
25 #include "gui/widgets/combobox.hpp"
26 #include "gui/widgets/drawing.hpp"
28 #include "gui/widgets/image.hpp"
29 #include "gui/widgets/label.hpp"
30 #include "gui/widgets/matrix.hpp"
31 #include "gui/widgets/minimap.hpp"
32 #include "gui/widgets/pane.hpp"
37 #include "gui/widgets/settings.hpp"
38 #include "gui/widgets/slider.hpp"
43 #include "gui/widgets/viewport.hpp"
44 #include "gui/widgets/window.hpp"
45 #include "formula/string_utils.hpp"
46 #include "wml_exception.hpp"
47 
48 #include "utils/functional.hpp"
49 
50 namespace gui2
51 {
52 
53 static std::map<std::string, std::function<tbuilder_widget_ptr(config)> >&
55 {
56  static std::map<std::string, std::function<tbuilder_widget_ptr(config)> >
57  result;
58  return result;
59 }
60 
61 /*WIKI
62  * @page = GUIWidgetInstanceWML
63  * @order = 1
64  *
65  * {{Autogenerated}}
66  *
67  * = Widget instance =
68  *
69  * Inside a grid (which is inside all container widgets) a widget is
70  * instantiated. With this instantiation some more variables of a widget can
71  * be tuned. This page will describe what can be tuned.
72  *
73  */
74 twindow* build(CVideo& video, const twindow_builder::tresolution* definition)
75 {
76  // We set the values from the definition since we can only determine the
77  // best size (if needed) after all widgets have been placed.
78  twindow* window = new twindow(video,
79  definition->x,
80  definition->y,
81  definition->width,
82  definition->height,
83  definition->reevaluate_best_size,
84  definition->functions,
85  definition->automatic_placement,
86  definition->horizontal_placement,
87  definition->vertical_placement,
88  definition->maximum_width,
89  definition->maximum_height,
90  definition->definition,
91  definition->tooltip,
92  definition->helptip);
93  assert(window);
94 
95  for(const auto & lg : definition->linked_groups)
96  {
97 
98  if(window->has_linked_size_group(lg.id)) {
99  utils::string_map symbols;
100  symbols["id"] = lg.id;
102  "Linked '$id' group has multiple definitions.", symbols);
103 
104  VALIDATE(false, msg);
105  }
106 
107  window->init_linked_size_group(lg.id, lg.fixed_width, lg.fixed_height);
108  }
109 
110  window->set_click_dismiss(definition->click_dismiss);
111 
113  conf = boost::dynamic_pointer_cast<const twindow_definition::tresolution>(
114  window->config());
115  assert(conf);
116 
117  if(conf->grid) {
118  window->init_grid(conf->grid);
119  window->finalize(definition->grid);
120  } else {
121  window->init_grid(definition->grid);
122  }
123 
124  window->add_to_keyboard_chain(window);
125 
126  return window;
127 }
128 
130 {
131  std::vector<twindow_builder::tresolution>::const_iterator definition
132  = get_window_builder(type);
133  twindow* window = build(video, &*definition);
134  window->set_id(type);
135  return window;
136 }
137 
139  : id(cfg["id"])
140  , linked_group(cfg["linked_group"])
141 #ifndef LOW_MEM
142  , debug_border_mode(cfg["debug_border_mode"])
143  , debug_border_color(decode_color(cfg["debug_border_color"]))
144 #endif
145 {
146 }
147 
148 void
150  std::function<tbuilder_widget_ptr(config)> functor)
151 {
152  builder_widget_lookup().insert(std::make_pair(id, functor));
153 }
154 
156 {
158  size_t nb_children = std::distance(children.first, children.second);
159  VALIDATE(nb_children == 1, "Grid cell does not have exactly 1 child.");
160 
161  for(const auto & item : builder_widget_lookup())
162  {
163  if(item.first == "window" || item.first == "tooltip") {
164  continue;
165  }
166  if(const config& c = cfg.child(item.first)) {
167  return item.second(c);
168  }
169  }
170 
171  if(const config& c = cfg.child("grid")) {
172  return new tbuilder_grid(c);
173  }
174 
175  if(const config& instance = cfg.child("instance")) {
176  return new implementation::tbuilder_instance(instance);
177  }
178 
179  if(const config& pane = cfg.child("pane")) {
180  return new implementation::tbuilder_pane(pane);
181  }
182 
183  if(const config& viewport = cfg.child("viewport")) {
184  return new implementation::tbuilder_viewport(viewport);
185  }
186 
187 /*
188  * This is rather odd, when commented out the classes no longer seem to be in
189  * the executable, no real idea why, except maybe of an overzealous optimizer
190  * while linking. It seems that all these classes aren't explicitly
191  * instantiated but only implicitly. Also when looking at the symbols in
192  * libwesnoth-game.a the repeating button is there regardless of this #if but
193  * in the final binary only if the #if is enabled.
194  *
195  * If this code is executed, which it will cause an assertion failure.
196  *
197  * Its likeley that this happens becasue some build this as a library file
198  * which is then used by the wesnoth executable. For msvc a good try to fix
199  * this issue is to add __pragma(comment(linker, "/include:" #TYPE)) or
200  * similar in the REGISTER_WIDGET3 macro. For gcc and similar this can only
201  * be fixed by using --whole-archive flag when linking this library.
202  */
203 #if 1
204 #define TRY(name) \
205  do { \
206  if(const config& c = cfg.child(#name)) { \
207  tbuilder_widget_ptr p = new implementation::tbuilder_##name(c); \
208  assert(false); \
209  } \
210  } while(0)
211 
212  TRY(stacked_widget);
213  TRY(scrollbar_panel);
214  TRY(horizontal_scrollbar);
215  TRY(repeating_button);
216  TRY(vertical_scrollbar);
217  TRY(label);
218  TRY(image);
219  TRY(toggle_button);
220  TRY(slider);
221  TRY(scroll_label);
222  TRY(matrix);
223  TRY(minimap);
224  TRY(button);
225  TRY(combobox);
226  TRY(drawing);
227  TRY(password_box);
228  TRY(unit_preview_pane);
229 #undef TRY
230 #endif
231 
232  std::cerr << cfg;
233  ERROR_LOG(false);
234 }
235 
236 /*WIKI
237  * @page = GUIToolkitWML
238  * @order = 1_window
239  * @begin{parent}{name="gui/"}
240  * = Window definition =
241  * @begin{tag}{name="window"}{min="0"}{max="-1"}
242  *
243  * A window defines how a window looks in the game.
244  *
245  * @begin{table}{config}
246  * id & string & & Unique id for this window. $
247  * description & t_string & & Unique translatable name for this
248  * window. $
249  *
250  * resolution & section & & The definitions of the window in various
251  * resolutions. $
252  * @end{table}
253  * @end{tag}{name="window"}
254  * @end{parent}{name="gui/"}
255  *
256  *
257  */
259 {
260  id_ = cfg["id"].str();
261  description_ = cfg["description"].str();
262 
263  VALIDATE(!id_.empty(), missing_mandatory_wml_key("window", "id"));
264  VALIDATE(!description_.empty(),
265  missing_mandatory_wml_key("window", "description"));
266 
267  DBG_GUI_P << "Window builder: reading data for window " << id_ << ".\n";
268 
269  config::const_child_itors cfgs = cfg.child_range("resolution");
270  VALIDATE(cfgs.first != cfgs.second, _("No resolution defined."));
271  for(const auto & i : cfgs)
272  {
273  resolutions.push_back(tresolution(i));
274  }
275 
276  return id_;
277 }
278 
279 /*WIKI
280  * @page = GUIToolkitWML
281  * @order = 1_window
282  * @begin{parent}{name=gui/window/}
283  * == Resolution ==
284  * @begin{tag}{name="resolution"}{min="0"}{max="-1"}
285  * @begin{table}{config}
286  * window_width & unsigned & 0 & Width of the application window. $
287  * window_height & unsigned & 0 & Height of the application window. $
288  *
289  *
290  * automatic_placement & bool & true &
291  * Automatically calculate the best size for the window and place it. If
292  * automatically placed ''vertical_placement'' and ''horizontal_placement''
293  * can be used to modify the final placement. If not automatically placed
294  * the ''width'' and ''height'' are mandatory. $
295  *
296  *
297  * x & f_unsigned & 0 & X coordinate of the window to show. $
298  * y & f_unsigned & 0 & Y coordinate of the window to show. $
299  * width & f_unsigned & 0 & Width of the window to show. $
300  * height & f_unsigned & 0 & Height of the window to show. $
301  *
302  * reevaluate_best_size & f_bool & false &
303  * The foo $
304  *
305  * functions & function & "" &
306  * The function definitions s available for the formula fields in window. $
307  *
308  * vertical_placement & v_align & "" &
309  * The vertical placement of the window. $
310  *
311  * horizontal_placement & h_align & "" &
312  * The horizontal placement of the window. $
313  *
314  *
315  * maximum_width & unsigned & 0 &
316  * The maximum width of the window (only used for automatic placement). $
317  *
318  * maximum_height & unsigned & 0 &
319  * The maximum height of the window (only used for automatic placement). $
320  *
321  *
322  * click_dismiss & bool & false &
323  * Does the window need click dismiss behavior? Click dismiss behavior
324  * means that any mouse click will close the dialog. Note certain widgets
325  * will automatically disable this behavior since they need to process the
326  * clicks as well, for example buttons do need a click and a misclick on
327  * button shouldn't close the dialog. NOTE with some widgets this behavior
328  * depends on their contents (like scrolling labels) so the behavior might
329  * get changed depending on the data in the dialog. NOTE the default
330  * behavior might be changed since it will be disabled when can't be used
331  * due to widgets which use the mouse, including buttons, so it might be
332  * wise to set the behavior explicitly when not wanted and no mouse using
333  * widgets are available. This means enter, escape or an external source
334  * needs to be used to close the dialog (which is valid). $
335  *
336  *
337  * definition & string & "default" &
338  * Definition of the window which we want to show. $
339  *
340  *
341  * linked_group & sections & [] & A group of linked widget sections. $
342  *
343  *
344  * tooltip & section & &
345  * Information regarding the tooltip for this window. $
346  *
347  * helptip & section & &
348  * Information regarding the helptip for this window. $
349  *
350  *
351  * grid & grid & & The grid with the widgets to show. $
352  * @end{table}
353  * @begin{tag}{name="linked_group"}{min=0}{max=-1}
354  * A linked_group section has the following fields:
355  * @begin{table}{config}
356  * id & string & & The unique id of the group (unique in this
357  * window). $
358  * fixed_width & bool & false & Should widget in this group have the same
359  * width. $
360  * fixed_height & bool & false & Should widget in this group have the same
361  * height. $
362  * @end{table}
363  * @end{tag}{name="linked_group"}
364  * A linked group needs to have at least one size fixed.
365  * @begin{tag}{name="tooltip"}{min=0}{max=1}
366  * A tooltip and helptip section have the following field:
367  * @begin{table}{config}
368  * id & string & & The id of the tip to show.
369  * Note more fields will probably be added later on.
370  * @end{table}{config}
371  * @end{tag}{name=tooltip}
372  * @begin{tag}{name="foreground"}{min=0}{max=1}
373  * @end{tag}{name="foreground"}
374  * @begin{tag}{name="background"}{min=0}{max=1}
375  * @end{tag}{name="background"}
376  * @end{tag}{name="resolution"}
377  * @end{parent}{name=gui/window/}
378  * @begin{parent}{name=gui/window/resolution/}
379  * @begin{tag}{name="helptip"}{min=0}{max=1}{super="gui/window/resolution/tooltip"}
380  * @end{tag}{name="helptip"}
381  * @end{parent}{name=gui/window/resolution/}
382  */
384  : window_width(cfg["window_width"])
385  , window_height(cfg["window_height"])
386  , automatic_placement(cfg["automatic_placement"].to_bool(true))
387  , x(cfg["x"])
388  , y(cfg["y"])
389  , width(cfg["width"])
390  , height(cfg["height"])
391  , reevaluate_best_size(cfg["reevaluate_best_size"])
392  , functions()
393  , vertical_placement(implementation::get_v_align(cfg["vertical_placement"]))
394  , horizontal_placement(
395  implementation::get_h_align(cfg["horizontal_placement"]))
396  , maximum_width(cfg["maximum_width"])
397  , maximum_height(cfg["maximum_height"])
398  , click_dismiss(cfg["click_dismiss"].to_bool())
399  , definition(cfg["definition"])
400  , linked_groups()
401  , tooltip(cfg.child_or_empty("tooltip"), "tooltip")
402  , helptip(cfg.child_or_empty("helptip"), "helptip")
403  , grid(0)
404 {
405  if(!cfg["functions"].empty()) {
406  game_logic::formula(cfg["functions"], &functions).evaluate();
407  }
408 
409  const config& c = cfg.child("grid");
410 
411  VALIDATE(c, _("No grid defined."));
412 
413  grid = new tbuilder_grid(c);
414 
415  if(!automatic_placement) {
416  VALIDATE(width.has_formula() || width(),
417  missing_mandatory_wml_key("resolution", "width"));
418  VALIDATE(height.has_formula() || height(),
419  missing_mandatory_wml_key("resolution", "height"));
420  }
421 
422  DBG_GUI_P << "Window builder: parsing resolution " << window_width << ','
423  << window_height << '\n';
424 
425  if(definition.empty()) {
426  definition = "default";
427  }
428 
429  for(const auto & lg : cfg.child_range("linked_group"))
430  {
431  tlinked_group linked_group;
432  linked_group.id = lg["id"].str();
433  linked_group.fixed_width = lg["fixed_width"].to_bool();
434  linked_group.fixed_height = lg["fixed_height"].to_bool();
435 
436  VALIDATE(!linked_group.id.empty(),
437  missing_mandatory_wml_key("linked_group", "id"));
438 
439  if(!(linked_group.fixed_width || linked_group.fixed_height)) {
440  utils::string_map symbols;
441  symbols["id"] = linked_group.id;
442  t_string msg
443  = vgettext("Linked '$id' group needs a 'fixed_width' or "
444  "'fixed_height' key.",
445  symbols);
446 
447  VALIDATE(false, msg);
448  }
449 
450  linked_groups.push_back(linked_group);
451  }
452 }
453 
454 twindow_builder::tresolution::ttip::ttip(const config& cfg, const std::string& tagname) : id(cfg["id"])
455 {
456  VALIDATE(!id.empty(),
457  missing_mandatory_wml_key("[window][resolution][" + tagname + "]", "id"));
458 }
459 
460 /*WIKI
461  * @page = GUIToolkitWML
462  * @order = 2_cell
463  * @begin{parent}{name="gui/window/resolution/"}
464  * = Cell =
465  * @begin{tag}{name="grid"}{min="1"}{max="1"}
466  * @begin{table}{config}
467  * id & string & "" & A grid is a widget and can have an id. This isn't
468  * used that often, but is allowed. $
469  * linked_group & string & 0 & $
470  * @end{table}
471  *
472  * Every grid cell has some cell configuration values and one widget in the grid
473  * cell. Here we describe the what is available more information about the usage
474  * can be found here [[GUILayout]].
475  *
476  * == Row values ==
477  * @begin{tag}{name="row"}{min="0"}{max="-1"}
478  * For every row the following variables are available:
479  *
480  * @begin{table}{config}
481  * grow_factor & unsigned & 0 & The grow factor for a row. $
482  * @end{table}
483  *
484  * == Cell values ==
485  * @begin{tag}{name="column"}{min="0"}{max="-1"}
486  * @allow{link}{name="gui/window/resolution/grid"}
487  * For every column the following variables are available:
488  * @begin{table}{config}
489  * grow_factor & unsigned & 0 & The grow factor for a column, this
490  * value is only read for the first row. $
491  *
492  * border_size & unsigned & 0 & The border size for this grid cell. $
493  * border & border & "" & Where to place the border in this grid
494  * cell. $
495  *
496  * vertical_alignment & v_align & "" &
497  * The vertical alignment of the widget in
498  * the grid cell. (This value is ignored if
499  * vertical_grow is true.) $
500  * horizontal_alignment & h_align & "" &
501  * The horizontal alignment of the widget in
502  * the grid cell.(This value is ignored if
503  * horizontal_grow is true.) $
504  *
505  * vertical_grow & bool & false & Does the widget grow in vertical
506  * direction when the grid cell grows in the
507  * vertical direction. This is used if the
508  * grid cell is wider as the best width for
509  * the widget. $
510  * horizontal_grow & bool & false & Does the widget grow in horizontal
511  * direction when the grid cell grows in the
512  * horizontal direction. This is used if the
513  * grid cell is higher as the best width for
514  * the widget. $
515  * @end{table}
516  * @end{tag}{name="column"}
517  * @end{tag}{name="row"}
518  * @end{tag}{name="grid"}
519  * @end{parent}{name="gui/window/resolution/"}
520  *
521  */
523  : tbuilder_widget(cfg)
524  , rows(0)
525  , cols(0)
526  , row_grow_factor()
527  , col_grow_factor()
528  , flags()
529  , border_size()
530  , widgets()
531 {
532  log_scope2(log_gui_parse, "Window builder: parsing a grid");
533 
534  for(const auto & row : cfg.child_range("row"))
535  {
536  unsigned col = 0;
537 
538  row_grow_factor.push_back(row["grow_factor"]);
539 
540  for(const auto & c : row.child_range("column"))
541  {
542  flags.push_back(implementation::read_flags(c));
543  border_size.push_back(c["border_size"]);
544  if(rows == 0) {
545  col_grow_factor.push_back(c["grow_factor"]);
546  }
547 
548  widgets.push_back(create_builder_widget(c));
549 
550  ++col;
551  }
552 
553  ++rows;
554  if(rows == 1) {
555  cols = col;
556  } else {
557  VALIDATE(col, _("A row must have a column."));
558  VALIDATE(col == cols, _("Number of columns differ."));
559  }
560  }
561 
562  DBG_GUI_P << "Window builder: grid has " << rows << " rows and " << cols
563  << " columns.\n";
564 }
565 
567 {
568  return build(new tgrid());
569 }
570 
571 twidget* tbuilder_grid::build(const treplacements& replacements) const
572 {
573  tgrid* result = new tgrid();
574  build(*result, replacements);
575  return result;
576 }
577 
579 {
580  grid->set_id(id);
582  grid->set_rows_cols(rows, cols);
583 
584  log_scope2(log_gui_general, "Window builder: building grid");
585 
586  DBG_GUI_G << "Window builder: grid '" << id << "' has " << rows
587  << " rows and " << cols << " columns.\n";
588 
589  for(unsigned x = 0; x < rows; ++x) {
591  for(unsigned y = 0; y < cols; ++y) {
592 
593  if(x == 0) {
595  }
596 
597  DBG_GUI_G << "Window builder: adding child at " << x << ',' << y
598  << ".\n";
599 
600  twidget* widget = widgets[x * cols + y]->build();
601  grid->set_child(widget,
602  x,
603  y,
604  flags[x * cols + y],
605  border_size[x * cols + y]);
606  }
607  }
608 
609  return grid;
610 }
611 
612 void tbuilder_grid::build(tgrid& grid, const treplacements& replacements) const
613 {
614  grid.set_id(id);
616  grid.set_rows_cols(rows, cols);
617 
618  log_scope2(log_gui_general, "Window builder: building grid");
619 
620  DBG_GUI_G << "Window builder: grid '" << id << "' has " << rows
621  << " rows and " << cols << " columns.\n";
622 
623  for(unsigned x = 0; x < rows; ++x) {
625  for(unsigned y = 0; y < cols; ++y) {
626 
627  if(x == 0) {
629  }
630 
631  DBG_GUI_G << "Window builder: adding child at " << x << ',' << y
632  << ".\n";
633 
634  grid.set_child(widgets[x * cols + y]->build(replacements),
635  x,
636  y,
637  flags[x * cols + y],
638  border_size[x * cols + y]);
639  }
640  }
641 }
642 
643 } // namespace gui2
644 
645 /*WIKI
646  * @page = GUIToolkitWML
647  * @order = ZZZZZZ_footer
648  *
649  * [[Category: WML Reference]]
650  * [[Category: GUI WML Reference]]
651  */
652 
653 /*WIKI
654  * @page = GUIWidgetInstanceWML
655  * @order = ZZZZZZ_footer
656  *
657  * [[Category: WML Reference]]
658  * [[Category: GUI WML Reference]]
659  *
660  */
Define the common log macros for the gui toolkit.
#define DBG_GUI_P
Definition: log.hpp:69
child_itors child_range(const std::string &key)
Definition: config.cpp:613
std::vector< unsigned > col_grow_factor
void set_row_grow_factor(const unsigned row, const unsigned factor)
Sets the grow factor for a row.
Definition: grid.hpp:81
#define TRY(name)
unsigned read_flags(const config &cfg)
Returns the placement/resize flags.
Definition: helper.cpp:80
twindow * build(CVideo &video, const twindow_builder::tresolution *definition)
Builds a window.
const GLfloat * c
Definition: glew.h:12741
Contains the info needed to instantiate a widget.
Add a special kind of assert to validate whether the input from WML doesn't contain any problems that...
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1221
Definition: video.hpp:58
itor second functor(surf, f[1])
Base container class.
Definition: grid.hpp:29
tresolution_definition_ptr config()
Definition: control.hpp:299
This file contains the window object, this object is a top level container which has the event manage...
void add_to_keyboard_chain(twidget *widget)
Adds the widget to the keyboard chain.
Definition: window.cpp:1400
std::vector< tbuilder_widget_ptr > widgets
The widgets per grid cell.
#define ERROR_LOG(a)
Definition: asserts.hpp:42
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1220
std::pair< const_child_iterator, const_child_iterator > const_child_itors
Definition: config.hpp:214
std::vector< unsigned > row_grow_factor
The grow factor for the rows / columns.
std::string missing_mandatory_wml_key(const std::string &section, const std::string &key, const std::string &primary_key, const std::string &primary_value)
Returns a standard message for a missing wml key.
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:62
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
const std::string & read(const config &cfg)
static std::map< std::string, std::function< tbuilder_widget_ptr(config)> > & builder_widget_lookup()
void finalize(const boost::intrusive_ptr< tbuilder_grid > &content_grid)
Finishes the initialization of the grid.
Definition: window.cpp:1301
static UNUSEDNOWARN std::string _(const char *str)
Definition: gettext.hpp:82
GLuint64EXT * result
Definition: glew.h:10727
std::map< std::string, t_string > string_map
lg::log_domain log_gui_parse("gui/parse")
Definition: log.hpp:68
GLuint id
Definition: glew.h:1647
#define VALIDATE(cond, message)
The macro to use for the validation of WML.
This file contains the settings handling of the widget library.
void set_column_grow_factor(const unsigned column, const unsigned factor)
Sets the grow factor for a column.
Definition: grid.hpp:96
all_children_itors all_children_range() const
In-order iteration over all children.
Definition: config.cpp:1127
std::vector< tresolution > resolutions
std::pair< all_children_iterator, all_children_iterator > all_children_itors
Definition: config.hpp:665
std::vector< twindow_builder::tresolution >::const_iterator get_window_builder(const std::string &type)
Returns an interator to the requested builder.
Definition: settings.cpp:624
void init_grid(const boost::intrusive_ptr< tbuilder_grid > &grid_builder)
Initializes and builds the grid.
Definition: container.cpp:209
#define log_scope2(domain, description)
Definition: log.hpp:186
void init_linked_size_group(const std::string &id, const bool fixed_width, const bool fixed_height)
Initializes a linked size group.
Definition: window.cpp:969
void set_id(const std::string &id)
Definition: widget.cpp:97
ttip(const config &cfg, const std::string &tagname)
cl_event GLbitfield flags
Definition: glew.h:3070
Definition: pump.hpp:42
tbuilder_grid(const config &cfg)
static variant evaluate(const const_formula_ptr &f, const formula_callable &variables, formula_debugger *fdb=nullptr, variant default_res=variant(0))
Definition: formula.hpp:31
GLuint GLenum matrix
Definition: glew.h:11418
size_t i
Definition: function.cpp:1057
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
Definition: debugger.cpp:112
GLint GLint GLint GLint GLint x
Definition: glew.h:1220
std::vector< unsigned > border_size
The border size per grid cell.
void set_click_dismiss(const bool click_dismiss)
Definition: window.hpp:434
boost::uint32_t decode_color(const std::string &color)
Converts a color string to a color.
Definition: helper.cpp:73
unsigned get_v_align(const std::string &v_align)
Returns the vertical alignment.
Definition: helper.cpp:30
tbuilder_widget_ptr create_builder_widget(const config &cfg)
Create a widget builder.
lg::log_domain log_gui_general("gui/general")
Definition: log.hpp:40
std::string vgettext(const char *msgid, const utils::string_map &symbols)
GLint GLint GLint GLint GLint GLint GLsizei GLsizei height
Definition: glew.h:1220
void register_builder_widget(const std::string &id, std::function< tbuilder_widget_ptr(config)> functor)
Registers a widget to be build.
void set_rows_cols(const unsigned rows, const unsigned cols)
Wrapper to set_rows and set_cols.
Definition: grid.cpp:679
bool has_linked_size_group(const std::string &id)
Is the linked size group defined for this window?
Definition: window.cpp:979
GLenum GLenum GLvoid * row
Definition: glew.h:3805
tbuilder_widget(const config &cfg)
boost::intrusive_ptr< tbuilder_widget > tbuilder_widget_ptr
std::vector< tlinked_group > linked_groups
config & child(const std::string &key, int n=0)
Returns the nth child with the given key, or a reference to an invalid config if there is none...
Definition: config.cpp:658
Base class for all widgets.
Definition: widget.hpp:49
this module manages the cache of images.
Definition: image.cpp:75
GLint GLint GLint GLint GLint GLint GLsizei width
Definition: glew.h:1220
void set_child(twidget *widget, const unsigned row, const unsigned col, const unsigned flags, const unsigned border_size)
Sets a child in the grid.
Definition: grid.cpp:69
std::map< std::string, boost::intrusive_ptr< tbuilder_widget > > treplacements
The replacements type is used to define replacement types.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
unsigned get_h_align(const std::string &h_align)
Returns the horizontal alignment.
Definition: helper.cpp:45
game_logic::function_symbol_table functions
#define DBG_GUI_G
Definition: log.hpp:41
GLsizei const GLcharARB ** string
Definition: glew.h:4503
Contains the implementation details for lexical_cast and shouldn't be used directly.
void set_linked_group(const std::string &linked_group)
Definition: widget.cpp:314
tgrid * build() const