The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
mouse_action_item.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_ITEM_HPP
16 #define EDITOR_MOUSE_ACTION_ITEM_HPP
17 
20 
21 class CKey;
22 
23 namespace editor {
24 
25 /**
26  * item placement action class
27  */
29 {
30 public:
32  : mouse_action(palette, key)
33  , click_(false)
34  , start_hex_()
35  , item_palette_(palette)
36  {
37  }
38 
39  bool has_context_menu() const {
40  return true;
41  }
42 
43  void move(editor_display& disp, const map_location& hex);
44 
45  /**
46  * TODO
47  */
48  editor_action* click_left(editor_display& disp, int x, int y);
49 
50  /**
51  * TODO
52  */
53  editor_action* up_left(editor_display& disp, int x, int y);
54 
55  editor_action* drag_left(editor_display& disp, int x, int y, bool& partial, editor_action* last_undo);
56 
57  /**
58  * Drag end replaces the item when clicked left, or adjusts
59  * the facing when clicked right.
60  */
61  editor_action* drag_end_left(editor_display& disp, int x, int y);
62 
63  editor_action* click_right(editor_display& /*disp*/, int /*x*/, int /*y*/) {
64  return nullptr;
65  }
66 
67  virtual void set_mouse_overlay(editor_display& disp);
68  void set_item_mouse_overlay(editor_display& disp, const overlay& u);
69 
70 private:
71  bool click_;
72 
75 };
76 
77 
78 } //end namespace editor
79 
80 #endif
editor_action * click_right(editor_display &, int, int)
A click, possibly the beginning of a drag.
editor_action * click_left(editor_display &disp, int x, int y)
TODO.
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1220
editor_action * up_left(editor_display &disp, int x, int y)
TODO.
item placement action class
editor_action * drag_left(editor_display &disp, int x, int y, bool &partial, editor_action *last_undo)
Drag operation.
Manage the empty-palette in the editor.
Definition: action.cpp:28
virtual void set_mouse_overlay(editor_display &disp)
Set the mouse overlay for this action.
Encapsulates the map of the game.
Definition: location.hpp:38
void set_item_mouse_overlay(editor_display &disp, const overlay &u)
mouse_action_item(const CKey &key, item_palette &palette)
Palette where the terrain to be drawn can be selected.
Base class for all editor actions.
Definition: action_base.hpp:41
GLint GLint GLint GLint GLint x
Definition: glew.h:1220
A mouse action receives events from the controller, and responds to them by creating an appropriate e...
void move(editor_display &disp, const map_location &hex)
Mouse move (not a drag).
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.
editor_action * drag_end_left(editor_display &disp, int x, int y)
Drag end replaces the item when clicked left, or adjusts the facing when clicked right.