The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
helper.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2017 by Mark de Wever <koraq@xs4all.nl>
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 #pragma once
16 
18 
19 #include <string>
20 #include <vector>
21 
22 class config;
23 
24 namespace gui2
25 {
26 
27 namespace implementation
28 {
29 
31 
32 /**
33  * Returns the vertical alignment.
34  *
35  * @param v_align The string representing the alignment.
36  *
37  * @returns The alignment.
38  */
39 unsigned get_v_align(const std::string& v_align);
40 
41 /**
42  * Returns the horizontal alignment.
43  *
44  * @param h_align The string representing the alignment.
45  *
46  * @returns The alignment.
47  */
48 unsigned get_h_align(const std::string& h_align);
49 
50 /**
51  * Returns the border flags.
52  *
53  * @param borders The string representing the border flags.
54  *
55  * @returns The border flags.
56  */
57 unsigned get_border(const std::vector<std::string>& borders);
58 
59 /**
60  * Returns the placement/resize flags.
61  *
62  * @param cfg The config to look for flags for.
63  *
64  * @returns The placement/resize flags.
65  */
66 unsigned read_flags(const config& cfg);
67 
68 /**
69  * Returns the scrollbar mode flags.
70  *
71  * @param scrollbar_mode The string representing the scrollbar_mode.
72  *
73  * @returns The scrollbar mode flags.
74  */
76 
77 /**
78  * Returns the return value for a widget.
79  *
80  * If there's a valid retval_id that will be returned.
81  * Else if there's a retval that's returned.
82  * Else it falls back to the id.
83  */
84 int get_retval(const std::string& retval_id,
85  const int retval,
86  const std::string& id);
87 
88 } // namespace implementation
89 
90 } // namespace gui2
std::vector< char_t > string
unsigned read_flags(const config &cfg)
Returns the placement/resize flags.
Definition: helper.cpp:87
unsigned get_border(const std::vector< std::string > &borders)
Returns the border flags.
Definition: helper.cpp:67
int get_retval(const std::string &retval_id, const int retval, const std::string &id)
Returns the return value for a widget.
Definition: helper.cpp:136
Generic file dialog.
Definition: text.hpp:37
scrollbar_mode get_scrollbar_mode(const std::string &scrollbar_mode)
Returns the scrollbar mode flags.
Definition: helper.cpp:120
static std::map< std::string, scrollbar_mode > unsigned get_v_align(const std::string &v_align)
Returns the vertical alignment.
Definition: helper.cpp:37
scrollbar_mode
The way to handle the showing or hiding of the scrollbar.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:93
unsigned get_h_align(const std::string &h_align)
Returns the horizontal alignment.
Definition: helper.cpp:52
Contains the implementation details for lexical_cast and shouldn't be used directly.