1.10
input.h
1/*
2 * Copyright (C) 2018 Microchip Technology Inc. All rights reserved.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#ifndef EGT_INPUT_H
7#define EGT_INPUT_H
8
14#include <egt/detail/meta.h>
15#include <egt/event.h>
16#include <egt/object.h>
17#include <egt/signal.h>
18#include <memory>
19
20namespace egt
21{
22inline namespace v1
23{
24
25namespace detail
26{
27class MouseGesture;
28}
29
30class Widget;
31
38class EGT_API Input
39{
40public:
41
43
44 Input(const Input&) = delete;
45 Input& operator=(const Input&) = delete;
46 Input(Input&&) noexcept;
47 Input& operator=(Input&&) noexcept;
48
66 static Object& global_input()
67 {
68 return m_global_handler;
69 }
70
71 virtual ~Input() noexcept;
72
73protected:
74
78 virtual void dispatch(Event& event);
79
86 static Object m_global_handler;
87
91 std::unique_ptr<detail::MouseGesture> m_mouse;
92
96 bool m_dispatching{false};
97};
98
99namespace detail
100{
101
106
112EGT_API void mouse_grab(Widget* widget);
113
120EGT_API void keyboard_focus(Widget* widget);
121
126
130EGT_API Widget* dragged();
131
135EGT_API void dragged(Widget* widget);
136
137}
138
139}
140}
141
142#endif
Base Input device class.
Definition input.h:39
virtual ~Input() noexcept
Input(Input &&) noexcept
Input(const Input &)=delete
Input & operator=(const Input &)=delete
Base object class with fundamental properties.
Definition object.h:32
Base Widget class.
Definition widget.h:53
EGT_API Widget * keyboard_focus()
Get the current widget which has the keyboard focus, or nullptr.
EGT_API Widget * dragged()
Get the current widget which is being dragged, or nullptr.
EGT_API Widget * mouse_grab()
Get the current widget which has the mouse grabbed, or nullptr.
EGT framework namespace.
Definition animation.h:24
A single event that has information about the event and state for the event.
Definition event.h:255