Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes

arrow Class Reference

Arrows destined to be drawn on the map. More...

#include <arrow.hpp>

Collaboration diagram for arrow:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::string STYLE
 The style is simply the name of a subdirectory under images/arrows, that holds an alternate copy of the arrow graphics.

Public Member Functions

 arrow (bool hidden=false)
virtual ~arrow ()
void hide ()
 Sets the arrow's visibility.
void show ()
virtual void set_path (arrow_path_t const &path)
virtual void reset ()
 invalidates and clears the present path, forgets the previous path, clears the symbols map
virtual void set_color (std::string const &color)
 The string color parameter is in the same format expected by the image::locator modifiers parameter.
virtual std::string get_color () const
STYLE get_style ()
void set_style (std::string const &style)
arrow_path_t const & get_path () const
arrow_path_t const & get_previous_path () const
bool path_contains (map_location const &hex) const
virtual void draw_hex (map_location const &hex)
virtual void notify_arrow_changed ()

Static Public Member Functions

static bool valid_path (arrow_path_t const &path)
 Checks that the path is not of length 0 or 1.
static void invalidate_arrow_path (arrow_path_t const &path)
 Invalidates every hex along the given path.

Static Public Attributes

static std::string const STYLE_STANDARD = "standard"
 If you add more styles, you should look at move::update_arrow_style().
static std::string const STYLE_HIGHLIGHTED = "highlighted"
static std::string const STYLE_FOCUS = "focus"
static std::string const STYLE_FOCUS_INVALID = "focus_invalid"

Protected Types

typedef std::map< map_location,
image::locator
arrow_symbols_map_t

Protected Member Functions

virtual void update_symbols ()
 Calculate the symbols to place along the arrow path.

Protected Attributes

display::tdrawing_layer layer_
std::string color_
std::string style_
 represents the subdirectory that holds images for this arrow style
arrow_path_t path_
arrow_path_t previous_path_
arrow_symbols_map_t symbols_map_
bool hidden_

Detailed Description

Arrows destined to be drawn on the map.

Created for the whiteboard system.

Definition at line 31 of file arrow.hpp.


Member Typedef Documentation

typedef std::map<map_location, image::locator> arrow::arrow_symbols_map_t [protected]

Definition at line 102 of file arrow.hpp.

typedef std::string arrow::STYLE

The style is simply the name of a subdirectory under images/arrows, that holds an alternate copy of the arrow graphics.

If it doesn't exist or has missing images, you'll get "under construction" symbols instead of arrow graphics.

Definition at line 62 of file arrow.hpp.


Constructor & Destructor Documentation

arrow::arrow ( bool  hidden = false  ) 

Definition at line 36 of file arrow.cpp.

References show().

Here is the call graph for this function:

arrow::~arrow (  )  [virtual]

Definition at line 49 of file arrow.cpp.

References hide().

Here is the call graph for this function:


Member Function Documentation

void arrow::draw_hex ( map_location const &  hex  )  [virtual]

Definition at line 141 of file arrow.cpp.

References image::get_image(), layer_, path_contains(), image::SCALED_TO_ZOOM, SCREEN, and symbols_map_.

Referenced by display::draw_hex().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual std::string arrow::get_color (  )  const [inline, virtual]

Definition at line 54 of file arrow.hpp.

References color_.

arrow_path_t const & arrow::get_path (  )  const

Definition at line 125 of file arrow.cpp.

References path_.

Referenced by display::add_arrow(), display::remove_arrow(), and display::update_arrow().

Here is the caller graph for this function:

arrow_path_t const & arrow::get_previous_path (  )  const

Definition at line 130 of file arrow.cpp.

References previous_path_.

Referenced by display::update_arrow().

Here is the caller graph for this function:

STYLE arrow::get_style (  )  [inline]

Definition at line 63 of file arrow.hpp.

References style_.

void arrow::hide (  ) 

Sets the arrow's visibility.

Definition at line 54 of file arrow.cpp.

References hidden_, invalidate_arrow_path(), path_, and SCREEN.

Referenced by ~arrow().

Here is the call graph for this function:

Here is the caller graph for this function:

void arrow::invalidate_arrow_path ( arrow_path_t const &  path  )  [static]

Invalidates every hex along the given path.

Definition at line 292 of file arrow.cpp.

References SCREEN.

Referenced by hide(), reset(), set_path(), and update_symbols().

Here is the caller graph for this function:

void arrow::notify_arrow_changed (  )  [virtual]

Definition at line 302 of file arrow.cpp.

References SCREEN.

Referenced by reset(), and set_path().

Here is the caller graph for this function:

bool arrow::path_contains ( map_location const &  hex  )  const

Definition at line 135 of file arrow.cpp.

References gui2::contains(), and symbols_map_.

Referenced by draw_hex().

Here is the call graph for this function:

Here is the caller graph for this function:

void arrow::reset (  )  [virtual]

invalidates and clears the present path, forgets the previous path, clears the symbols map

Definition at line 92 of file arrow.cpp.

References invalidate_arrow_path(), notify_arrow_changed(), path_, previous_path_, and symbols_map_.

Here is the call graph for this function:

void arrow::set_color ( std::string const &  color  )  [virtual]

The string color parameter is in the same format expected by the image::locator modifiers parameter.

Examples: red is "red" or "FF0000" or "255,0,0". Feel free to add another method that accepts an Uint32 as a parameter instead.

Definition at line 102 of file arrow.cpp.

References color_, path_, update_symbols(), and valid_path().

Here is the call graph for this function:

void arrow::set_path ( arrow_path_t const &  path  )  [virtual]

Definition at line 77 of file arrow.cpp.

References hidden_, invalidate_arrow_path(), notify_arrow_changed(), path_, previous_path_, update_symbols(), and valid_path().

Here is the call graph for this function:

void arrow::set_style ( std::string const &  style  ) 

Definition at line 116 of file arrow.cpp.

References path_, style_, update_symbols(), and valid_path().

Here is the call graph for this function:

void arrow::show (  ) 

Definition at line 67 of file arrow.cpp.

References hidden_, and SCREEN.

Referenced by arrow().

Here is the caller graph for this function:

void arrow::update_symbols (  )  [protected, virtual]

Calculate the symbols to place along the arrow path.

Invalidates every hex along the path.

Definition at line 158 of file arrow.cpp.

References color_, ERR_ARR, image::locator::file_exists(), invalidate_arrow_path(), game_config::images::missing, map_location::NDIRECTIONS, path_, editor::start(), style_, symbols_map_, tiles_adjacent(), valid_path(), map_location::write_direction(), and WRN_ARR.

Referenced by set_color(), set_path(), and set_style().

Here is the call graph for this function:

Here is the caller graph for this function:

bool arrow::valid_path ( arrow_path_t const &  path  )  [static]

Checks that the path is not of length 0 or 1.

Definition at line 150 of file arrow.cpp.

Referenced by set_color(), set_path(), set_style(), and update_symbols().

Here is the caller graph for this function:


Member Data Documentation

std::string arrow::color_ [protected]

Definition at line 95 of file arrow.hpp.

Referenced by get_color(), set_color(), and update_symbols().

bool arrow::hidden_ [protected]

Definition at line 105 of file arrow.hpp.

Referenced by hide(), set_path(), and show().

Definition at line 93 of file arrow.hpp.

Referenced by draw_hex().

Definition at line 99 of file arrow.hpp.

Referenced by get_path(), hide(), reset(), set_color(), set_path(), set_style(), and update_symbols().

Definition at line 100 of file arrow.hpp.

Referenced by get_previous_path(), reset(), and set_path().

std::string arrow::style_ [protected]

represents the subdirectory that holds images for this arrow style

Definition at line 97 of file arrow.hpp.

Referenced by get_style(), set_style(), and update_symbols().

std::string const arrow::STYLE_FOCUS = "focus" [static]

Definition at line 68 of file arrow.hpp.

Referenced by wb::move::init(), and wb::move::update_arrow_style().

std::string const arrow::STYLE_FOCUS_INVALID = "focus_invalid" [static]

Definition at line 69 of file arrow.hpp.

Referenced by wb::move::init(), and wb::move::update_arrow_style().

std::string const arrow::STYLE_HIGHLIGHTED = "highlighted" [static]

Definition at line 67 of file arrow.hpp.

Referenced by wb::move::init(), and wb::move::update_arrow_style().

std::string const arrow::STYLE_STANDARD = "standard" [static]

If you add more styles, you should look at move::update_arrow_style().

Definition at line 66 of file arrow.hpp.

Referenced by wb::move::init(), wb::move::move(), and wb::move::update_arrow_style().

Definition at line 103 of file arrow.hpp.

Referenced by draw_hex(), path_contains(), reset(), and update_symbols().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:12:56 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs