The Battle for Wesnoth  1.19.5+dev
campaign_difficulty.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 2024
3  by Iris Morelle <shadowm2006@gmail.com>
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 #pragma once
17 
18 #include "config.hpp"
20 
21 
22 namespace gui2::dialogs
23 {
24 
25 /**
26  * Helper function to convert old difficulty markup. Declared outside class to allow other
27  * classes to make use of it.
28  */
30 
32 {
33 public:
34  /**
35  * @param campaign The campaign the difficulty is being chosen for
36  */
37  campaign_difficulty(const config& campaign);
38 
39  /**
40  * Returns the selected difficulty define after displaying.
41  * @return 'CANCEL' if the dialog was canceled.
42  */
43  std::string selected_difficulty() const
44  {
45  return selected_difficulty_;
46  }
47 
48 private:
50  std::string campaign_id_;
51  std::string selected_difficulty_;
52 
53  virtual const std::string& window_id() const override;
54 
55  virtual void pre_show() override;
56 
57  virtual void post_show() override;
58 };
59 } // namespace dialogs
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:172
virtual void post_show() override
Actions to be taken after the window has been shown.
campaign_difficulty(const config &campaign)
virtual void pre_show() override
Actions to be taken before showing the window.
virtual const std::string & window_id() const override
The ID of the window to build.
std::string selected_difficulty() const
Returns the selected difficulty define after displaying.
Abstract base class for all modal dialogs.
Definitions for the interface to Wesnoth Markup Language (WML).
config generate_difficulty_config(const config &source)
Helper function to convert old difficulty markup.