The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
unit_palette.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 - 2017 by Fabian Mueller <fabianmueller5@gmx.de>
3  Part of the Battle for Wesnoth Project http://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 /**
16  * Manage the unit-palette in the editor.
17  */
18 
19 #pragma once
20 
22 
23 #include "units/types.hpp"
24 
25 namespace editor {
26 
27 class editor_toolkit;
28 
29 //std::string get_selected_terrain();
30 
31 /** Palette where the terrain to be drawn can be selected. */
32 class unit_palette : public editor_palette<unit_type> {
33 public:
34 
36  const config& cfg,
37  editor_toolkit &toolkit);
38 
39  virtual void setup(const config& cfg);
40 
41  virtual std::string get_help_string();
42 
43  bool supports_swap() { return false; }
44 
45  const std::set<std::string>& get_selected_bg_items() { return selected_bg_items_; }
46 
47 private:
48  virtual const std::string& get_id(const unit_type& terrain);
49 
50  virtual void draw_item(const unit_type& terrain, surface& image, std::stringstream& tooltip_text);
51 
52  virtual bool is_selected_bg_item(const std::string& id);
53 
54  virtual void select_bg_item(const std::string& item_id);
55 // virtual void update_report();
56 
57  std::set<std::string> selected_bg_items_;
58 
59 };
60 
61 }
std::vector< char_t > string
std::set< std::string > selected_bg_items_
unit_palette(editor_display &gui, const config &cfg, editor_toolkit &toolkit)
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:43
Manage the empty-palette in the editor.
Definition: action.cpp:29
static const ::config * terrain
The terrain used to create the cache.
Definition: minimap.cpp:133
virtual const std::string & get_id(const unit_type &terrain)
Palette where the terrain to be drawn can be selected.
virtual void setup(const config &cfg)
Setup the internal data structure.
this module manages the cache of images.
Definition: image.cpp:109
virtual void select_bg_item(const std::string &item_id)
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:93
virtual void draw_item(const unit_type &terrain, surface &image, std::stringstream &tooltip_text)