#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 | |
theme & | operator= (const theme &)=delete |
theme & | operator= (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 menu * | context_menu () const |
object * | refresh_title (const std::string &id, const std::string &new_title) |
object * | refresh_title2 (const std::string &id, const std::string &title_tag) |
void | modify_label (const std::string &id, const std::string &text) |
const status_item * | get_status_item (const std::string &item) const |
const menu * | get_menu_item (const std::string &key) const |
const action * | get_action_item (const std::string &key) const |
const rect & | main_map_location (const SDL_Rect &screen) const |
const rect & | mini_map_location (const SDL_Rect &screen) const |
const rect & | unit_image_location (const SDL_Rect &screen) const |
const rect & | palette_location (const SDL_Rect &screen) const |
const border_t & | border () const |
events::generic_event & | theme_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 config & | get_theme_config (const std::string &id) |
Returns the saved config for the theme with the given ID. More... | |
static std::vector< theme_info > | get_basic_theme_info (bool include_hidden=false) |
Returns minimal info about saved themes, optionally including hidden ones. More... | |
Private Member Functions | |
theme::object & | find_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< panel > | panels_ |
std::vector< label > | labels_ |
std::vector< menu > | menus_ |
std::vector< action > | actions_ |
std::vector< slider > | sliders_ |
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, config > | known_themes {} |
|
explicit |
Definition at line 579 of file theme.cpp.
References cfg_, do_resolve_rects(), expand_partialresolution(), and set_resolution().
|
delete |
|
inline |
Definition at line 259 of file theme.hpp.
References actions_.
Referenced by display::action_pressed(), display::create_buttons(), display::layout_buttons(), and hotkey::command_executor_default::set_button_state().
|
private |
Definition at line 677 of file theme.cpp.
References action_context_, actions_, border_, c, config::child_range(), context_, DBG_DP, desktop::battery_info::does_device_have_battery(), theme::action::is_context(), theme::menu::is_context(), labels_, main_map_, menus_, mini_map_, modify(), config::optional_child(), p, palette_, panels_, s, screen_dimensions_, set_object_location(), sliders_, status_, sw, and unit_image_.
Referenced by modify(), and set_resolution().
|
inline |
Definition at line 283 of file theme.hpp.
References border_.
Referenced by display::bounds_check_position(), display::draw_minimap(), display::get_location(), display::get_terrain_images(), display::hexes_under_rect(), display::max_map_area(), display::pixel_position_to_hex(), display::render_map_outside_area(), and display::set_theme().
|
inline |
Definition at line 261 of file theme.hpp.
References context_, and theme::menu::is_context().
Referenced by controller_base::handle_event(), controller_base::long_touch_callback(), and events::mouse_handler_base::right_mouse_up().
|
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().
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().
|
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().
const theme::menu * theme::get_menu_item | ( | const std::string & | key | ) | const |
Definition at line 917 of file theme.cpp.
References menus_.
Referenced by hotkey::command_executor::get_menu_image(), hotkey::command_executor::get_menu_images(), and display::menu_pressed().
const theme::status_item * theme::get_status_item | ( | const std::string & | item | ) | const |
Definition at line 908 of file theme.cpp.
Referenced by display::draw_report(), and display::refresh_report().
|
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().
|
inline |
Definition at line 256 of file theme.hpp.
References labels_.
Referenced by display::draw_all_panels().
|
inline |
Definition at line 274 of file theme.hpp.
References theme::object::location(), and main_map_.
Referenced by display::map_outside_area().
|
inline |
Definition at line 257 of file theme.hpp.
References menus_.
Referenced by display::create_buttons(), editor::editor_toolkit::init_mouse_actions(), display::layout_buttons(), display::menu_pressed(), and hotkey::command_executor_default::set_button_state().
|
inline |
Definition at line 276 of file theme.hpp.
References theme::object::location(), and mini_map_.
Referenced by display::minimap_area().
void theme::modify | ( | const config & | cfg | ) |
Definition at line 819 of file theme.cpp.
References actions_, add_object(), c, config::child_range(), cur_spec_height_, cur_spec_width_, find_element(), theme::object::get_id(), menus_, remove_object(), and set_object_location().
Referenced by add_object(), and replay_controller::add_replay_theme().
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().
|
inline |
Definition at line 280 of file theme.hpp.
References theme::object::location(), and palette_.
Referenced by display::palette_area().
|
inline |
Definition at line 255 of file theme.hpp.
References panels_.
Referenced by display::draw_all_panels().
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().
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().
|
private |
|
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().
|
private |
Definition at line 805 of file theme.cpp.
References find_element(), theme::object::get_id(), theme::object::get_location(), and theme::object::modify_location().
Referenced by add_object(), and modify().
bool theme::set_resolution | ( | const SDL_Rect & | screen | ) |
Definition at line 604 of file theme.cpp.
References actions_, add_object(), cfg_, config::child_count(), config::child_range(), cur_spec_height_, cur_spec_width_, ERR_DP, i, labels_, LOG_DP, menus_, events::generic_event::notify_observers(), panels_, screen_dimensions_, sliders_, status_, and theme_reset_event_.
Referenced by display::queue_rerender(), and theme().
|
inline |
|
inline |
Definition at line 285 of file theme.hpp.
References theme_reset_event_.
Referenced by replay_controller::replay_controller(), and replay_controller::~replay_controller().
|
inline |
Definition at line 278 of file theme.hpp.
References theme::object::location(), and unit_image_.
Referenced by display::unit_image_area().
|
private |
Definition at line 306 of file theme.hpp.
Referenced by add_object().
|
private |
Definition at line 302 of file theme.hpp.
Referenced by actions(), add_object(), find_element(), get_action_item(), modify(), refresh_title(), remove_object(), and set_resolution().
|
private |
Definition at line 312 of file theme.hpp.
Referenced by add_object(), and border().
|
private |
Definition at line 298 of file theme.hpp.
Referenced by refresh_title2(), set_resolution(), and theme().
|
private |
Definition at line 305 of file theme.hpp.
Referenced by add_object(), and context_menu().
|
private |
Definition at line 315 of file theme.hpp.
Referenced by modify(), and set_resolution().
|
private |
Definition at line 315 of file theme.hpp.
Referenced by modify(), and set_resolution().
|
inlinestaticprivate |
Definition at line 317 of file theme.hpp.
Referenced by get_basic_theme_info(), get_theme_config(), and set_known_themes().
|
private |
Definition at line 300 of file theme.hpp.
Referenced by add_object(), find_element(), labels(), remove_object(), and set_resolution().
|
private |
Definition at line 310 of file theme.hpp.
Referenced by add_object(), find_element(), and main_map_location().
|
private |
Definition at line 301 of file theme.hpp.
Referenced by add_object(), find_element(), get_menu_item(), menus(), modify(), refresh_title(), remove_object(), and set_resolution().
|
private |
Definition at line 310 of file theme.hpp.
Referenced by add_object(), find_element(), and mini_map_location().
|
private |
Definition at line 310 of file theme.hpp.
Referenced by add_object(), find_element(), and palette_location().
|
private |
Definition at line 299 of file theme.hpp.
Referenced by add_object(), find_element(), panels(), remove_object(), and set_resolution().
|
private |
Definition at line 314 of file theme.hpp.
Referenced by add_object(), and set_resolution().
|
private |
Definition at line 303 of file theme.hpp.
Referenced by add_object(), remove_object(), set_resolution(), and sliders().
|
private |
Definition at line 308 of file theme.hpp.
Referenced by add_object(), find_element(), get_status_item(), remove_object(), and set_resolution().
|
private |
Definition at line 295 of file theme.hpp.
Referenced by set_resolution(), and theme_reset_event().
|
private |
Definition at line 310 of file theme.hpp.
Referenced by add_object(), find_element(), and unit_image_location().