FifeGUI 0.2.0
A C++ GUI library designed for games.
keyevent.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
2// SPDX-FileCopyrightText: 2004 - 2008 Olof Naessén and Per Larsson
3// SPDX-FileCopyrightText: 2013 - 2026 Fifengine contributors
4
5#ifndef INCLUDE_FIFECHAN_KEYEVENT_HPP_
6#define INCLUDE_FIFECHAN_KEYEVENT_HPP_
7
8#include <cstdint>
9
10#include "fifechan/inputevent.hpp"
11#include "fifechan/key.hpp"
12#include "fifechan/platform.hpp"
13
14namespace fcn
15{
16 class Widget;
17
21 class FIFEGUI_API KeyEvent : public InputEvent
22 {
23 public:
27 enum class Type : std::uint8_t
28 {
29 Pressed = 0,
30 Released
31 };
32
48 Widget* source,
49 Widget* distributor,
50 bool isShiftPressed,
51 bool isControlPressed,
52 bool isAltPressed,
53 bool isMetaPressed,
54 Type type,
55 bool isNumericPad,
56 Key const & key);
57
63 Type getType() const;
64
72 bool isNumericPad() const;
73
79 Key const & getKey() const;
80
81 protected:
86
91
96 };
97} // namespace fcn
98
99#endif // INCLUDE_FIFECHAN_KEYEVENT_HPP_
InputEvent(Widget *source, Widget *distributor, bool isShiftPressed, bool isControlPressed, bool isAltPressed, bool isMetaPressed)
Constructor.
Represents a key event.
Definition keyevent.hpp:22
bool mIsNumericPad
True if the numeric pad was used, false otherwise.
Definition keyevent.hpp:90
KeyEvent(Widget *source, Widget *distributor, bool isShiftPressed, bool isControlPressed, bool isAltPressed, bool isMetaPressed, Type type, bool isNumericPad, Key const &key)
Constructor.
Definition keyevent.cpp:12
Type mType
Holds the type of the key event.
Definition keyevent.hpp:85
Type
Key event types.
Definition keyevent.hpp:28
Key mKey
Holds the key of the key event.
Definition keyevent.hpp:95
Represents a keyboard key or character code.
Definition key.hpp:20
Abstract base class defining the common behavior, properties, and lifecycle of all GUI elements.
Definition widget.hpp:45