LabelProtocol

public protocol LabelProtocol : WidgetProtocol

The GtkLabel widget displays a small amount of text.

As the name implies, most labels are used to label another widget such as a [classButton].

An example GtkLabel

CSS nodes

label
├── [selection]
├── [link]

╰── [link]

GtkLabel has a single CSS node with the name label. A wide variety of style classes may be applied to labels, such as .title, .subtitle, .dim-label, etc. In the GtkShortcutsWindow, labels are used with the .keycap style class.

If the label has a selection, it gets a subnode with name selection.

If the label has links, there is one subnode per link. These subnodes carry the link or visited state depending on whether they have been visited. In this case, label node also gets a .link style class.

GtkLabel as GtkBuildable

The GtkLabel implementation of the GtkBuildable interface supports a custom <attributes> element, which supports any number of <attribute> elements. The <attribute> element has attributes named “name“, “value“, “start“ and “end“ and allows you to specify [structPango.Attribute] values for this label.

An example of a UI definition fragment specifying Pango attributes:

&lt;object class="GtkLabel"&gt;
  &lt;attributes&gt;
    &lt;attribute name="weight" value="PANGO_WEIGHT_BOLD"/&gt;
    &lt;attribute name="background" value="red" start="5" end="10"/&gt;
  &lt;/attributes&gt;
&lt;/object&gt;

The start and end attributes specify the range of characters to which the Pango attribute applies. If start and end are not specified, the attribute is applied to the whole text. Note that specifying ranges does not make much sense with translatable attributes. Use markup embedded in the translatable content instead.

Accessibility

GtkLabel uses the GTK_ACCESSIBLE_ROLE_LABEL role.

Mnemonics

Labels may contain “mnemonics”. Mnemonics are underlined characters in the label, used for keyboard navigation. Mnemonics are created by providing a string with an underscore before the mnemonic character, such as "_File", to the functions [ctorGtk.Label.new_with_mnemonic] or [methodGtk.Label.set_text_with_mnemonic].

Mnemonics automatically activate any activatable widget the label is inside, such as a [classGtk.Button]; if the label is not inside the mnemonic’s target widget, you have to tell the label about the target using [classGtk.Label.set_mnemonic_widget]. Here’s a simple example where the label is inside a button:

// Pressing Alt+H will activate this button
GtkWidget *button = gtk_button_new ();
GtkWidget *label = gtk_label_new_with_mnemonic ("_Hello");
gtk_button_set_child (GTK_BUTTON (button), label);

There’s a convenience function to create buttons with a mnemonic label already inside:

// Pressing Alt+H will activate this button
GtkWidget *button = gtk_button_new_with_mnemonic ("_Hello");

To create a mnemonic for a widget alongside the label, such as a [classGtk.Entry], you have to point the label at the entry with [methodGtk.Label.set_mnemonic_widget]:

// Pressing Alt+H will focus the entry
GtkWidget *entry = gtk_entry_new ();
GtkWidget *label = gtk_label_new_with_mnemonic ("_Hello");
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);

Markup (styled text)

To make it easy to format text in a label (changing colors, fonts, etc.), label text can be provided in a simple markup format:

Here’s how to create a label with a small font:

GtkWidget *label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), "&lt;small&gt;Small text&lt;/small&gt;");

(See the Pango manual for complete documentation] of available tags, [funcPango.parse_markup])

The markup passed to gtk_label_set_markup() must be valid; for example, literal <, > and & characters must be escaped as <, >, and &. If you pass text obtained from the user, file, or a network to [methodGtk.Label.set_markup], you’ll want to escape it with g_markup_escape_text() or g_markup_printf_escaped().

Markup strings are just a convenient way to set the [structPango.AttrList] on a label; [methodGtk.Label.set_attributes] may be a simpler way to set attributes in some cases. Be careful though; [structPango.AttrList] tends to cause internationalization problems, unless you’re applying attributes to the entire string (i.e. unless you set the range of each attribute to [0, G_MAXINT)). The reason is that specifying the start_index and end_index for a [structPango.Attribute] requires knowledge of the exact string being displayed, so translations will cause problems.

Selectable labels

Labels can be made selectable with [methodGtk.Label.set_selectable]. Selectable labels allow the user to copy the label contents to the clipboard. Only labels that contain useful-to-copy information — such as error messages — should be made selectable.

Text layout

A label can contain any number of paragraphs, but will have performance problems if it contains more than a small number. Paragraphs are separated by newlines or other paragraph separators understood by Pango.

Labels can automatically wrap text if you call [methodGtk.Label.set_wrap].

[methodGtk.Label.set_justify] sets how the lines in a label align with one another. If you want to set how the label as a whole aligns in its available space, see the [propertyGtk.Widget:halign] and [propertyGtk.Widget:valign] properties.

The [propertyGtk.Label:width-chars] and [propertyGtk.Label:max-width-chars] properties can be used to control the size allocation of ellipsized or wrapped labels. For ellipsizing labels, if either is specified (and less than the actual text size), it is used as the minimum width, and the actual text size is used as the natural width of the label. For wrapping labels, width-chars is used as the minimum width, if specified, and max-width-chars is used as the natural width. Even if max-width-chars specified, wrapping labels will be rewrapped to use all of the available width.

Links

GTK supports markup for clickable hyperlinks in addition to regular Pango markup. The markup for links is borrowed from HTML, using the &lt;a&gt; with “href“, “title“ and “class“ attributes. GTK renders links similar to the way they appear in web browsers, with colored, underlined text. The “title“ attribute is displayed as a tooltip on the link. The “class“ attribute is used as style class on the CSS node for the link.

An example looks like this:

const char *text =
"Go to the"
"&lt;a href=\"http://www.gtk.org title=\"&lt;i&gt;Our&lt;/i&gt; website\"&gt;"
"GTK website&lt;/a&gt; for more...";
GtkWidget *label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), text);

It is possible to implement custom handling for links and their tooltips with the [signalGtk.Label::activate-link] signal and the [methodGtk.Label.get_current_uri] function.

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

  • ptr

    Untyped pointer to the underlying GtkLabel instance.

    Declaration

    Swift

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

    Typed pointer to the underlying GtkLabel instance.

    Default Implementation

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

    Declaration

    Swift

    var label_ptr: UnsafeMutablePointer<GtkLabel>! { get }
  • Required Initialiser for types conforming to LabelProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

Label Class

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

    Declaration

    Swift

    @discardableResult
    @inlinable
    func bind<Q, T>(property source_property: LabelPropertyName, 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 Label property

    Declaration

    Swift

    @inlinable
    func get(property: LabelPropertyName) -> 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 Label property. Note that this will only have an effect on properties that are writable and not construct-only!

    Declaration

    Swift

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

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

Label signals

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

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: LabelSignalName, 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 LabelSignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: LabelSignalName, 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)

  • Gets emitted when the user activates a link in the label.

    The activate-current-link is a keybinding signal.

    Applications may also emit the signal with g_signal_emit_by_name() if they need to control activation of URIs programmatically.

    The default bindings for this signal are all forms of the Enter key.

    Note

    This represents the underlying activate-current-link signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onActivateCurrentLink(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    handler

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

  • activateCurrentLinkSignal Extension method

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

    Declaration

    Swift

    static var activateCurrentLinkSignal: LabelSignalName { get }
  • Gets emitted to activate a URI.

    Applications may connect to it to override the default behaviour, which is to call gtk_show_uri().

    Note

    This represents the underlying activate-link signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onActivateLink(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ uri: String) -> Bool) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    uri

    the URI that is activated

    handler

    true if the link has been activated Run the given callback whenever the activateLink signal is emitted

  • activateLinkSignal Extension method

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

    Declaration

    Swift

    static var activateLinkSignal: LabelSignalName { get }
  • Gets emitted to copy the slection to the clipboard.

    The copy-clipboard signal is a keybinding signal.

    The default binding for this signal is Ctrl-c.

    Note

    This represents the underlying copy-clipboard signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onCopyClipboard(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    handler

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

  • copyClipboardSignal Extension method

    Typed copy-clipboard signal for using the connect(signal:) methods

    Declaration

    Swift

    static var copyClipboardSignal: LabelSignalName { get }
  • onMoveCursor(flags:handler:) Extension method

    Gets emitted when the user initiates a cursor movement.

    The move-cursor signal is a keybinding signal. If the cursor is not visible in entry, this signal causes the viewport to be moved instead.

    Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the cursor programmatically.

    The default bindings for this signal come in two variants, the variant with the Shift modifier extends the selection, the variant without the Shift modifier does not. There are too many key combinations to list them all here.

    • Arrow keys move by individual characters/lines
    • Ctrl-arrow key combinations move by words/paragraphs
    • Home/End keys move to the ends of the buffer

    Note

    This represents the underlying move-cursor signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onMoveCursor(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ step: MovementStep, _ count: Int, _ extendSelection: Bool) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    step

    the granularity of the move, as a GtkMovementStep

    count

    the number of step units to move

    extendSelection

    true if the move should extend the selection

    handler

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

  • moveCursorSignal Extension method

    Typed move-cursor signal for using the connect(signal:) methods

    Declaration

    Swift

    static var moveCursorSignal: LabelSignalName { 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::attributes signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyAttributes(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ 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 notifyAttributes signal is emitted

  • notifyAttributesSignal Extension method

    Typed notify::attributes signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyAttributesSignal: LabelSignalName { 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::ellipsize signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyEllipsize(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ 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 notifyEllipsize signal is emitted

  • notifyEllipsizeSignal Extension method

    Typed notify::ellipsize signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyEllipsizeSignal: LabelSignalName { 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::extra-menu signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyExtraMenu(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ 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 notifyExtraMenu signal is emitted

  • notifyExtraMenuSignal Extension method

    Typed notify::extra-menu signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyExtraMenuSignal: LabelSignalName { 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::justify signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyJustify(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ 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 notifyJustify signal is emitted

  • notifyJustifySignal Extension method

    Typed notify::justify signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyJustifySignal: LabelSignalName { 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::label signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyLabel(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ 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 notifyLabel signal is emitted

  • notifyLabelSignal Extension method

    Typed notify::label signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyLabelSignal: LabelSignalName { 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::lines signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyLines(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ 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 notifyLines signal is emitted

  • notifyLinesSignal Extension method

    Typed notify::lines signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyLinesSignal: LabelSignalName { 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::max-width-chars signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyMaxWidthChars(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ 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 notifyMaxWidthChars signal is emitted

  • notifyMaxWidthCharsSignal Extension method

    Typed notify::max-width-chars signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyMaxWidthCharsSignal: LabelSignalName { 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::mnemonic-keyval signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyMnemonicKeyval(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ 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 notifyMnemonicKeyval signal is emitted

  • notifyMnemonicKeyvalSignal Extension method

    Typed notify::mnemonic-keyval signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyMnemonicKeyvalSignal: LabelSignalName { 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::mnemonic-widget signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyMnemonicWidget(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ 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 notifyMnemonicWidget signal is emitted

  • notifyMnemonicWidgetSignal Extension method

    Typed notify::mnemonic-widget signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyMnemonicWidgetSignal: LabelSignalName { 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::selectable signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifySelectable(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ 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 notifySelectable signal is emitted

  • notifySelectableSignal Extension method

    Typed notify::selectable signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifySelectableSignal: LabelSignalName { 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::single-line-mode signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifySingleLineMode(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ 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 notifySingleLineMode signal is emitted

  • notifySingleLineModeSignal Extension method

    Typed notify::single-line-mode signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifySingleLineModeSignal: LabelSignalName { 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::use-markup signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyUseMarkup(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ 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 notifyUseMarkup signal is emitted

  • notifyUseMarkupSignal Extension method

    Typed notify::use-markup signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyUseMarkupSignal: LabelSignalName { 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::use-underline signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyUseUnderline(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ 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 notifyUseUnderline signal is emitted

  • notifyUseUnderlineSignal Extension method

    Typed notify::use-underline signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyUseUnderlineSignal: LabelSignalName { 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::width-chars signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyWidthChars(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ 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 notifyWidthChars signal is emitted

  • notifyWidthCharsSignal Extension method

    Typed notify::width-chars signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyWidthCharsSignal: LabelSignalName { get }
  • onNotifyWrap(flags:handler:) Extension method

    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::wrap signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyWrap(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ 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 notifyWrap signal is emitted

  • notifyWrapSignal Extension method

    Typed notify::wrap signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyWrapSignal: LabelSignalName { 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::wrap-mode signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyWrapMode(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ 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 notifyWrapMode signal is emitted

  • notifyWrapModeSignal Extension method

    Typed notify::wrap-mode signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyWrapModeSignal: LabelSignalName { 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::xalign signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyXalign(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ 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 notifyXalign signal is emitted

  • notifyXalignSignal Extension method

    Typed notify::xalign signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyXalignSignal: LabelSignalName { 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::yalign signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyYalign(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ 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 notifyYalign signal is emitted

  • notifyYalignSignal Extension method

    Typed notify::yalign signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyYalignSignal: LabelSignalName { get }

Label Class: LabelProtocol extension (methods and fields)

  • getAttributes() Extension method

    Gets the labels attribute list.

    This is the [structPango.AttrList] that was set on the label using [methodGtk.Label.set_attributes], if any. This function does not reflect attributes that come from the labels markup (see [methodGtk.Label.set_markup]). If you want to get the effective attributes for the label, use pango_layout_get_attribute (gtk_label_get_layout (self)).

    Declaration

    Swift

    @inlinable
    func getAttributes() -> Pango.AttrListRef!
  • getCurrentUri() Extension method

    Returns the URI for the currently active link in the label.

    The active link is the one under the mouse pointer or, in a selectable label, the link in which the text cursor is currently positioned.

    This function is intended for use in a [signalGtk.Label::activate-link] handler or for use in a [signalGtk.Widget::query-tooltip] handler.

    Declaration

    Swift

    @inlinable
    func getCurrentUri() -> String!
  • getEllipsize() Extension method

    Returns the ellipsizing position of the label.

    See [methodGtk.Label.set_ellipsize].

    Declaration

    Swift

    @inlinable
    func getEllipsize() -> PangoEllipsizeMode
  • getExtraMenu() Extension method

    Gets the extra menu model of label.

    See [methodGtk.Label.set_extra_menu].

    Declaration

    Swift

    @inlinable
    func getExtraMenu() -> GIO.MenuModelRef!
  • getJustify() Extension method

    Returns the justification of the label.

    See [methodGtk.Label.set_justify].

    Declaration

    Swift

    @inlinable
    func getJustify() -> GtkJustification
  • getLabel() Extension method

    Fetches the text from a label.

    The returned text includes any embedded underlines indicating mnemonics and Pango markup. (See [methodGtk.Label.get_text]).

    Declaration

    Swift

    @inlinable
    func getLabel() -> String!
  • getLayout() Extension method

    Gets the PangoLayout used to display the label.

    The layout is useful to e.g. convert text positions to pixel positions, in combination with [methodGtk.Label.get_layout_offsets]. The returned layout is owned by the label so need not be freed by the caller. The label is free to recreate its layout at any time, so it should be considered read-only.

    Declaration

    Swift

    @inlinable
    func getLayout() -> Pango.LayoutRef!
  • getLayoutOffsets(x:y:) Extension method

    Obtains the coordinates where the label will draw its PangoLayout.

    The coordinates are useful to convert mouse events into coordinates inside the [classPango.Layout], e.g. to take some action if some part of the label is clicked. Remember when using the [classPango.Layout] functions you need to convert to and from pixels using PANGO_PIXELS() or [constPango.SCALE].

    Declaration

    Swift

    @inlinable
    func getLayoutOffsets(x: UnsafeMutablePointer<gint>! = nil, y: UnsafeMutablePointer<gint>! = nil)
  • getLines() Extension method

    Gets the number of lines to which an ellipsized, wrapping label should be limited.

    See [methodGtk.Label.set_lines].

    Declaration

    Swift

    @inlinable
    func getLines() -> Int
  • getMaxWidthChars() Extension method

    Retrieves the desired maximum width of label, in characters.

    See [methodGtk.Label.set_width_chars].

    Declaration

    Swift

    @inlinable
    func getMaxWidthChars() -> Int
  • getMnemonicKeyval() Extension method

    Return the mnemonic accelerator.

    If the label has been set so that it has a mnemonic key this function returns the keyval used for the mnemonic accelerator. If there is no mnemonic set up it returns GDK_KEY_VoidSymbol.

    Declaration

    Swift

    @inlinable
    func getMnemonicKeyval() -> Int
  • getMnemonicWidget() Extension method

    Retrieves the target of the mnemonic (keyboard shortcut) of this label.

    See [methodGtk.Label.set_mnemonic_widget].

    Declaration

    Swift

    @inlinable
    func getMnemonicWidget() -> WidgetRef!
  • getSelectable() Extension method

    Returns whether the label is selectable.

    Declaration

    Swift

    @inlinable
    func getSelectable() -> Bool
  • Gets the selected range of characters in the label.

    Declaration

    Swift

    @inlinable
    func getSelectionBounds(start: UnsafeMutablePointer<gint>!, end: UnsafeMutablePointer<gint>!) -> Bool
  • getSingleLineMode() Extension method

    Returns whether the label is in single line mode.

    Declaration

    Swift

    @inlinable
    func getSingleLineMode() -> Bool
  • getText() Extension method

    Fetches the text from a label.

    The returned text is as it appears on screen. This does not include any embedded underlines indicating mnemonics or Pango markup. (See [methodGtk.Label.get_label])

    Declaration

    Swift

    @inlinable
    func getText() -> String!
  • getUseMarkup() Extension method

    Returns whether the label’s text is interpreted as Pango markup.

    See [methodGtk.Label.set_use_markup].

    Declaration

    Swift

    @inlinable
    func getUseMarkup() -> Bool
  • getUseUnderline() Extension method

    Returns whether an embedded underlines in the label indicate mnemonics.

    See [methodGtk.Label.set_use_underline].

    Declaration

    Swift

    @inlinable
    func getUseUnderline() -> Bool
  • getWidthChars() Extension method

    Retrieves the desired width of label, in characters.

    See [methodGtk.Label.set_width_chars].

    Declaration

    Swift

    @inlinable
    func getWidthChars() -> Int
  • getWrap() Extension method

    Returns whether lines in the label are automatically wrapped.

    See [methodGtk.Label.set_wrap].

    Declaration

    Swift

    @inlinable
    func getWrap() -> Bool
  • getWrapMode() Extension method

    Returns line wrap mode used by the label.

    See [methodGtk.Label.set_wrap_mode].

    Declaration

    Swift

    @inlinable
    func getWrapMode() -> PangoWrapMode
  • getXalign() Extension method

    Gets the xalign of the label.

    See the [propertyGtk.Label:xalign] property.

    Declaration

    Swift

    @inlinable
    func getXalign() -> CFloat
  • getYalign() Extension method

    Gets the yalign of the label.

    See the [propertyGtk.Label:yalign] property.

    Declaration

    Swift

    @inlinable
    func getYalign() -> CFloat
  • Selects a range of characters in the label, if the label is selectable.

    See [methodGtk.Label.set_selectable]. If the label is not selectable, this function has no effect. If start_offset or end_offset are -1, then the end of the label will be substituted.

    Declaration

    Swift

    @inlinable
    func selectRegion(startOffset: Int, endOffset: Int)
  • setAttributes(attrs:) Extension method

    Apply attributes to the label text.

    The attributes set with this function will be applied and merged with any other attributes previously effected by way of the [propertyGtk.Label:use-underline] or [propertyGtk.Label:use-markup] properties. While it is not recommended to mix markup strings with manually set attributes, if you must; know that the attributes will be applied to the label after the markup string is parsed.

    Declaration

    Swift

    @inlinable
    func setAttributes(attrs: Pango.AttrListRef? = nil)
  • setAttributes(attrs:) Extension method

    Apply attributes to the label text.

    The attributes set with this function will be applied and merged with any other attributes previously effected by way of the [propertyGtk.Label:use-underline] or [propertyGtk.Label:use-markup] properties. While it is not recommended to mix markup strings with manually set attributes, if you must; know that the attributes will be applied to the label after the markup string is parsed.

    Declaration

    Swift

    @inlinable
    func setAttributes<AttrListT>(attrs: AttrListT?) where AttrListT : AttrListProtocol
  • setEllipsize(mode:) Extension method

    Sets the mode used to ellipsizei the text.

    The text will be ellipsized if there is not enough space to render the entire string.

    Declaration

    Swift

    @inlinable
    func setEllipsize(mode: PangoEllipsizeMode)
  • setExtraMenu(model:) Extension method

    Sets a menu model to add when constructing the context menu for label.

    Declaration

    Swift

    @inlinable
    func setExtraMenu(model: GIO.MenuModelRef? = nil)
  • setExtraMenu(model:) Extension method

    Sets a menu model to add when constructing the context menu for label.

    Declaration

    Swift

    @inlinable
    func setExtraMenu<MenuModelT>(model: MenuModelT?) where MenuModelT : MenuModelProtocol
  • setJustify(jtype:) Extension method

    Sets the alignment of the lines in the text of the label relative to each other.

    GTK_JUSTIFY_LEFT is the default value when the widget is first created with [ctorGtk.Label.new]. If you instead want to set the alignment of the label as a whole, use [methodGtk.Widget.set_halign] instead. [methodGtk.Label.set_justify] has no effect on labels containing only a single line.

    Declaration

    Swift

    @inlinable
    func setJustify(jtype: GtkJustification)
  • setLabel(str:) Extension method

    Sets the text of the label.

    The label is interpreted as including embedded underlines and/or Pango markup depending on the values of the [propertyGtk.Label:use-underline] and [propertyGtk.Label:use-markup] properties.

    Declaration

    Swift

    @inlinable
    func setLabel(str: UnsafePointer<CChar>!)
  • set(lines:) Extension method

    Sets the number of lines to which an ellipsized, wrapping label should be limited.

    This has no effect if the label is not wrapping or ellipsized. Set this to -1 if you don’t want to limit the number of lines.

    Declaration

    Swift

    @inlinable
    func set(lines: Int)
  • setMarkup(str:) Extension method

    Sets the labels text and attributes from markup.

    The string must be marked up with Pango markup (see [funcPango.parse_markup]).

    If the str is external data, you may need to escape it with g_markup_escape_text() or g_markup_printf_escaped():

    GtkWidget *self = gtk_label_new (NULL);
    const char *str = "...";
    const char *format = "&lt;span style=\"italic\"&gt;\`s`&lt;/span&gt;";
    char *markup;
    
    markup = g_markup_printf_escaped (format, str);
    gtk_label_set_markup (GTK_LABEL (self), markup);
    g_free (markup);
    

    This function will set the [propertyGtk.Label:use-markup] property to true as a side effect.

    If you set the label contents using the [propertyGtk.Label:label] property you should also ensure that you set the [propertyGtk.Label:use-markup] property accordingly.

    See also: [methodGtk.Label.set_text]

    Declaration

    Swift

    @inlinable
    func setMarkup(str: UnsafePointer<CChar>!)
  • setMarkupWithMnemonic(str:) Extension method

    Sets the labels text, attributes and mnemonic from markup.

    Parses str which is marked up with Pango markup (see [funcPango.parse_markup]), setting the label’s text and attribute list based on the parse results. If characters in str are preceded by an underscore, they are underlined indicating that they represent a keyboard accelerator called a mnemonic.

    The mnemonic key can be used to activate another widget, chosen automatically, or explicitly using [methodGtk.Label.set_mnemonic_widget].

    Declaration

    Swift

    @inlinable
    func setMarkupWithMnemonic(str: UnsafePointer<CChar>!)
  • setMaxWidthChars(nChars:) Extension method

    Sets the desired maximum width in characters of label to n_chars.

    Declaration

    Swift

    @inlinable
    func setMaxWidthChars(nChars: Int)
  • setMnemonic(widget:) Extension method

    Associate the label with its mnemonic target.

    If the label has been set so that it has a mnemonic key (using i.e. [methodGtk.Label.set_markup_with_mnemonic], [methodGtk.Label.set_text_with_mnemonic], [ctorGtk.Label.new_with_mnemonic] or the [propertyGtk.Label:use_underline] property) the label can be associated with a widget that is the target of the mnemonic. When the label is inside a widget (like a [classGtk.Button] or a [classGtk.Notebook] tab) it is automatically associated with the correct widget, but sometimes (i.e. when the target is a [classGtk.Entry] next to the label) you need to set it explicitly using this function.

    The target widget will be accelerated by emitting the [signalGtkWidget::mnemonic-activate] signal on it. The default handler for this signal will activate the widget if there are no mnemonic collisions and toggle focus between the colliding widgets otherwise.

    Declaration

    Swift

    @inlinable
    func setMnemonic(widget: WidgetRef? = nil)
  • setMnemonic(widget:) Extension method

    Associate the label with its mnemonic target.

    If the label has been set so that it has a mnemonic key (using i.e. [methodGtk.Label.set_markup_with_mnemonic], [methodGtk.Label.set_text_with_mnemonic], [ctorGtk.Label.new_with_mnemonic] or the [propertyGtk.Label:use_underline] property) the label can be associated with a widget that is the target of the mnemonic. When the label is inside a widget (like a [classGtk.Button] or a [classGtk.Notebook] tab) it is automatically associated with the correct widget, but sometimes (i.e. when the target is a [classGtk.Entry] next to the label) you need to set it explicitly using this function.

    The target widget will be accelerated by emitting the [signalGtkWidget::mnemonic-activate] signal on it. The default handler for this signal will activate the widget if there are no mnemonic collisions and toggle focus between the colliding widgets otherwise.

    Declaration

    Swift

    @inlinable
    func setMnemonic<WidgetT>(widget: WidgetT?) where WidgetT : WidgetProtocol
  • setSelectable(setting:) Extension method

    Makes text in the label selectable.

    Selectable labels allow the user to select text from the label, for copy-and-paste.

    Declaration

    Swift

    @inlinable
    func setSelectable(setting: Bool)
  • set(singleLineMode:) Extension method

    Sets whether the label is in single line mode.

    Declaration

    Swift

    @inlinable
    func set(singleLineMode: Bool)
  • setText(str:) Extension method

    Sets the text within the GtkLabel widget.

    It overwrites any text that was there before.

    This function will clear any previously set mnemonic accelerators, and set the [propertyGtk.Label:use-underline property] to false as a side effect.

    This function will set the [propertyGtk.Label:use-markup] property to false as a side effect.

    See also: [methodGtk.Label.set_markup]

    Declaration

    Swift

    @inlinable
    func setText(str: UnsafePointer<CChar>!)
  • setTextWithMnemonic(str:) Extension method

    Sets the label’s text from the string str.

    If characters in str are preceded by an underscore, they are underlined indicating that they represent a keyboard accelerator called a mnemonic. The mnemonic key can be used to activate another widget, chosen automatically, or explicitly using [methodGtk.Label.set_mnemonic_widget].

    Declaration

    Swift

    @inlinable
    func setTextWithMnemonic(str: UnsafePointer<CChar>!)
  • setUseMarkup(setting:) Extension method

    Sets whether the text of the label contains markup.

    See [methodGtk.Label.set_markup].

    Declaration

    Swift

    @inlinable
    func setUseMarkup(setting: Bool)
  • setUseUnderline(setting:) Extension method

    Sets whether underlines in the text indicate mnemonics.

    Declaration

    Swift

    @inlinable
    func setUseUnderline(setting: Bool)
  • setWidthChars(nChars:) Extension method

    Sets the desired width in characters of label to n_chars.

    Declaration

    Swift

    @inlinable
    func setWidthChars(nChars: Int)
  • set(wrap:) Extension method

    Toggles line wrapping within the GtkLabel widget.

    true makes it break lines if text exceeds the widget’s size. false lets the text get cut off by the edge of the widget if it exceeds the widget size.

    Note that setting line wrapping to true does not make the label wrap at its parent container’s width, because GTK widgets conceptually can’t make their requisition depend on the parent container’s size. For a label that wraps at a specific position, set the label’s width using [methodGtk.Widget.set_size_request].

    Declaration

    Swift

    @inlinable
    func set(wrap: Bool)
  • set(wrapMode:) Extension method

    Controls how line wrapping is done.

    This only affects the label if line wrapping is on. (See [methodGtk.Label.set_wrap]) The default is PANGO_WRAP_WORD which means wrap on word boundaries.

    Declaration

    Swift

    @inlinable
    func set(wrapMode: PangoWrapMode)
  • set(xalign:) Extension method

    Sets the xalign of the label.

    See the [propertyGtk.Label:xalign] property.

    Declaration

    Swift

    @inlinable
    func set(xalign: CFloat)
  • set(yalign:) Extension method

    Sets the yalign of the label.

    See the [propertyGtk.Label:yalign] property.

    Declaration

    Swift

    @inlinable
    func set(yalign: CFloat)
  • attributes Extension method

    A list of style attributes to apply to the text of the label.

    Declaration

    Swift

    @inlinable
    var attributes: Pango.AttrListRef! { get nonmutating set }
  • currentUri Extension method

    Returns the URI for the currently active link in the label.

    The active link is the one under the mouse pointer or, in a selectable label, the link in which the text cursor is currently positioned.

    This function is intended for use in a [signalGtk.Label::activate-link] handler or for use in a [signalGtk.Widget::query-tooltip] handler.

    Declaration

    Swift

    @inlinable
    var currentUri: String! { get }
  • ellipsize Extension method

    The preferred place to ellipsize the string, if the label does not have enough room to display the entire string.

    Note that setting this property to a value other than PANGO_ELLIPSIZE_NONE has the side-effect that the label requests only enough space to display the ellipsis “…”. In particular, this means that ellipsizing labels do not work well in notebook tabs, unless the [propertyGtk.NotebookPage:tab-expand] child property is set to true. Other ways to set a label’s width are [methodGtk.Widget.set_size_request] and [methodGtk.Label.set_width_chars].

    Declaration

    Swift

    @inlinable
    var ellipsize: PangoEllipsizeMode { get nonmutating set }
  • extraMenu Extension method

    Gets the extra menu model of label.

    See [methodGtk.Label.set_extra_menu].

    Declaration

    Swift

    @inlinable
    var extraMenu: GIO.MenuModelRef! { get nonmutating set }
  • justify Extension method

    The alignment of the lines in the text of the label, relative to each other.

    This does not affect the alignment of the label within its allocation. See [propertyGtk.Label:xalign] for that.

    Declaration

    Swift

    @inlinable
    var justify: GtkJustification { get nonmutating set }
  • label Extension method

    The contents of the label.

    If the string contains Pango markup (see [funcPango.parse_markup]), you will have to set the [propertyGtk.Label:use-markup] property to true in order for the label to display the markup attributes. See also [methodGtk.Label.set_markup] for a convenience function that sets both this property and the [propertyGtk.Label:use-markup] property at the same time.

    If the string contains underlines acting as mnemonics, you will have to set the [propertyGtk.Label:use-underline] property to true in order for the label to display them.

    Declaration

    Swift

    @inlinable
    var label: String! { get nonmutating set }
  • layout Extension method

    Gets the PangoLayout used to display the label.

    The layout is useful to e.g. convert text positions to pixel positions, in combination with [methodGtk.Label.get_layout_offsets]. The returned layout is owned by the label so need not be freed by the caller. The label is free to recreate its layout at any time, so it should be considered read-only.

    Declaration

    Swift

    @inlinable
    var layout: Pango.LayoutRef! { get }
  • lines Extension method

    The number of lines to which an ellipsized, wrapping label should be limited.

    This property has no effect if the label is not wrapping or ellipsized. Set this property to -1 if you don’t want to limit the number of lines.

    Declaration

    Swift

    @inlinable
    var lines: Int { get nonmutating set }
  • maxWidthChars Extension method

    Retrieves the desired maximum width of label, in characters.

    See [methodGtk.Label.set_width_chars].

    Declaration

    Swift

    @inlinable
    var maxWidthChars: Int { get nonmutating set }
  • mnemonicKeyval Extension method

    Return the mnemonic accelerator.

    If the label has been set so that it has a mnemonic key this function returns the keyval used for the mnemonic accelerator. If there is no mnemonic set up it returns GDK_KEY_VoidSymbol.

    Declaration

    Swift

    @inlinable
    var mnemonicKeyval: Int { get }
  • mnemonicWidget Extension method

    Retrieves the target of the mnemonic (keyboard shortcut) of this label.

    See [methodGtk.Label.set_mnemonic_widget].

    Declaration

    Swift

    @inlinable
    var mnemonicWidget: WidgetRef! { get nonmutating set }
  • selectable Extension method

    Whether the label text can be selected with the mouse.

    Declaration

    Swift

    @inlinable
    var selectable: Bool { get nonmutating set }
  • singleLineMode Extension method

    Returns whether the label is in single line mode.

    Declaration

    Swift

    @inlinable
    var singleLineMode: Bool { get nonmutating set }
  • text Extension method

    Fetches the text from a label.

    The returned text is as it appears on screen. This does not include any embedded underlines indicating mnemonics or Pango markup. (See [methodGtk.Label.get_label])

    Declaration

    Swift

    @inlinable
    var text: String! { get nonmutating set }
  • useMarkup Extension method

    Returns whether the label’s text is interpreted as Pango markup.

    See [methodGtk.Label.set_use_markup].

    Declaration

    Swift

    @inlinable
    var useMarkup: Bool { get nonmutating set }
  • useUnderline Extension method

    Returns whether an embedded underlines in the label indicate mnemonics.

    See [methodGtk.Label.set_use_underline].

    Declaration

    Swift

    @inlinable
    var useUnderline: Bool { get nonmutating set }
  • widthChars Extension method

    Retrieves the desired width of label, in characters.

    See [methodGtk.Label.set_width_chars].

    Declaration

    Swift

    @inlinable
    var widthChars: Int { get nonmutating set }
  • wrap Extension method

    true if the label text will wrap if it gets too wide.

    Declaration

    Swift

    @inlinable
    var wrap: Bool { get nonmutating set }
  • wrapMode Extension method

    Returns line wrap mode used by the label.

    See [methodGtk.Label.set_wrap_mode].

    Declaration

    Swift

    @inlinable
    var wrapMode: PangoWrapMode { get nonmutating set }
  • xalign Extension method

    The horizontal alignment of the label text inside its size allocation.

    Compare this to [propertyGtk.Widget:halign], which determines how the labels size allocation is positioned in the space available for the label.

    Declaration

    Swift

    @inlinable
    var xalign: CFloat { get nonmutating set }
  • yalign Extension method

    The vertical alignment of the label text inside its size allocation.

    Compare this to [propertyGtk.Widget:valign], which determines how the labels size allocation is positioned in the space available for the label.

    Declaration

    Swift

    @inlinable
    var yalign: CFloat { get nonmutating set }