The Battle for Wesnoth  1.15.1+dev
game_save.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2018 by Jörg Hinrichs <joerg.hinrichs@alice-dsl.de>
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 #define GETTEXT_DOMAIN "wesnoth-lib"
16 
18 
19 #include "gettext.hpp"
20 #include "gui/auxiliary/field.hpp"
21 #include "gui/widgets/button.hpp"
22 #include "gui/widgets/label.hpp"
23 #include "gui/widgets/settings.hpp"
24 
25 namespace gui2
26 {
27 namespace dialogs
28 {
29 
30 /*WIKI
31  * @page = GUIWindowDefinitionWML
32  * @order = 2_game_save
33  *
34  * == Save a game ==
35  *
36  * This shows the dialog to create a savegame file.
37  *
38  * @begin{table}{dialog_widgets}
39  *
40  * lblTitle & & label & m &
41  * The title of the window. $
42  *
43  * txtFilename & & text_box & m &
44  * The name of the savefile. $
45  *
46  * @end{table}
47  */
48 
49 REGISTER_DIALOG(game_save)
50 
51 game_save::game_save(std::string& filename, const std::string& title)
52 {
53  set_restore(true);
54 
55  register_text("txtFilename", false, filename, true);
56  register_label("lblTitle", true, title);
57 }
58 
60 
62  const std::string& title,
63  const std::string& message)
64 {
65  set_restore(true);
66 
67  register_label("lblTitle", true, title);
68  register_text("txtFilename", false, filename, true);
69  register_label("lblMessage", true, message);
70 }
71 
73 
74 game_save_oos::game_save_oos(bool& ignore_all,
75  std::string& filename,
76  const std::string& title,
77  const std::string& message)
78 {
79  register_label("lblTitle", true, title);
80  register_text("txtFilename", false, filename, true);
81  register_label("lblMessage", true, message);
82  register_bool("ignore_all", true, ignore_all);
83 
84  /* Always need the ignore_all flag. */
85  set_always_save_fields(true);
86 }
87 
88 } // namespace dialogs
89 } // namespace gui2
Main class to show messages to the user.
Definition: message.hpp:34
STL namespace.
Implements some helper classes to ease adding fields to a dialog and hide the synchronization needed...
Generic file dialog.
Definition: field-fwd.hpp:22
This file contains the settings handling of the widget library.
Various uncategorised dialogs.