KeyEventProtocol

public protocol KeyEventProtocol : EventProtocol

The KeyEventProtocol protocol exposes the methods and properties of an underlying GdkKeyEvent 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 KeyEvent. Alternatively, use KeyEventRef as a lighweight, unowned reference if you already have an instance you just want to use.

An event related to a key-based device.

  • ptr

    Untyped pointer to the underlying GdkKeyEvent instance.

    Declaration

    Swift

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

    Typed pointer to the underlying GdkKeyEvent instance.

    Default Implementation

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

    Declaration

    Swift

    var key_event_ptr: UnsafeMutablePointer<GdkKeyEvent>! { get }
  • Required Initialiser for types conforming to KeyEventProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

KeyEvent Class: KeyEventProtocol extension (methods and fields)

  • getConsumedModifiers() Extension method

    Extracts the consumed modifiers from a key event.

    Declaration

    Swift

    @inlinable
    func getConsumedModifiers() -> ModifierType
  • getKeycode() Extension method

    Extracts the keycode from a key event.

    Declaration

    Swift

    @inlinable
    func getKeycode() -> Int
  • getKeyval() Extension method

    Extracts the keyval from a key event.

    Declaration

    Swift

    @inlinable
    func getKeyval() -> Int
  • getLayout() Extension method

    Extracts the layout from a key event.

    Declaration

    Swift

    @inlinable
    func getLayout() -> Int
  • getLevel() Extension method

    Extracts the shift level from a key event.

    Declaration

    Swift

    @inlinable
    func getLevel() -> Int
  • getMatch(keyval:modifiers:) Extension method

    Gets a keyval and modifier combination that will match the event.

    See [methodGdk.KeyEvent.matches].

    Declaration

    Swift

    @inlinable
    func getMatch(keyval: UnsafeMutablePointer<guint>!, modifiers: UnsafeMutablePointer<GdkModifierType>!) -> Bool
  • matches(keyval:modifiers:) Extension method

    Matches a key event against a keyval and modifiers.

    This is typically used to trigger keyboard shortcuts such as Ctrl-C.

    Partial matches are possible where the combination matches if the currently active group is ignored.

    Note that we ignore Caps Lock for matching.

    Declaration

    Swift

    @inlinable
    func matches(keyval: Int, modifiers: ModifierType) -> GdkKeyMatch
  • consumedModifiers Extension method

    Extracts the consumed modifiers from a key event.

    Declaration

    Swift

    @inlinable
    var consumedModifiers: ModifierType { get }
  • isModifier Extension method

    Extracts whether the key event is for a modifier key.

    Declaration

    Swift

    @inlinable
    var isModifier: Bool { get }
  • keycode Extension method

    Extracts the keycode from a key event.

    Declaration

    Swift

    @inlinable
    var keycode: Int { get }
  • keyval Extension method

    Extracts the keyval from a key event.

    Declaration

    Swift

    @inlinable
    var keyval: Int { get }
  • layout Extension method

    Extracts the layout from a key event.

    Declaration

    Swift

    @inlinable
    var layout: Int { get }
  • level Extension method

    Extracts the shift level from a key event.

    Declaration

    Swift

    @inlinable
    var level: Int { get }