AccelGroupProtocol

public protocol AccelGroupProtocol : ObjectProtocol

A GtkAccelGroup represents a group of keyboard accelerators, typically attached to a toplevel GtkWindow (with gtk_window_add_accel_group()). Usually you won’t need to create a GtkAccelGroup directly; instead, when using GtkUIManager, GTK+ automatically sets up the accelerators for your menus in the ui manager’s GtkAccelGroup.

Note that “accelerators” are different from “mnemonics”. Accelerators are shortcuts for activating a menu item; they appear alongside the menu item they’re a shortcut for. For example “Ctrl+Q” might appear alongside the “Quit” menu item. Mnemonics are shortcuts for GUI elements such as text entries or buttons; they appear as underlined characters. See gtk_label_new_with_mnemonic(). Menu items can have both accelerators and mnemonics, of course.

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

  • ptr

    Untyped pointer to the underlying GtkAccelGroup instance.

    Declaration

    Swift

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

    Typed pointer to the underlying GtkAccelGroup instance.

    Default Implementation

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

    Declaration

    Swift

    var accel_group_ptr: UnsafeMutablePointer<GtkAccelGroup>! { get }
  • Required Initialiser for types conforming to AccelGroupProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

AccelGroup Class

  • Bind a AccelGroupPropertyName source property to a given target object.

    Declaration

    Swift

    @discardableResult
    @inlinable
    func bind<Q, T>(property source_property: AccelGroupPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocol

    Parameters

    source_property

    the source property to bind

    target

    the target object to bind to

    target_property

    the target property to bind to

    flags

    the flags to pass to the Binding

    transform_from

    ValueTransformer to use for forward transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return Value

    binding reference or nil in case of an error

  • get(property:) Extension method

    Get the value of a AccelGroup property

    Declaration

    Swift

    @inlinable
    func get(property: AccelGroupPropertyName) -> GLibObject.Value

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

  • set(property:value:) Extension method

    Set the value of a AccelGroup property. Note that this will only have an effect on properties that are writable and not construct-only!

    Declaration

    Swift

    @inlinable
    func set(property: AccelGroupPropertyName, value v: GLibObject.Value)

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

AccelGroup signals

  • Connect a Swift signal handler to the given, typed AccelGroupSignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: AccelGroupSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> Int

    Parameters

    signal

    The signal to connect

    flags

    The connection flags to use

    data

    A pointer to user data to provide to the callback

    destroyData

    A GClosureNotify C function to destroy the data pointed to by userData

    handler

    The Swift signal handler (function or callback) to invoke on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • Connect a C signal handler to the given, typed AccelGroupSignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: AccelGroupSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> Int

    Parameters

    signal

    The signal to connect

    flags

    The connection flags to use

    data

    A pointer to user data to provide to the callback

    destroyData

    A GClosureNotify C function to destroy the data pointed to by userData

    signalHandler

    The C function to be called on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • The accel-activate signal is an implementation detail of GtkAccelGroup and not meant to be used by applications.

    Note

    This represents the underlying accel-activate signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onAccelActivate(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AccelGroupRef, _ acceleratable: GLibObject.ObjectRef, _ keyval: UInt, _ modifier: Gdk.ModifierType) -> Bool) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    acceleratable

    the object on which the accelerator was activated

    keyval

    the accelerator keyval

    modifier

    the modifier combination of the accelerator

    handler

    true if the accelerator was activated Run the given callback whenever the accelActivate signal is emitted

  • accelActivateSignal Extension method

    Typed accel-activate signal for using the connect(signal:) methods

    Declaration

    Swift

    static var accelActivateSignal: AccelGroupSignalName { get }
  • The accel-changed signal is emitted when an entry is added to or removed from the accel group.

    Widgets like GtkAccelLabel which display an associated accelerator should connect to this signal, and rebuild their visual representation if the accel_closure is theirs.

    Note

    This represents the underlying accel-changed signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onAccelChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AccelGroupRef, _ keyval: UInt, _ modifier: Gdk.ModifierType, _ accelClosure: GLibObject.ClosureRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    keyval

    the accelerator keyval

    modifier

    the modifier combination of the accelerator

    accelClosure

    the GClosure of the accelerator

    handler

    The signal handler to call Run the given callback whenever the accelChanged signal is emitted

  • accelChangedSignal Extension method

    Typed accel-changed signal for using the connect(signal:) methods

    Declaration

    Swift

    static var accelChangedSignal: AccelGroupSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::is-locked signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyIsLocked(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AccelGroupRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyIsLocked signal is emitted

  • notifyIsLockedSignal Extension method

    Typed notify::is-locked signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyIsLockedSignal: AccelGroupSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::modifier-mask signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyModifierMask(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AccelGroupRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyModifierMask signal is emitted

  • notifyModifierMaskSignal Extension method

    Typed notify::modifier-mask signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyModifierMaskSignal: AccelGroupSignalName { get }

AccelGroup Class: AccelGroupProtocol extension (methods and fields)

  • Finds the first accelerator in accel_group that matches accel_key and accel_mods, and activates it.

    Declaration

    Swift

    @inlinable
    func activate<ObjectT>(accelQuark: GQuark, acceleratable: ObjectT, accelKey: Int, accelMods: Gdk.ModifierType) -> Bool where ObjectT : ObjectProtocol
  • Installs an accelerator in this group. When accel_group is being activated in response to a call to gtk_accel_groups_activate(), closure will be invoked if the accel_key and accel_mods from gtk_accel_groups_activate() match those of this connection.

    The signature used for the closure is that of GtkAccelGroupActivate.

    Note that, due to implementation details, a single closure can only be connected to one accelerator group.

    Declaration

    Swift

    @inlinable
    func connect<ClosureT>(accelKey: Int, accelMods: Gdk.ModifierType, accelFlags: AccelFlags, closure: ClosureT) where ClosureT : ClosureProtocol
  • Installs an accelerator in this group, using an accelerator path to look up the appropriate key and modifiers (see gtk_accel_map_add_entry()). When accel_group is being activated in response to a call to gtk_accel_groups_activate(), closure will be invoked if the accel_key and accel_mods from gtk_accel_groups_activate() match the key and modifiers for the path.

    The signature used for the closure is that of GtkAccelGroupActivate.

    Note that accel_path string will be stored in a GQuark. Therefore, if you pass a static string, you can save some memory by interning it first with g_intern_static_string().

    Declaration

    Swift

    @inlinable
    func connectByPath<ClosureT>(accelPath: UnsafePointer<gchar>!, closure: ClosureT) where ClosureT : ClosureProtocol
  • disconnect(closure:) Extension method

    Removes an accelerator previously installed through gtk_accel_group_connect().

    Since 2.20 closure can be nil.

    Declaration

    Swift

    @inlinable
    func disconnect(closure: GLibObject.ClosureRef? = nil) -> Bool
  • disconnect(closure:) Extension method

    Removes an accelerator previously installed through gtk_accel_group_connect().

    Since 2.20 closure can be nil.

    Declaration

    Swift

    @inlinable
    func disconnect<ClosureT>(closure: ClosureT?) -> Bool where ClosureT : ClosureProtocol
  • Removes an accelerator previously installed through gtk_accel_group_connect().

    Declaration

    Swift

    @inlinable
    func disconnectKey(accelKey: Int, accelMods: Gdk.ModifierType) -> Bool
  • find(findFunc:data:) Extension method

    Finds the first entry in an accelerator group for which find_func returns true and returns its GtkAccelKey.

    Declaration

    Swift

    @inlinable
    func find(findFunc: GtkAccelGroupFindFunc?, data: gpointer! = nil) -> AccelKeyRef!
  • getIsLocked() Extension method

    Locks are added and removed using gtk_accel_group_lock() and gtk_accel_group_unlock().

    Declaration

    Swift

    @inlinable
    func getIsLocked() -> Bool
  • getModifierMask() Extension method

    Gets a GdkModifierType representing the mask for this accel_group. For example, GDK_CONTROL_MASK, GDK_SHIFT_MASK, etc.

    Declaration

    Swift

    @inlinable
    func getModifierMask() -> Gdk.ModifierType
  • lock() Extension method

    Locks the given accelerator group.

    Locking an acelerator group prevents the accelerators contained within it to be changed during runtime. Refer to gtk_accel_map_change_entry() about runtime accelerator changes.

    If called more than once, accel_group remains locked until gtk_accel_group_unlock() has been called an equivalent number of times.

    Declaration

    Swift

    @inlinable
    func lock()
  • Queries an accelerator group for all entries matching accel_key and accel_mods.

    Declaration

    Swift

    @inlinable
    func query(accelKey: Int, accelMods: Gdk.ModifierType, nEntries: UnsafeMutablePointer<guint>! = nil) -> UnsafeMutablePointer<GtkAccelGroupEntry>!
  • unlock() Extension method

    Undoes the last call to gtk_accel_group_lock() on this accel_group.

    Declaration

    Swift

    @inlinable
    func unlock()
  • isLocked Extension method

    Locks are added and removed using gtk_accel_group_lock() and gtk_accel_group_unlock().

    Declaration

    Swift

    @inlinable
    var isLocked: Bool { get }
  • modifierMask Extension method

    Gets a GdkModifierType representing the mask for this accel_group. For example, GDK_CONTROL_MASK, GDK_SHIFT_MASK, etc.

    Declaration

    Swift

    @inlinable
    var modifierMask: Gdk.ModifierType { get }
  • parent Extension method

    Undocumented

    Declaration

    Swift

    @inlinable
    var parent: GObject { get }