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].

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:
<object class="GtkLabel">
<attributes>
<attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
<attribute name="background" value="red" start="5" end="10"/>
</attributes>
</object>
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), "<small>Small text</small>");
(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 <a> 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"
"<a href=\"http://www.gtk.org title=\"<i>Our</i> website\">"
"GTK website</a> 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.
-
Untyped pointer to the underlying
GtkLabelinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
label_ptrDefault implementationTyped pointer to the underlying
GtkLabelinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkLabelinstance.Declaration
Swift
var label_ptr: UnsafeMutablePointer<GtkLabel>! { get } -
Required Initialiser for types conforming to
LabelProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
LabelPropertyNamesource 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 : ObjectProtocolParameters
source_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 Value
binding reference or
nilin case of an error -
get(property:Extension method) Get the value of a Label property
Declaration
Swift
@inlinable func get(property: LabelPropertyName) -> GLibObject.ValueParameters
propertythe property to get the value for
Return Value
the value of the named property
-
set(property:Extension methodvalue: ) 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
propertythe property to get the value for
Return Value
the value of the named property
-
connect(signal:Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
LabelSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: LabelSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatahandlerThe 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(signal:Extension methodflags: data: destroyData: signalHandler: ) Connect a C signal handler to the given, typed
LabelSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: LabelSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatasignalHandlerThe C function to be called on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
onActivateCurrentLink(flags:Extension methodhandler: ) Gets emitted when the user activates a link in the label.
The
activate-current-linkis 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 underlyingactivate-current-linksignalDeclaration
Swift
@discardableResult @inlinable func onActivateCurrentLink(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
activateCurrentLinksignal is emitted -
activateCurrentLinkSignalExtension methodTyped
activate-current-linksignal for using theconnect(signal:)methodsDeclaration
Swift
static var activateCurrentLinkSignal: LabelSignalName { get } -
onActivateLink(flags:Extension methodhandler: ) 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 underlyingactivate-linksignalDeclaration
Swift
@discardableResult @inlinable func onActivateLink(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ uri: String) -> Bool) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
urithe URI that is activated
handlertrueif the link has been activated Run the given callback whenever theactivateLinksignal is emitted -
activateLinkSignalExtension methodTyped
activate-linksignal for using theconnect(signal:)methodsDeclaration
Swift
static var activateLinkSignal: LabelSignalName { get } -
onCopyClipboard(flags:Extension methodhandler: ) Gets emitted to copy the slection to the clipboard.
The
copy-clipboardsignal is a keybinding signal.The default binding for this signal is Ctrl-c.
Note
This represents the underlyingcopy-clipboardsignalDeclaration
Swift
@discardableResult @inlinable func onCopyClipboard(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
copyClipboardsignal is emitted -
copyClipboardSignalExtension methodTyped
copy-clipboardsignal for using theconnect(signal:)methodsDeclaration
Swift
static var copyClipboardSignal: LabelSignalName { get } -
onMoveCursor(flags:Extension methodhandler: ) Gets emitted when the user initiates a cursor movement.
The
move-cursorsignal is a keybinding signal. If the cursor is not visible inentry, 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 underlyingmove-cursorsignalDeclaration
Swift
@discardableResult @inlinable func onMoveCursor(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ step: MovementStep, _ count: Int, _ extendSelection: Bool) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
stepthe granularity of the move, as a
GtkMovementStepcountthe number of
stepunits to moveextendSelectiontrueif the move should extend the selectionhandlerThe signal handler to call Run the given callback whenever the
moveCursorsignal is emitted -
moveCursorSignalExtension methodTyped
move-cursorsignal for using theconnect(signal:)methodsDeclaration
Swift
static var moveCursorSignal: LabelSignalName { get } -
onNotifyAttributes(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::attributessignalDeclaration
Swift
@discardableResult @inlinable func onNotifyAttributes(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyAttributessignal is emitted -
notifyAttributesSignalExtension methodTyped
notify::attributessignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyAttributesSignal: LabelSignalName { get } -
onNotifyEllipsize(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::ellipsizesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyEllipsize(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyEllipsizesignal is emitted -
notifyEllipsizeSignalExtension methodTyped
notify::ellipsizesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyEllipsizeSignal: LabelSignalName { get } -
onNotifyExtraMenu(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::extra-menusignalDeclaration
Swift
@discardableResult @inlinable func onNotifyExtraMenu(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyExtraMenusignal is emitted -
notifyExtraMenuSignalExtension methodTyped
notify::extra-menusignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyExtraMenuSignal: LabelSignalName { get } -
onNotifyJustify(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::justifysignalDeclaration
Swift
@discardableResult @inlinable func onNotifyJustify(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyJustifysignal is emitted -
notifyJustifySignalExtension methodTyped
notify::justifysignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyJustifySignal: LabelSignalName { get } -
onNotifyLabel(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::labelsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyLabel(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyLabelsignal is emitted -
notifyLabelSignalExtension methodTyped
notify::labelsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyLabelSignal: LabelSignalName { get } -
onNotifyLines(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::linessignalDeclaration
Swift
@discardableResult @inlinable func onNotifyLines(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyLinessignal is emitted -
notifyLinesSignalExtension methodTyped
notify::linessignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyLinesSignal: LabelSignalName { get } -
onNotifyMaxWidthChars(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::max-width-charssignalDeclaration
Swift
@discardableResult @inlinable func onNotifyMaxWidthChars(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyMaxWidthCharssignal is emitted -
notifyMaxWidthCharsSignalExtension methodTyped
notify::max-width-charssignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyMaxWidthCharsSignal: LabelSignalName { get } -
onNotifyMnemonicKeyval(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::mnemonic-keyvalsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyMnemonicKeyval(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyMnemonicKeyvalsignal is emitted -
notifyMnemonicKeyvalSignalExtension methodTyped
notify::mnemonic-keyvalsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyMnemonicKeyvalSignal: LabelSignalName { get } -
onNotifyMnemonicWidget(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::mnemonic-widgetsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyMnemonicWidget(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyMnemonicWidgetsignal is emitted -
notifyMnemonicWidgetSignalExtension methodTyped
notify::mnemonic-widgetsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyMnemonicWidgetSignal: LabelSignalName { get } -
onNotifySelectable(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::selectablesignalDeclaration
Swift
@discardableResult @inlinable func onNotifySelectable(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifySelectablesignal is emitted -
notifySelectableSignalExtension methodTyped
notify::selectablesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifySelectableSignal: LabelSignalName { get } -
onNotifySingleLineMode(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::single-line-modesignalDeclaration
Swift
@discardableResult @inlinable func onNotifySingleLineMode(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifySingleLineModesignal is emitted -
notifySingleLineModeSignalExtension methodTyped
notify::single-line-modesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifySingleLineModeSignal: LabelSignalName { get } -
onNotifyUseMarkup(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::use-markupsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyUseMarkup(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyUseMarkupsignal is emitted -
notifyUseMarkupSignalExtension methodTyped
notify::use-markupsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyUseMarkupSignal: LabelSignalName { get } -
onNotifyUseUnderline(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::use-underlinesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyUseUnderline(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyUseUnderlinesignal is emitted -
notifyUseUnderlineSignalExtension methodTyped
notify::use-underlinesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyUseUnderlineSignal: LabelSignalName { get } -
onNotifyWidthChars(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::width-charssignalDeclaration
Swift
@discardableResult @inlinable func onNotifyWidthChars(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyWidthCharssignal is emitted -
notifyWidthCharsSignalExtension methodTyped
notify::width-charssignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyWidthCharsSignal: LabelSignalName { get } -
onNotifyWrap(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::wrapsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyWrap(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyWrapsignal is emitted -
notifyWrapSignalExtension methodTyped
notify::wrapsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyWrapSignal: LabelSignalName { get } -
onNotifyWrapMode(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::wrap-modesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyWrapMode(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyWrapModesignal is emitted -
notifyWrapModeSignalExtension methodTyped
notify::wrap-modesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyWrapModeSignal: LabelSignalName { get } -
onNotifyXalign(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::xalignsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyXalign(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyXalignsignal is emitted -
notifyXalignSignalExtension methodTyped
notify::xalignsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyXalignSignal: LabelSignalName { get } -
onNotifyYalign(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::yalignsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyYalign(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: LabelRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyYalignsignal is emitted -
notifyYalignSignalExtension methodTyped
notify::yalignsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyYalignSignal: LabelSignalName { get }
-
getAttributes()Extension methodGets the labels attribute list.
This is the [struct
Pango.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, usepango_layout_get_attribute (gtk_label_get_layout (self)).Declaration
Swift
@inlinable func getAttributes() -> Pango.AttrListRef! -
getCurrentUri()Extension methodReturns 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 [signal
Gtk.Label::activate-link] handler or for use in a [signalGtk.Widget::query-tooltip] handler.Declaration
Swift
@inlinable func getCurrentUri() -> String! -
getEllipsize()Extension methodReturns the ellipsizing position of the label.
See [method
Gtk.Label.set_ellipsize].Declaration
Swift
@inlinable func getEllipsize() -> PangoEllipsizeMode -
getExtraMenu()Extension methodGets the extra menu model of
label.See [method
Gtk.Label.set_extra_menu].Declaration
Swift
@inlinable func getExtraMenu() -> GIO.MenuModelRef! -
getJustify()Extension methodReturns the justification of the label.
See [method
Gtk.Label.set_justify].Declaration
Swift
@inlinable func getJustify() -> GtkJustification -
getLabel()Extension methodFetches the text from a label.
The returned text includes any embedded underlines indicating mnemonics and Pango markup. (See [method
Gtk.Label.get_text]).Declaration
Swift
@inlinable func getLabel() -> String! -
getLayout()Extension methodGets the
PangoLayoutused to display the label.The layout is useful to e.g. convert text positions to pixel positions, in combination with [method
Gtk.Label.get_layout_offsets]. The returned layout is owned by thelabelso need not be freed by the caller. Thelabelis free to recreate its layout at any time, so it should be considered read-only.Declaration
Swift
@inlinable func getLayout() -> Pango.LayoutRef! -
getLayoutOffsets(x:Extension methody: ) Obtains the coordinates where the label will draw its
PangoLayout.The coordinates are useful to convert mouse events into coordinates inside the [class
Pango.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 usingPANGO_PIXELS()or [constPango.SCALE].Declaration
Swift
@inlinable func getLayoutOffsets(x: UnsafeMutablePointer<gint>! = nil, y: UnsafeMutablePointer<gint>! = nil) -
getLines()Extension methodGets the number of lines to which an ellipsized, wrapping label should be limited.
See [method
Gtk.Label.set_lines].Declaration
Swift
@inlinable func getLines() -> Int -
getMaxWidthChars()Extension methodRetrieves the desired maximum width of
label, in characters.See [method
Gtk.Label.set_width_chars].Declaration
Swift
@inlinable func getMaxWidthChars() -> Int -
getMnemonicKeyval()Extension methodReturn 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 methodRetrieves the target of the mnemonic (keyboard shortcut) of this label.
See [method
Gtk.Label.set_mnemonic_widget].Declaration
Swift
@inlinable func getMnemonicWidget() -> WidgetRef! -
getSelectable()Extension methodReturns whether the label is selectable.
Declaration
Swift
@inlinable func getSelectable() -> Bool -
getSelectionBounds(start:Extension methodend: ) Gets the selected range of characters in the label.
Declaration
Swift
@inlinable func getSelectionBounds(start: UnsafeMutablePointer<gint>!, end: UnsafeMutablePointer<gint>!) -> Bool -
getSingleLineMode()Extension methodReturns whether the label is in single line mode.
Declaration
Swift
@inlinable func getSingleLineMode() -> Bool -
getText()Extension methodFetches 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 [method
Gtk.Label.get_label])Declaration
Swift
@inlinable func getText() -> String! -
getUseMarkup()Extension methodReturns whether the label’s text is interpreted as Pango markup.
See [method
Gtk.Label.set_use_markup].Declaration
Swift
@inlinable func getUseMarkup() -> Bool -
getUseUnderline()Extension methodReturns whether an embedded underlines in the label indicate mnemonics.
See [method
Gtk.Label.set_use_underline].Declaration
Swift
@inlinable func getUseUnderline() -> Bool -
getWidthChars()Extension methodRetrieves the desired width of
label, in characters.See [method
Gtk.Label.set_width_chars].Declaration
Swift
@inlinable func getWidthChars() -> Int -
getWrap()Extension methodReturns whether lines in the label are automatically wrapped.
See [method
Gtk.Label.set_wrap].Declaration
Swift
@inlinable func getWrap() -> Bool -
getWrapMode()Extension methodReturns line wrap mode used by the label.
See [method
Gtk.Label.set_wrap_mode].Declaration
Swift
@inlinable func getWrapMode() -> PangoWrapMode -
getXalign()Extension methodGets the
xalignof the label.See the [property
Gtk.Label:xalign] property.Declaration
Swift
@inlinable func getXalign() -> CFloat -
getYalign()Extension methodGets the
yalignof the label.See the [property
Gtk.Label:yalign] property.Declaration
Swift
@inlinable func getYalign() -> CFloat -
selectRegion(startOffset:Extension methodendOffset: ) Selects a range of characters in the label, if the label is selectable.
See [method
Gtk.Label.set_selectable]. If the label is not selectable, this function has no effect. Ifstart_offsetorend_offsetare -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 [property
Gtk.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 [property
Gtk.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_LEFTis 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 [property
Gtk.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 [func
Pango.parse_markup]).If the
stris external data, you may need to escape it withg_markup_escape_text()org_markup_printf_escaped():GtkWidget *self = gtk_label_new (NULL); const char *str = "..."; const char *format = "<span style=\"italic\">\`s`</span>"; 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 [property
Gtk.Label:use-markup] property totrueas a side effect.If you set the label contents using the [property
Gtk.Label:label] property you should also ensure that you set the [propertyGtk.Label:use-markup] property accordingly.See also: [method
Gtk.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
strwhich 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 instrare 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 [method
Gtk.Label.set_mnemonic_widget].Declaration
Swift
@inlinable func setMarkupWithMnemonic(str: UnsafePointer<CChar>!) -
setMaxWidthChars(nChars:Extension method) Sets the desired maximum width in characters of
labelton_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. [method
Gtk.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 [signal
GtkWidget::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. [method
Gtk.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 [signal
GtkWidget::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
GtkLabelwidget.It overwrites any text that was there before.
This function will clear any previously set mnemonic accelerators, and set the [property
Gtk.Label:use-underlineproperty] tofalseas a side effect.This function will set the [property
Gtk.Label:use-markup] property tofalseas a side effect.See also: [method
Gtk.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
strare 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 [method
Gtk.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
labelton_chars.Declaration
Swift
@inlinable func setWidthChars(nChars: Int) -
set(wrap:Extension method) Toggles line wrapping within the
GtkLabelwidget.truemakes it break lines if text exceeds the widget’s size.falselets the text get cut off by the edge of the widget if it exceeds the widget size.Note that setting line wrapping to
truedoes 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 [method
Gtk.Label.set_wrap]) The default isPANGO_WRAP_WORDwhich means wrap on word boundaries.Declaration
Swift
@inlinable func set(wrapMode: PangoWrapMode) -
set(xalign:Extension method) Sets the
xalignof the label.See the [property
Gtk.Label:xalign] property.Declaration
Swift
@inlinable func set(xalign: CFloat) -
set(yalign:Extension method) Sets the
yalignof the label.See the [property
Gtk.Label:yalign] property.Declaration
Swift
@inlinable func set(yalign: CFloat) -
attributesExtension methodA list of style attributes to apply to the text of the label.
Declaration
Swift
@inlinable var attributes: Pango.AttrListRef! { get nonmutating set } -
currentUriExtension methodReturns 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 [signal
Gtk.Label::activate-link] handler or for use in a [signalGtk.Widget::query-tooltip] handler.Declaration
Swift
@inlinable var currentUri: String! { get } -
ellipsizeExtension methodThe 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_NONEhas 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 totrue. 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 } -
extraMenuExtension methodGets the extra menu model of
label.See [method
Gtk.Label.set_extra_menu].Declaration
Swift
@inlinable var extraMenu: GIO.MenuModelRef! { get nonmutating set } -
justifyExtension methodThe 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 [property
Gtk.Label:xalign] for that.Declaration
Swift
@inlinable var justify: GtkJustification { get nonmutating set } -
labelExtension methodThe contents of the label.
If the string contains Pango markup (see [func
Pango.parse_markup]), you will have to set the [propertyGtk.Label:use-markup] property totruein 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 [property
Gtk.Label:use-underline] property totruein order for the label to display them.Declaration
Swift
@inlinable var label: String! { get nonmutating set } -
layoutExtension methodGets the
PangoLayoutused to display the label.The layout is useful to e.g. convert text positions to pixel positions, in combination with [method
Gtk.Label.get_layout_offsets]. The returned layout is owned by thelabelso need not be freed by the caller. Thelabelis free to recreate its layout at any time, so it should be considered read-only.Declaration
Swift
@inlinable var layout: Pango.LayoutRef! { get } -
linesExtension methodThe 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 } -
maxWidthCharsExtension methodRetrieves the desired maximum width of
label, in characters.See [method
Gtk.Label.set_width_chars].Declaration
Swift
@inlinable var maxWidthChars: Int { get nonmutating set } -
mnemonicKeyvalExtension methodReturn 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 } -
mnemonicWidgetExtension methodRetrieves the target of the mnemonic (keyboard shortcut) of this label.
See [method
Gtk.Label.set_mnemonic_widget].Declaration
Swift
@inlinable var mnemonicWidget: WidgetRef! { get nonmutating set } -
selectableExtension methodWhether the label text can be selected with the mouse.
Declaration
Swift
@inlinable var selectable: Bool { get nonmutating set } -
singleLineModeExtension methodReturns whether the label is in single line mode.
Declaration
Swift
@inlinable var singleLineMode: Bool { get nonmutating set } -
textExtension methodFetches 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 [method
Gtk.Label.get_label])Declaration
Swift
@inlinable var text: String! { get nonmutating set } -
useMarkupExtension methodReturns whether the label’s text is interpreted as Pango markup.
See [method
Gtk.Label.set_use_markup].Declaration
Swift
@inlinable var useMarkup: Bool { get nonmutating set } -
useUnderlineExtension methodReturns whether an embedded underlines in the label indicate mnemonics.
See [method
Gtk.Label.set_use_underline].Declaration
Swift
@inlinable var useUnderline: Bool { get nonmutating set } -
widthCharsExtension methodRetrieves the desired width of
label, in characters.See [method
Gtk.Label.set_width_chars].Declaration
Swift
@inlinable var widthChars: Int { get nonmutating set } -
wrapExtension methodtrueif the label text will wrap if it gets too wide.Declaration
Swift
@inlinable var wrap: Bool { get nonmutating set } -
wrapModeExtension methodReturns line wrap mode used by the label.
See [method
Gtk.Label.set_wrap_mode].Declaration
Swift
@inlinable var wrapMode: PangoWrapMode { get nonmutating set } -
xalignExtension methodThe horizontal alignment of the label text inside its size allocation.
Compare this to [property
Gtk.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 } -
yalignExtension methodThe vertical alignment of the label text inside its size allocation.
Compare this to [property
Gtk.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 }
View on GitHub
Install in Dash
LabelProtocol Protocol Reference