The Battle for Wesnoth  1.19.6+dev
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
theme Class Reference

#include <theme.hpp>

Classes

class  action
 
struct  border_t
 
class  label
 
class  menu
 
class  object
 
class  panel
 
class  slider
 
class  status_item
 

Public Member Functions

 theme (const config &cfg, const SDL_Rect &screen)
 
 theme (const theme &)=delete
 
themeoperator= (const theme &)=delete
 
themeoperator= (theme &&)
 
bool set_resolution (const SDL_Rect &screen)
 
void modify (const config &cfg)
 
const std::vector< panel > & panels () const
 
const std::vector< label > & labels () const
 
const std::vector< menu > & menus () const
 
const std::vector< slider > & sliders () const
 
const std::vector< action > & actions () const
 
const menucontext_menu () const
 
objectrefresh_title (const std::string &id, const std::string &new_title)
 
objectrefresh_title2 (const std::string &id, const std::string &title_tag)
 
void modify_label (const std::string &id, const std::string &text)
 
const status_itemget_status_item (const std::string &item) const
 
const menuget_menu_item (const std::string &key) const
 
const actionget_action_item (const std::string &key) const
 
const rectmain_map_location (const SDL_Rect &screen) const
 
const rectmini_map_location (const SDL_Rect &screen) const
 
const rectunit_image_location (const SDL_Rect &screen) const
 
const rectpalette_location (const SDL_Rect &screen) const
 
const border_tborder () const
 
events::generic_eventtheme_reset_event ()
 

Static Public Member Functions

static void set_known_themes (const game_config_view *cfg)
 Copies the theme configs from the main game config. More...
 
static NOT_DANGLING const configget_theme_config (const std::string &id)
 Returns the saved config for the theme with the given ID. More...
 
static std::vector< theme_infoget_basic_theme_info (bool include_hidden=false)
 Returns minimal info about saved themes, optionally including hidden ones. More...
 

Private Member Functions

theme::objectfind_element (const std::string &id)
 
void add_object (std::size_t sw, std::size_t sh, const config &cfg)
 
void remove_object (const std::string &id)
 
void set_object_location (theme::object &element, const std::string &rect_str, std::string ref_id)
 

Private Attributes

events::generic_event theme_reset_event_
 
std::string cur_theme
 
config cfg_
 
std::vector< panelpanels_
 
std::vector< labellabels_
 
std::vector< menumenus_
 
std::vector< actionactions_
 
std::vector< slidersliders_
 
menu context_
 
action action_context_
 
std::map< std::string, std::unique_ptr< status_item > > status_
 
object main_map_
 
object mini_map_
 
object unit_image_
 
object palette_
 
border_t border_
 
SDL_Rect screen_dimensions_
 
std::size_t cur_spec_width_
 
std::size_t cur_spec_height_
 

Static Private Attributes

static std::map< std::string, configknown_themes {}
 

Detailed Description

Definition at line 43 of file theme.hpp.

Constructor & Destructor Documentation

◆ theme() [1/2]

theme::theme ( const config cfg,
const SDL_Rect &  screen 
)
explicit

Definition at line 579 of file theme.cpp.

References cfg_, do_resolve_rects(), expand_partialresolution(), and set_resolution().

◆ theme() [2/2]

theme::theme ( const theme )
delete

Member Function Documentation

◆ actions()

const std::vector<action>& theme::actions ( ) const
inline

◆ add_object()

void theme::add_object ( std::size_t  sw,
std::size_t  sh,
const config cfg 
)
private

◆ border()

const border_t& theme::border ( ) const
inline

◆ context_menu()

const menu* theme::context_menu ( ) const
inline

◆ find_element()

theme::object & theme::find_element ( const std::string &  id)
private

Definition at line 863 of file theme.cpp.

References actions_, labels_, main_map_, menus_, mini_map_, p, palette_, panels_, status_, and unit_image_.

Referenced by modify(), modify_label(), and set_object_location().

◆ get_action_item()

const theme::action * theme::get_action_item ( const std::string &  key) const

Definition at line 926 of file theme.cpp.

References actions_.

Referenced by hotkey::command_executor::get_menu_images().

◆ get_basic_theme_info()

std::vector< theme_info > theme::get_basic_theme_info ( bool  include_hidden = false)
static

Returns minimal info about saved themes, optionally including hidden ones.

Definition at line 987 of file theme.cpp.

References id, lg::info(), and known_themes.

Referenced by gui2::dialogs::preferences_dialog::set_theme_list(), and prefs::show_theme_dialog().

◆ get_menu_item()

const theme::menu * theme::get_menu_item ( const std::string &  key) const

◆ get_status_item()

const theme::status_item * theme::get_status_item ( const std::string &  item) const

Definition at line 908 of file theme.cpp.

References i, and status_.

Referenced by display::draw_report(), and display::refresh_report().

◆ get_theme_config()

const config & theme::get_theme_config ( const std::string &  id)
static

Returns the saved config for the theme with the given ID.

Definition at line 1003 of file theme.cpp.

References ERR_DP, and known_themes.

Referenced by replay_controller::add_replay_theme(), and display::set_theme().

◆ labels()

const std::vector<label>& theme::labels ( ) const
inline

Definition at line 256 of file theme.hpp.

References labels_.

Referenced by display::draw_all_panels().

◆ main_map_location()

const rect& theme::main_map_location ( const SDL_Rect &  screen) const
inline

Definition at line 274 of file theme.hpp.

References theme::object::location(), and main_map_.

Referenced by display::map_outside_area().

◆ menus()

const std::vector<menu>& theme::menus ( ) const
inline

◆ mini_map_location()

const rect& theme::mini_map_location ( const SDL_Rect &  screen) const
inline

Definition at line 276 of file theme.hpp.

References theme::object::location(), and mini_map_.

Referenced by display::minimap_area().

◆ modify()

void theme::modify ( const config cfg)

◆ modify_label()

void theme::modify_label ( const std::string &  id,
const std::string &  text 
)

Definition at line 967 of file theme.cpp.

References find_element(), LOG_DP, and theme::label::set_text().

◆ operator=() [1/2]

theme& theme::operator= ( const theme )
delete

◆ operator=() [2/2]

theme & theme::operator= ( theme &&  )
default

◆ palette_location()

const rect& theme::palette_location ( const SDL_Rect &  screen) const
inline

Definition at line 280 of file theme.hpp.

References theme::object::location(), and palette_.

Referenced by display::palette_area().

◆ panels()

const std::vector<panel>& theme::panels ( ) const
inline

Definition at line 255 of file theme.hpp.

References panels_.

Referenced by display::draw_all_panels().

◆ refresh_title()

theme::object * theme::refresh_title ( const std::string &  id,
const std::string &  new_title 
)

Definition at line 935 of file theme.cpp.

References actions_, and menus_.

Referenced by refresh_title2().

◆ refresh_title2()

theme::object * theme::refresh_title2 ( const std::string &  id,
const std::string &  title_tag 
)

Definition at line 956 of file theme.cpp.

References cfg_, find_ref(), and refresh_title().

◆ remove_object()

void theme::remove_object ( const std::string &  id)
private

Definition at line 763 of file theme.cpp.

References actions_, labels_, menus_, p, panels_, s, sliders_, and status_.

Referenced by modify().

◆ set_known_themes()

void theme::set_known_themes ( const game_config_view cfg)
static

Copies the theme configs from the main game config.

Definition at line 977 of file theme.cpp.

References game_config_view::child_range(), and known_themes.

Referenced by game_config_manager::load_game_config().

◆ set_object_location()

void theme::set_object_location ( theme::object element,
const std::string &  rect_str,
std::string  ref_id 
)
private

◆ set_resolution()

bool theme::set_resolution ( const SDL_Rect &  screen)

◆ sliders()

const std::vector<slider>& theme::sliders ( ) const
inline

Definition at line 258 of file theme.hpp.

References sliders_.

◆ theme_reset_event()

events::generic_event& theme::theme_reset_event ( )
inline

◆ unit_image_location()

const rect& theme::unit_image_location ( const SDL_Rect &  screen) const
inline

Definition at line 278 of file theme.hpp.

References theme::object::location(), and unit_image_.

Referenced by display::unit_image_area().

Member Data Documentation

◆ action_context_

action theme::action_context_
private

Definition at line 306 of file theme.hpp.

Referenced by add_object().

◆ actions_

std::vector<action> theme::actions_
private

◆ border_

border_t theme::border_
private

Definition at line 312 of file theme.hpp.

Referenced by add_object(), and border().

◆ cfg_

config theme::cfg_
private

Definition at line 298 of file theme.hpp.

Referenced by refresh_title2(), set_resolution(), and theme().

◆ context_

menu theme::context_
private

Definition at line 305 of file theme.hpp.

Referenced by add_object(), and context_menu().

◆ cur_spec_height_

std::size_t theme::cur_spec_height_
private

Definition at line 315 of file theme.hpp.

Referenced by modify(), and set_resolution().

◆ cur_spec_width_

std::size_t theme::cur_spec_width_
private

Definition at line 315 of file theme.hpp.

Referenced by modify(), and set_resolution().

◆ cur_theme

std::string theme::cur_theme
private

Definition at line 297 of file theme.hpp.

◆ known_themes

std::map<std::string, config> theme::known_themes {}
inlinestaticprivate

Definition at line 317 of file theme.hpp.

Referenced by get_basic_theme_info(), get_theme_config(), and set_known_themes().

◆ labels_

std::vector<label> theme::labels_
private

Definition at line 300 of file theme.hpp.

Referenced by add_object(), find_element(), labels(), remove_object(), and set_resolution().

◆ main_map_

object theme::main_map_
private

Definition at line 310 of file theme.hpp.

Referenced by add_object(), find_element(), and main_map_location().

◆ menus_

std::vector<menu> theme::menus_
private

◆ mini_map_

object theme::mini_map_
private

Definition at line 310 of file theme.hpp.

Referenced by add_object(), find_element(), and mini_map_location().

◆ palette_

object theme::palette_
private

Definition at line 310 of file theme.hpp.

Referenced by add_object(), find_element(), and palette_location().

◆ panels_

std::vector<panel> theme::panels_
private

Definition at line 299 of file theme.hpp.

Referenced by add_object(), find_element(), panels(), remove_object(), and set_resolution().

◆ screen_dimensions_

SDL_Rect theme::screen_dimensions_
private

Definition at line 314 of file theme.hpp.

Referenced by add_object(), and set_resolution().

◆ sliders_

std::vector<slider> theme::sliders_
private

Definition at line 303 of file theme.hpp.

Referenced by add_object(), remove_object(), set_resolution(), and sliders().

◆ status_

std::map<std::string, std::unique_ptr<status_item> > theme::status_
private

Definition at line 308 of file theme.hpp.

Referenced by add_object(), find_element(), get_status_item(), remove_object(), and set_resolution().

◆ theme_reset_event_

events::generic_event theme::theme_reset_event_
private

Definition at line 295 of file theme.hpp.

Referenced by set_resolution(), and theme_reset_event().

◆ unit_image_

object theme::unit_image_
private

Definition at line 310 of file theme.hpp.

Referenced by add_object(), find_element(), and unit_image_location().


The documentation for this class was generated from the following files: