The Battle for Wesnoth  1.15.1+dev
campaign_difficulty.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 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 
17 #include "config.hpp"
19 
20 #include <vector>
21 
22 namespace gui2
23 {
24 namespace dialogs
25 {
26 
27 /**
28  * Helper function to convert old difficulty markup. Declared outside class to allow other
29  * classes to make use of it.
30  */
32 
34 {
35 public:
36  /**
37  * @param campaign The campaign the difficulty is being chosen for
38  */
39  campaign_difficulty(const config& campaign);
40 
41  /**
42  * Returns the selected difficulty define after displaying.
43  * @return 'CANCEL' if the dialog was canceled.
44  */
45  std::string selected_difficulty() const
46  {
47  return selected_difficulty_;
48  }
49 
50 private:
52  std::string campaign_id_;
53  std::string selected_difficulty_;
54 
55  /** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
56  virtual const std::string& window_id() const override;
57 
58  /** Inherited from modal_dialog. */
59  virtual void pre_show(window& window) override;
60 
61  /** Inherited from modal_dialog. */
62  virtual void post_show(window& window) override;
63 };
64 } // namespace dialogs
65 } // namespace gui2
virtual const std::string & window_id() const override
Inherited from modal_dialog, implemented by REGISTER_DIALOG.
Definitions for the interface to Wesnoth Markup Language (WML).
Generic file dialog.
Definition: field-fwd.hpp:22
std::string selected_difficulty() const
Returns the selected difficulty define after displaying.
Various uncategorised dialogs.
config generate_difficulty_config(const config &source)
Helper function to convert old difficulty markup.
Abstract base class for all modal dialogs.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:92
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:63
campaign_difficulty(const config &campaign)
virtual void pre_show(window &window) override
Inherited from modal_dialog.
virtual void post_show(window &window) override
Inherited from modal_dialog.