FifeGUI 0.3.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// Standard library includes
9#include <cstdint>
10
11// Platform config include
12#include "fifechan/platform.hpp"
13
14// Project headers (subdirs before local)
15#include "fifechan/events/inputevent.hpp"
16#include "fifechan/key.hpp"
17
18namespace fcn
19{
20 class Widget;
21
25 class FIFEGUI_API KeyEvent : public InputEvent
26 {
27 public:
31 enum class Type : std::uint8_t
32 {
33 Pressed = 0,
34 Released
35 };
36
52 Widget* source,
53 Widget* distributor,
54 bool isShiftPressed,
55 bool isControlPressed,
56 bool isAltPressed,
57 bool isMetaPressed,
58 Type type,
59 bool isNumericPad,
60 Key const & key);
61
67 Type getType() const;
68
75 bool isNumericPad() const;
76
82 Key const & getKey() const;
83
84 protected:
89
94
98 Key mKey;
99 };
100} // namespace fcn
101
102#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:26
bool mIsNumericPad
True if the numeric pad was used, false otherwise.
Definition keyevent.hpp:93
KeyEvent(Widget *source, Widget *distributor, bool isShiftPressed, bool isControlPressed, bool isAltPressed, bool isMetaPressed, Type type, bool isNumericPad, Key const &key)
Constructor.
Definition keyevent.cpp:20
Type mType
Holds the type of the key event.
Definition keyevent.hpp:88
Type
Key event types.
Definition keyevent.hpp:32
Key mKey
Holds the key of the key event.
Definition keyevent.hpp:98
Abstract base class defining the common behavior, properties, and lifecycle of all GUI elements.
Definition widget.hpp:56
Used replacement tokens by configure_file():