The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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  */
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 
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. */
78 
79  /** The first text item of the menu item, normally a short string. */
81 
82  /** The second text item of the menu item, normally a longer string. */
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
std::string icon_
The icon for the menu item.
Definition: old_markup.hpp:77
std::string label_
The first text item of the menu item, normally a short string.
Definition: old_markup.hpp:80
bool default_
Is the item the default item and thus initially selected.
Definition: old_markup.hpp:90
tlegacy_menu_item & operator=(const tlegacy_menu_item &rhs)
Definition: old_markup.hpp:65
Implements simple parsing of legacy GUI1 item markup.
Definition: old_markup.hpp:26
const std::string & icon() const
Definition: old_markup.hpp:45
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
bool is_default() const
Definition: old_markup.hpp:60
std::string desc_
The second text item of the menu item, normally a longer string.
Definition: old_markup.hpp:83
const std::string & description() const
Definition: old_markup.hpp:55
tlegacy_menu_item(const std::string &str=std::string())
Definition: old_markup.cpp:20
const std::string & label() const
Definition: old_markup.hpp:50
GLsizei const GLcharARB ** string
Definition: glew.h:4503