The Battle for Wesnoth  1.17.0-dev
unit_palette.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 - 2021
3  by Fabian Mueller <fabianmueller5@gmx.de>
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 /**
17  * Manage the unit-palette in the editor.
18  */
19 
20 #pragma once
21 
23 
24 #include "units/types.hpp"
25 
26 namespace editor {
27 
28 class editor_toolkit;
29 
30 //std::string get_selected_terrain();
31 
32 /** Palette where the terrain to be drawn can be selected. */
33 class unit_palette : public editor_palette<const unit_type&> {
34 public:
35 
37  const game_config_view& cfg,
38  editor_toolkit &toolkit);
39 
40  virtual void setup(const game_config_view& cfg);
41 
42  virtual std::string get_help_string();
43 
44  bool supports_swap() { return false; }
45 
46  const std::set<std::string>& get_selected_bg_items() { return selected_bg_items_; }
47 
48 private:
49  virtual const std::string& get_id(const unit_type& terrain);
50 
51  virtual void draw_item(const unit_type& terrain, surface& image, std::stringstream& tooltip_text);
52 
53  virtual bool is_selected_bg_item(const std::string& id);
54 
55  virtual void select_bg_item(const std::string& item_id);
56 // virtual void update_report();
57 
58  std::set<std::string> selected_bg_items_;
59 
60 };
61 
62 }
unit_palette(editor_display &gui, const game_config_view &cfg, editor_toolkit &toolkit)
std::set< std::string > selected_bg_items_
const std::set< std::string > & get_selected_bg_items()
General purpose widgets.
virtual bool is_selected_bg_item(const std::string &id)
virtual std::string get_help_string()
A single unit type that the player may recruit.
Definition: types.hpp:45
Manage the empty-palette in the editor.
Definition: action.cpp:30
virtual const std::string & get_id(const unit_type &terrain)
Palette where the terrain to be drawn can be selected.
Functions to load and save images from/to disk.
virtual void select_bg_item(const std::string &item_id)
virtual void setup(const game_config_view &cfg)
Setup the internal data structure.
virtual void draw_item(const unit_type &terrain, surface &image, std::stringstream &tooltip_text)