The Battle for Wesnoth  1.17.23+dev
terrain_palettes.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2023
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 setup_item(
61  texture& item_base_image,
62  texture& item_overlay_image,
63  std::stringstream& tooltip
64  );
65 };
66 
67 }
const gamemap & get_map() const
Definition: display.hpp:105
Palette where the terrain to be drawn can be selected.
virtual std::string get_help_string()
void select_fg_item(const t_translation::terrain_code &terrain)
virtual const std::string & get_id(const t_translation::terrain_code &terrain)
terrain_palette(editor_display &gui, const game_config_view &cfg, editor_toolkit &toolkit)
const t_translation::terrain_code & selected_bg_item() const
virtual void setup_item(const t_translation::terrain_code &item, texture &item_base_image, texture &item_overlay_image, std::stringstream &tooltip)
Setup item image and tooltip.
const t_translation::terrain_code & selected_fg_item() const
virtual void setup(const game_config_view &cfg)
Setup the internal data structure.
const gamemap & map() const
void select_bg_item(const t_translation::terrain_code &terrain)
A class grating read only view to a vector of config objects, viewed as one config with all children ...
Encapsulates the map of the game.
Definition: map.hpp:172
Wrapper class to encapsulate creation and management of an SDL_Texture.
Definition: texture.hpp:33
std::string tooltip
Shown when hovering over an entry in the filter's drop-down list.
Definition: manager.cpp:219
Manage the empty-palette in the editor.
Definition: action.cpp:31
const t_translation::terrain_code & get_selected_bg_terrain()
const t_translation::terrain_code & get_selected_fg_terrain()
General purpose widgets.
std::pair< std::string, unsigned > item
Definition: help_impl.hpp:414
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...
Definition: translation.hpp:49