The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
map_labels Class Reference

#include <label.hpp>

Public Types

typedef std::map< map_location,
terrain_label * > 
label_map
 
typedef std::map< std::string,
label_map
team_label_map
 

Public Member Functions

 map_labels (const map_labels &)
 
 map_labels (const display &disp, const team *)
 
 ~map_labels ()
 
map_labelsoperator= (const map_labels &)
 
void write (config &res) const
 
void read (const config &cfg)
 
const terrain_labelget_label (const map_location &loc, const std::string &team_name) const
 
const terrain_labelget_label (const map_location &loc) const
 
const terrain_labelset_label (const map_location &loc, const t_string &text, const int creator=-1, const std::string &team="", const SDL_Color 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="")
 
bool enabled () const
 
void enable (bool is_enabled)
 
void clear (const std::string &, bool force)
 
void recalculate_labels ()
 
void recalculate_shroud ()
 
bool visible_global_label (const map_location &) const
 Returns whether or not a global (non-team) label can be shown at a specified location. More...
 
const displaydisp () const
 
const std::stringteam_name () const
 
const std::vector< std::string > & all_categories () const
 
void set_team (const team *)
 
void clear_all ()
 

Private Member Functions

void add_label (const map_location &, terrain_label *)
 
void clear_map (label_map &, bool)
 
terrain_labelget_label_private (const map_location &loc, const std::string &team_name)
 For our private use, a wrapper for get_label() that can return a pointer to a non-const terrain_label. More...
 

Private Attributes

const displaydisp_
 
const teamteam_
 
team_label_map labels_
 
bool enabled_
 
std::vector< std::stringcategories
 
bool categories_dirty
 

Detailed Description

Definition at line 29 of file label.hpp.

Member Typedef Documentation

Definition at line 32 of file label.hpp.

Definition at line 33 of file label.hpp.

Constructor & Destructor Documentation

map_labels::map_labels ( const map_labels other)

Definition at line 48 of file label.cpp.

References read(), and write().

Referenced by operator=().

map_labels::map_labels ( const display disp,
const team team 
)

Definition at line 43 of file label.cpp.

map_labels::~map_labels ( )

Definition at line 56 of file label.cpp.

References clear_all().

Referenced by operator=().

Member Function Documentation

void map_labels::add_label ( const map_location loc,
terrain_label new_label 
)
private

Definition at line 211 of file label.cpp.

References categories_dirty, labels_, and terrain_label::team_name().

Referenced by read(), and set_label().

const std::vector< std::string > & map_labels::all_categories ( ) const

Definition at line 296 of file label.cpp.

References categories, categories_dirty, i, labels_, and resources::teams.

Referenced by gui2::tlabel_settings::tlabel_settings().

void map_labels::clear ( const std::string team_name,
bool  force 
)

Definition at line 217 of file label.cpp.

References categories_dirty, clear_map(), i, and labels_.

Referenced by events::menu_handler::clear_labels(), and do_replay_handle().

void map_labels::clear_all ( )
void map_labels::clear_map ( label_map m,
bool  force 
)
private

Definition at line 233 of file label.cpp.

References categories_dirty, and i.

Referenced by clear(), and clear_all().

const display & map_labels::disp ( ) const

Definition at line 120 of file label.cpp.

References disp_.

Referenced by terrain_label::draw(), terrain_label::get_rect(), and terrain_label::hidden().

void map_labels::enable ( bool  is_enabled)

Definition at line 266 of file label.cpp.

References enabled_, and recalculate_labels().

Referenced by editor::map_context_refresher::refresh().

bool map_labels::enabled ( ) const
inline

Definition at line 58 of file label.hpp.

References enabled_.

Referenced by terrain_label::viewable().

const terrain_label * map_labels::get_label ( const map_location loc,
const std::string team_name 
) const
const terrain_label * map_labels::get_label ( const map_location loc) const

Definition at line 108 of file label.cpp.

References get_label(), and team_name().

terrain_label* map_labels::get_label_private ( const map_location loc,
const std::string team_name 
)
inlineprivate

For our private use, a wrapper for get_label() that can return a pointer to a non-const terrain_label.

Definition at line 86 of file label.hpp.

References get_label().

Referenced by set_label().

map_labels & map_labels::operator= ( const map_labels other)

Definition at line 61 of file label.cpp.

References map_labels(), and ~map_labels().

void map_labels::read ( const config cfg)
void map_labels::recalculate_labels ( )
void map_labels::recalculate_shroud ( )
const terrain_label * map_labels::set_label ( const map_location loc,
const t_string text,
const int  creator = -1,
const std::string team = "",
const SDL_Color  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 = "" 
)
void map_labels::set_team ( const team team)

Definition at line 135 of file label.cpp.

References categories_dirty, and team_.

Referenced by display::set_team().

const std::string & map_labels::team_name ( ) const
bool map_labels::visible_global_label ( const map_location loc) const

Returns whether or not a global (non-team) label can be shown at a specified location.

(Global labels are suppressed in favor of team labels.)

Definition at line 278 of file label.cpp.

References labels_, and team_name().

Referenced by terrain_label::viewable().

void map_labels::write ( config res) const

Definition at line 70 of file label.cpp.

References config::add_child(), i, and labels_.

Referenced by map_labels(), and editor::map_context::to_config().

Member Data Documentation

std::vector<std::string> map_labels::categories
mutableprivate

Definition at line 97 of file label.hpp.

Referenced by all_categories().

bool map_labels::categories_dirty
mutableprivate

Definition at line 98 of file label.hpp.

Referenced by add_label(), all_categories(), clear(), clear_map(), set_label(), and set_team().

const display& map_labels::disp_
private

Definition at line 91 of file label.hpp.

Referenced by disp().

bool map_labels::enabled_
private

Definition at line 95 of file label.hpp.

Referenced by enable(), and enabled().

team_label_map map_labels::labels_
private
const team* map_labels::team_
private

Definition at line 92 of file label.hpp.

Referenced by set_team(), and team_name().


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