The Battle for Wesnoth  1.17.0-dev
terrain_palettes.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2021
3  by David White <dave@whitevine.net>
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 terrain-palette in the editor.
18  * Note: this is a near-straight rip from the old editor.
19 */
20 
21 #pragma once
22 
24 
25 namespace editor {
26 
27 class editor_toolkit;
28 
31 
32 /** Palette where the terrain to be drawn can be selected. */
33 class terrain_palette : public editor_palette<t_translation::terrain_code> {
34 
35 public:
36 
38  editor_toolkit &toolkit);
39 
40  const gamemap& map() const { return gui_.get_map(); }
41 
42  virtual void setup(const game_config_view& cfg);
43 
44  void select_bg_item(const t_translation::terrain_code& terrain);
45  void select_fg_item(const t_translation::terrain_code& terrain);
46 
49 
50  virtual std::string get_help_string();
51 
52 private:
53 
54  virtual void select_bg_item(const std::string& item_id);
55  virtual void select_fg_item(const std::string& item_id);
56 
57  virtual const std::string& get_id(const t_translation::terrain_code& terrain);
58 
59  virtual void draw_item(const t_translation::terrain_code& terrain, surface& item_image, std::stringstream& tooltip_text);
60 
61 };
62 
63 }
virtual const std::string & get_id(const t_translation::terrain_code &terrain)
const t_translation::terrain_code & get_selected_bg_terrain()
terrain_palette(editor_display &gui, const game_config_view &cfg, editor_toolkit &toolkit)
const gamemap & map() const
Palette where the terrain to be drawn can be selected.
General purpose widgets.
const t_translation::terrain_code & selected_bg_item() const
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...
Definition: translation.hpp:50
const t_translation::terrain_code & get_selected_fg_terrain()
void select_bg_item(const t_translation::terrain_code &terrain)
virtual std::string get_help_string()
Encapsulates the map of the game.
Definition: map.hpp:171
Manage the empty-palette in the editor.
Definition: action.cpp:30
void select_fg_item(const t_translation::terrain_code &terrain)
const gamemap & get_map() const
Definition: display.hpp:96
virtual void setup(const game_config_view &cfg)
Setup the internal data structure.
virtual void draw_item(const t_translation::terrain_code &terrain, surface &item_image, std::stringstream &tooltip_text)
const t_translation::terrain_code & selected_fg_item() const