Base class for all editor actions. More...
#include <action_base.hpp>

Public Member Functions | |
| editor_action () | |
| virtual | ~editor_action () |
| virtual editor_action * | clone () const =0 |
| Action cloning. | |
| virtual editor_action * | perform (map_context &) const |
| Perform the action, returning an undo action that, when performed, shall reverse any effects of this action. | |
| virtual void | perform_without_undo (map_context &) const =0 |
| Perform the action without creating an undo action. | |
| virtual int | action_count () const |
| virtual const char * | get_name () const |
| virtual std::string | get_description () const |
| A textual description of the action. | |
| int | get_id () const |
| Debugging aid. | |
Static Public Member Functions | |
| static int | get_instance_count () |
| Debugging aid. | |
Private Attributes | |
| const int | id_ |
Static Private Attributes | |
| static int | next_id_ = 1 |
| static int | instance_count_ = 0 |
Base class for all editor actions.
An editor_action object encapsulates the action to be performed on a map, in separation from the user interface or display, and provides a way of reversing its affects by creating an "undo" action. All the actions can be processed via this base class' virtual functions.
Definition at line 42 of file action_base.hpp.
| editor::editor_action::editor_action | ( | ) |
Definition at line 29 of file action.cpp.
| editor::editor_action::~editor_action | ( | ) | [virtual] |
Definition at line 38 of file action.cpp.
| int editor::editor_action::action_count | ( | ) | const [virtual] |
Reimplemented in editor::editor_action_chain.
Definition at line 46 of file action.cpp.
| virtual editor_action* editor::editor_action::clone | ( | ) | const [pure virtual] |
Action cloning.
Implemented in editor::editor_action_whole_map, editor::editor_action_chain, editor::editor_action_paste, editor::editor_action_paint_area, editor::editor_action_fill, editor::editor_action_starting_position, editor::editor_action_select, editor::editor_action_deselect, editor::editor_action_select_all, editor::editor_action_select_none, editor::editor_action_select_inverse, editor::editor_action_resize_map, editor::editor_action_apply_mask, editor::editor_action_create_mask, editor::editor_action_shuffle_area, editor::editor_action_label, editor::editor_action_label_delete, editor::editor_action_unit, editor::editor_action_unit_delete, editor::editor_action_unit_replace, and editor::editor_action_unit_facing.
Referenced by editor::editor_action_chain::operator=(), and editor::editor_action_chain::~editor_action_chain().

| std::string editor::editor_action::get_description | ( | ) | const [virtual] |
A textual description of the action.
For use e.g. in the undo menu, to have a "Undo: Fill with Grassland" item rather than just "Undo". Should be overridden by derived Actions, defaults to a debug message.
Definition at line 51 of file action.cpp.
| int editor::editor_action::get_id | ( | ) | const [inline] |
Debugging aid.
Return an unique identifier of this Action.
Definition at line 90 of file action_base.hpp.
References id_.
Referenced by editor::map_context::perform_action(), and editor::map_context::perform_partial_action().

| static int editor::editor_action::get_instance_count | ( | ) | [inline, static] |
Debugging aid.
Return number of existing instances of Actions.
Definition at line 95 of file action_base.hpp.
References instance_count_.
Referenced by editor::map_context::perform_action(), and editor::map_context::perform_partial_action().

| virtual const char* editor::editor_action::get_name | ( | ) | const [inline, virtual] |
Reimplemented in editor::editor_action_whole_map, editor::editor_action_extendable, editor::editor_action_chain, editor::editor_action_location, editor::editor_action_location_terrain, editor::editor_action_area, editor::editor_action_paste, editor::editor_action_paint_area, editor::editor_action_fill, editor::editor_action_starting_position, editor::editor_action_select, editor::editor_action_deselect, editor::editor_action_select_all, editor::editor_action_select_none, editor::editor_action_select_inverse, editor::editor_action_resize_map, editor::editor_action_apply_mask, editor::editor_action_create_mask, editor::editor_action_shuffle_area, editor::editor_action_label, editor::editor_action_label_delete, editor::editor_action_unit, editor::editor_action_unit_delete, editor::editor_action_unit_replace, and editor::editor_action_unit_facing.
Definition at line 76 of file action_base.hpp.
Referenced by editor::map_context::perform_action(), and editor::map_context::perform_partial_action().

| editor_action * editor::editor_action::perform | ( | map_context & | mc | ) | const [virtual] |
Perform the action, returning an undo action that, when performed, shall reverse any effects of this action.
The undo action object is owned by the caller. Default behaviour is to create a whole-map undo, call the perform_without_undo function and return the undo object.
Reimplemented in editor::editor_action_chain, editor::editor_action_paste, editor::editor_action_paint_area, editor::editor_action_fill, editor::editor_action_starting_position, editor::editor_action_select, editor::editor_action_deselect, editor::editor_action_select_all, editor::editor_action_select_none, editor::editor_action_select_inverse, editor::editor_action_shuffle_area, editor::editor_action_label, editor::editor_action_label_delete, editor::editor_action_unit, editor::editor_action_unit_delete, editor::editor_action_unit_replace, and editor::editor_action_unit_facing.
Definition at line 56 of file action.cpp.
Referenced by editor::map_context::perform_action(), and editor::map_context::perform_partial_action().

| virtual void editor::editor_action::perform_without_undo | ( | map_context & | ) | const [pure virtual] |
Perform the action without creating an undo action.
Implemented in editor::editor_action_whole_map, editor::editor_action_chain, editor::editor_action_paste, editor::editor_action_paint_area, editor::editor_action_fill, editor::editor_action_starting_position, editor::editor_action_select, editor::editor_action_deselect, editor::editor_action_select_all, editor::editor_action_select_none, editor::editor_action_select_inverse, editor::editor_action_resize_map, editor::editor_action_apply_mask, editor::editor_action_create_mask, editor::editor_action_shuffle_area, editor::editor_action_label, editor::editor_action_label_delete, editor::editor_action_unit, editor::editor_action_unit_delete, editor::editor_action_unit_replace, and editor::editor_action_unit_facing.
Referenced by editor::editor_action_whole_map::clone().

const int editor::editor_action::id_ [private] |
Definition at line 100 of file action_base.hpp.
Referenced by get_id().
int editor::editor_action::instance_count_ = 0 [static, private] |
Definition at line 99 of file action_base.hpp.
Referenced by get_instance_count().
int editor::editor_action::next_id_ = 1 [static, private] |
Definition at line 98 of file action_base.hpp.
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:19:28 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |