A brush-drag mouse action base class which adds brush and drag processing to a basic mouse action. More...
#include <mouse_action.hpp>


Public Member Functions | |
| brush_drag_mouse_action (common_palette &palette, const brush *const *const brush, const CKey &key) | |
| std::set< map_location > | affected_hexes (editor_display &disp, const map_location &hex) |
| The affected hexes of a brush action are the result of projecting the current brush on the mouseover hex. | |
| virtual editor_action * | click_perform_left (editor_display &disp, const std::set< map_location > &hexes)=0 |
| The actual action function which is called by click() and drag(). | |
| virtual editor_action * | click_perform_right (editor_display &disp, const std::set< map_location > &hexes)=0 |
| The actual action function which is called by click() and drag(). | |
| editor_action * | click_left (editor_display &disp, int x, int y) |
| Calls click_perform_left(). | |
| editor_action * | click_right (editor_display &disp, int x, int y) |
| Calls click_perform_right(). | |
| editor_action * | drag_left (editor_display &disp, int x, int y, bool &partial, editor_action *last_undo) |
| Calls click_perform() for every new hex the mouse is dragged into. | |
| editor_action * | drag_right (editor_display &disp, int x, int y, bool &partial, editor_action *last_undo) |
| Calls click_perform for every new hex the mouse is dragged into. | |
| editor_action * | drag_end (editor_display &disp, int x, int y) |
| End of dragging. | |
Protected Member Functions | |
| const brush & | get_brush () |
| Brush accessor. | |
Protected Attributes | |
| map_location | previous_drag_hex_ |
| The previous hex dragged into. | |
Private Member Functions | |
| template<editor_action *(brush_drag_mouse_action::*)(editor_display &, const std::set< map_location > &) perform_func> | |
| editor_action * | drag_generic (editor_display &disp, int x, int y, bool &partial, editor_action *last_undo) |
| Template helper gathering actions common for both drag_right and drag_left. | |
Private Attributes | |
| const brush *const *const | brush_ |
| Current brush handle. | |
A brush-drag mouse action base class which adds brush and drag processing to a basic mouse action.
Definition at line 162 of file mouse_action.hpp.
| editor::brush_drag_mouse_action::brush_drag_mouse_action | ( | common_palette & | palette, | |
| const brush *const *const | brush, | |||
| const CKey & | key | |||
| ) | [inline] |
Definition at line 165 of file mouse_action.hpp.
| std::set< map_location > editor::brush_drag_mouse_action::affected_hexes | ( | editor_display & | disp, | |
| const map_location & | hex | |||
| ) | [virtual] |
The affected hexes of a brush action are the result of projecting the current brush on the mouseover hex.
Reimplemented from editor::mouse_action.
Reimplemented in editor::mouse_action_select.
Definition at line 190 of file mouse_action.cpp.
Referenced by drag_generic().

| editor_action * editor::brush_drag_mouse_action::click_left | ( | editor_display & | disp, | |
| int | x, | |||
| int | y | |||
| ) | [virtual] |
Calls click_perform_left().
Implements editor::mouse_action.
Reimplemented in editor::mouse_action_paint.
Definition at line 196 of file mouse_action.cpp.
| virtual editor_action* editor::brush_drag_mouse_action::click_perform_left | ( | editor_display & | disp, | |
| const std::set< map_location > & | hexes | |||
| ) | [pure virtual] |
The actual action function which is called by click() and drag().
Derived classes override this instead of click() and drag().
Implemented in editor::mouse_action_paint, and editor::mouse_action_select.
| virtual editor_action* editor::brush_drag_mouse_action::click_perform_right | ( | editor_display & | disp, | |
| const std::set< map_location > & | hexes | |||
| ) | [pure virtual] |
The actual action function which is called by click() and drag().
Derived classes override this instead of click() and drag().
Implemented in editor::mouse_action_paint, and editor::mouse_action_select.
| editor_action * editor::brush_drag_mouse_action::click_right | ( | editor_display & | disp, | |
| int | x, | |||
| int | y | |||
| ) | [virtual] |
Calls click_perform_right().
Implements editor::mouse_action.
Reimplemented in editor::mouse_action_paint.
Definition at line 203 of file mouse_action.cpp.
| editor_action * editor::brush_drag_mouse_action::drag_end | ( | editor_display & | disp, | |
| int | x, | |||
| int | y | |||
| ) | [virtual] |
End of dragging.
Reimplemented from editor::mouse_action.
Definition at line 222 of file mouse_action.cpp.
| editor_action * editor::brush_drag_mouse_action::drag_generic | ( | editor_display & | disp, | |
| int | x, | |||
| int | y, | |||
| bool & | partial, | |||
| editor_action * | last_undo | |||
| ) | [private] |
Template helper gathering actions common for both drag_right and drag_left.
The drags differ only in the worker function called, which should be passed as the template parameter. This exists only to avoid copy-pasting code.
Definition at line 229 of file mouse_action.cpp.
References affected_hexes(), display::hex_clicked_on(), LOG_ED, editor::mouse_action::move(), and previous_drag_hex_.

| editor_action * editor::brush_drag_mouse_action::drag_left | ( | editor_display & | disp, | |
| int | x, | |||
| int | y, | |||
| bool & | partial, | |||
| editor_action * | last_undo | |||
| ) | [virtual] |
Calls click_perform() for every new hex the mouse is dragged into.
Reimplemented from editor::mouse_action.
Definition at line 210 of file mouse_action.cpp.
| editor_action * editor::brush_drag_mouse_action::drag_right | ( | editor_display & | disp, | |
| int | x, | |||
| int | y, | |||
| bool & | partial, | |||
| editor_action * | last_undo | |||
| ) | [virtual] |
Calls click_perform for every new hex the mouse is dragged into.
Reimplemented from editor::mouse_action.
Definition at line 216 of file mouse_action.cpp.
| const brush & editor::brush_drag_mouse_action::get_brush | ( | ) | [protected] |
Brush accessor.
Definition at line 246 of file mouse_action.cpp.
const brush* const* const editor::brush_drag_mouse_action::brush_ [private] |
Current brush handle.
Currently a pointer-to-pointer with full constness. The mouse action does not modify the brush, does not modify the pointer to the current brush, and we allow setting this pointr only once, hence the three "consts".
Definition at line 240 of file mouse_action.hpp.
The previous hex dragged into.
Definition at line 223 of file mouse_action.hpp.
Referenced by drag_generic().
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:19:31 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |