The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
mouse_action_select.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2017 by Fabian Mueller <fabianmueller5@gmx.de>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #pragma once
16 
18 
19 class CKey;
20 class empty_palette;
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)
31  : brush_drag_mouse_action(palette, brush, key)
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  editor_action* key_event(editor_display& disp, const SDL_Event& e) override;
44 
45  /**
46  * Left click/drag selects
47  */
48  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  editor_action* click_right(editor_display& disp, int x, int y) override;
54 
55 
56  /**
57  * Right click/drag
58  */
59  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
mouse_action_select(const brush *const *const brush, const CKey &key, empty_palette &palette)
virtual bool has_context_menu() const override
std::vector< color_t > palette(const color_range &cr)
Creates a reference color palette from a color range.
Definition: color_range.cpp:85
virtual void set_mouse_overlay(editor_display &disp) override
Set the mouse overlay for this action.
editor_action * click_perform_left(editor_display &disp, const std::set< map_location > &hexes) override
Left click/drag selects.
Select (and deselect) action, by brush or "magic wand" (via keyboard modifier)
A brush-drag mouse action base class which adds brush and drag processing to a basic mouse action...
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.
The brush class represents a single brush – a set of relative locations around a "hotspot"...
Definition: brush.hpp:25
Manage the empty-palette in the editor.
Definition: action.cpp:29
Encapsulates the map of the game.
Definition: location.hpp:40
Base class for all editor actions.
Definition: action_base.hpp:40
editor_action * click_perform_right(editor_display &disp, const std::set< map_location > &hexes) override
Right click/drag.
#define e
virtual bool supports_brushes() const override
Whether we need the brush bar, is used to grey it out.
Class that keeps track of all the keys on the keyboard.
Definition: key.hpp:27
editor_action * key_event(editor_display &disp, const SDL_Event &e) override
Force a fake "move" event to update brush overlay on key event.