1 /*
2    Copyright (C) 2009 - 2018 by Mark de Wever <koraq@xs4all.nl>
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 "gui/dialogs/modal_dialog.hpp"
18 
19 class config;
20 
21 namespace gui2
22 {
23 namespace dialogs
24 {
25 
26 class core_selection : public modal_dialog
27 {
28 public:
core_selection(const std::vector<config> & cores,int choice)29 	explicit core_selection(const std::vector<config>& cores, int choice)
30 		: cores_(cores), choice_(choice)
31 
32 	{
33 	}
34 
35 	/***** ***** ***** setters / getters for members ***** ****** *****/
36 
get_choice() const37 	int get_choice() const
38 	{
39 		return choice_;
40 	}
41 
42 private:
43 	/** Called when another core is selected. */
44 	void core_selected(window& window);
45 
46 	/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
47 	virtual const std::string& window_id() const override;
48 
49 	/** Inherited from modal_dialog. */
50 	virtual void pre_show(window& window) override;
51 
52 	/** Inherited from modal_dialog. */
53 	virtual void post_show(window& window) override;
54 
55 	/** Contains the config objects for all cores. */
56 	const std::vector<config>& cores_;
57 
58 	/** The chosen core. */
59 	int choice_;
60 };
61 
62 } // namespace dialogs
63 } // namespace gui2
64