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

item placement action class More...

#include <mouse_action_item.hpp>

Inheritance diagram for editor::mouse_action_item:

Public Member Functions

 mouse_action_item (const CKey &key, item_palette &palette)
 
bool has_context_menu () const override
 
void move (editor_display &disp, const map_location &hex) override
 Mouse move (not a drag). More...
 
std::unique_ptr< editor_actionclick_left (editor_display &disp, int x, int y) override
 Left clicking places the currently selected item on the x,y map hex. More...
 
std::unique_ptr< editor_actionclick_right (editor_display &disp, int x, int y) override
 Right clicking removes the item on the x,y map hex. More...
 
std::unique_ptr< editor_actionup_left (editor_display &disp, int x, int y) override
 TODO. More...
 
std::unique_ptr< editor_actiondrag_left (editor_display &disp, int x, int y, bool &partial, editor_action *last_undo) override
 Drag operation. More...
 
std::unique_ptr< editor_actiondrag_end_left (editor_display &disp, int x, int y) override
 Drag end replaces the item when clicked left, or adjusts the facing when clicked right. More...
 
virtual void set_mouse_overlay (editor_display &disp) override
 Set the mouse overlay for this action. More...
 
void set_item_mouse_overlay (editor_display &disp, const overlay &u)
 
- Public Member Functions inherited from editor::mouse_action
 mouse_action (common_palette &palette, const CKey &key)
 
virtual ~mouse_action ()
 
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_right (editor_display &disp, int x, int y, bool &partial, editor_action *last_undo)
 Drag operation. More...
 
virtual std::unique_ptr< editor_actiondrag_end_right (editor_display &disp, int x, int y)
 
virtual std::unique_ptr< editor_actionup_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_
 
map_location start_hex_
 
item_paletteitem_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

item placement action class

Definition at line 28 of file mouse_action_item.hpp.

Constructor & Destructor Documentation

◆ mouse_action_item()

editor::mouse_action_item::mouse_action_item ( const CKey key,
item_palette palette 
)
inline

Definition at line 31 of file mouse_action_item.hpp.

Member Function Documentation

◆ click_left()

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

◆ click_right()

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

Right clicking removes the item on the x,y map hex.

Implements editor::mouse_action.

Definition at line 60 of file mouse_action_item.cpp.

References click_, editor::editor_display::get_map(), display::hex_clicked_on(), gamemap_base::on_board(), display::remove_overlay(), and start_hex_.

◆ drag_end_left()

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

Drag end replaces the item when clicked left, or adjusts the facing when clicked right.

Reimplemented from editor::mouse_action.

Definition at line 118 of file mouse_action_item.cpp.

References click_, editor::editor_display::get_map(), display::hex_clicked_on(), gamemap_base::on_board(), and start_hex_.

◆ drag_left()

std::unique_ptr< editor_action > editor::mouse_action_item::drag_left ( editor_display disp,
int  x,
int  y,
bool &  partial,
editor_action last_undo 
)
overridevirtual

Drag operation.

A click should have occurred earlier. Defaults to no action.

Reimplemented from editor::mouse_action.

Definition at line 73 of file mouse_action_item.cpp.

References click_, display::hex_clicked_on(), and start_hex_.

◆ has_context_menu()

bool editor::mouse_action_item::has_context_menu ( ) const
inlineoverridevirtual

Reimplemented from editor::mouse_action.

Definition at line 39 of file mouse_action_item.hpp.

◆ move()

void editor::mouse_action_item::move ( editor_display disp,
const map_location hex 
)
overridevirtual

Mouse move (not a drag).

Never changes anything (other than temporary highlights and similar)

Reimplemented from editor::mouse_action.

Definition at line 29 of file mouse_action_item.cpp.

References get_adjacent_tiles(), display::invalidate(), editor::mouse_action::previous_move_hex_, and editor::mouse_action::update_brush_highlights().

◆ set_item_mouse_overlay()

void editor::mouse_action_item::set_item_mouse_overlay ( editor_display disp,
const overlay u 
)

◆ set_mouse_overlay()

void editor::mouse_action_item::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 134 of file mouse_action_item.cpp.

References item_palette_, editor::editor_palette< Item >::selected_fg_item(), and set_item_mouse_overlay().

◆ up_left()

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

Member Data Documentation

◆ click_

bool editor::mouse_action_item::click_
private

Definition at line 72 of file mouse_action_item.hpp.

Referenced by click_left(), click_right(), drag_end_left(), drag_left(), and up_left().

◆ item_palette_

item_palette& editor::mouse_action_item::item_palette_
private

Definition at line 75 of file mouse_action_item.hpp.

Referenced by click_left(), and set_mouse_overlay().

◆ start_hex_

map_location editor::mouse_action_item::start_hex_
private

Definition at line 74 of file mouse_action_item.hpp.

Referenced by click_left(), click_right(), drag_end_left(), and drag_left().


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