The Battle for Wesnoth  1.15.1+dev
event_executor.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2007 - 2018 by Mark de Wever <koraq@xs4all.nl>
3  Part of the Battle for Wesnoth Project https://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 
17 namespace gui2
18 {
19 
20 class event_handler;
21 
22 /**
23  * Event execution calls.
24  *
25  * Base class with all possible events, most widgets can ignore most of these,
26  * but they are available. In order to use an event simply override the
27  * execution function and implement the wanted behavior. The default behavior
28  * defined here is to do nothing.
29  *
30  * For more info about the event handling have a look at the event_handler
31  * class which 'translates' sdl events into 'widget' events.
32  */
34 {
35 public:
37  : wants_mouse_hover_(false)
41  {
42  }
43 
44  virtual ~event_executor()
45  {
46  }
47 
48  /***** ***** ***** setters / getters for members ***** ****** *****/
49 
50  void set_wants_mouse_hover(const bool hover = true)
51  {
52  wants_mouse_hover_ = hover;
53  }
54  bool wants_mouse_hover() const
55  {
56  return wants_mouse_hover_;
57  }
58 
59  void set_wants_mouse_left_double_click(const bool click = true)
60  {
62  }
64  {
66  }
67 
69  {
71  }
73  {
75  }
76 
78  {
80  return *this;
81  }
83  {
85  }
86 
87 private:
88  /** Does the widget want a hover event? See mouse_hover. */
90 
91  /**
92  * Does the widget want a left button double click? See
93  * mouse_left_button_double_click.
94  */
96 
97  /** See wants_mouse_left_double_click_ */
99 
100  /** See wants_mouse_left_double_click_ */
102 };
103 
104 } // namespace gui2
event_executor & set_wants_mouse_right_double_click(const bool click=true)
void set_wants_mouse_hover(const bool hover=true)
bool wants_mouse_hover() const
Generic file dialog.
Definition: field-fwd.hpp:22
void set_wants_mouse_left_double_click(const bool click=true)
Event execution calls.
bool wants_mouse_right_double_click_
See wants_mouse_left_double_click_.
bool wants_mouse_left_double_click_
Does the widget want a left button double click? See mouse_left_button_double_click.
bool wants_mouse_middle_double_click_
See wants_mouse_left_double_click_.
bool click(int mousex, int mousey)
Definition: tooltips.cpp:211
bool wants_mouse_right_double_click() const
void set_wants_mouse_middle_double_click(const bool click=true)
bool wants_mouse_left_double_click() const
bool wants_mouse_hover_
Does the widget want a hover event? See mouse_hover.
bool wants_mouse_middle_double_click() const