FifeGUI 0.3.0
A C++ GUI library designed for games.
keyevent.cpp
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// Corresponding header include
6#include "fifechan/events/keyevent.hpp"
7
8// Standard library includes
9#include <cassert>
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{
21 Widget* source,
22 Widget* distributor,
23 bool isShiftPressed,
25 bool isAltPressed,
26 bool isMetaPressed,
27 Type type,
28 bool isNumericPad,
29 Key const & key) :
31 mType(type),
33 mKey(key)
34 {
35 assert("Type must be Pressed or Released" && (type == Type::Pressed || type == Type::Released));
36 }
37
39 {
40 return mType;
41 }
42
44 {
45 return mIsNumericPad;
46 }
47
48 Key const & KeyEvent::getKey() const
49 {
50 return mKey;
51 }
52} // namespace fcn
InputEvent(Widget *source, Widget *distributor, bool isShiftPressed, bool isControlPressed, bool isAltPressed, bool isMetaPressed)
Constructor.
bool isAltPressed() const
Checks if alt is pressed.
bool isControlPressed() const
Checks if control is pressed.
bool isMetaPressed() const
Checks whether meta is pressed.
bool isShiftPressed() const
Checks if shift is pressed.
Type getType() const
Gets the type of the event.
Definition keyevent.cpp:38
bool mIsNumericPad
True if the numeric pad was used, false otherwise.
Definition keyevent.hpp:93
Key const & getKey() const
Gets the key of the event.
Definition keyevent.cpp:48
bool isNumericPad() const
Checks if the key event occurred on the numeric pad.
Definition keyevent.cpp:43
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():