The Battle for Wesnoth
1.13.4+dev
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
gui
auxiliary
old_markup.hpp
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
#ifndef GUI_AUXILIARY_OLD_MARKUP_INCLUDED
16
#define GUI_AUXILIARY_OLD_MARKUP_INCLUDED
17
18
#include <string>
19
20
namespace
gui2
21
{
22
23
/**
24
* Implements simple parsing of legacy GUI1 item markup.
25
*/
26
class
tlegacy_menu_item
27
{
28
/*
29
* Legacy options/menu items have some special markup:
30
* A line starting with a * is selected by default.
31
* A line starting with a & enables the following markup:
32
* - The part until the = is the name of an image.
33
* - The part until the second = is the first column.
34
* - The rest is the third column (the wiki only specifies two columns
35
* so only two of them are implemented).
36
*/
37
/**
38
* @todo This syntax looks like a bad hack, it would be nice to write
39
* a new syntax which doesn't use those hacks (also avoids the problem
40
* with special meanings for certain characters.
41
*/
42
public
:
43
explicit
tlegacy_menu_item
(
const
std::string
& str =
std::string
());
44
45
const
std::string
&
icon
()
const
46
{
47
return
icon_
;
48
}
49
50
const
std::string
&
label
()
const
51
{
52
return
label_
;
53
}
54
55
const
std::string
&
description
()
const
56
{
57
return
desc_
;
58
}
59
60
bool
is_default
()
const
61
{
62
return
default_
;
63
}
64
65
tlegacy_menu_item
&
operator=
(
const
tlegacy_menu_item
& rhs)
66
{
67
if
(&rhs !=
this
) {
68
icon_
= rhs.
icon_
;
69
label_
= rhs.
label_
;
70
desc_
= rhs.
desc_
;
71
}
72
return
*
this
;
73
}
74
75
private
:
76
/** The icon for the menu item. */
77
std::string
icon_
;
78
79
/** The first text item of the menu item, normally a short string. */
80
std::string
label_
;
81
82
/** The second text item of the menu item, normally a longer string. */
83
std::string
desc_
;
84
85
/**
86
* Is the item the default item and thus initially selected.
87
*
88
* It's unspecified what happens if multiple items in a menu are selected.
89
*/
90
bool
default_
;
91
};
92
}
93
94
#endif
gui2::tlegacy_menu_item::icon_
std::string icon_
The icon for the menu item.
Definition:
old_markup.hpp:77
gui2::tlegacy_menu_item::label_
std::string label_
The first text item of the menu item, normally a short string.
Definition:
old_markup.hpp:80
gui2::tlegacy_menu_item::default_
bool default_
Is the item the default item and thus initially selected.
Definition:
old_markup.hpp:90
gui2::tlegacy_menu_item::operator=
tlegacy_menu_item & operator=(const tlegacy_menu_item &rhs)
Definition:
old_markup.hpp:65
gui2::tlegacy_menu_item
Implements simple parsing of legacy GUI1 item markup.
Definition:
old_markup.hpp:26
gui2::tlegacy_menu_item::icon
const std::string & icon() const
Definition:
old_markup.hpp:45
gui2
A class inherited from ttext_box that displays its input as stars.
Definition:
field-fwd.hpp:23
gui2::tlegacy_menu_item::is_default
bool is_default() const
Definition:
old_markup.hpp:60
gui2::tlegacy_menu_item::desc_
std::string desc_
The second text item of the menu item, normally a longer string.
Definition:
old_markup.hpp:83
gui2::tlegacy_menu_item::description
const std::string & description() const
Definition:
old_markup.hpp:55
gui2::tlegacy_menu_item::tlegacy_menu_item
tlegacy_menu_item(const std::string &str=std::string())
Definition:
old_markup.cpp:20
gui2::tlegacy_menu_item::label
const std::string & label() const
Definition:
old_markup.hpp:50
string
GLsizei const GLcharARB ** string
Definition:
glew.h:4503
Generated by
1.8.8