The Battle for Wesnoth  1.15.2+dev
core_selection.hpp
Go to the documentation of this file.
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 
18 
19 class config;
20 
21 namespace gui2
22 {
23 namespace dialogs
24 {
25 
27 {
28 public:
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 
37  int get_choice() const
38  {
39  return choice_;
40  }
41 
42 private:
43  /** Called when another core is selected. */
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
int choice_
The chosen core.
void core_selected(window &window)
Called when another core is selected.
core_selection(const std::vector< config > &cores, int choice)
virtual void post_show(window &window) override
Inherited from modal_dialog.
Generic file dialog.
Definition: field-fwd.hpp:22
const std::vector< config > & cores_
Contains the config objects for all cores.
Various uncategorised dialogs.
Abstract base class for all modal dialogs.
virtual void pre_show(window &window) override
Inherited from modal_dialog.
virtual const std::string & window_id() const override
Inherited from modal_dialog, implemented by REGISTER_DIALOG.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:68
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:62