The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
helper.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2008 - 2025
3 by Mark de Wever <koraq@xs4all.nl>
4 Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY.
12
13 See the COPYING file for more details.
14*/
15
16#pragma once
17
19
20#include <string>
21#include <vector>
22
23class config;
24
25namespace gui2
26{
27
28namespace implementation
29{
30
32
33/**
34 * Returns the vertical alignment.
35 *
36 * @param v_align The string representing the alignment.
37 *
38 * @returns The alignment.
39 */
40unsigned get_v_align(const std::string& v_align);
41
42/**
43 * Returns the horizontal alignment.
44 *
45 * @param h_align The string representing the alignment.
46 *
47 * @returns The alignment.
48 */
49unsigned get_h_align(const std::string& h_align);
50
51/**
52 * Returns the border flags.
53 *
54 * @param borders The string representing the border flags.
55 *
56 * @returns The border flags.
57 */
58unsigned get_border(const std::vector<std::string>& borders);
59
60/**
61 * Returns the placement/resize flags.
62 *
63 * @param cfg The config to look for flags for.
64 *
65 * @returns The placement/resize flags.
66 */
67unsigned read_flags(const config& cfg);
68
69/**
70 * Returns the scrollbar mode flags.
71 *
72 * @param scrollbar_mode The string representing the scrollbar_mode.
73 *
74 * @returns The scrollbar mode flags.
75 */
77
78/**
79 * Returns the return value for a widget.
80 *
81 * If there's a valid retval_id that will be returned.
82 * Else if there's a retval that's returned.
83 * Else it falls back to the id.
84 */
85int get_retval(const std::string& retval_id,
86 const int retval,
87 const std::string& id);
88
89} // namespace implementation
90
91} // namespace gui2
A config object defines a single node in a WML file, with access to child nodes.
Definition config.hpp:157
scrollbar_mode
The way to handle the showing or hiding of the scrollbar.
const config * cfg
unsigned get_v_align(const std::string &v_align)
Returns the vertical alignment.
Definition helper.cpp:38
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:137
unsigned get_h_align(const std::string &h_align)
Returns the horizontal alignment.
Definition helper.cpp:53
unsigned get_border(const std::vector< std::string > &borders)
Returns the border flags.
Definition helper.cpp:68
unsigned read_flags(const config &cfg)
Returns the placement/resize flags.
Definition helper.cpp:88
scrollbar_mode get_scrollbar_mode(const std::string &scrollbar_mode)
Returns the scrollbar mode flags.
Definition helper.cpp:121
Generic file dialog.
retval
Default window/dialog return values.
Definition retval.hpp:30
Contains the implementation details for lexical_cast and shouldn't be used directly.