The Battle for Wesnoth  1.13.4+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 - 2016 by Fabian Mueller <[email protected]>
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 #ifndef EDITOR_MOUSE_ACTION_SELECT_HPP
16 #define EDITOR_MOUSE_ACTION_SELECT_HPP
17 
18 #include "mouse_action.hpp"
19 
20 class CKey;
21 class empty_palette;
22 
23 namespace editor {
24 
25 /**
26  * Select (and deselect) action, by brush or "magic wand" (via keyboard modifier)
27  */
29 {
30 public:
31  mouse_action_select(const brush* const * const brush, const CKey& key, empty_palette& palette)
32  : brush_drag_mouse_action(palette, brush, key)
33  {
34  }
35 
36  /**
37  * Overridden to allow special behavior based on modifier keys
38  */
39  std::set<map_location> affected_hexes(editor_display& disp, const map_location& hex);
40 
41  /**
42  * Force a fake "move" event to update brush overlay on key event
43  */
44  editor_action* key_event(editor_display& disp, const SDL_Event& e);
45 
46  /**
47  * Left click/drag selects
48  */
49  editor_action* click_perform_left(editor_display& disp, const std::set<map_location>& hexes);
50 
51  /**
52  * Right click does nothing for now
53  */
54  editor_action* click_right(editor_display& disp, int x, int y);
55 
56 
57  /**
58  * Right click/drag
59  */
60  editor_action* click_perform_right(editor_display& disp, const std::set<map_location>& hexes);
61 
62  virtual void set_mouse_overlay(editor_display& disp);
63 
64  bool has_context_menu() const { return true; }
65  bool supports_brushes() { return true; }
66 
67 };
68 
69 } //end namespace editor
70 
71 #endif
editor_action * click_right(editor_display &disp, int x, int y)
Right click does nothing for now.
mouse_action_select(const brush *const *const brush, const CKey &key, empty_palette &palette)
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1220
virtual void set_mouse_overlay(editor_display &disp)
Set the mouse overlay for this action.
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 * key_event(editor_display &disp, const SDL_Event &e)
Force a fake "move" event to update brush overlay on key event.
The brush class represents a single brush – a set of relative locations around a "hotspot"...
Definition: brush.hpp:26
Manage the empty-palette in the editor.
Definition: action.cpp:28
Encapsulates the map of the game.
Definition: location.hpp:38
editor_action * click_perform_right(editor_display &disp, const std::set< map_location > &hexes)
Right click/drag.
Base class for all editor actions.
Definition: action_base.hpp:41
GLint GLint GLint GLint GLint x
Definition: glew.h:1220
std::set< map_location > affected_hexes(editor_display &disp, const map_location &hex)
Overridden to allow special behavior based on modifier keys.
#define e
bool supports_brushes()
Whether we need the brush bar, is used to grey it out.
editor_action * click_perform_left(editor_display &disp, const std::set< map_location > &hexes)
Left click/drag selects.
Class that keeps track of all the keys on the keyboard.
Definition: key.hpp:27
std::vector< Uint32 > palette(color_range cr)
Creates a reference color palette from a color range.