The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
depcheck_confirm_change.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 - 2016 by Boldizsár Lipka <[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 
18 
19 #include "gui/widgets/settings.hpp"
20 #include "gui/widgets/window.hpp"
21 #include "formula/string_utils.hpp"
22 #include "gettext.hpp"
23 
24 namespace gui2
25 {
26 
27 /*WIKI
28  * @page = GUIWindowDefinitionWML
29  * @order = 2_depcheck_confirm_change
30  *
31  * == SP/MP Dependency Check: Confirm Change ==
32  *
33  * Asks the user to confirm a change required to proceed. Currently used
34  * for enabling/disabling modifications
35  *
36  * @begin{table}{dialog_widgets}
37  *
38  * message & & label & m &
39  * displays the details of the required changes $
40  *
41  * itemlist & & scroll_label & m &
42  * displays the list of affected items $
43  *
44  * cancel & & button & m &
45  * refuse to apply changes $
46  *
47  * ok & & button & m &
48  * agree to apply changes $
49  *
50  * @end{table}
51  */
52 
53 REGISTER_DIALOG(depcheck_confirm_change)
54 
56  bool action,
57  const std::vector<std::string>& mods,
58  const std::string& requester)
59 {
60  utils::string_map symbols;
61  symbols["requester"] = requester;
63  if(action) {
64  message = vgettext("$requester requires the following modifications to "
65  "be enabled:",
66  symbols);
67  } else {
68  message = vgettext("$requester requires the following modifications to "
69  "be disabled:",
70  symbols);
71  }
72 
73  std::string list = "\t";
74  list += utils::join(mods, "\n\t");
75 
76  register_label("message", false, message);
77 
78  register_label("itemlist", false, list);
79 }
80 }
This file contains the window object, this object is a top level container which has the event manage...
REGISTER_DIALOG(label_settings)
STL namespace.
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
std::map< std::string, t_string > string_map
This file contains the settings handling of the widget library.
std::string join(T const &v, const std::string &s=",")
Generates a new string joining container items in a list.
std::string vgettext(const char *msgid, const utils::string_map &symbols)
GLsizei GLenum GLuint GLuint GLsizei char * message
Definition: glew.h:2499
GLsizei const GLcharARB ** string
Definition: glew.h:4503