The Battle for Wesnoth
1.15.0-dev
gui
auxiliary
old_markup.hpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2008 - 2018 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
17
#include <string>
18
19
namespace
gui2
20
{
21
22
/**
23
* Implements simple parsing of legacy GUI1 item markup.
24
*/
25
class
legacy_menu_item
26
{
27
/*
28
* Legacy options/menu items have some special markup:
29
* A line starting with a * is selected by default.
30
* A line starting with a & enables the following markup:
31
* - The part until the = is the name of an image.
32
* - The part until the second = is the first column.
33
* - The rest is the third column (the wiki only specifies two columns
34
* so only two of them are implemented).
35
*/
36
/**
37
* @todo This syntax looks like a bad hack, it would be nice to write
38
* a new syntax which doesn't use those hacks (also avoids the problem
39
* with special meanings for certain characters.
40
*/
41
public
:
42
explicit
legacy_menu_item
(
const
std::string& str =
""
,
const
std::string deprecation_msg =
""
);
43
44
const
std::string&
icon
()
const
45
{
46
return
icon_
;
47
}
48
49
const
std::string&
label
()
const
50
{
51
return
label_
;
52
}
53
54
const
std::string&
description
()
const
55
{
56
return
desc_
;
57
}
58
59
bool
is_default
()
const
60
{
61
return
default_
;
62
}
63
64
bool
contained_markup
()
const
65
{
66
return
contained_markup_
;
67
}
68
69
legacy_menu_item
&
operator=
(
const
legacy_menu_item
& rhs)
70
{
71
if
(&rhs !=
this
) {
72
icon_
= rhs.
icon_
;
73
label_
= rhs.
label_
;
74
desc_
= rhs.
desc_
;
75
default_
= rhs.
default_
;
76
contained_markup_
= rhs.
contained_markup_
;
77
}
78
return
*
this
;
79
}
80
81
private
:
82
/** The icon for the menu item. */
83
std::string
icon_
;
84
85
/** The first text item of the menu item, normally a short string. */
86
std::string
label_
;
87
88
/** The second text item of the menu item, normally a longer string. */
89
std::string
desc_
;
90
91
/**
92
* Is the item the default item and thus initially selected.
93
*
94
* It's unspecified what happens if multiple items in a menu are selected.
95
*/
96
bool
default_
;
97
98
/**
99
* Was any old markup actually parsed?
100
*/
101
bool
contained_markup_
;
102
};
103
}
gui2::legacy_menu_item::icon
const std::string & icon() const
Definition:
old_markup.hpp:44
gui2::legacy_menu_item::label_
std::string label_
The first text item of the menu item, normally a short string.
Definition:
old_markup.hpp:86
gui2::legacy_menu_item::legacy_menu_item
legacy_menu_item(const std::string &str="", const std::string deprecation_msg="")
Definition:
old_markup.cpp:22
gui2::legacy_menu_item::contained_markup_
bool contained_markup_
Was any old markup actually parsed?
Definition:
old_markup.hpp:101
gui2::legacy_menu_item::desc_
std::string desc_
The second text item of the menu item, normally a longer string.
Definition:
old_markup.hpp:89
gui2
Generic file dialog.
Definition:
field-fwd.hpp:22
gui2::legacy_menu_item::icon_
std::string icon_
The icon for the menu item.
Definition:
old_markup.hpp:83
gui2::legacy_menu_item::operator=
legacy_menu_item & operator=(const legacy_menu_item &rhs)
Definition:
old_markup.hpp:69
gui2::legacy_menu_item::default_
bool default_
Is the item the default item and thus initially selected.
Definition:
old_markup.hpp:96
gui2::legacy_menu_item::contained_markup
bool contained_markup() const
Definition:
old_markup.hpp:64
gui2::legacy_menu_item::is_default
bool is_default() const
Definition:
old_markup.hpp:59
gui2::legacy_menu_item::label
const std::string & label() const
Definition:
old_markup.hpp:49
gui2::legacy_menu_item
Implements simple parsing of legacy GUI1 item markup.
Definition:
old_markup.hpp:25
gui2::legacy_menu_item::description
const std::string & description() const
Definition:
old_markup.hpp:54
Generated by
1.8.13