The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
edit_text.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2013 - 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_EDIT_TEXT_INCLUDED
16 #define GUI_DIALOGS_EDIT_TEXT_INCLUDED
17 
18 #include "gui/dialogs/dialog.hpp"
19 
20 namespace gui2
21 {
22 
23 class tedit_text : public tdialog
24 {
25 public:
26  /**
27  * Constructor.
28  *
29  * @param title The dialog's title.
30  * @param label Label of the text field.
31  * @param [in, out] text The parameter's usage is:
32  * - Input: The initial value of the text field.
33  * - Output: The new unit name the user entered
34  * if the dialog returns @ref twindow::OK,
35  * undefined otherwise.
36  */
37  tedit_text(const std::string& title,
38  const std::string& label,
39  std::string& text);
40 
41  /**
42  * Executes the dialog.
43  * See @ref tdialog for more information.
44  *
45  * @param [in, out] text The parameter's usage is:
46  * - Input: The initial value of the unit name.
47  * - Output: The new unit name the user entered
48  * if this method returns @a true, undefined
49  * otherwise.
50  */
51  static bool execute(const std::string& title,
52  const std::string& label,
53  std::string& text,
54  CVideo& video)
55  {
56  return tedit_text(title, label, text).show(video);
57  }
58 
59 private:
60  /** Inherited from tdialog, implemented by REGISTER_DIALOG. */
61  virtual const std::string& window_id() const;
62 };
63 }
64 
65 #endif /* ! GUI_DIALOGS_EDIT_TEXT_INCLUDED */
Definition: video.hpp:58
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
static bool execute(const std::string &title, const std::string &label, std::string &text, CVideo &video)
Executes the dialog.
Definition: edit_text.hpp:51
Abstract base class for all dialogs.
Definition: dialog.hpp:121
tedit_text(const std::string &title, const std::string &label, std::string &text)
Constructor.
Definition: edit_text.cpp:43
virtual const std::string & window_id() const
Inherited from tdialog, implemented by REGISTER_DIALOG.
GLsizei const GLcharARB ** string
Definition: glew.h:4503