AccelLabelProtocol
public protocol AccelLabelProtocol : LabelProtocolThe GtkAccelLabel widget is a subclass of GtkLabel that also displays an
accelerator key on the right of the label text, e.g. “Ctrl+S”.
It is commonly used in menus to show the keyboard short-cuts for commands.
The accelerator key to display is typically not set explicitly (although it
can be, with gtk_accel_label_set_accel()). Instead, the GtkAccelLabel displays
the accelerators which have been added to a particular widget. This widget is
set by calling gtk_accel_label_set_accel_widget().
For example, a GtkMenuItem widget may have an accelerator added to emit
the “activate” signal when the “Ctrl+S” key combination is pressed.
A GtkAccelLabel is created and added to the GtkMenuItem, and
gtk_accel_label_set_accel_widget() is called with the GtkMenuItem as the
second argument. The GtkAccelLabel will now display “Ctrl+S” after its label.
Note that creating a GtkMenuItem with gtk_menu_item_new_with_label() (or
one of the similar functions for GtkCheckMenuItem and GtkRadioMenuItem)
automatically adds a GtkAccelLabel to the GtkMenuItem and calls
gtk_accel_label_set_accel_widget() to set it up for you.
A GtkAccelLabel will only display accelerators which have GTK_ACCEL_VISIBLE
set (see GtkAccelFlags).
A GtkAccelLabel can display multiple accelerators and even signal names,
though it is almost always used to display just one accelerator key.
Creating a simple menu item with an accelerator key.
(C Language Example):
  GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  GtkWidget *menu = gtk_menu_new ();
  GtkWidget *save_item;
  GtkAccelGroup *accel_group;
  // Create a GtkAccelGroup and add it to the window.
  accel_group = gtk_accel_group_new ();
  gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
  // Create the menu item using the convenience function.
  save_item = gtk_menu_item_new_with_label ("Save");
  gtk_widget_show (save_item);
  gtk_container_add (GTK_CONTAINER (menu), save_item);
  // Now add the accelerator to the GtkMenuItem. Note that since we
  // called gtk_menu_item_new_with_label() to create the GtkMenuItem
  // the GtkAccelLabel is automatically set up to display the
  // GtkMenuItem accelerators. We just need to make sure we use
  // GTK_ACCEL_VISIBLE here.
  gtk_widget_add_accelerator (save_item, "activate", accel_group,
                              GDK_KEY_s, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
CSS nodes
(plain Language Example):
label
╰── accelerator
Like GtkLabel, GtkAccelLabel has a main CSS node with the name label.
It adds a subnode with name accelerator.
The AccelLabelProtocol protocol exposes the methods and properties of an underlying GtkAccelLabel 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 AccelLabel.
Alternatively, use AccelLabelRef as a lighweight, unowned reference if you already have an instance you just want to use.
- 
                  
                  Untyped pointer to the underlying GtkAccelLabelinstance.DeclarationSwift var ptr: UnsafeMutableRawPointer! { get }
- 
                  accel_label_ptrDefault implementationTyped pointer to the underlying GtkAccelLabelinstance.Default ImplementationReturn the stored, untyped pointer as a typed pointer to the GtkAccelLabelinstance.DeclarationSwift var accel_label_ptr: UnsafeMutablePointer<GtkAccelLabel>! { get }
- 
                  
                  Required Initialiser for types conforming to AccelLabelProtocolDeclarationSwift init(raw: UnsafeMutableRawPointer)
- 
                  bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a AccelLabelPropertyNamesource property to a given target object.DeclarationSwift @discardableResult @inlinable func bind<Q, T>(property source_property: AccelLabelPropertyName, 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 : ObjectProtocolParameterssource_propertythe source property to bind targetthe target object to bind to target_propertythe target property to bind to flagsthe flags to pass to the Bindingtransform_fromValueTransformerto use for forward transformationtransform_toValueTransformerto use for backwards transformationReturn Valuebinding reference or nilin case of an error
- 
                  get(property:Extension method) Get the value of a AccelLabel property DeclarationSwift @inlinable func get(property: AccelLabelPropertyName) -> GLibObject.ValueParameterspropertythe property to get the value for Return Valuethe value of the named property 
- 
                  set(property:Extension methodvalue: ) Set the value of a AccelLabel property. Note that this will only have an effect on properties that are writable and not construct-only! DeclarationSwift @inlinable func set(property: AccelLabelPropertyName, value v: GLibObject.Value)Parameterspropertythe property to get the value for Return Valuethe value of the named property 
- 
                  getAccel(acceleratorKey:Extension methodacceleratorMods: ) Gets the keyval and modifier mask set with gtk_accel_label_set_accel().DeclarationSwift @inlinable func getAccel(acceleratorKey: UnsafeMutablePointer<guint>!, acceleratorMods: UnsafeMutablePointer<GdkModifierType>!)
- 
                  getAccelWidget()Extension methodFetches the widget monitored by this accelerator label. See gtk_accel_label_set_accel_widget().DeclarationSwift @inlinable func getAccelWidget() -> WidgetRef!
- 
                  getAccelWidth()Extension methodReturns the width needed to display the accelerator key(s). This is used by menus to align all of theGtkMenuItemwidgets, and shouldn’t be needed by applications.DeclarationSwift @inlinable func getAccelWidth() -> Int
- 
                  refetch()Extension methodRecreates the string representing the accelerator keys. This should not be needed since the string is automatically updated whenever accelerators are added or removed from the associated widget. DeclarationSwift @inlinable func refetch() -> Bool
- 
                  setAccel(acceleratorKey:Extension methodacceleratorMods: ) Manually sets a keyval and modifier mask as the accelerator rendered by accel_label.If a keyval and modifier are explicitly set then these values are used regardless of any associated accel closure or widget. Providing an accelerator_keyof 0 removes the manual setting.DeclarationSwift @inlinable func setAccel(acceleratorKey: Int, acceleratorMods: Gdk.ModifierType)
- 
                  set(accelClosure:Extension method) Sets the closure to be monitored by this accelerator label. The closure must be connected to an accelerator group; see gtk_accel_group_connect(). Passingnilforaccel_closurewill dissociateaccel_labelfrom its current closure, if any.DeclarationSwift @inlinable func set(accelClosure: GLibObject.ClosureRef? = nil)
- 
                  set(accelClosure:Extension method) Sets the closure to be monitored by this accelerator label. The closure must be connected to an accelerator group; see gtk_accel_group_connect(). Passingnilforaccel_closurewill dissociateaccel_labelfrom its current closure, if any.DeclarationSwift @inlinable func set<ClosureT>(accelClosure: ClosureT?) where ClosureT : ClosureProtocol
- 
                  set(accelWidget:Extension method) Sets the widget to be monitored by this accelerator label. Passing nilforaccel_widgetwill dissociateaccel_labelfrom its current widget, if any.DeclarationSwift @inlinable func set(accelWidget: WidgetRef? = nil)
- 
                  set(accelWidget:Extension method) Sets the widget to be monitored by this accelerator label. Passing nilforaccel_widgetwill dissociateaccel_labelfrom its current widget, if any.DeclarationSwift @inlinable func set<WidgetT>(accelWidget: WidgetT?) where WidgetT : WidgetProtocol
- 
                  accelWidgetExtension methodFetches the widget monitored by this accelerator label. See gtk_accel_label_set_accel_widget().DeclarationSwift @inlinable var accelWidget: WidgetRef! { get nonmutating set }
- 
                  accelWidthExtension methodReturns the width needed to display the accelerator key(s). This is used by menus to align all of theGtkMenuItemwidgets, and shouldn’t be needed by applications.DeclarationSwift @inlinable var accelWidth: Int { get }
- 
                  labelExtension methodUndocumented DeclarationSwift @inlinable var label: GtkLabel { get }
 View on GitHub
            View on GitHub
           Install in Dash
            Install in Dash
           AccelLabelProtocol Protocol Reference
      AccelLabelProtocol Protocol Reference