EventKeyProtocol

public protocol EventKeyProtocol

The EventKeyProtocol protocol exposes the methods and properties of an underlying GdkEventKey instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see EventKey. Alternatively, use EventKeyRef as a lighweight, unowned reference if you already have an instance you just want to use.

Describes a key press or key release event.

  • ptr

    Untyped pointer to the underlying GdkEventKey instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • _ptr Default implementation

    Typed pointer to the underlying GdkEventKey instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GdkEventKey instance.

    Declaration

    Swift

    var _ptr: UnsafeMutablePointer<GdkEventKey>! { get }
  • Required Initialiser for types conforming to EventKeyProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

EventKey Record: EventKeyProtocol extension (methods and fields)

  • type Extension method

    the type of the event (GDK_KEY_PRESS or GDK_KEY_RELEASE).

    Declaration

    Swift

    @inlinable
    var type: GdkEventType { get set }
  • window Extension method

    the window which received the event.

    Declaration

    Swift

    @inlinable
    var window: WindowRef! { get set }
  • sendEvent Extension method

    true if the event was sent explicitly.

    Declaration

    Swift

    @inlinable
    var sendEvent: gint8 { get set }
  • time Extension method

    the time of the event in milliseconds.

    Declaration

    Swift

    @inlinable
    var time: guint32 { get set }
  • state Extension method

    a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt) and the pointer buttons. See GdkModifierType.

    Declaration

    Swift

    @inlinable
    var state: ModifierType { get set }
  • keyval Extension method

    the key that was pressed or released. See the gdk/gdkkeysyms.h header file for a complete list of GDK key codes.

    Declaration

    Swift

    @inlinable
    var keyval: guint { get set }
  • length Extension method

    the length of string.

    Declaration

    Swift

    @inlinable
    var length: gint { get set }
  • string Extension method

    a string containing an approximation of the text that would result from this keypress. The only correct way to handle text input of text is using input methods (see GtkIMContext), so this field is deprecated and should never be used. (gdk_unicode_to_keyval() provides a non-deprecated way of getting an approximate translation for a key.) The string is encoded in the encoding of the current locale (Note: this for backwards compatibility: strings in GTK+ and GDK are typically in UTF-8.) and NUL-terminated. In some cases, the translation of the key code will be a single NUL byte, in which case looking at length is necessary to distinguish it from the an empty translation.

    Declaration

    Swift

    @inlinable
    var string: UnsafeMutablePointer<gchar>! { get set }
  • hardwareKeycode Extension method

    the raw code of the key that was pressed or released.

    Declaration

    Swift

    @inlinable
    var hardwareKeycode: guint16 { get set }
  • group Extension method

    the keyboard group.

    Declaration

    Swift

    @inlinable
    var group: guint8 { get set }
  • isModifier Extension method

    a flag that indicates if hardware_keycode is mapped to a modifier. Since 2.10

    Declaration

    Swift

    @inlinable
    var isModifier: guint { get set }