Brush paint mouse action. More...
#include <mouse_action.hpp>
Public Member Functions | |
mouse_action_paint (const brush *const *const brush, const CKey &key, terrain_palette &palette) | |
std::unique_ptr< editor_action > | click_left (editor_display &disp, int x, int y) override |
Handle terrain sampling before calling generic handler. More... | |
std::unique_ptr< editor_action > | click_right (editor_display &disp, int x, int y) override |
Handle terrain sampling before calling generic handler. More... | |
std::unique_ptr< editor_action > | click_perform_left (editor_display &disp, const std::set< map_location > &hexes) override |
Create an appropriate editor_action and return it. More... | |
std::unique_ptr< editor_action > | click_perform_right (editor_display &disp, const std::set< map_location > &hexes) override |
Create an appropriate editor_action and return it. More... | |
void | set_mouse_overlay (editor_display &disp) override |
Set the mouse overlay for this action. More... | |
virtual bool | supports_brushes () const override |
Whether we need the brush bar, is used to grey it out. More... | |
Public Member Functions inherited from editor::brush_drag_mouse_action | |
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. More... | |
std::unique_ptr< 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. More... | |
std::unique_ptr< 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. More... | |
std::unique_ptr< editor_action > | drag_end (editor_display &disp, int x, int y) |
End of dragging. More... | |
Public Member Functions inherited from editor::mouse_action | |
mouse_action (common_palette &palette, const CKey &key) | |
virtual | ~mouse_action () |
virtual bool | has_context_menu () const |
virtual void | move (editor_display &disp, const map_location &hex) |
Mouse move (not a drag). More... | |
void | update_brush_highlights (editor_display &disp, const map_location &hex) |
Unconditionally update the brush highlights for the current tool when hex is the center location. More... | |
virtual std::unique_ptr< editor_action > | drag_end_left (editor_display &disp, int x, int y) |
The end of dragging. More... | |
virtual std::unique_ptr< editor_action > | drag_end_right (editor_display &disp, int x, int y) |
virtual std::unique_ptr< editor_action > | up_left (editor_display &disp, int x, int y) |
virtual std::unique_ptr< editor_action > | up_right (editor_display &disp, int x, int y) |
virtual std::unique_ptr< editor_action > | key_event (editor_display &disp, const SDL_Event &e) |
Function called by the controller on a key event for the current mouse action. More... | |
void | set_toolbar_button (const theme::menu *value) |
Helper variable setter - pointer to a toolbar menu/button used for highlighting the current action. More... | |
const theme::menu * | toolbar_button () const |
Getter for the (possibly nullptr) associated menu/button. More... | |
common_palette & | get_palette () |
Getter for the associated palette. More... | |
Protected Attributes | |
terrain_palette & | terrain_palette_ |
Protected Attributes inherited from editor::brush_drag_mouse_action | |
map_location | previous_drag_hex_ |
The previous hex dragged into. More... | |
Protected Attributes inherited from editor::mouse_action | |
map_location | previous_move_hex_ |
The hex previously used in move operations. More... | |
const CKey & | key_ |
Key presses, used for modifiers (alt, shift) in some operations. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from editor::brush_drag_mouse_action | |
const brush & | get_brush () |
Brush accessor. More... | |
Protected Member Functions inherited from editor::mouse_action | |
bool | has_alt_modifier () const |
bool | has_shift_modifier () const |
bool | has_ctrl_modifier () const |
void | set_terrain_mouse_overlay (editor_display &disp, const t_translation::terrain_code &fg, const t_translation::terrain_code &bg) |
Helper function for derived classes that need a active-terrain mouse overlay. More... | |
Brush paint mouse action.
Uses keyboard modifiers for one-layer painting.
Definition at line 249 of file mouse_action.hpp.
|
inline |
Definition at line 252 of file mouse_action.hpp.
|
overridevirtual |
Handle terrain sampling before calling generic handler.
Reimplemented from editor::brush_drag_mouse_action.
Definition at line 250 of file mouse_action.cpp.
References editor::brush_drag_mouse_action::click_left(), editor::editor_display::get_map(), gamemap_base::get_terrain(), editor::mouse_action::has_ctrl_modifier(), display::hex_clicked_on(), editor::terrain_palette::select_fg_item(), and terrain_palette_.
|
overridevirtual |
Create an appropriate editor_action and return it.
Implements editor::brush_drag_mouse_action.
Definition at line 272 of file mouse_action.cpp.
References editor::mouse_action::has_ctrl_modifier(), editor::mouse_action::has_shift_modifier(), editor::terrain_palette::selected_fg_item(), and terrain_palette_.
|
overridevirtual |
Create an appropriate editor_action and return it.
Implements editor::brush_drag_mouse_action.
Definition at line 284 of file mouse_action.cpp.
References editor::mouse_action::has_ctrl_modifier(), editor::mouse_action::has_shift_modifier(), editor::terrain_palette::selected_bg_item(), and terrain_palette_.
|
overridevirtual |
Handle terrain sampling before calling generic handler.
Reimplemented from editor::brush_drag_mouse_action.
Definition at line 261 of file mouse_action.cpp.
References editor::brush_drag_mouse_action::click_right(), editor::editor_display::get_map(), gamemap_base::get_terrain(), editor::mouse_action::has_ctrl_modifier(), display::hex_clicked_on(), editor::terrain_palette::select_bg_item(), and terrain_palette_.
|
overridevirtual |
Set the mouse overlay for this action.
Defaults to an empty overlay.
Reimplemented from editor::mouse_action.
Definition at line 295 of file mouse_action.cpp.
References editor::terrain_palette::selected_bg_item(), editor::terrain_palette::selected_fg_item(), editor::mouse_action::set_terrain_mouse_overlay(), and terrain_palette_.
|
inlineoverridevirtual |
Whether we need the brush bar, is used to grey it out.
Reimplemented from editor::mouse_action.
Definition at line 281 of file mouse_action.hpp.
|
protected |
Definition at line 285 of file mouse_action.hpp.
Referenced by click_left(), click_perform_left(), click_perform_right(), click_right(), and set_mouse_overlay().