29 #include <SDL2/SDL_rect.h> 52 virtual rect& location(
const SDL_Rect& screen)
const;
54 const std::string&
get_id()
const {
return id_; }
59 void modify_location(std::string rect_str, SDL_Rect rect_ref);
81 static ANCHORING read_anchor(
const std::string& str);
104 explicit label(std::size_t
sw, std::size_t sh,
const config& cfg);
106 using object::location;
108 const std::string&
text()
const {
return text_; }
109 void set_text(
const std::string& text) { text_ = text; }
110 const std::string&
icon()
const {
return icon_; }
112 bool empty()
const {
return text_.empty() && icon_.empty(); }
130 using object::location;
132 const std::string&
prefix()
const {
return prefix_; }
133 const std::string&
postfix()
const {
return postfix_; }
153 explicit panel(std::size_t
sw, std::size_t sh,
const config& cfg);
155 using object::location;
157 const std::string&
image()
const {
return image_; }
167 explicit action(std::size_t
sw, std::size_t sh,
const config& cfg);
169 using object::location;
173 const std::string&
title()
const {
return title_; }
177 const std::string&
type()
const {
return type_; }
179 const std::string&
image()
const {
return image_; }
181 const std::string&
overlay()
const {
return overlay_; }
183 const std::vector<std::string>&
items()
const {
return items_; }
185 void set_title(
const std::string& new_title) { title_ = new_title; }
188 std::string title_, tooltip_, image_, overlay_,
type_;
196 explicit slider(std::size_t
sw, std::size_t sh,
const config& cfg);
198 using object::location;
200 const std::string&
title()
const {
return title_; }
202 const std::string&
tooltip()
const {
return tooltip_; }
204 const std::string&
image()
const {
return image_; }
206 const std::string&
overlay()
const {
return overlay_; }
210 void set_title(
const std::string& new_title) { title_ = new_title; }
220 explicit menu(std::size_t
sw, std::size_t sh,
const config& cfg);
222 using object::location;
228 const std::string&
title()
const {
return title_; }
230 const std::string&
tooltip()
const {
return tooltip_; }
232 const std::string&
image()
const {
return image_; }
234 const std::string&
overlay()
const {
return overlay_; }
236 const std::vector<config>&
items()
const {
return items_; }
238 void set_title(
const std::string& new_title) { title_ = new_title; }
246 explicit theme(
const config& cfg,
const SDL_Rect& screen);
252 void modify(
const config &cfg);
254 const std::vector<panel>&
panels()
const {
return panels_; }
255 const std::vector<label>&
labels()
const {
return labels_; }
256 const std::vector<menu>&
menus()
const {
return menus_; }
257 const std::vector<slider>&
sliders()
const {
return sliders_; }
258 const std::vector<action>&
actions()
const {
return actions_; }
261 {
return context_.
is_context() ? &context_ :
nullptr; }
265 object* refresh_title(
const std::string&
id,
const std::string& new_title);
266 object* refresh_title2(
const std::string&
id,
const std::string& title_tag);
267 void modify_label(
const std::string&
id,
const std::string& text);
270 const menu *get_menu_item(
const std::string &key)
const;
271 const action* get_action_item(
const std::string &key)
const;
274 {
return main_map_.location(screen); }
276 {
return mini_map_.location(screen); }
278 {
return unit_image_.location(screen); }
280 {
return palette_.location(screen); }
288 void add_object(std::size_t
sw, std::size_t sh,
const config& cfg);
289 void remove_object(
const std::string&
id);
290 void set_object_location(
theme::object& element, std::string rect_str, std::string ref_id);
307 std::map<std::string, std::unique_ptr<status_item>>
status_;
316 static inline std::map<std::string, config> known_themes{};
323 static const config& get_theme_config(
const std::string&
id);
326 static std::vector<theme_info> get_basic_theme_info(
bool include_hidden =
false);
std::vector< label > labels_
std::size_t font_size() const
std::map< std::string, std::unique_ptr< status_item > > status_
events::generic_event theme_reset_event_
const std::string & icon() const
void set_title(const std::string &new_title)
const std::string & overlay() const
std::vector< action > actions_
void set_title(const std::string &new_title)
const rect & mini_map_location(const SDL_Rect &screen) const
const rect & palette_location(const SDL_Rect &screen) const
std::vector< panel > panels_
const label * get_label() const
const std::string & tooltip() const
std::vector< slider > sliders_
const std::vector< label > & labels() const
Definitions for the interface to Wesnoth Markup Language (WML).
bool set_resolution(const point &resolution)
Set the window resolution.
const std::string & text() const
const std::string & prefix() const
std::string label
What to show in the filter's drop-down list.
std::vector< menu > menus_
bool font_rgb_set() const
const rect & unit_image_location(const SDL_Rect &screen) const
const std::string & type() const
const std::string & image() const
std::string background_image
events::generic_event & theme_reset_event()
The basic class for representing 8-bit RGB or RGBA colour values.
bool font_rgb_set() const
const std::vector< std::string > & items() const
const std::string & get_id() const
const std::string & title() const
const border_t & border() const
const std::string & postfix() const
SDL_Rect screen_dimensions_
An abstract description of a rectangle with integer coordinates.
const std::string & image() const
const std::vector< action > & actions() const
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
static map_location::DIRECTION sw
const std::vector< slider > & sliders() const
std::size_t cur_spec_width_
const std::string & image() const
bool tooltip_name_prepend_
void set_text(const std::string &text)
const std::string & overlay() const
Contains the SDL_Rect helper code.
const std::string & title() const
std::vector< std::string > items_
const menu * context_menu() const
std::size_t font_size() const
const std::vector< menu > & menus() const
A config object defines a single node in a WML file, with access to child nodes.
const std::vector< panel > & panels() const
const rect & get_location() const
const rect & main_map_location(const SDL_Rect &screen) const
std::string tooltip
Shown when hovering over an entry in the filter's drop-down list.
std::pair< std::string, unsigned > item