The Battle for Wesnoth
1.19.3+dev
editor
palette
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
23
#include "
editor/palette/editor_palettes.hpp
"
24
25
namespace
editor
{
26
27
class
editor_toolkit;
28
29
const
t_translation::terrain_code
&
get_selected_fg_terrain
();
30
const
t_translation::terrain_code
&
get_selected_bg_terrain
();
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
37
terrain_palette
(
editor_display
&
gui
,
const
game_config_view
& cfg,
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
47
const
t_translation::terrain_code
&
selected_fg_item
()
const
;
48
const
t_translation::terrain_code
&
selected_bg_item
()
const
;
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
(
60
const
t_translation::terrain_code
&
item
,
61
texture
& item_base_image,
62
texture
& item_overlay_image,
63
std::stringstream&
tooltip
64
);
65
};
66
67
}
display::get_map
const gamemap & get_map() const
Definition:
display.hpp:107
editor::editor_display
Definition:
editor_display.hpp:24
editor::editor_palette
Definition:
editor_palettes.hpp:27
editor::editor_palette< t_translation::terrain_code >::gui_
editor_display & gui_
Definition:
editor_palettes.hpp:148
editor::editor_toolkit
Definition:
editor_toolkit.hpp:27
editor::terrain_palette
Palette where the terrain to be drawn can be selected.
Definition:
terrain_palettes.hpp:33
editor::terrain_palette::get_help_string
virtual std::string get_help_string()
Definition:
terrain_palettes.cpp:221
editor::terrain_palette::select_fg_item
void select_fg_item(const t_translation::terrain_code &terrain)
Definition:
terrain_palettes.cpp:66
editor::terrain_palette::get_id
virtual const std::string & get_id(const t_translation::terrain_code &terrain)
Definition:
terrain_palettes.cpp:215
editor::terrain_palette::terrain_palette
terrain_palette(editor_display &gui, const game_config_view &cfg, editor_toolkit &toolkit)
Definition:
terrain_palettes.cpp:209
editor::terrain_palette::selected_bg_item
const t_translation::terrain_code & selected_bg_item() const
Definition:
terrain_palettes.cpp:44
editor::terrain_palette::setup_item
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.
Definition:
terrain_palettes.cpp:167
editor::terrain_palette::selected_fg_item
const t_translation::terrain_code & selected_fg_item() const
Definition:
terrain_palettes.cpp:43
editor::terrain_palette::setup
virtual void setup(const game_config_view &cfg)
Setup the internal data structure.
Definition:
terrain_palettes.cpp:72
editor::terrain_palette::map
const gamemap & map() const
Definition:
terrain_palettes.hpp:40
editor::terrain_palette::select_bg_item
void select_bg_item(const t_translation::terrain_code &terrain)
Definition:
terrain_palettes.cpp:61
game_config_view
A class grating read only view to a vector of config objects, viewed as one config with all children ...
Definition:
game_config_view.hpp:31
gamemap
Encapsulates the map of the game.
Definition:
map.hpp:172
texture
Wrapper class to encapsulate creation and management of an SDL_Texture.
Definition:
texture.hpp:33
editor_palettes.hpp
tooltip
std::string tooltip
Shown when hovering over an entry in the filter's drop-down list.
Definition:
manager.cpp:209
editor
Manage the empty-palette in the editor.
Definition:
action.cpp:31
editor::get_selected_bg_terrain
const t_translation::terrain_code & get_selected_bg_terrain()
Definition:
terrain_palettes.cpp:35
editor::get_selected_fg_terrain
const t_translation::terrain_code & get_selected_fg_terrain()
Definition:
terrain_palettes.cpp:39
gui
General purpose widgets.
Definition:
tristate_button.cpp:30
help::item
std::pair< std::string, unsigned > item
Definition:
help_impl.hpp:411
t_translation::terrain_code
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
Generated by
1.9.1