To store label data Class implements logic for rendering. More...
#include <label.hpp>
Public Member Functions | |
terrain_label (const terrain_label &)=delete | |
Delete copy ctor and assignment ops. More... | |
terrain_label & | operator= (const terrain_label &)=delete |
terrain_label (const map_labels &parent, const t_string &text, const int creator, const std::string &team_name, const map_location &loc, const color_t color=font::NORMAL_COLOR, const bool visible_in_fog=true, const bool visible_in_shroud=false, const bool immutable=false, const std::string &category="", const t_string &tooltip="") | |
Create a new label. More... | |
terrain_label (const map_labels &, const config &) | |
Load label from config. More... | |
terrain_label (terrain_label &&) | |
Move ctor. More... | |
~terrain_label () | |
void | write (config &res) const |
void | read (const config &cfg) |
const t_string & | text () const |
const t_string & | tooltip () const |
int | creator () const |
const std::string & | team_name () const |
const std::string & | category () const |
bool | visible_in_fog () const |
bool | visible_in_shroud () const |
bool | immutable () const |
const map_location & | location () const |
const color_t & | color () const |
void | set_text (const t_string &text) |
void | update_info (const t_string &, const int creator, const t_string &, const std::string &, const color_t) |
void | update_info (const t_string &text, const int creator, const t_string &tooltip, const std::string &team_name, const color_t color, const bool visible_in_fog, const bool visible_in_shroud, const bool immutable, const std::string &category) |
void | recalculate () |
void | calculate_shroud () |
Private Member Functions | |
void | clear () |
bool | hidden () const |
This is a lightweight test used to see if labels are revealed as a result of unit actions (i.e. More... | |
bool | viewable (const display &disp) const |
This is a test used to see if we should bother with the overhead of actually creating a label. More... | |
SDL_Rect | get_rect () const |
Private Attributes | |
int | handle_ |
int | tooltip_handle_ |
t_string | text_ |
t_string | tooltip_ |
std::string | category_ |
std::string | team_name_ |
bool | visible_in_fog_ |
bool | visible_in_shroud_ |
bool | immutable_ |
int | creator_ |
color_t | color_ |
const map_labels * | parent_ |
map_location | loc_ |
|
delete |
Delete copy ctor and assignment ops.
terrain_label::terrain_label | ( | const map_labels & | parent, |
const t_string & | text, | ||
const int | creator, | ||
const std::string & | team_name, | ||
const map_location & | loc, | ||
const color_t | color = font::NORMAL_COLOR , |
||
const bool | visible_in_fog = true , |
||
const bool | visible_in_shroud = false , |
||
const bool | immutable = false , |
||
const std::string & | category = "" , |
||
const t_string & | tooltip = "" |
||
) |
terrain_label::terrain_label | ( | const map_labels & | parent, |
const config & | cfg | ||
) |
terrain_label::terrain_label | ( | terrain_label && | l | ) |
void terrain_label::calculate_shroud | ( | ) |
Definition at line 480 of file label.cpp.
References tooltips::add_tooltip(), t_string::empty(), get_rect(), handle_, hidden(), tooltips::remove_tooltip(), font::show_floating_label(), t_string::str(), tooltip_, tooltip_handle_, and tooltips::update_tooltip().
Referenced by recalculate().
|
inline |
Definition at line 159 of file label.hpp.
Referenced by editor::mouse_action_map_label::drag_end_left(), hidden(), editor::editor_action_label::perform(), editor::editor_action_label_delete::perform(), editor::mouse_action_map_label::up_left(), and update_info().
|
private |
Definition at line 642 of file label.cpp.
References handle_, font::remove_floating_label(), tooltips::remove_tooltip(), and tooltip_handle_.
Referenced by recalculate(), and ~terrain_label().
|
inline |
Definition at line 184 of file label.hpp.
Referenced by do_replay_handle(), editor::mouse_action_map_label::drag_end_left(), editor::editor_action_label::perform(), editor::editor_action_label_delete::perform(), read(), editor::mouse_action_map_label::up_left(), and update_info().
|
inline |
Definition at line 149 of file label.hpp.
Referenced by do_replay_handle(), hidden(), and update_info().
|
private |
Definition at line 501 of file label.cpp.
References display::get_location_x(), display::get_location_y(), display::get_singleton(), display::hex_size(), loc_, and draw::rect().
Referenced by calculate_shroud().
|
private |
This is a lightweight test used to see if labels are revealed as a result of unit actions (i.e.
fog/shroud clearing). It should not contain any tests that are invariant during unit movement (disregarding potential WML events); those belong in visible().
Definition at line 573 of file label.cpp.
References category(), category_, creator(), creator_, display::get_disp_context(), display::get_singleton(), display_context::hidden_label_categories(), is_fogged(), is_shrouded(), loc_, team_name(), visible_in_fog_, and visible_in_shroud_.
Referenced by calculate_shroud().
|
inline |
Definition at line 174 of file label.hpp.
Referenced by playsingle_controller::hotkey_handler::can_execute_command(), editor::mouse_action_map_label::drag_end_left(), editor::editor_action_label::perform(), editor::editor_action_label_delete::perform(), editor::mouse_action_map_label::up_left(), and update_info().
|
inline |
Definition at line 179 of file label.hpp.
References loc_.
Referenced by map_labels::add_label(), and do_replay_handle().
|
delete |
void terrain_label::read | ( | const config & | cfg | ) |
Definition at line 385 of file label.cpp.
References category_, color(), color_, creator_, config_attribute_value::empty(), color_t::from_rgb_string(), color_t::from_rgba_string(), resources::gamedata, variable_set::get_variable_const(), immutable_, utils::interpolate_variables_into_string(), utils::interpolate_variables_into_tstring(), font::LABEL_COLOR, loc_, team_name_, text_, config_attribute_value::to_int(), tooltip_, visible_in_fog_, and visible_in_shroud_.
Referenced by terrain_label().
void terrain_label::recalculate | ( | ) |
Definition at line 525 of file label.cpp.
References font::add_floating_label(), font::ANCHOR_LABEL_MAP, calculate_shroud(), clear(), color_, t_string::empty(), map_location::get_direction(), display::get_location_x(), display::get_location_y(), display::get_singleton(), handle_, font::LABEL_COLOR, loc_, display::map_outside_area(), map_location::NORTH_EAST, scale_to_map_zoom(), font::floating_label::set_font_size(), font::SIZE_NORMAL, map_location::SOUTH, t_string::str(), text_, tooltip_, and viewable().
Referenced by map_labels::set_label(), terrain_label(), and update_info().
|
inline |
Definition at line 189 of file label.hpp.
References map_labels::clear(), and tooltip.
|
inline |
Definition at line 154 of file label.hpp.
Referenced by map_labels::add_label(), do_replay_handle(), editor::mouse_action_map_label::drag_end_left(), hidden(), editor::editor_action_label::perform(), editor::editor_action_label_delete::perform(), editor::mouse_action_map_label::up_left(), update_info(), and write().
|
inline |
Definition at line 139 of file label.hpp.
Referenced by do_replay_handle(), events::menu_handler::do_search(), editor::mouse_action_map_label::drag_end_left(), events::menu_handler::label_terrain(), editor::editor_action_label::perform(), editor::editor_action_label_delete::perform(), editor::mouse_action_map_label::up_left(), update_info(), and write().
|
inline |
Definition at line 144 of file label.hpp.
Referenced by update_info(), and write().
void terrain_label::update_info | ( | const t_string & | text, |
const int | creator, | ||
const t_string & | tooltip, | ||
const std::string & | team_name, | ||
const color_t | color | ||
) |
Definition at line 447 of file label.cpp.
References color(), color_, creator(), creator_, recalculate(), team_name(), team_name_, text(), text_, tooltip(), and tooltip_.
Referenced by update_info().
void terrain_label::update_info | ( | const t_string & | text, |
const int | creator, | ||
const t_string & | tooltip, | ||
const std::string & | team_name, | ||
const color_t | color, | ||
const bool | visible_in_fog, | ||
const bool | visible_in_shroud, | ||
const bool | immutable, | ||
const std::string & | category | ||
) |
Definition at line 462 of file label.cpp.
References category(), category_, immutable(), immutable_, update_info(), visible_in_fog(), visible_in_fog_, visible_in_shroud(), and visible_in_shroud_.
|
private |
This is a test used to see if we should bother with the overhead of actually creating a label.
Conditions that can change during unit movement (disregarding potential WML events) should not be listed here; they belong in hidden().
Definition at line 619 of file label.cpp.
References map_labels::enabled(), display::get_disp_context(), display::in_editor(), display_context::is_observer(), loc_, parent_, map_labels::team_name(), team_name_, and map_labels::visible_global_label().
Referenced by recalculate().
|
inline |
Definition at line 164 of file label.hpp.
Referenced by editor::mouse_action_map_label::drag_end_left(), editor::editor_action_label::perform(), editor::editor_action_label_delete::perform(), editor::mouse_action_map_label::up_left(), and update_info().
|
inline |
Definition at line 169 of file label.hpp.
Referenced by editor::mouse_action_map_label::drag_end_left(), editor::editor_action_label::perform(), editor::editor_action_label_delete::perform(), editor::mouse_action_map_label::up_left(), and update_info().
void terrain_label::write | ( | config & | res | ) | const |
Definition at line 432 of file label.cpp.
References category_, color_, creator_, immutable_, loc_, team_name(), text(), color_t::to_rgb_string(), tooltip(), visible_in_fog_, visible_in_shroud_, and map_location::write().
Referenced by replay::add_label(), and game_lua_kernel::intf_get_label().
|
private |
|
private |
Definition at line 228 of file label.hpp.
Referenced by read(), recalculate(), update_info(), and write().
|
private |
|
private |
Definition at line 214 of file label.hpp.
Referenced by calculate_shroud(), clear(), and recalculate().
|
private |
Definition at line 225 of file label.hpp.
Referenced by read(), update_info(), and write().
|
private |
Definition at line 231 of file label.hpp.
Referenced by get_rect(), hidden(), read(), recalculate(), viewable(), and write().
|
private |
Definition at line 230 of file label.hpp.
Referenced by viewable().
|
private |
Definition at line 221 of file label.hpp.
Referenced by read(), update_info(), and viewable().
|
private |
Definition at line 217 of file label.hpp.
Referenced by read(), recalculate(), and update_info().
|
private |
Definition at line 218 of file label.hpp.
Referenced by calculate_shroud(), read(), recalculate(), and update_info().
|
private |
Definition at line 215 of file label.hpp.
Referenced by calculate_shroud(), and clear().
|
private |
|
private |