FifeGUI
0.2.0
A C++ GUI library designed for games.
src
inputevent.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
#include "fifechan/inputevent.hpp"
6
7
#include "fifechan/event.hpp"
8
9
namespace
fcn
10
{
11
InputEvent::InputEvent
(
12
Widget
* source,
13
Widget
* distributor,
14
bool
isShiftPressed
,
15
bool
isControlPressed
,
16
bool
isAltPressed
,
17
bool
isMetaPressed
) :
18
Event
(source),
19
mShiftPressed
(
isShiftPressed
),
20
mControlPressed
(
isControlPressed
),
21
mAltPressed
(
isAltPressed
),
22
mMetaPressed
(
isMetaPressed
),
23
mIsConsumed
(false),
24
mDistributor
(distributor)
25
{
26
}
27
28
bool
InputEvent::isShiftPressed
()
const
29
{
30
return
mShiftPressed
;
31
}
32
33
bool
InputEvent::isControlPressed
()
const
34
{
35
return
mControlPressed
;
36
}
37
38
bool
InputEvent::isAltPressed
()
const
39
{
40
return
mAltPressed
;
41
}
42
43
bool
InputEvent::isMetaPressed
()
const
44
{
45
return
mMetaPressed
;
46
}
47
48
void
InputEvent::consume
()
49
{
50
mIsConsumed
=
true
;
51
}
52
53
bool
InputEvent::isConsumed
()
const
54
{
55
return
mIsConsumed
;
56
}
57
58
Widget
*
InputEvent::getDistributor
()
const
59
{
60
return
mDistributor
;
61
}
62
}
// namespace fcn
fcn::Event::Event
Event(Widget *source)
Constructor.
Definition
event.cpp:9
fcn::InputEvent::getDistributor
Widget * getDistributor() const
Gets the distributor of the event.
Definition
inputevent.cpp:58
fcn::InputEvent::InputEvent
InputEvent(Widget *source, Widget *distributor, bool isShiftPressed, bool isControlPressed, bool isAltPressed, bool isMetaPressed)
Constructor.
Definition
inputevent.cpp:11
fcn::InputEvent::mIsConsumed
bool mIsConsumed
True if the input event is consumed, false otherwise.
Definition
inputevent.hpp:125
fcn::InputEvent::isConsumed
bool isConsumed() const
Checks if the input event is consumed.
Definition
inputevent.cpp:53
fcn::InputEvent::isAltPressed
bool isAltPressed() const
Checks if alt is pressed.
Definition
inputevent.cpp:38
fcn::InputEvent::isControlPressed
bool isControlPressed() const
Checks if control is pressed.
Definition
inputevent.cpp:33
fcn::InputEvent::isMetaPressed
bool isMetaPressed() const
Checks whether meta is pressed.
Definition
inputevent.cpp:43
fcn::InputEvent::consume
void consume()
Marks the event as consumed.
Definition
inputevent.cpp:48
fcn::InputEvent::mControlPressed
bool mControlPressed
True if control is pressed, false otherwise.
Definition
inputevent.hpp:109
fcn::InputEvent::mAltPressed
bool mAltPressed
True if alt is pressed, false otherwise.
Definition
inputevent.hpp:114
fcn::InputEvent::mDistributor
Widget * mDistributor
Holds the distributor of the event.
Definition
inputevent.hpp:130
fcn::InputEvent::isShiftPressed
bool isShiftPressed() const
Checks if shift is pressed.
Definition
inputevent.cpp:28
fcn::InputEvent::mShiftPressed
bool mShiftPressed
True if shift is pressed, false otherwise.
Definition
inputevent.hpp:104
fcn::InputEvent::mMetaPressed
bool mMetaPressed
True if meta is pressed, false otherwise.
Definition
inputevent.hpp:119
fcn::Widget
Abstract base class defining the common behavior, properties, and lifecycle of all GUI elements.
Definition
widget.hpp:45
Generated by
1.16.1