The Battle for Wesnoth  1.13.4+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 - 2016 by Fabian Mueller <[email protected]>
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 #ifndef UNIT_PALETTES_H_INCLUDED
20 #define UNIT_PALETTES_H_INCLUDED
21 
22 #include "editor_palettes.hpp"
23 
24 #include "units/types.hpp"
25 
26 namespace editor {
27 
28 //std::string get_selected_terrain();
29 
30 /** Palette where the terrain to be drawn can be selected. */
31 class unit_palette : public editor_palette<unit_type> {
32 public:
33 
35  const config& cfg,
36  mouse_action** active_mouse_action);
37 
38  virtual void setup(const config& cfg);
39 
40  virtual std::string get_help_string();
41 
42  bool supports_swap() { return false; }
43 
44  const std::set<std::string>& get_selected_bg_items() { return selected_bg_items_; }
45 
46 private:
47  virtual const std::string& get_id(const unit_type& terrain);
48 
49  virtual void draw_item(const unit_type& terrain, surface& image, std::stringstream& tooltip_text);
50 
51  virtual bool is_selected_bg_item(const std::string& id);
52 
53  virtual void select_bg_item(const std::string& item_id);
54 // virtual void update_report();
55 
56  std::set<std::string> selected_bg_items_;
57 
58 };
59 
60 }
61 #endif
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()
Manage the empty-palette in the editor.
Definition: action.cpp:28
static const ::config * terrain
The terrain used to create the cache.
Definition: minimap.cpp:135
unit_palette(editor_display &gui, const config &cfg, mouse_action **active_mouse_action)
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:75
A mouse action receives events from the controller, and responds to them by creating an appropriate e...
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:83
GLsizei const GLcharARB ** string
Definition: glew.h:4503
virtual void draw_item(const unit_type &terrain, surface &image, std::stringstream &tooltip_text)