Set map label action. More...
#include <mouse_action_map_label.hpp>
Public Member Functions | |
mouse_action_map_label (const CKey &key, empty_palette &palette) | |
std::unique_ptr< editor_action > | click_left (editor_display &disp, int x, int y) override |
A click, possibly the beginning of a drag. More... | |
std::unique_ptr< editor_action > | drag_left (editor_display &disp, int x, int y, bool &partial, editor_action *last_undo) override |
Drags a label. More... | |
std::unique_ptr< editor_action > | drag_end_left (editor_display &disp, int x, int y) override |
Replaces the label under the mouse with the dragged label. More... | |
std::unique_ptr< editor_action > | up_left (editor_display &disp, int x, int y) override |
Left click displays a dialog that is used for entering the label string. More... | |
std::unique_ptr< editor_action > | click_right (editor_display &disp, int x, int y) override |
A click, possibly the beginning of a drag. More... | |
std::unique_ptr< editor_action > | up_right (editor_display &disp, int x, int y) override |
Right click erases the label under the mouse. More... | |
virtual void | set_mouse_overlay (editor_display &disp) override |
Set the mouse overlay for this action. 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::set< map_location > | affected_hexes (editor_display &disp, const map_location &hex) |
Locations that would be affected by a click, used by move to update highlights. More... | |
virtual std::unique_ptr< editor_action > | drag_right (editor_display &disp, int x, int y, bool &partial, editor_action *last_undo) |
Drag operation. More... | |
virtual std::unique_ptr< editor_action > | drag_end_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... | |
virtual bool | supports_brushes () const |
Whether we need the brush bar, is used to grey it out. More... | |
Private Attributes | |
bool | click_ |
map_location | clicked_on_ |
Additional Inherited Members | |
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... | |
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... | |
Set map label action.
Definition at line 28 of file mouse_action_map_label.hpp.
|
inline |
Definition at line 31 of file mouse_action_map_label.hpp.
|
overridevirtual |
A click, possibly the beginning of a drag.
Must be overridden.
Implements editor::mouse_action.
Definition at line 31 of file mouse_action_map_label.cpp.
References click_, clicked_on_, and display::hex_clicked_on().
|
overridevirtual |
A click, possibly the beginning of a drag.
Must be overridden.
Implements editor::mouse_action.
Definition at line 77 of file mouse_action_map_label.cpp.
|
overridevirtual |
Replaces the label under the mouse with the dragged label.
Reimplemented from editor::mouse_action.
Definition at line 94 of file mouse_action_map_label.cpp.
References terrain_label::category(), click_, clicked_on_, terrain_label::color(), editor::editor_display::get_controller(), editor::editor_controller::get_current_map_context(), map_labels::get_label(), editor::map_context::get_labels(), editor::editor_display::get_map(), display::hex_clicked_on(), terrain_label::immutable(), gamemap_base::on_board(), terrain_label::team_name(), terrain_label::text(), terrain_label::visible_in_fog(), and terrain_label::visible_in_shroud().
|
overridevirtual |
Drags a label.
Reimplemented from editor::mouse_action.
Definition at line 39 of file mouse_action_map_label.cpp.
References click_, clicked_on_, and display::hex_clicked_on().
|
overridevirtual |
Set the mouse overlay for this action.
Defaults to an empty overlay.
Reimplemented from editor::mouse_action.
Definition at line 136 of file mouse_action_map_label.cpp.
References image::get_texture(), and editor::editor_display::set_mouseover_hex_overlay().
|
overridevirtual |
Left click displays a dialog that is used for entering the label string.
Reimplemented from editor::mouse_action.
Definition at line 47 of file mouse_action_map_label.cpp.
References terrain_label::category(), click_, terrain_label::color(), d, editor::editor_display::get_controller(), editor::editor_controller::get_current_map_context(), map_labels::get_label(), editor::map_context::get_labels(), editor::editor_display::get_map(), display::hex_clicked_on(), terrain_label::immutable(), label, font::NORMAL_COLOR, gamemap_base::on_board(), terrain_label::team_name(), terrain_label::text(), editor::mouse_action::update_brush_highlights(), terrain_label::visible_in_fog(), and terrain_label::visible_in_shroud().
|
overridevirtual |
Right click erases the label under the mouse.
Reimplemented from editor::mouse_action.
Definition at line 82 of file mouse_action_map_label.cpp.
References display::hex_clicked_on().
|
private |
Definition at line 63 of file mouse_action_map_label.hpp.
Referenced by click_left(), drag_end_left(), drag_left(), and up_left().
|
private |
Definition at line 64 of file mouse_action_map_label.hpp.
Referenced by click_left(), drag_end_left(), and drag_left().