ManaPlus
Public Member Functions | Protected Attributes
KeyEvent Class Reference

#include <keyevent.h>

Inheritance diagram for KeyEvent:
InputGuiEvent Event

Public Member Functions

 KeyEvent (Widget *const source, KeyEventTypeT type, const InputActionT actionId, const Key &key)
 
KeyEventTypeT getType () const
 
const KeygetKey () const
 
InputActionT getActionId () const
 
- Public Member Functions inherited from InputGuiEvent
 InputGuiEvent (Widget *const source)
 
void consume ()
 
bool isConsumed () const
 
- Public Member Functions inherited from Event
 Event (Widget *const source)
 
virtual ~Event ()
 
WidgetgetSource () const
 

Protected Attributes

Key mKey
 
KeyEventTypeT mType
 
InputActionT mActionId
 
- Protected Attributes inherited from InputGuiEvent
bool mIsConsumed
 
- Protected Attributes inherited from Event
WidgetmSource
 

Detailed Description

Represents a key event.

Definition at line 85 of file keyevent.h.

Constructor & Destructor Documentation

◆ KeyEvent()

KeyEvent::KeyEvent ( Widget *const  source,
KeyEventTypeT  type,
const InputActionT  actionId,
const Key key 
)
inline

Constructor.

Parameters
sourceThe source widget of the event.
typeThe type of the event. A value from KeyEventType. false otherwise.
keyThe key of the event.

Definition at line 96 of file keyevent.h.

99  :
100  InputGuiEvent(source),
101  mKey(key),
102 #ifdef USE_SDL2
103  mText(),
104 #endif // USE_SDL2
105  mType(type),
106  mActionId(actionId)
107  { }
InputGuiEvent(Widget *const source)
Definition: inputguievent.h:83
Key mKey
Definition: keyevent.h:142
KeyEventTypeT mType
Definition: keyevent.h:151
InputActionT mActionId
Definition: keyevent.h:153

Member Function Documentation

◆ getActionId()

InputActionT KeyEvent::getActionId ( ) const
inline

Definition at line 127 of file keyevent.h.

128  { return mActionId; }

References mActionId.

Referenced by InventoryWindow::keyPressed(), ServerDialog::keyPressed(), and InventoryWindow::keyReleased().

◆ getKey()

const Key& KeyEvent::getKey ( ) const
inline

Gets the key of the event.

Returns
The key of the event.

Definition at line 124 of file keyevent.h.

125  { return mKey; }

References mKey.

Referenced by IntTextField::keyPressed(), and ChatWindow::keyPressed().

◆ getType()

KeyEventTypeT KeyEvent::getType ( ) const
inline

Gets the type of the event.

Returns
The type of the event.

Definition at line 116 of file keyevent.h.

117  { return mType; }

References mType.

Field Documentation

◆ mActionId

InputActionT KeyEvent::mActionId
protected

Definition at line 153 of file keyevent.h.

Referenced by getActionId().

◆ mKey

Key KeyEvent::mKey
protected

Holds the key of the key event.

Definition at line 142 of file keyevent.h.

Referenced by getKey().

◆ mType

KeyEventTypeT KeyEvent::mType
protected

Holds the type of the key event.

Definition at line 151 of file keyevent.h.

Referenced by getType().


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