1 /* 2 Copyright (C) 2011 - 2018 by Lukasz Dobrogowski 3 <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 18 #include "gui/dialogs/modal_dialog.hpp" 19 20 #include <vector> 21 22 namespace events 23 { 24 class menu_handler; 25 } 26 27 namespace gui2 28 { 29 namespace dialogs 30 { 31 32 class mp_change_control : public modal_dialog 33 { 34 public: 35 explicit mp_change_control(events::menu_handler& mh); 36 37 private: 38 /** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */ 39 virtual const std::string& window_id() const override; 40 41 /** Inherited from modal_dialog. */ 42 virtual void pre_show(window& window) override; 43 44 /** Inherited from modal_dialog. */ 45 virtual void post_show(window& window) override; 46 47 void handle_sides_list_item_clicked(window& window); 48 void handle_nicks_list_item_clicked(window& window); 49 50 void highlight_side_nick(window& window); 51 52 events::menu_handler& menu_handler_; 53 54 unsigned int selected_side_; 55 unsigned int selected_nick_; 56 57 // Contains the mapping from listbox labels to actual sides 58 std::vector<int> sides_; 59 60 // Contains the mapping from listbox labels to actual nicks 61 std::vector<std::string> nicks_; 62 }; 63 64 } // namespace dialogs 65 } // namespace gui2 66