The Battle for Wesnoth  1.19.0-dev
mp_change_control.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2024
3  by Lukasz Dobrogowski <lukasz.dobrogowski@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 
19 
20 #include <vector>
21 
22 namespace events
23 {
24  class menu_handler;
25 }
26 
27 namespace gui2::dialogs
28 {
29 
30 /**
31  * @ingroup GUIWindowDefinitionWML
32  *
33  * This shows the multiplayer change control dialog.
34  * Key |Type |Mandatory|Description
35  * ------------------|--------------|---------|-----------
36  * sides_list | @ref listbox |yes |List of sides participating in the MP game.
37  * nicks_list | @ref listbox |yes |List of nicks of all clients playing or observing the MP game.
38  */
40 {
41 public:
43 
45 
46 private:
47  virtual const std::string& window_id() const override;
48 
49  virtual void pre_show(window& window) override;
50 
51  virtual void post_show(window& window) override;
52 
55 
56  void highlight_side_nick();
57 
59 
60  unsigned int selected_side_;
61  unsigned int selected_nick_;
62 
63  // Contains the mapping from listbox labels to actual sides
64  std::vector<int> sides_;
65 
66  // Contains the mapping from listbox labels to actual nicks
67  std::vector<std::string> nicks_;
68 };
69 
70 } // namespace dialogs
Abstract base class for all modal dialogs.
This shows the multiplayer change control dialog.
std::vector< std::string > nicks_
virtual const std::string & window_id() const override
The ID of the window to build.
events::menu_handler & menu_handler_
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
mp_change_control(events::menu_handler &mh)
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
base class of top level items, the only item which needs to store the final canvases to draw on.
Definition: window.hpp:63
#define DEFINE_SIMPLE_DISPLAY_WRAPPER(dialog)
Adds a bare-bones static display function to a dialog class that immediately invokes the dialogs's mo...
Handling of system events.