The Battle for Wesnoth  1.19.0-dev
mouse_action_select.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2024
3  by Fabian Mueller <fabianmueller5@gmx.de>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
19 
20 class CKey;
21 
22 namespace editor {
23 
24 /**
25  * Select (and deselect) action, by brush or "magic wand" (via keyboard modifier)
26  */
28 {
29 public:
30  mouse_action_select(const brush* const * const brush, const CKey& key, empty_palette& palette)
32  {
33  }
34 
35  /**
36  * Overridden to allow special behavior based on modifier keys
37  */
38  std::set<map_location> affected_hexes(editor_display& disp, const map_location& hex) override;
39 
40  /**
41  * Force a fake "move" event to update brush overlay on key event
42  */
43  std::unique_ptr<editor_action> key_event(editor_display& disp, const SDL_Event& e) override;
44 
45  /**
46  * Left click/drag selects
47  */
48  std::unique_ptr<editor_action> click_perform_left(editor_display& disp, const std::set<map_location>& hexes) override;
49 
50  /**
51  * Right click does nothing for now
52  */
53  std::unique_ptr<editor_action> click_right(editor_display& disp, int x, int y) override;
54 
55 
56  /**
57  * Right click/drag
58  */
59  std::unique_ptr<editor_action> click_perform_right(editor_display& disp, const std::set<map_location>& hexes) override;
60 
61  virtual void set_mouse_overlay(editor_display& disp) override;
62 
63  virtual bool has_context_menu() const override { return true; }
64  virtual bool supports_brushes() const override { return true; }
65 
66 };
67 
68 } //end namespace editor
Class that keeps track of all the keys on the keyboard.
Definition: key.hpp:29
A brush-drag mouse action base class which adds brush and drag processing to a basic mouse action.
The brush class represents a single brush – a set of relative locations around a "hotspot",...
Definition: brush.hpp:27
Select (and deselect) action, by brush or "magic wand" (via keyboard modifier)
mouse_action_select(const brush *const *const brush, const CKey &key, empty_palette &palette)
std::unique_ptr< editor_action > click_perform_right(editor_display &disp, const std::set< map_location > &hexes) override
Right click/drag.
std::unique_ptr< editor_action > click_right(editor_display &disp, int x, int y) override
Right click does nothing for now.
std::set< map_location > affected_hexes(editor_display &disp, const map_location &hex) override
Overridden to allow special behavior based on modifier keys.
virtual void set_mouse_overlay(editor_display &disp) override
Set the mouse overlay for this action.
virtual bool has_context_menu() const override
virtual bool supports_brushes() const override
Whether we need the brush bar, is used to grey it out.
std::unique_ptr< editor_action > click_perform_left(editor_display &disp, const std::set< map_location > &hexes) override
Left click/drag selects.
std::unique_ptr< editor_action > key_event(editor_display &disp, const SDL_Event &e) override
Force a fake "move" event to update brush overlay on key event.
std::vector< color_t > palette(const color_range &cr)
Creates a reference color palette from a color range.
Definition: color_range.cpp:84
Manage the empty-palette in the editor.
Definition: action.cpp:31
Encapsulates the map of the game.
Definition: location.hpp:38
#define e