The Battle for Wesnoth  1.19.5+dev
terrain_palettes.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2024
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 
39  virtual void setup(const game_config_view& cfg) override;
40 
41  void select_bg_item(const t_translation::terrain_code& terrain);
42  void select_fg_item(const t_translation::terrain_code& terrain);
43 
46 
47  virtual std::string get_help_string() const override;
48 
49 private:
50 
51  virtual void select_bg_item(const std::string& item_id) override;
52  virtual void select_fg_item(const std::string& item_id) override;
53 
54  virtual const std::string& get_id(const t_translation::terrain_code& terrain) override;
55 
56  virtual void setup_item(
57  const t_translation::terrain_code& item,
58  texture& item_base_image,
59  texture& item_overlay_image,
60  std::stringstream& tooltip
61  ) override;
62 };
63 
64 }
Palette where the terrain to be drawn can be selected.
terrain_palette(editor_display &gui, editor_toolkit &toolkit)
void select_fg_item(const t_translation::terrain_code &terrain)
virtual void setup_item(const t_translation::terrain_code &item, texture &item_base_image, texture &item_overlay_image, std::stringstream &tooltip) override
Setup item image and tooltip.
virtual void setup(const game_config_view &cfg) override
Setup the internal data structure.
const t_translation::terrain_code & selected_bg_item() const
virtual const std::string & get_id(const t_translation::terrain_code &terrain) override
virtual std::string get_help_string() const override
const t_translation::terrain_code & selected_fg_item() 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 ...
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:202
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.
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