The Battle for Wesnoth  1.19.0-dev
clickable_item.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009 - 2024
3  by Mark de Wever <koraq@xs4all.nl>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
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 ~clickable_item()
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  */
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  */
65  = 0;
66 };
67 
68 } // namespace gui2
Small concept class.
virtual void disconnect_click_handler(const event::signal &signal)=0
Disconnects a signal handler for a 'click' event.
virtual void connect_click_handler(const event::signal &signal)=0
Connects a signal handler for a 'click' event.
dispatcher_callback<> signal
Used for events in event_category::general.
Definition: dispatcher.hpp:56
Generic file dialog.