FifeGUI 0.3.0
A C++ GUI library designed for games.
fcn::KeyEvent Class Reference

#include <keyevent.hpp>

Inheritance diagram for fcn::KeyEvent:
fcn::InputEvent fcn::Event

Public Types

enum class  Type : std::uint8_t { Pressed = 0 , Released }

Public Member Functions

Key const & getKey () const
Type getType () const
bool isNumericPad () const
 KeyEvent (Widget *source, Widget *distributor, bool isShiftPressed, bool isControlPressed, bool isAltPressed, bool isMetaPressed, Type type, bool isNumericPad, Key const &key)
Public Member Functions inherited from fcn::InputEvent
void consume ()
WidgetgetDistributor () const
uint16_t getModMask () const
 InputEvent (Widget *source, Widget *distributor, bool isShiftPressed, bool isControlPressed, bool isAltPressed, bool isMetaPressed)
bool isAltPressed () const
bool isConsumed () const
bool isControlPressed () const
bool isMetaPressed () const
bool isShiftPressed () const
Public Member Functions inherited from fcn::Event
 Event (Widget *source)
WidgetgetSource () const

Protected Attributes

bool mIsNumericPad
Key mKey
Type mType
Protected Attributes inherited from fcn::InputEvent
WidgetmDistributor
bool mIsConsumed
uint16_t mModMask {0}
Protected Attributes inherited from fcn::Event
WidgetmSource {nullptr}

Additional Inherited Members

Static Public Attributes inherited from fcn::InputEvent
static constexpr uint16_t ModAlt = 1 << 2
static constexpr uint16_t ModControl = 1 << 1
static constexpr uint16_t ModMeta = 1 << 3
static constexpr uint16_t ModShift = 1 << 0

Detailed Description

Represents a key event.

Definition at line 25 of file keyevent.hpp.

Member Enumeration Documentation

◆ Type

enum class fcn::KeyEvent::Type : std::uint8_t
strong

Key event types.

Definition at line 31 of file keyevent.hpp.

Constructor & Destructor Documentation

◆ KeyEvent()

fcn::KeyEvent::KeyEvent ( Widget * source,
Widget * distributor,
bool isShiftPressed,
bool isControlPressed,
bool isAltPressed,
bool isMetaPressed,
Type type,
bool isNumericPad,
Key const & key )

Constructor.

Parameters
sourceThe widget the event concerns..
distributorThe distributor of the event.
isShiftPressedTrue if shift is pressed, false otherwise.
isControlPressedTrue if control is pressed, false otherwise.
isAltPressedTrue if alt is pressed, false otherwise.
isMetaPressedTrue if meta is pressed, false otherwise.
typeThe type of the event. A value from KeyEventType.
isNumericPadTrue if the event occurred on the numeric pad, false otherwise.
keyThe key of the event.

Definition at line 20 of file keyevent.cpp.

References fcn::InputEvent::InputEvent(), fcn::InputEvent::isAltPressed(), fcn::InputEvent::isControlPressed(), fcn::InputEvent::isMetaPressed(), isNumericPad(), fcn::InputEvent::isShiftPressed(), mIsNumericPad, mKey, and mType.

Member Function Documentation

◆ getKey()

◆ getType()

KeyEvent::Type fcn::KeyEvent::getType ( ) const

Gets the type of the event.

Returns
The type of the event.

Definition at line 38 of file keyevent.cpp.

References mType.

Referenced by fcn::Gui::distributeKeyEvent(), and fcn::Gui::distributeKeyEventToGlobalKeyListeners().

◆ isNumericPad()

bool fcn::KeyEvent::isNumericPad ( ) const

Checks if the key event occurred on the numeric pad.

Returns
True if key event occurred on the numeric pad, false otherwise.

Definition at line 43 of file keyevent.cpp.

References mIsNumericPad.

Referenced by KeyEvent().

Member Data Documentation

◆ mIsNumericPad

bool fcn::KeyEvent::mIsNumericPad
protected

True if the numeric pad was used, false otherwise.

Definition at line 93 of file keyevent.hpp.

Referenced by isNumericPad(), and KeyEvent().

◆ mKey

Key fcn::KeyEvent::mKey
protected

Holds the key of the key event.

Definition at line 98 of file keyevent.hpp.

Referenced by getKey(), and KeyEvent().

◆ mType

Type fcn::KeyEvent::mType
protected

Holds the type of the key event.

Definition at line 88 of file keyevent.hpp.

Referenced by getType(), and KeyEvent().


The documentation for this class was generated from the following files: