1 /* 2 * Copyright (C) 2002-2020 by the Widelands Development Team 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 * 18 */ 19 20 #ifndef WL_UI_FSMENU_MAPSELECT_H 21 #define WL_UI_FSMENU_MAPSELECT_H 22 23 #include "ui_basic/box.h" 24 #include "ui_basic/checkbox.h" 25 #include "ui_basic/dropdown.h" 26 #include "ui_basic/textarea.h" 27 #include "ui_fsmenu/load_map_or_game.h" 28 #include "wui/mapdetails.h" 29 #include "wui/maptable.h" 30 31 using Widelands::Map; 32 class GameController; 33 struct GameSettingsProvider; 34 35 /** 36 * Select a Map in Fullscreen Mode. It's a modal fullscreen menu 37 */ 38 class FullscreenMenuMapSelect : public FullscreenMenuLoadMapOrGame { 39 public: 40 FullscreenMenuMapSelect(GameSettingsProvider*, GameController*); 41 42 bool is_scenario(); 43 MapData const* get_map() const; 44 void think() override; 45 46 protected: 47 void clicked_ok() override; 48 void entry_selected() override; 49 void fill_table() override; 50 51 private: 52 void layout() override; 53 54 bool compare_players(uint32_t, uint32_t); 55 bool compare_mapnames(uint32_t, uint32_t); 56 bool compare_size(uint32_t, uint32_t); 57 58 /// Updates buttons and text labels and returns whether a table entry is selected. 59 bool set_has_selection(); 60 UI::Checkbox* add_tag_checkbox(UI::Box*, std::string, std::string); 61 void tagbox_changed(int32_t, bool); 62 void clear_filter(); 63 void rebuild_balancing_dropdown(); 64 65 int32_t const checkbox_space_; 66 const int checkbox_padding_; 67 int32_t checkboxes_y_; 68 69 UI::Textarea title_; 70 UI::Box checkboxes_; 71 72 MapTable table_; 73 MapDetails map_details_; 74 75 Map::ScenarioTypes scenario_types_; 76 77 const std::string basedir_; 78 std::string curdir_; 79 80 GameSettingsProvider* settings_; 81 GameController* ctrl_; 82 83 UI::Checkbox* cb_dont_localize_mapnames_; 84 bool has_translated_mapname_; 85 86 UI::Button* show_all_maps_; 87 std::vector<UI::Checkbox*> tags_checkboxes_; 88 89 UI::Dropdown<std::string>* official_tags_dropdown_; 90 91 UI::Dropdown<std::string>* balancing_tags_dropdown_; 92 bool unspecified_balancing_found_; // Backwards compatibility 93 94 UI::Dropdown<std::string>* team_tags_dropdown_; 95 96 std::vector<std::string> tags_ordered_; 97 std::set<uint32_t> req_tags_; 98 99 std::vector<MapData> maps_data_; 100 }; 101 102 #endif // end of include guard: WL_UI_FSMENU_MAPSELECT_H 103