Debian Codegraph @

gtk/src/eventcontroller.hg

raw
1 /* Copyright (C) 2014 The gtkmm Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 #include <glibmm/object.h>
18 #include <gtkmm/widget.h>
19
20 _DEFS(gtkmm,gtk)
21 _PINCLUDE(glibmm/private/object_p.h)
22
23 namespace Gtk
24 {
25 /** @defgroup Gestures Event Controllers and Gestures
26 *
27 * These classes handle input events.
28 *
29 * Event controllers are standalone objects that can perform specific actions
30 * upon received GdkEvent%s. These are tied to a Widget, and can be told of
31 * the event propagation phase at which they will manage the events.
32 *
33 * Gestures are a set of specific controllers that are prepared to handle pointer
34 * and/or touch events. Each gestures implementation attempts to recognize specific
35 * actions out the received events, notifying of the state/progress accordingly to
36 * let the widget react to those. On multi-touch gestures, every interacting touch
37 * sequence will be tracked independently.
38 *
39 * See the <a href="https://docs.gtk.org/gtk3/input-handling.html">
40 * Overview of GTK input and event handling</a>
41 * for more information about input events and gestures.
42 *
43 * @newin{3,14}
44 */
45
46 _WRAP_ENUM(PropagationPhase, GtkPropagationPhase, decl_prefix GTKMM_API)
47
48 /** Self-contained handler of series of events.
49 *
50 * This is an abstract base class, low-level implementation for event
51 * controllers. Those react to a series of GdkEvent%s, and possibly trigger
52 * actions as a consequence of those.
53 *
54 * @newin{3,14}
55 *
56 * @ingroup Gestures
57 */
58 class GTKMM_API EventController : public Glib::Object
59 {
60 _CLASS_GOBJECT(EventController, GtkEventController, GTK_EVENT_CONTROLLER, Glib::Object, GObject, , , GTKMM_API)
61
62 protected:
63 /** There is no create() method that corresponds to this constructor,
64 * because only derived classes shall be created.
65 */
66 _CTOR_DEFAULT
67
68 public:
69 // No create() because only derived classes shall be instantiated.
70
71 _WRAP_METHOD(Widget* get_widget(), gtk_event_controller_get_widget)
72 _WRAP_METHOD(const Widget* get_widget() const, gtk_event_controller_get_widget, constversion)
73 _WRAP_METHOD(bool handle_event(const GdkEvent* event), gtk_event_controller_handle_event)
74 _WRAP_METHOD(void reset(), gtk_event_controller_reset)
75 _WRAP_METHOD(PropagationPhase get_propagation_phase() const, gtk_event_controller_get_propagation_phase)
76 _WRAP_METHOD(void set_propagation_phase(PropagationPhase phase), gtk_event_controller_set_propagation_phase)
77
78 _WRAP_PROPERTY("widget", Widget*)
79 _WRAP_PROPERTY("propagation-phase", PropagationPhase)
80
81 // EventController has no signals
82 };
83
84 } // namespace Gtk