The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
edit_label.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 2016 by Ignacio Riquelme Morelle <[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_DIALOGS_EDITOR_EDIT_LABEL_HPP_INCLUDED
16 #define GUI_DIALOGS_EDITOR_EDIT_LABEL_HPP_INCLUDED
17 
18 #include "gui/dialogs/dialog.hpp"
19 #include "map/label.hpp"
20 
21 namespace gui2
22 {
23 
25 {
26 public:
27  /**
28  * Constructor.
29  *
30  * @param[in, out] text The parameter's usage is:
31  * - Input: The initial value of the label.
32  * - Output: The label text the user entered if
33  * the dialog returns @ref twindow::OK
34  * undefined otherwise.
35  */
37  bool& immutable,
38  bool& visible_fog,
39  bool& visible_shroud,
40  SDL_Color& color,
41  std::string& category);
42 
43  /** The execute function see @ref tdialog for more information. */
44  static bool execute(std::string& text,
45  bool& immutable,
46  bool& visible_fog,
47  bool& visible_shroud,
48  SDL_Color& color,
49  std::string& category,
50  CVideo& video)
51  {
52  return teditor_edit_label(text, immutable, visible_fog, visible_shroud, color, category)
53  .show(video);
54  }
55 
56 private:
57  SDL_Color& color_store;
58  int load_color_component(Uint8 SDL_Color::* component);
59  void save_color_component(Uint8 SDL_Color::* component, const int value);
60  void register_color_component(std::string widget_id, Uint8 SDL_Color::* component);
61  /** Inherited from tdialog, implemented by REGISTER_DIALOG. */
62  virtual const std::string& window_id() const;
63 };
64 }
65 
66 #endif /* ! GUI_DIALOGS_EDIT_LABEL_INCLUDED */
virtual const std::string & window_id() const
Inherited from tdialog, implemented by REGISTER_DIALOG.
static bool execute(std::string &text, bool &immutable, bool &visible_fog, bool &visible_shroud, SDL_Color &color, std::string &category, CVideo &video)
The execute function see tdialog for more information.
Definition: edit_label.hpp:44
void register_color_component(std::string widget_id, Uint8 SDL_Color::*component)
Definition: edit_label.cpp:83
Definition: video.hpp:58
teditor_edit_label(std::string &text, bool &immutable, bool &visible_fog, bool &visible_shroud, SDL_Color &color, std::string &category)
Constructor.
Definition: edit_label.cpp:52
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
Abstract base class for all dialogs.
Definition: dialog.hpp:121
GLsizei const GLfloat * value
Definition: glew.h:1817
void save_color_component(Uint8 SDL_Color::*component, const int value)
Definition: edit_label.cpp:93
GLuint color
Definition: glew.h:5801
int load_color_component(Uint8 SDL_Color::*component)
Definition: edit_label.cpp:89
GLsizei const GLcharARB ** string
Definition: glew.h:4503