The Battle for Wesnoth
1.21.0-dev
Loading...
Searching...
No Matches
editor
palette
unit_palette.hpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2012 - 2025
3
by Fabian Mueller <fabianmueller5@gmx.de>
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 unit-palette in the editor.
18
*/
19
20
#pragma once
21
22
#include "
editor/palette/editor_palettes.hpp
"
23
24
#include "
units/types.hpp
"
25
26
namespace
editor
{
27
28
class
editor_toolkit;
29
30
//std::string get_selected_terrain();
31
32
/** Palette where the terrain to be drawn can be selected. */
33
class
unit_palette
:
public
editor_palette
<const unit_type&> {
34
public
:
35
36
unit_palette
(
editor_display
&
gui
,
editor_toolkit
&toolkit);
37
38
virtual
void
setup
(
const
game_config_view
&
cfg
)
override
;
39
40
virtual
std::string
get_help_string
()
const override
;
41
42
virtual
bool
supports_swap
()
override
{
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)
override
;
48
49
virtual
void
setup_item
(
50
const
unit_type
& item,
51
texture
& item_base_image,
52
texture
& item_overlay_image,
53
std::stringstream& tooltip
54
)
override
;
55
56
virtual
bool
is_selected_bg_item
(
const
std::string&
id
)
override
;
57
58
virtual
void
select_bg_item
(
const
std::string& item_id)
override
;
59
60
std::set<std::string>
selected_bg_items_
;
61
62
};
63
64
}
editor::editor_display
Definition
editor_display.hpp:24
editor::editor_palette
Definition
editor_palettes.hpp:27
editor::editor_toolkit
Definition
editor_toolkit.hpp:27
editor::unit_palette
Palette where the terrain to be drawn can be selected.
Definition
unit_palette.hpp:33
editor::unit_palette::select_bg_item
virtual void select_bg_item(const std::string &item_id) override
Definition
unit_palette.cpp:113
editor::unit_palette::get_selected_bg_items
const std::set< std::string > & get_selected_bg_items()
Definition
unit_palette.hpp:44
editor::unit_palette::setup
virtual void setup(const game_config_view &cfg) override
Setup the internal data structure.
Definition
unit_palette.cpp:35
editor::unit_palette::supports_swap
virtual bool supports_swap() override
Whether the hotkey system should the enable GUI button connected to swap().
Definition
unit_palette.hpp:42
editor::unit_palette::get_id
virtual const std::string & get_id(const unit_type &terrain) override
Definition
unit_palette.cpp:103
editor::unit_palette::is_selected_bg_item
virtual bool is_selected_bg_item(const std::string &id) override
Definition
unit_palette.cpp:108
editor::unit_palette::get_help_string
virtual std::string get_help_string() const override
Definition
unit_palette.cpp:31
editor::unit_palette::setup_item
virtual void setup_item(const unit_type &item, texture &item_base_image, texture &item_overlay_image, std::stringstream &tooltip) override
Definition
unit_palette.cpp:72
editor::unit_palette::selected_bg_items_
std::set< std::string > selected_bg_items_
Definition
unit_palette.hpp:60
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
texture
Wrapper class to encapsulate creation and management of an SDL_Texture.
Definition
texture.hpp:33
unit_type
A single unit type that the player may recruit.
Definition
types.hpp:43
editor_palettes.hpp
cfg
const config * cfg
Definition
faction_select.cpp:44
editor
Manage the empty-palette in the editor.
Definition
action.cpp:31
gui
General purpose widgets.
Definition
tristate_button.cpp:30
types.hpp
Generated by
1.9.8