The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
clickable.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009 - 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_CLICKABLE_HPP_INCLUDED
16 #define GUI_WIDGETS_CLICKABLE_HPP_INCLUDED
17 
19 
20 namespace gui2
21 {
22 
23 /**
24  * Small concept class.
25  *
26  * Parts of the engine inherit this class so we can have generic
27  * clickable items. This is mainly for the button and the repeating button
28  * classes.
29  *
30  * The reason for having the click functions here is that not all subclasses
31  * need to implement the click event in the same way; e.g. the repeating button
32  * clicks on the mouse down event and the normal button on the mouse click
33  * event.
34  *
35  * Common signal handlers:
36  * - connect_signal_mouse_left_click
37  * - disconnect_signal_mouse_left_click
38  */
40 {
41 public:
42  virtual ~tclickable_()
43  {
44  }
45 
46  /**
47  * Connects a signal handler for a 'click' event.
48  *
49  * What the click is depends on the subclass.
50  *
51  * @param signal The signal to connect.
52  */
53  virtual void connect_click_handler(const event::tsignal_function& signal)
54  = 0;
55 
56  /**
57  * Disconnects a signal handler for a 'click' event.
58  *
59  * What the click is depends on the subclass.
60  *
61  * @param signal The signal to disconnect (should be the same
62  * as send to the connect call.
63  */
64  virtual void disconnect_click_handler(const event::tsignal_function& signal)
65  = 0;
66 };
67 
68 } // namespace gui2
69 
70 #endif
virtual ~tclickable_()
Definition: clickable.hpp:42
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
virtual void disconnect_click_handler(const event::tsignal_function &signal)=0
Disconnects a signal handler for a 'click' event.
std::function< void(tdispatcher &dispatcher, const tevent event, bool &handled, bool &halt)> tsignal_function
Callback function signature.
Definition: dispatcher.hpp:40
virtual void connect_click_handler(const event::tsignal_function &signal)=0
Connects a signal handler for a 'click' event.
Small concept class.
Definition: clickable.hpp:39