The Battle for Wesnoth  1.15.2+dev
edit_text.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2013 - 2018 by Iris Morelle <shadowm2006@gmail.com>
3  Part of the Battle for Wesnoth Project https://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 
18 
19 namespace gui2
20 {
21 namespace dialogs
22 {
23 
24 class edit_text : public modal_dialog
25 {
26 public:
27  /**
28  * Constructor.
29  *
30  * @param title The dialog's title.
31  * @param label Label of the text field.
32  * @param [in, out] text The parameter's usage is:
33  * - Input: The initial value of the text field.
34  * - Output: The new unit name the user entered
35  * if the dialog returns @ref retval::OK,
36  * undefined otherwise.
37  */
38  edit_text(const std::string& title,
39  const std::string& label,
40  std::string& text);
41 
42  /**
43  * Executes the dialog.
44  * See @ref modal_dialog for more information.
45  *
46  * @param [in, out] text The parameter's usage is:
47  * - Input: The initial value of the unit name.
48  * - Output: The new unit name the user entered
49  * if this method returns @a true, undefined
50  * otherwise.
51  */
53 
54 private:
55  /** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
56  virtual const std::string& window_id() const override;
57 };
58 } // namespace dialogs
59 } // namespace gui2
virtual const std::string & window_id() const override
Executes the dialog.
edit_text(const std::string &title, const std::string &label, std::string &text)
Constructor.
Definition: edit_text.cpp:45
Label showing a text.
Definition: label.hpp:32
Generic file dialog.
Definition: field-fwd.hpp:22
Various uncategorised dialogs.
Abstract base class for all modal dialogs.