The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
game_save.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2016 by Jörg Hinrichs <[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 #define GETTEXT_DOMAIN "wesnoth-lib"
16 
17 #include <boost/multi_index_container.hpp>
18 // ^ This is apparently unnecessary but we don't compile without it...
19 
21 
22 #include "gettext.hpp"
23 #include "gui/auxiliary/field.hpp"
24 #include "gui/widgets/button.hpp"
25 #include "gui/widgets/label.hpp"
26 #include "gui/widgets/settings.hpp"
27 
28 namespace gui2
29 {
30 
31 /*WIKI
32  * @page = GUIWindowDefinitionWML
33  * @order = 2_game_save
34  *
35  * == Save a game ==
36  *
37  * This shows the dialog to create a savegame file.
38  *
39  * @begin{table}{dialog_widgets}
40  *
41  * lblTitle & & label & m &
42  * The title of the window. $
43  *
44  * txtFilename & & text_box & m &
45  * The name of the savefile. $
46  *
47  * @end{table}
48  */
49 
50 REGISTER_DIALOG(game_save)
51 
52 tgame_save::tgame_save(std::string& filename, const std::string& title)
53 {
54  register_text("txtFilename", false, filename, true);
55  register_label("lblTitle", true, title);
56 }
57 
58 REGISTER_DIALOG(game_save_message)
59 
61  const std::string& title,
62  const std::string& message)
63 {
64  set_restore(true);
65 
66  register_label("lblTitle", true, title);
67  register_text("txtFilename", false, filename, true);
68  register_label("lblMessage", true, message);
69 }
70 
71 REGISTER_DIALOG(game_save_oos)
72 
73 tgame_save_oos::tgame_save_oos(bool& ignore_all,
74  std::string& filename,
75  const std::string& title,
76  const std::string& message)
77 {
78  register_label("lblTitle", true, title);
79  register_text("txtFilename", false, filename, true);
80  register_label("lblMessage", true, message);
81  register_bool("ignore_all", true, ignore_all);
82 
83  /* Always need the ignore_all flag. */
84  set_always_save_fields(true);
85 }
86 
87 } // namespace gui2
REGISTER_DIALOG(label_settings)
STL namespace.
Implements some helper classes to ease adding fields to a dialog and hide the synchronization needed...
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
This file contains the settings handling of the widget library.
GLsizei GLenum GLuint GLuint GLsizei char * message
Definition: glew.h:2499