IMContextRef

public struct IMContextRef : IMContextProtocol, GWeakCapturing

GtkIMContext defines the interface for GTK input methods.

GtkIMContext is used by GTK text input widgets like GtkText to map from key events to Unicode character strings.

An input method may consume multiple key events in sequence before finally outputting the composed result. This is called preediting, and an input method may provide feedback about this process by displaying the intermediate composition states as preedit text. To do so, the GtkIMContext will emit [signalGtk.IMContext::preedit-start], [signalGtk.IMContext::preedit-changed] and [signalGtk.IMContext::preedit-end] signals.

For instance, the built-in GTK input method [classGtk.IMContextSimple] implements the input of arbitrary Unicode code points by holding down the <kbd>Control</kbd> and <kbd>Shift</kbd> keys and then typing <kbd>u</kbd> followed by the hexadecimal digits of the code point. When releasing the <kbd>Control</kbd> and <kbd>Shift</kbd> keys, preediting ends and the character is inserted as text. For example,

Ctrl+Shift+u 2 0 A C

results in the € sign.

Additional input methods can be made available for use by GTK widgets as loadable modules. An input method module is a small shared library which provides a GIOExtension for the extension point named “gtk-im-module”.

To connect a widget to the users preferred input method, you should use [classGtk.IMMulticontext].

The IMContextRef type acts as a lightweight Swift reference to an underlying GtkIMContext instance. It exposes methods that can operate on this data type through IMContextProtocol conformance. Use IMContextRef only as an unowned reference to an existing GtkIMContext instance.

  • ptr
    Untyped pointer to the underlying `GtkIMContext` instance.
    

    For type-safe access, use the generated, typed pointer im_context_ptr property instead.

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

IMContext Class

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafeMutablePointer<GtkIMContext>)
  • Designated initialiser from a constant pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafePointer<GtkIMContext>)
  • Conditional initialiser from an optional pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafeMutablePointer<GtkIMContext>?)
  • Conditional initialiser from an optional, non-mutable pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafePointer<GtkIMContext>?)
  • Conditional initialiser from an optional gpointer

    Declaration

    Swift

    @inlinable
    init!(gpointer g: gpointer?)
  • Conditional initialiser from an optional, non-mutable gconstpointer

    Declaration

    Swift

    @inlinable
    init!(gconstpointer g: gconstpointer?)
  • Reference intialiser for a related type that implements IMContextProtocol

    Declaration

    Swift

    @inlinable
    init<T>(_ other: T) where T : IMContextProtocol
  • This factory is syntactic sugar for setting weak pointers wrapped in GWeak<T>

    Declaration

    Swift

    @inlinable
    static func unowned<T>(_ other: T) -> IMContextRef where T : IMContextProtocol
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to IMContextProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(cPointer: UnsafeMutablePointer<T>)
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to IMContextProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(constPointer: UnsafePointer<T>)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to IMContextProtocol.

    Declaration

    Swift

    @inlinable
    init(mutating raw: UnsafeRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to IMContextProtocol.

    Declaration

    Swift

    @inlinable
    init(raw: UnsafeMutableRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to IMContextProtocol.

    Declaration

    Swift

    @inlinable
    init(opaquePointer: OpaquePointer)