The Battle for Wesnoth  1.17.0-dev
game_save.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2021
3  by Jörg Hinrichs <joerg.hinrichs@alice-dsl.de>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #define GETTEXT_DOMAIN "wesnoth-lib"
17 
19 
20 #include "gettext.hpp"
21 #include "gui/auxiliary/field.hpp"
22 #include "gui/widgets/button.hpp"
23 #include "gui/widgets/label.hpp"
24 #include "gui/widgets/settings.hpp"
25 
26 namespace gui2::dialogs
27 {
28 
29 REGISTER_DIALOG(game_save)
30 
31 game_save::game_save(std::string& filename, const std::string& title)
32 {
33  set_restore(true);
34 
35  register_text("txtFilename", false, filename, true);
36  register_label("lblTitle", true, title);
37 }
38 
40 
42  const std::string& title,
43  const std::string& message)
44 {
45  set_restore(true);
46 
47  register_label("lblTitle", true, title);
48  register_text("txtFilename", false, filename, true);
49  register_label("lblMessage", true, message);
50 }
51 
53 
54 game_save_oos::game_save_oos(bool& ignore_all,
55  std::string& filename,
56  const std::string& title,
57  const std::string& message)
58 {
59  register_label("lblTitle", true, title);
60  register_text("txtFilename", false, filename, true);
61  register_label("lblMessage", true, message);
62  register_bool("ignore_all", true, ignore_all);
63 
64  /* Always need the ignore_all flag. */
65  set_always_save_fields(true);
66 }
67 
68 } // namespace dialogs
Main class to show messages to the user.
Definition: message.hpp:35
STL namespace.
Implements some helper classes to ease adding fields to a dialog and hide the synchronization needed...
This file contains the settings handling of the widget library.
This shows the dialog to create a savegame file.
Definition: game_save.hpp:32