The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
event_executor.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2007 - 2016 by Mark de Wever <[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 GUI_WIDGETS_EVENT_EXECUTOR_HPP_INCLUDED
16 #define GUI_WIDGETS_EVENT_EXECUTOR_HPP_INCLUDED
17 
18 namespace gui2
19 {
20 
21 class tevent_handler;
22 
23 /**
24  * Event execution calls.
25  *
26  * Base class with all possible events, most widgets can ignore most of these,
27  * but they are available. In order to use an event simply override the
28  * execution function and implement the wanted behavior. The default behavior
29  * defined here is to do nothing.
30  *
31  * For more info about the event handling have a look at the tevent_handler
32  * class which 'translates' sdl events into 'widget' events.
33  */
35 {
36 public:
38  : wants_mouse_hover_(false)
42  {
43  }
44 
45  virtual ~tevent_executor()
46  {
47  }
48 
49  /***** ***** ***** setters / getters for members ***** ****** *****/
50 
51  void set_wants_mouse_hover(const bool hover = true)
52  {
53  wants_mouse_hover_ = hover;
54  }
55  bool wants_mouse_hover() const
56  {
57  return wants_mouse_hover_;
58  }
59 
60  void set_wants_mouse_left_double_click(const bool click = true)
61  {
63  }
65  {
67  }
68 
70  {
72  }
74  {
76  }
77 
79  {
81  return *this;
82  }
84  {
86  }
87 
88 private:
89  /** Does the widget want a hover event? See mouse_hover. */
91 
92  /**
93  * Does the widget want a left button double click? See
94  * mouse_left_button_double_click.
95  */
97 
98  /** See wants_mouse_left_double_click_ */
100 
101  /** See wants_mouse_left_double_click_ */
103 };
104 
105 } // namespace gui2
106 
107 #endif
bool wants_mouse_left_double_click_
Does the widget want a left button double click? See mouse_left_button_double_click.
void set_wants_mouse_middle_double_click(const bool click=true)
Event execution calls.
bool wants_mouse_middle_double_click() const
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
bool wants_mouse_left_double_click() const
bool wants_mouse_hover_
Does the widget want a hover event? See mouse_hover.
bool wants_mouse_right_double_click_
See wants_mouse_left_double_click_.
tevent_executor & set_wants_mouse_right_double_click(const bool click=true)
void set_wants_mouse_left_double_click(const bool click=true)
bool wants_mouse_hover() const
void set_wants_mouse_hover(const bool hover=true)
bool click(int mousex, int mousey)
Definition: tooltips.cpp:216
bool wants_mouse_middle_double_click_
See wants_mouse_left_double_click_.
bool wants_mouse_right_double_click() const