The Battle for Wesnoth  1.19.5+dev
Public Member Functions | Private Attributes | List of all members
editor::mouse_action_starting_position Class Reference

Set starting position action. More...

#include <mouse_action.hpp>

Inheritance diagram for editor::mouse_action_starting_position:

Public Member Functions

 mouse_action_starting_position (const CKey &key, location_palette &palette)
 
std::unique_ptr< editor_actionup_left (editor_display &disp, int x, int y) override
 Left click displays a player-number-selector dialog and then creates an action or returns nullptr if cancel was pressed or there would be no change. More...
 
std::unique_ptr< editor_actionclick_left (editor_display &disp, int x, int y) override
 A click, possibly the beginning of a drag. More...
 
std::unique_ptr< editor_actionup_right (editor_display &disp, int x, int y) override
 Right click only erases the starting position if there is one. More...
 
std::unique_ptr< editor_actionclick_right (editor_display &disp, int x, int y) override
 A click, possibly the beginning of a drag. 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_locationaffected_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_actiondrag_left (editor_display &disp, int x, int y, bool &partial, editor_action *last_undo)
 Drag operation. More...
 
virtual std::unique_ptr< editor_actiondrag_right (editor_display &disp, int x, int y, bool &partial, editor_action *last_undo)
 Drag operation. More...
 
virtual std::unique_ptr< editor_actiondrag_end_left (editor_display &disp, int x, int y)
 The end of dragging. More...
 
virtual std::unique_ptr< editor_actiondrag_end_right (editor_display &disp, int x, int y)
 
virtual std::unique_ptr< editor_actionkey_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::menutoolbar_button () const
 Getter for the (possibly nullptr) associated menu/button. More...
 
common_paletteget_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_
 
location_palettelocation_palette_
 

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 CKeykey_
 Key presses, used for modifiers (alt, shift) in some operations. More...
 

Detailed Description

Set starting position action.

Definition at line 365 of file mouse_action.hpp.

Constructor & Destructor Documentation

◆ mouse_action_starting_position()

editor::mouse_action_starting_position::mouse_action_starting_position ( const CKey key,
location_palette palette 
)
inline

Definition at line 368 of file mouse_action.hpp.

Member Function Documentation

◆ click_left()

std::unique_ptr< editor_action > editor::mouse_action_starting_position::click_left ( editor_display disp,
int  x,
int  y 
)
overridevirtual

A click, possibly the beginning of a drag.

Must be overridden.

Implements editor::mouse_action.

Definition at line 414 of file mouse_action.cpp.

References click_.

◆ click_right()

std::unique_ptr< editor_action > editor::mouse_action_starting_position::click_right ( editor_display disp,
int  x,
int  y 
)
overridevirtual

A click, possibly the beginning of a drag.

Must be overridden.

Implements editor::mouse_action.

Definition at line 431 of file mouse_action.cpp.

◆ set_mouse_overlay()

void editor::mouse_action_starting_position::set_mouse_overlay ( editor_display disp)
overridevirtual

Set the mouse overlay for this action.

Defaults to an empty overlay.

Reimplemented from editor::mouse_action.

Definition at line 436 of file mouse_action.cpp.

References image::get_texture(), and editor::editor_display::set_mouseover_hex_overlay().

◆ up_left()

std::unique_ptr< editor_action > editor::mouse_action_starting_position::up_left ( editor_display disp,
int  x,
int  y 
)
overridevirtual

Left click displays a player-number-selector dialog and then creates an action or returns nullptr if cancel was pressed or there would be no change.

Do this on mouse up to avoid drag issue.

Reimplemented from editor::mouse_action.

Definition at line 380 of file mouse_action.cpp.

References editor::location_palette::add_item(), click_, editor::editor_display::get_map(), editor::mouse_action::has_ctrl_modifier(), display::hex_clicked_on(), gamemap_base::is_special_location(), location_palette_, gamemap_base::on_board(), editor::location_palette::selected_item(), and editor::mouse_action::update_brush_highlights().

◆ up_right()

std::unique_ptr< editor_action > editor::mouse_action_starting_position::up_right ( editor_display disp,
int  x,
int  y 
)
overridevirtual

Right click only erases the starting position if there is one.

Do this on mouse up to avoid drag issue,

Reimplemented from editor::mouse_action.

Definition at line 420 of file mouse_action.cpp.

References editor::editor_display::get_map(), display::hex_clicked_on(), and gamemap_base::is_special_location().

Member Data Documentation

◆ click_

bool editor::mouse_action_starting_position::click_
private

Definition at line 392 of file mouse_action.hpp.

Referenced by click_left(), and up_left().

◆ location_palette_

location_palette& editor::mouse_action_starting_position::location_palette_
private

Definition at line 393 of file mouse_action.hpp.

Referenced by up_left().


The documentation for this class was generated from the following files: