Class Efl.Input.Key
Represents a single key event from a keyboard or similar device.
Syntax
public class Key : Object, IEvent, IState, IWrapper, IDisposable
Constructors
Key(EoWrapper.ConstructingHandle)
Subclasses should override this constructor if they are expected to be instantiated from native code. Do not call this constructor directly.
Declaration
protected Key(EoWrapper.ConstructingHandle ch)
Parameters
Type | Name | Description |
---|---|---|
Efl.Eo.EoWrapper.ConstructingHandle | ch | Tag struct storing the native handle of the object being constructed. |
Key(Object)
Initializes a new instance of the Efl.Input.Key class.
Declaration
public Key(Object parent = null)
Parameters
Type | Name | Description |
---|---|---|
Efl.Object | parent | Parent instance. |
Key(IntPtr, Object)
Initializes a new instance of the Efl.Input.Key class. Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.
Declaration
protected Key(IntPtr baseKlass, Object parent)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | baseKlass | The pointer to the base native Eo class. |
Efl.Object | parent | The Efl.Object parent of this instance. |
Properties
ComposeString
A UTF8 string if this keystroke has modified a string in the middle of being composed. Note: This string replaces the previous one.
Declaration
public string ComposeString { get; set; }
Property Value
Type | Description |
---|---|
System.String | Composed string in UTF8. |
Device
Input device that originated this event.
Declaration
public Device Device { get; set; }
Property Value
Type | Description |
---|---|
Efl.Input.Device | Input device origin |
EventFlags
Extra flags for this event, may be changed by the user.
Declaration
public Flags EventFlags { get; set; }
Property Value
Type | Description |
---|---|
Efl.Input.Flags | Input event flags |
Fake
true
if the event was fake, not triggered by real hardware.
Declaration
public bool Fake { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
KeyCode
Keyboard scan code of the physical key that produced this event. You typically do not need to use this field, because the system maps scan codes to the more convenient Efl.Input.Key.KeyName. Us this in keyboard remapping applications or when trying to use a keyboard unknown to your operating system.
Declaration
public int KeyCode { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | Keyboard scan code. |
KeyName
Name string of the physical key that produced this event. This typically matches what is printed on the key. For example, "1" or "a". Note that both "a" and "A" are obtained with the same physical key, so both events will have the same Efl.Input.Key.KeyName "a" but different Efl.Input.Key.KeySym.
Commonly used in keyboard remapping menus to uniquely identify a physical key.
Declaration
public string KeyName { get; set; }
Property Value
Type | Description |
---|---|
System.String | Name of the key that produced this event. |
KeySym
Name of the symbol produced by this key event. For example, "a", "A", "1" or "exclam". The same physical key can produce different symbols when combined with other keys like "shift" or "alt gr". For example, "a" and "A" have different Efl.Input.Key.KeySym but the same Efl.Input.Key.KeyName "a".
This is the field you typically use to uniquely identify a keyboard symbol, in keyboard shortcuts for example.
Declaration
public string KeySym { get; set; }
Property Value
Type | Description |
---|---|
System.String | Symbol name produced by key event. |
Pressed
true
if the key is down, false
if it is released.
Declaration
public bool Pressed { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Processed
true
if Efl.Input.IEvent.EventFlags indicates the event is on hold.
Declaration
public bool Processed { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Scrolling
true
if Efl.Input.IEvent.EventFlags indicates the event happened while scrolling.
Declaration
public bool Scrolling { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
String
A UTF8 string if this keystroke has produced a visible string to be added.
Declaration
public string String { get; set; }
Property Value
Type | Description |
---|---|
System.String | Visible string produced by this key event, in UTF8. |
Timestamp
The time at which an event was generated. If the event is generated by a server (eg. X.org or Wayland), then the time may be set by the server. Usually this time will be based on the monotonic clock, if available, but this class can not guarantee it.
Declaration
public double Timestamp { get; set; }
Property Value
Type | Description |
---|---|
System.Double | Time in milliseconds when the event happened. |
Methods
GetComposeString()
A UTF8 string if this keystroke has modified a string in the middle of being composed. Note: This string replaces the previous one.
Declaration
public virtual string GetComposeString()
Returns
Type | Description |
---|---|
System.String | Composed string in UTF8. |
GetDevice()
Input device that originated this event.
Declaration
public virtual Device GetDevice()
Returns
Type | Description |
---|---|
Efl.Input.Device | Input device origin |
GetEventFlags()
Extra flags for this event, may be changed by the user.
Declaration
public virtual Flags GetEventFlags()
Returns
Type | Description |
---|---|
Efl.Input.Flags | Input event flags |
GetFake()
true
if the event was fake, not triggered by real hardware.
Declaration
public virtual bool GetFake()
Returns
Type | Description |
---|---|
System.Boolean |
|
GetKeyCode()
Keyboard scan code of the physical key that produced this event. You typically do not need to use this field, because the system maps scan codes to the more convenient Efl.Input.Key.KeyName. Us this in keyboard remapping applications or when trying to use a keyboard unknown to your operating system.
Declaration
public virtual int GetKeyCode()
Returns
Type | Description |
---|---|
System.Int32 | Keyboard scan code. |
GetKeyName()
Name string of the physical key that produced this event. This typically matches what is printed on the key. For example, "1" or "a". Note that both "a" and "A" are obtained with the same physical key, so both events will have the same Efl.Input.Key.KeyName "a" but different Efl.Input.Key.KeySym.
Commonly used in keyboard remapping menus to uniquely identify a physical key.
Declaration
public virtual string GetKeyName()
Returns
Type | Description |
---|---|
System.String | Name of the key that produced this event. |
GetKeySym()
Name of the symbol produced by this key event. For example, "a", "A", "1" or "exclam". The same physical key can produce different symbols when combined with other keys like "shift" or "alt gr". For example, "a" and "A" have different Efl.Input.Key.KeySym but the same Efl.Input.Key.KeyName "a".
This is the field you typically use to uniquely identify a keyboard symbol, in keyboard shortcuts for example.
Declaration
public virtual string GetKeySym()
Returns
Type | Description |
---|---|
System.String | Symbol name produced by key event. |
GetPressed()
true
if the key is down, false
if it is released.
Declaration
public virtual bool GetPressed()
Returns
Type | Description |
---|---|
System.Boolean |
|
GetProcessed()
true
if Efl.Input.IEvent.EventFlags indicates the event is on hold.
Declaration
public virtual bool GetProcessed()
Returns
Type | Description |
---|---|
System.Boolean |
|
GetScrolling()
true
if Efl.Input.IEvent.EventFlags indicates the event happened while scrolling.
Declaration
public virtual bool GetScrolling()
Returns
Type | Description |
---|---|
System.Boolean |
|
GetString()
A UTF8 string if this keystroke has produced a visible string to be added.
Declaration
public virtual string GetString()
Returns
Type | Description |
---|---|
System.String | Visible string produced by this key event, in UTF8. |
GetTimestamp()
The time at which an event was generated. If the event is generated by a server (eg. X.org or Wayland), then the time may be set by the server. Usually this time will be based on the monotonic clock, if available, but this class can not guarantee it.
Declaration
public virtual double GetTimestamp()
Returns
Type | Description |
---|---|
System.Double | Time in milliseconds when the event happened. |
Reset()
Resets the internal data to 0 or default values.
Declaration
public virtual void Reset()
SetComposeString(String)
A UTF8 string if this keystroke has modified a string in the middle of being composed. Note: This string replaces the previous one.
Declaration
public virtual void SetComposeString(string val)
Parameters
Type | Name | Description |
---|---|---|
System.String | val | Composed string in UTF8. |
SetDevice(Device)
Input device that originated this event.
Declaration
public virtual void SetDevice(Device dev)
Parameters
Type | Name | Description |
---|---|---|
Efl.Input.Device | dev | Input device origin |
SetEventFlags(Flags)
Extra flags for this event, may be changed by the user.
Declaration
public virtual void SetEventFlags(Flags flags)
Parameters
Type | Name | Description |
---|---|---|
Efl.Input.Flags | flags | Input event flags |
SetKeyCode(Int32)
Keyboard scan code of the physical key that produced this event. You typically do not need to use this field, because the system maps scan codes to the more convenient Efl.Input.Key.KeyName. Us this in keyboard remapping applications or when trying to use a keyboard unknown to your operating system.
Declaration
public virtual void SetKeyCode(int val)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | val | Keyboard scan code. |
SetKeyName(String)
Name string of the physical key that produced this event. This typically matches what is printed on the key. For example, "1" or "a". Note that both "a" and "A" are obtained with the same physical key, so both events will have the same Efl.Input.Key.KeyName "a" but different Efl.Input.Key.KeySym.
Commonly used in keyboard remapping menus to uniquely identify a physical key.
Declaration
public virtual void SetKeyName(string val)
Parameters
Type | Name | Description |
---|---|---|
System.String | val | Name of the key that produced this event. |
SetKeySym(String)
Name of the symbol produced by this key event. For example, "a", "A", "1" or "exclam". The same physical key can produce different symbols when combined with other keys like "shift" or "alt gr". For example, "a" and "A" have different Efl.Input.Key.KeySym but the same Efl.Input.Key.KeyName "a".
This is the field you typically use to uniquely identify a keyboard symbol, in keyboard shortcuts for example.
Declaration
public virtual void SetKeySym(string val)
Parameters
Type | Name | Description |
---|---|---|
System.String | val | Symbol name produced by key event. |
SetPressed(Boolean)
true
if the key is down, false
if it is released.
Declaration
public virtual void SetPressed(bool val)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | val |
|
SetProcessed(Boolean)
true
if Efl.Input.IEvent.EventFlags indicates the event is on hold.
Declaration
public virtual void SetProcessed(bool val)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | val |
|
SetScrolling(Boolean)
true
if Efl.Input.IEvent.EventFlags indicates the event happened while scrolling.
Declaration
public virtual void SetScrolling(bool val)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | val |
|
SetString(String)
A UTF8 string if this keystroke has produced a visible string to be added.
Declaration
public virtual void SetString(string val)
Parameters
Type | Name | Description |
---|---|---|
System.String | val | Visible string produced by this key event, in UTF8. |
SetTimestamp(Double)
Call this when generating events manually.
Declaration
public virtual void SetTimestamp(double ms)
Parameters
Type | Name | Description |
---|---|---|
System.Double | ms | Time in milliseconds when the event happened. |