#include <Pt/Forms/KeyEvent.h>

Key press or release. More...

Inherits BasicEvent< T >.

Public Types

enum  Action
 Defines the key action.
 

Public Member Functions

 KeyEvent ()
 Creates a key-release event without a target.
 
 KeyEvent (Widget &widget)
 Creates a key-release event targeted at widget.
 
Pt::uint64_t widgetId () const
 Returns the target widget ID, or 0 when no target is set.
 
Widgetwidget () const
 Returns the target widget, or 0 when no target is set.
 
void setWidget (Widget *widget)
 Sets the target widget and its ID.
 
const Keykey () const
 Returns the key and modifiers.
 
const Pt::Charunicode () const
 Returns the optional Unicode text.
 
bool isPress () const
 Returns true when the event is a key press.
 
void setPress (const Key &key, const Pt::Char &ch)
 Changes the event to a press of key with text ch.
 
bool isRelease () const
 Returns true when the event is a key release.
 
void setRelease (const Key &key, const Pt::Char &ch)
 Changes the event to a release of key with text ch.
 
Eventclone (Allocator &allocator) const
 Clones this event using an allocator.
 
void destroy (Allocator &allocator)
 Destroys this event using an allocator.
 
const std::type_info & typeInfo () const
 Returns the type info for this class of events.
 

Static Public Member Functions

template<typename EventT >
static EventcopyConstruct (const EventT &ev, Allocator &allocator)
 Copies an event using an allocator.
 
template<typename EventT >
static void destruct (EventT &ev, Allocator &allocator)
 Destructs an event using an allocator.
 

Detailed Description

The event carries a Key, optional Unicode text, and the action. The widget pointer and widget ID identify the target.