1702 lines
95 KiB
Swift
1702 lines
95 KiB
Swift
// Generated by PorticoGen. DO NOT EDIT. See Sources/PorticoGen to make changes.
|
||
|
||
import Adw
|
||
import Gtk
|
||
import Gio
|
||
import Gdk
|
||
|
||
// PorticoGen: generateStruct | source: Gtk.Label
|
||
/// Displays a small amount of text.
|
||
///
|
||
/// Most labels are used to label another widget (such as an [class`Entry`]).
|
||
///
|
||
/// <picture>
|
||
/// <source srcset="label-dark.png" media="(prefers-color-scheme: dark)">
|
||
/// <img alt="An example GtkLabel" src="label.png">
|
||
/// </picture>
|
||
///
|
||
/// ## Shortcuts and Gestures
|
||
///
|
||
/// `GtkLabel` supports the following keyboard shortcuts, when the cursor is
|
||
/// visible:
|
||
///
|
||
/// - <kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Menu</kbd> opens the context menu.
|
||
/// - <kbd>Ctrl</kbd>+<kbd>A</kbd> or <kbd>Ctrl</kbd>+<kbd>/</kbd>
|
||
/// selects all.
|
||
/// - <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>A</kbd> or
|
||
/// <kbd>Ctrl</kbd>+<kbd>\</kbd> unselects all.
|
||
///
|
||
/// Additionally, the following signals have default keybindings:
|
||
///
|
||
/// - [signal`Gtk`.Label::activate-current-link]
|
||
/// - [signal`Gtk`.Label::copy-clipboard]
|
||
/// - [signal`Gtk`.Label::move-cursor]
|
||
///
|
||
/// ## Actions
|
||
///
|
||
/// `GtkLabel` defines a set of built-in actions:
|
||
///
|
||
/// - `clipboard.copy` copies the text to the clipboard.
|
||
/// - `clipboard.cut` doesn't do anything, since text in labels can't be deleted.
|
||
/// - `clipboard.paste` doesn't do anything, since text in labels can't be
|
||
/// edited.
|
||
/// - `link.open` opens the link, when activated on a link inside the label.
|
||
/// - `link.copy` copies the link to the clipboard, when activated on a link
|
||
/// inside the label.
|
||
/// - `menu.popup` opens the context menu.
|
||
/// - `selection.delete` doesn't do anything, since text in labels can't be
|
||
/// deleted.
|
||
/// - `selection.select-all` selects all of the text, if the label allows
|
||
/// selection.
|
||
///
|
||
/// ## 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 [struct`Pango`.Attribute]
|
||
/// values for this label.
|
||
///
|
||
/// An example of a UI definition fragment specifying Pango attributes:
|
||
///
|
||
/// ```xml
|
||
/// <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 [enum`Gtk`.AccessibleRole.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 [ctor`Gtk`.Label.new_with_mnemonic] or
|
||
/// [method`Gtk`.Label.set_text_with_mnemonic].
|
||
///
|
||
/// Mnemonics automatically activate any activatable widget the label is
|
||
/// inside, such as a [class`Gtk`.Button]; if the label is not inside the
|
||
/// mnemonic’s target widget, you have to tell the label about the target
|
||
/// using [method`Gtk`.Label.set_mnemonic_widget].
|
||
///
|
||
/// Here’s a simple example where the label is inside a button:
|
||
///
|
||
/// ```c
|
||
/// // 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:
|
||
///
|
||
/// ```c
|
||
/// // 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
|
||
/// [class`Gtk`.Entry], you have to point the label at the entry with
|
||
/// [method`Gtk`.Label.set_mnemonic_widget]:
|
||
///
|
||
/// ```c
|
||
/// // 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:
|
||
/// ```c
|
||
/// 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, [func`Pango`.parse_markup])
|
||
///
|
||
/// The markup passed to [method`Gtk`.Label.set_markup] must be valid XML; for example,
|
||
/// literal `<`, `>` and `&` characters must be escaped as `<`, `>`, and `&`.
|
||
/// If you pass text obtained from the user, file, or a network to
|
||
/// [method`Gtk`.Label.set_markup], you’ll want to escape it with
|
||
/// [func`GLib`.markup_escape_text] or [func`GLib`.markup_printf_escaped].
|
||
///
|
||
/// Markup strings are just a convenient way to set the [struct`Pango`.AttrList]
|
||
/// on a label; [method`Gtk`.Label.set_attributes] may be a simpler way to set
|
||
/// attributes in some cases. Be careful though; [struct`Pango`.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 [struct`Pango`.Attribute] requires knowledge of the exact
|
||
/// string being displayed, so translations will cause problems.
|
||
///
|
||
/// ## Selectable labels
|
||
///
|
||
/// Labels can be made selectable with [method`Gtk`.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 [method`Gtk`.Label.set_wrap].
|
||
///
|
||
/// [method`Gtk`.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 [property`Gtk`.Widget:halign] and
|
||
/// [property`Gtk`.Widget:valign] properties.
|
||
///
|
||
/// The [property`Gtk`.Label:width-chars] and [property`Gtk`.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>` tag
|
||
/// 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 of inline links looks like this:
|
||
///
|
||
/// ```c
|
||
/// const char *text =
|
||
/// "Go to the "
|
||
/// "<a href=\"https://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 [signal`Gtk`.Label::activate-link] signal and the
|
||
/// [method`Gtk`.Label.get_current_uri] function.
|
||
///
|
||
/// A Portico view that mounts a `Gtk.Label`.
|
||
@MainActor public struct Label: View {
|
||
private let make: (MountContext) -> Gtk.Label
|
||
private var configure: [(Gtk.Label, MountContext) -> Void] = []
|
||
|
||
public var body: Never { fatalError() }
|
||
|
||
// PorticoGen: generateInits(static) | source: Gtk.Label.init(str:)
|
||
/// Creates a new label with the given text inside it.
|
||
///
|
||
/// You can pass `NULL` to get an empty label widget.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for values that change.
|
||
/// Each closure is evaluated once; children are added in order and slot closures mount their first view.
|
||
/// An empty closure adds no children and leaves slots unset.
|
||
/// Optional value parameters are applied only when non-`nil`; a `nil` argument leaves the widget's own default in place and cannot clear a nullable property - use the matching modifier for that.
|
||
///
|
||
/// - Parameter str: The `str` value forwarded to `Gtk.Label`.
|
||
/// - Parameter attributes: A list of style attributes to apply to the text of the label.
|
||
/// - Parameter ellipsize: The preferred place to ellipsize the string, if the label does not have enough room to display the entire string.
|
||
/// - Parameter extraMenu: A menu model whose contents will be appended to the context menu.
|
||
/// - Parameter justify: The alignment of the lines in the text of the label, relative to each other.
|
||
/// - Parameter label: The contents of the label.
|
||
/// - Parameter lines: The number of lines to which an ellipsized, wrapping label should display before it gets ellipsized. This both prevents the label from ellipsizing before this many lines are displayed, and limits the height request of the label to this many lines.
|
||
/// - Parameter maxWidthChars: The desired maximum width of the label, in characters.
|
||
/// - Parameter naturalWrapMode: Select the line wrapping for the natural size request.
|
||
/// - Parameter selectable: Whether the label text can be selected with the mouse.
|
||
/// - Parameter singleLineMode: Whether the label is in single line mode.
|
||
/// - Parameter tabs: Custom tabs for this label.
|
||
/// - Parameter useMarkup: True if the text of the label includes Pango markup.
|
||
/// - Parameter useUnderline: True if the text of the label indicates a mnemonic with an `_` before the mnemonic character.
|
||
/// - Parameter widthChars: The desired width of the label, in characters.
|
||
/// - Parameter wrap: True if the label text will wrap if it gets too wide.
|
||
/// - Parameter wrapMode: Controls how the line wrapping is done.
|
||
/// - Parameter xalign: The horizontal alignment of the label text inside its size allocation.
|
||
/// - Parameter yalign: The vertical alignment of the label text inside its size allocation.
|
||
/// - Parameter mnemonicWidget: A `ViewBuilder` closure whose first view is mounted into the `mnemonicWidget` slot.
|
||
/// - Parameter onActivateCurrentLink: Invoked when the widget emits the `activate-current-link` signal.
|
||
/// - Parameter onActivateLink: Invoked when the widget emits the `activate-link` signal. The closure receives the signal's arguments in order. Its return value is forwarded to GTK as the signal's result.
|
||
/// - Parameter onCopyClipboard: Invoked when the widget emits the `copy-clipboard` signal.
|
||
/// - Parameter onMoveCursor: Invoked when the widget emits the `move-cursor` signal. The closure receives the signal's arguments in order.
|
||
public init(str: String?, attributes: Gtk.AttrList? = nil, ellipsize: Gtk.EllipsizeMode? = nil, extraMenu: Gtk.MenuModel? = nil, justify: Gtk.Justification? = nil, label: String? = nil, lines: Int32? = nil, maxWidthChars: Int32? = nil, naturalWrapMode: Gtk.NaturalWrapMode? = nil, selectable: Bool? = nil, singleLineMode: Bool? = nil, tabs: Gtk.TabArray? = nil, useMarkup: Bool? = nil, useUnderline: Bool? = nil, widthChars: Int32? = nil, wrap: Bool? = nil, wrapMode: Pango.WrapMode? = nil, xalign: Float? = nil, yalign: Float? = nil, @ViewBuilder mnemonicWidget: @escaping () -> [AnyView] = { [] }, onActivateCurrentLink: (() -> Void)? = nil, onActivateLink: ((String) -> Bool)? = nil, onCopyClipboard: (() -> Void)? = nil, onMoveCursor: ((Gtk.MovementStep, Int32, Bool) -> Void)? = nil) {
|
||
make = { _ in Gtk.Label(str: str) }
|
||
configure.append { w, ctx in
|
||
if let attributes { w.setAttributes(attrs: attributes) }
|
||
if let ellipsize { w.setEllipsize(mode: ellipsize) }
|
||
if let extraMenu { w.setExtraMenu(model: extraMenu) }
|
||
if let justify { w.setJustify(jtype: justify) }
|
||
if let label { w.setLabel(str: label) }
|
||
if let lines { w.setLines(lines: lines) }
|
||
if let maxWidthChars { w.setMaxWidthChars(nChars: maxWidthChars) }
|
||
if let naturalWrapMode { w.setNaturalWrapMode(wrapMode: naturalWrapMode) }
|
||
if let selectable { w.setSelectable(setting: selectable) }
|
||
if let singleLineMode { w.setSingleLineMode(singleLineMode: singleLineMode) }
|
||
if let tabs { w.setTabs(tabs: tabs) }
|
||
if let useMarkup { w.setUseMarkup(setting: useMarkup) }
|
||
if let useUnderline { w.setUseUnderline(setting: useUnderline) }
|
||
if let widthChars { w.setWidthChars(nChars: widthChars) }
|
||
if let wrap { w.setWrap(wrap: wrap) }
|
||
if let wrapMode { w.setWrapMode(wrapMode: wrapMode) }
|
||
if let xalign { w.setXalign(xalign: xalign) }
|
||
if let yalign { w.setYalign(yalign: yalign) }
|
||
if let v = Portico.mountSlotChild(mnemonicWidget, ctx, onUpdate: { v in w.setMnemonicWidget(widget: v) }) { w.setMnemonicWidget(widget: v) }
|
||
if let onActivateCurrentLink { ctx.registry.add(w.connectActivateCurrentLink { _ in onActivateCurrentLink() }) }
|
||
if let onActivateLink { ctx.registry.add(w.connectActivateLink { _, a0 in onActivateLink(a0) }) }
|
||
if let onCopyClipboard { ctx.registry.add(w.connectCopyClipboard { _ in onCopyClipboard() }) }
|
||
if let onMoveCursor { ctx.registry.add(w.connectMoveCursor { _, a0, a1, a2 in onMoveCursor(a0, a1, a2) }) }
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateInits(static) | source: Gtk.Label.init(withMnemonicStr:)
|
||
/// Creates a new label with the given text inside it, and a mnemonic.
|
||
///
|
||
/// If characters in `str` are preceded by an underscore, they are
|
||
/// underlined. If you need a literal underscore character in a label, use
|
||
/// '__' (two underscores). The first underlined character represents 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].
|
||
///
|
||
/// If [method`Gtk`.Label.set_mnemonic_widget] is not called, then the first
|
||
/// activatable ancestor of the label will be chosen as the mnemonic
|
||
/// widget. For instance, if the label is inside a button or menu item,
|
||
/// the button or menu item will automatically become the mnemonic widget
|
||
/// and be activated by the mnemonic.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for values that change.
|
||
/// Each closure is evaluated once; children are added in order and slot closures mount their first view.
|
||
/// An empty closure adds no children and leaves slots unset.
|
||
/// Optional value parameters are applied only when non-`nil`; a `nil` argument leaves the widget's own default in place and cannot clear a nullable property - use the matching modifier for that.
|
||
///
|
||
/// - Parameter withMnemonicStr: The `withMnemonicStr` value forwarded to `Gtk.Label`.
|
||
/// - Parameter attributes: A list of style attributes to apply to the text of the label.
|
||
/// - Parameter ellipsize: The preferred place to ellipsize the string, if the label does not have enough room to display the entire string.
|
||
/// - Parameter extraMenu: A menu model whose contents will be appended to the context menu.
|
||
/// - Parameter justify: The alignment of the lines in the text of the label, relative to each other.
|
||
/// - Parameter label: The contents of the label.
|
||
/// - Parameter lines: The number of lines to which an ellipsized, wrapping label should display before it gets ellipsized. This both prevents the label from ellipsizing before this many lines are displayed, and limits the height request of the label to this many lines.
|
||
/// - Parameter maxWidthChars: The desired maximum width of the label, in characters.
|
||
/// - Parameter naturalWrapMode: Select the line wrapping for the natural size request.
|
||
/// - Parameter selectable: Whether the label text can be selected with the mouse.
|
||
/// - Parameter singleLineMode: Whether the label is in single line mode.
|
||
/// - Parameter tabs: Custom tabs for this label.
|
||
/// - Parameter useMarkup: True if the text of the label includes Pango markup.
|
||
/// - Parameter useUnderline: True if the text of the label indicates a mnemonic with an `_` before the mnemonic character.
|
||
/// - Parameter widthChars: The desired width of the label, in characters.
|
||
/// - Parameter wrap: True if the label text will wrap if it gets too wide.
|
||
/// - Parameter wrapMode: Controls how the line wrapping is done.
|
||
/// - Parameter xalign: The horizontal alignment of the label text inside its size allocation.
|
||
/// - Parameter yalign: The vertical alignment of the label text inside its size allocation.
|
||
/// - Parameter mnemonicWidget: A `ViewBuilder` closure whose first view is mounted into the `mnemonicWidget` slot.
|
||
/// - Parameter onActivateCurrentLink: Invoked when the widget emits the `activate-current-link` signal.
|
||
/// - Parameter onActivateLink: Invoked when the widget emits the `activate-link` signal. The closure receives the signal's arguments in order. Its return value is forwarded to GTK as the signal's result.
|
||
/// - Parameter onCopyClipboard: Invoked when the widget emits the `copy-clipboard` signal.
|
||
/// - Parameter onMoveCursor: Invoked when the widget emits the `move-cursor` signal. The closure receives the signal's arguments in order.
|
||
public init(withMnemonicStr: String?, attributes: Gtk.AttrList? = nil, ellipsize: Gtk.EllipsizeMode? = nil, extraMenu: Gtk.MenuModel? = nil, justify: Gtk.Justification? = nil, label: String? = nil, lines: Int32? = nil, maxWidthChars: Int32? = nil, naturalWrapMode: Gtk.NaturalWrapMode? = nil, selectable: Bool? = nil, singleLineMode: Bool? = nil, tabs: Gtk.TabArray? = nil, useMarkup: Bool? = nil, useUnderline: Bool? = nil, widthChars: Int32? = nil, wrap: Bool? = nil, wrapMode: Pango.WrapMode? = nil, xalign: Float? = nil, yalign: Float? = nil, @ViewBuilder mnemonicWidget: @escaping () -> [AnyView] = { [] }, onActivateCurrentLink: (() -> Void)? = nil, onActivateLink: ((String) -> Bool)? = nil, onCopyClipboard: (() -> Void)? = nil, onMoveCursor: ((Gtk.MovementStep, Int32, Bool) -> Void)? = nil) {
|
||
make = { _ in Gtk.Label(withMnemonicStr: withMnemonicStr) }
|
||
configure.append { w, ctx in
|
||
if let attributes { w.setAttributes(attrs: attributes) }
|
||
if let ellipsize { w.setEllipsize(mode: ellipsize) }
|
||
if let extraMenu { w.setExtraMenu(model: extraMenu) }
|
||
if let justify { w.setJustify(jtype: justify) }
|
||
if let label { w.setLabel(str: label) }
|
||
if let lines { w.setLines(lines: lines) }
|
||
if let maxWidthChars { w.setMaxWidthChars(nChars: maxWidthChars) }
|
||
if let naturalWrapMode { w.setNaturalWrapMode(wrapMode: naturalWrapMode) }
|
||
if let selectable { w.setSelectable(setting: selectable) }
|
||
if let singleLineMode { w.setSingleLineMode(singleLineMode: singleLineMode) }
|
||
if let tabs { w.setTabs(tabs: tabs) }
|
||
if let useMarkup { w.setUseMarkup(setting: useMarkup) }
|
||
if let useUnderline { w.setUseUnderline(setting: useUnderline) }
|
||
if let widthChars { w.setWidthChars(nChars: widthChars) }
|
||
if let wrap { w.setWrap(wrap: wrap) }
|
||
if let wrapMode { w.setWrapMode(wrapMode: wrapMode) }
|
||
if let xalign { w.setXalign(xalign: xalign) }
|
||
if let yalign { w.setYalign(yalign: yalign) }
|
||
if let v = Portico.mountSlotChild(mnemonicWidget, ctx, onUpdate: { v in w.setMnemonicWidget(widget: v) }) { w.setMnemonicWidget(widget: v) }
|
||
if let onActivateCurrentLink { ctx.registry.add(w.connectActivateCurrentLink { _ in onActivateCurrentLink() }) }
|
||
if let onActivateLink { ctx.registry.add(w.connectActivateLink { _, a0 in onActivateLink(a0) }) }
|
||
if let onCopyClipboard { ctx.registry.add(w.connectCopyClipboard { _ in onCopyClipboard() }) }
|
||
if let onMoveCursor { ctx.registry.add(w.connectMoveCursor { _, a0, a1, a2 in onMoveCursor(a0, a1, a2) }) }
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
extension Label: WidgetView {
|
||
public typealias Target = Gtk.Label
|
||
|
||
@_spi(Portico) public func appending(
|
||
_ step: @escaping (Gtk.Label, MountContext) -> Void
|
||
) -> Self {
|
||
var c = self
|
||
c.configure.append(step)
|
||
return c
|
||
}
|
||
}
|
||
|
||
@_spi(Portico) extension Label: Mountable {
|
||
@_spi(Portico) public func mount(_ ctx: MountContext) -> Gtk.Widget {
|
||
let w = make(ctx)
|
||
for step in configure { step(w, ctx) }
|
||
return w
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension | source: Gtk.Label
|
||
/// Modifiers for `Gtk.Label`, available on every Portico view whose
|
||
/// backing widget is `Gtk.Label` or one of its subclasses.
|
||
extension WidgetView where Target: Gtk.Label {
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setAttributes(attrs:)
|
||
/// 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 [property`Gtk`.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.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter attributes: A list of style attributes to apply to the text of the label.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func attributes(_ attributes: Gtk.AttrList?) -> Self {
|
||
appending { w, _ in
|
||
w.setAttributes(attrs: attributes)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setAttributes(attrs:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getAttributes()
|
||
/// 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 [property`Gtk`.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.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Gtk.AttrList?` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func attributes(_ attributes: Portico.Binding<Gtk.AttrList?>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, attributes, registry: ctx.registry, notifyDetail: "attributes",
|
||
read: { [w] in w.getAttributes() },
|
||
write: { [w] v in w.setAttributes(attrs: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Label.setAttributes(attrs:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getAttributes()
|
||
/// 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 [property`Gtk`.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.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// `Binding` is invariant, so a `Binding<Gtk.AttrList>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.AttrList?>` to be able to clear the property.
|
||
/// When `Gtk.AttrList` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
/// A `nil` widget value is never written back into the binding.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func attributes(_ attributes: Portico.Binding<Gtk.AttrList>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, attributes, registry: ctx.registry, notifyDetail: "attributes",
|
||
read: { [w] in w.getAttributes() },
|
||
write: { [w] v in w.setAttributes(attrs: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setAttributes(attrs:)
|
||
/// 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 [property`Gtk`.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.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setAttributes(attrs:)`.
|
||
///
|
||
/// - Parameter attributes: A list of style attributes to apply to the text of the label.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func attributes(_ attributes: @escaping () -> Gtk.AttrList?) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setAttributes(attrs: attributes()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setEllipsize(mode:)
|
||
/// Sets the mode used to ellipsize the text.
|
||
///
|
||
/// The text will be ellipsized if there is not
|
||
/// enough space to render the entire string.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter ellipsize: The preferred place to ellipsize the string, if the label does not have enough room to display the entire string.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func ellipsize(_ ellipsize: Gtk.EllipsizeMode) -> Self {
|
||
appending { w, _ in
|
||
w.setEllipsize(mode: ellipsize)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setEllipsize(mode:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getEllipsize()
|
||
/// Sets the mode used to ellipsize the text.
|
||
///
|
||
/// The text will be ellipsized if there is not
|
||
/// enough space to render the entire string.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Gtk.EllipsizeMode` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func ellipsize(_ ellipsize: Portico.Binding<Gtk.EllipsizeMode>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, ellipsize, registry: ctx.registry, notifyDetail: "ellipsize",
|
||
read: { [w] in w.getEllipsize() },
|
||
write: { [w] v in w.setEllipsize(mode: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setEllipsize(mode:)
|
||
/// Sets the mode used to ellipsize the text.
|
||
///
|
||
/// The text will be ellipsized if there is not
|
||
/// enough space to render the entire string.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setEllipsize(mode:)`.
|
||
///
|
||
/// - Parameter ellipsize: The preferred place to ellipsize the string, if the label does not have enough room to display the entire string.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func ellipsize(_ ellipsize: @escaping () -> Gtk.EllipsizeMode) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setEllipsize(mode: ellipsize()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setExtraMenu(model:)
|
||
/// Sets a menu model to add to the context menu of the label.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter extraMenu: A menu model whose contents will be appended to the context menu.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func extraMenu(_ extraMenu: Gtk.MenuModel?) -> Self {
|
||
appending { w, _ in
|
||
w.setExtraMenu(model: extraMenu)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setExtraMenu(model:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getExtraMenu()
|
||
/// Sets a menu model to add to the context menu of the label.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Gtk.MenuModel?` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func extraMenu(_ extraMenu: Portico.Binding<Gtk.MenuModel?>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, extraMenu, registry: ctx.registry, notifyDetail: "extra-menu",
|
||
read: { [w] in w.getExtraMenu() },
|
||
write: { [w] v in w.setExtraMenu(model: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Label.setExtraMenu(model:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getExtraMenu()
|
||
/// Sets a menu model to add to the context menu of the label.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// `Binding` is invariant, so a `Binding<Gtk.MenuModel>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.MenuModel?>` to be able to clear the property.
|
||
/// When `Gtk.MenuModel` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
/// A `nil` widget value is never written back into the binding.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func extraMenu(_ extraMenu: Portico.Binding<Gtk.MenuModel>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, extraMenu, registry: ctx.registry, notifyDetail: "extra-menu",
|
||
read: { [w] in w.getExtraMenu() },
|
||
write: { [w] v in w.setExtraMenu(model: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setExtraMenu(model:)
|
||
/// Sets a menu model to add to the context menu of the label.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setExtraMenu(model:)`.
|
||
///
|
||
/// - Parameter extraMenu: A menu model whose contents will be appended to the context menu.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func extraMenu(_ extraMenu: @escaping () -> Gtk.MenuModel?) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setExtraMenu(model: extraMenu()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setJustify(jtype:)
|
||
/// Sets the alignment of lines in the label relative to each other.
|
||
///
|
||
/// This function has no effect on labels containing only a single line.
|
||
///
|
||
/// [enum`Gtk`.Justification.left] is the default value when the widget
|
||
/// is first created with [ctor`Gtk`.Label.new].
|
||
///
|
||
/// If you instead want to set the alignment of the label as a whole,
|
||
/// use [method`Gtk`.Widget.set_halign] instead.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter justify: The alignment of the lines in the text of the label, relative to each other.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func justify(_ justify: Gtk.Justification) -> Self {
|
||
appending { w, _ in
|
||
w.setJustify(jtype: justify)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setJustify(jtype:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getJustify()
|
||
/// Sets the alignment of lines in the label relative to each other.
|
||
///
|
||
/// This function has no effect on labels containing only a single line.
|
||
///
|
||
/// [enum`Gtk`.Justification.left] is the default value when the widget
|
||
/// is first created with [ctor`Gtk`.Label.new].
|
||
///
|
||
/// If you instead want to set the alignment of the label as a whole,
|
||
/// use [method`Gtk`.Widget.set_halign] instead.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Gtk.Justification` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func justify(_ justify: Portico.Binding<Gtk.Justification>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, justify, registry: ctx.registry, notifyDetail: "justify",
|
||
read: { [w] in w.getJustify() },
|
||
write: { [w] v in w.setJustify(jtype: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setJustify(jtype:)
|
||
/// Sets the alignment of lines in the label relative to each other.
|
||
///
|
||
/// This function has no effect on labels containing only a single line.
|
||
///
|
||
/// [enum`Gtk`.Justification.left] is the default value when the widget
|
||
/// is first created with [ctor`Gtk`.Label.new].
|
||
///
|
||
/// If you instead want to set the alignment of the label as a whole,
|
||
/// use [method`Gtk`.Widget.set_halign] instead.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setJustify(jtype:)`.
|
||
///
|
||
/// - Parameter justify: The alignment of the lines in the text of the label, relative to each other.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func justify(_ justify: @escaping () -> Gtk.Justification) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setJustify(jtype: justify()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setLabel(str:)
|
||
/// 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 [property`Gtk`.Label:use-markup] properties.
|
||
///
|
||
/// Applied once at mount; use the `Binding`, closure, or `InterpolatedText` overload for a value that changes.
|
||
/// A string literal containing interpolation selects the `InterpolatedText` overload instead, which updates live.
|
||
///
|
||
/// - Parameter label: The contents of the label.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
@_disfavoredOverload
|
||
public func label<S: StringProtocol>(_ label: S) -> Self {
|
||
appending { w, _ in
|
||
w.setLabel(str: String(label))
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setLabel(str:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getLabel()
|
||
/// 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 [property`Gtk`.Label:use-markup] properties.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `String` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func label(_ label: Portico.Binding<String>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, label, registry: ctx.registry, notifyDetail: "label",
|
||
read: { [w] in w.getLabel() },
|
||
write: { [w] v in w.setLabel(str: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setLabel(str:)
|
||
/// 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 [property`Gtk`.Label:use-markup] properties.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setLabel(str:)`.
|
||
///
|
||
/// - Parameter label: The contents of the label.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func label(_ label: @escaping () -> String) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setLabel(str: label()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(interpolation) | source: Gtk.Label.setLabel(str:)
|
||
/// 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 [property`Gtk`.Label:use-markup] properties.
|
||
///
|
||
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Gtk.Label.setLabel(str:)`. A literal with no interpolation is applied once, with no subscription.
|
||
///
|
||
/// - Parameter label: The contents of the label.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func label(_ label: Portico.InterpolatedText) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindInterpolation(label, registry: ctx.registry) { [w] v in w.setLabel(str: v) }
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setLines(lines:)
|
||
/// 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.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter lines: The number of lines to which an ellipsized, wrapping label should display before it gets ellipsized. This both prevents the label from ellipsizing before this many lines are displayed, and limits the height request of the label to this many lines.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func lines(_ lines: Int32) -> Self {
|
||
appending { w, _ in
|
||
w.setLines(lines: lines)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setLines(lines:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getLines()
|
||
/// 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.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Int32` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func lines(_ lines: Portico.Binding<Int32>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, lines, registry: ctx.registry, notifyDetail: "lines",
|
||
read: { [w] in w.getLines() },
|
||
write: { [w] v in w.setLines(lines: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setLines(lines:)
|
||
/// 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.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setLines(lines:)`.
|
||
///
|
||
/// - Parameter lines: The number of lines to which an ellipsized, wrapping label should display before it gets ellipsized. This both prevents the label from ellipsizing before this many lines are displayed, and limits the height request of the label to this many lines.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func lines(_ lines: @escaping () -> Int32) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setLines(lines: lines()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setMaxWidthChars(nChars:)
|
||
/// Sets the maximum width of the label in characters.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter maxWidthChars: The desired maximum width of the label, in characters.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func maxWidthChars(_ maxWidthChars: Int32) -> Self {
|
||
appending { w, _ in
|
||
w.setMaxWidthChars(nChars: maxWidthChars)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setMaxWidthChars(nChars:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getMaxWidthChars()
|
||
/// Sets the maximum width of the label in characters.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Int32` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func maxWidthChars(_ maxWidthChars: Portico.Binding<Int32>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, maxWidthChars, registry: ctx.registry, notifyDetail: "max-width-chars",
|
||
read: { [w] in w.getMaxWidthChars() },
|
||
write: { [w] v in w.setMaxWidthChars(nChars: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setMaxWidthChars(nChars:)
|
||
/// Sets the maximum width of the label in characters.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setMaxWidthChars(nChars:)`.
|
||
///
|
||
/// - Parameter maxWidthChars: The desired maximum width of the label, in characters.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func maxWidthChars(_ maxWidthChars: @escaping () -> Int32) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setMaxWidthChars(nChars: maxWidthChars()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setMnemonicWidget(widget:)
|
||
/// 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],
|
||
/// [method`Gtk`.Label.set_text_with_mnemonic],
|
||
/// [ctor`Gtk`.Label.new_with_mnemonic]
|
||
/// or the [property`Gtk`.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 [class`Gtk`.Button] or a
|
||
/// [class`Gtk`.Notebook] tab) it is automatically associated with the
|
||
/// correct widget, but sometimes (i.e. when the target is a [class`Gtk`.Entry]
|
||
/// next to the label) you need to set it explicitly using this function.
|
||
///
|
||
/// The target widget will be accelerated by emitting the
|
||
/// [signal`Gtk`.Widget::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.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter mnemonicWidget: The widget to be activated when the labels mnemonic key is pressed.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func mnemonicWidget(_ mnemonicWidget: Gtk.Widget?) -> Self {
|
||
appending { w, _ in
|
||
w.setMnemonicWidget(widget: mnemonicWidget)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(viewBuilder) | source: Gtk.Label.setMnemonicWidget(widget:)
|
||
/// 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],
|
||
/// [method`Gtk`.Label.set_text_with_mnemonic],
|
||
/// [ctor`Gtk`.Label.new_with_mnemonic]
|
||
/// or the [property`Gtk`.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 [class`Gtk`.Button] or a
|
||
/// [class`Gtk`.Notebook] tab) it is automatically associated with the
|
||
/// correct widget, but sometimes (i.e. when the target is a [class`Gtk`.Entry]
|
||
/// next to the label) you need to set it explicitly using this function.
|
||
///
|
||
/// The target widget will be accelerated by emitting the
|
||
/// [signal`Gtk`.Widget::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.
|
||
///
|
||
/// The closure is evaluated once when the modifier is applied. Its first view is mounted into the slot.
|
||
/// Additional views are ignored; an empty closure leaves the slot unset.
|
||
///
|
||
/// - Parameter mnemonicWidget: The widget to be activated when the labels mnemonic key is pressed.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func mnemonicWidget(@ViewBuilder _ mnemonicWidget: () -> [AnyView]) -> Self {
|
||
let mnemonicWidgetViews = mnemonicWidget()
|
||
return appending { w, ctx in
|
||
guard let v = mnemonicWidgetViews.first else { return }
|
||
w.setMnemonicWidget(widget: v.makeWidget(ctx))
|
||
}
|
||
}
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setMnemonicWidget(widget:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getMnemonicWidget()
|
||
/// 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],
|
||
/// [method`Gtk`.Label.set_text_with_mnemonic],
|
||
/// [ctor`Gtk`.Label.new_with_mnemonic]
|
||
/// or the [property`Gtk`.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 [class`Gtk`.Button] or a
|
||
/// [class`Gtk`.Notebook] tab) it is automatically associated with the
|
||
/// correct widget, but sometimes (i.e. when the target is a [class`Gtk`.Entry]
|
||
/// next to the label) you need to set it explicitly using this function.
|
||
///
|
||
/// The target widget will be accelerated by emitting the
|
||
/// [signal`Gtk`.Widget::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.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Gtk.Widget?` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func mnemonicWidget<W: Gtk.Widget>(_ mnemonicWidget: Portico.Binding<W?>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, mnemonicWidget, registry: ctx.registry, notifyDetail: "mnemonic-widget",
|
||
read: { [w] in w.getMnemonicWidget() as? W },
|
||
write: { [w] v in w.setMnemonicWidget(widget: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Label.setMnemonicWidget(widget:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getMnemonicWidget()
|
||
/// 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],
|
||
/// [method`Gtk`.Label.set_text_with_mnemonic],
|
||
/// [ctor`Gtk`.Label.new_with_mnemonic]
|
||
/// or the [property`Gtk`.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 [class`Gtk`.Button] or a
|
||
/// [class`Gtk`.Notebook] tab) it is automatically associated with the
|
||
/// correct widget, but sometimes (i.e. when the target is a [class`Gtk`.Entry]
|
||
/// next to the label) you need to set it explicitly using this function.
|
||
///
|
||
/// The target widget will be accelerated by emitting the
|
||
/// [signal`Gtk`.Widget::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.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// `Binding` is invariant, so a `Binding<Gtk.Widget>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.Widget?>` to be able to clear the property.
|
||
/// When `Gtk.Widget` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
/// A `nil` widget value is never written back into the binding.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func mnemonicWidget<W: Gtk.Widget>(_ mnemonicWidget: Portico.Binding<W>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, mnemonicWidget, registry: ctx.registry, notifyDetail: "mnemonic-widget",
|
||
read: { [w] in w.getMnemonicWidget() as? W },
|
||
write: { [w] v in w.setMnemonicWidget(widget: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setMnemonicWidget(widget:)
|
||
/// 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],
|
||
/// [method`Gtk`.Label.set_text_with_mnemonic],
|
||
/// [ctor`Gtk`.Label.new_with_mnemonic]
|
||
/// or the [property`Gtk`.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 [class`Gtk`.Button] or a
|
||
/// [class`Gtk`.Notebook] tab) it is automatically associated with the
|
||
/// correct widget, but sometimes (i.e. when the target is a [class`Gtk`.Entry]
|
||
/// next to the label) you need to set it explicitly using this function.
|
||
///
|
||
/// The target widget will be accelerated by emitting the
|
||
/// [signal`Gtk`.Widget::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.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setMnemonicWidget(widget:)`.
|
||
///
|
||
/// - Parameter mnemonicWidget: The widget to be activated when the labels mnemonic key is pressed.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func mnemonicWidget(_ mnemonicWidget: @escaping () -> Gtk.Widget?) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setMnemonicWidget(widget: mnemonicWidget()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setNaturalWrapMode(wrapMode:)
|
||
/// Selects the line wrapping for the natural size request.
|
||
///
|
||
/// This only affects the natural size requested, for the actual wrapping used,
|
||
/// see the [property`Gtk`.Label:wrap-mode] property.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter naturalWrapMode: Select the line wrapping for the natural size request.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func naturalWrapMode(_ naturalWrapMode: Gtk.NaturalWrapMode) -> Self {
|
||
appending { w, _ in
|
||
w.setNaturalWrapMode(wrapMode: naturalWrapMode)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setNaturalWrapMode(wrapMode:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getNaturalWrapMode()
|
||
/// Selects the line wrapping for the natural size request.
|
||
///
|
||
/// This only affects the natural size requested, for the actual wrapping used,
|
||
/// see the [property`Gtk`.Label:wrap-mode] property.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Gtk.NaturalWrapMode` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func naturalWrapMode(_ naturalWrapMode: Portico.Binding<Gtk.NaturalWrapMode>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, naturalWrapMode, registry: ctx.registry, notifyDetail: "natural-wrap-mode",
|
||
read: { [w] in w.getNaturalWrapMode() },
|
||
write: { [w] v in w.setNaturalWrapMode(wrapMode: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setNaturalWrapMode(wrapMode:)
|
||
/// Selects the line wrapping for the natural size request.
|
||
///
|
||
/// This only affects the natural size requested, for the actual wrapping used,
|
||
/// see the [property`Gtk`.Label:wrap-mode] property.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setNaturalWrapMode(wrapMode:)`.
|
||
///
|
||
/// - Parameter naturalWrapMode: Select the line wrapping for the natural size request.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func naturalWrapMode(_ naturalWrapMode: @escaping () -> Gtk.NaturalWrapMode) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setNaturalWrapMode(wrapMode: naturalWrapMode()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setSelectable(setting:)
|
||
/// Makes text in the label selectable.
|
||
///
|
||
/// Selectable labels allow the user to select text from the label,
|
||
/// for copy-and-paste.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter selectable: Whether the label text can be selected with the mouse.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func selectable(_ selectable: Bool) -> Self {
|
||
appending { w, _ in
|
||
w.setSelectable(setting: selectable)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setSelectable(setting:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getSelectable()
|
||
/// Makes text in the label selectable.
|
||
///
|
||
/// Selectable labels allow the user to select text from the label,
|
||
/// for copy-and-paste.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Bool` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func selectable(_ selectable: Portico.Binding<Bool>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, selectable, registry: ctx.registry, notifyDetail: "selectable",
|
||
read: { [w] in w.getSelectable() },
|
||
write: { [w] v in w.setSelectable(setting: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setSelectable(setting:)
|
||
/// Makes text in the label selectable.
|
||
///
|
||
/// Selectable labels allow the user to select text from the label,
|
||
/// for copy-and-paste.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setSelectable(setting:)`.
|
||
///
|
||
/// - Parameter selectable: Whether the label text can be selected with the mouse.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func selectable(_ selectable: @escaping () -> Bool) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setSelectable(setting: selectable()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setSingleLineMode(singleLineMode:)
|
||
/// Sets whether the label is in single line mode.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter singleLineMode: Whether the label is in single line mode.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func singleLineMode(_ singleLineMode: Bool) -> Self {
|
||
appending { w, _ in
|
||
w.setSingleLineMode(singleLineMode: singleLineMode)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setSingleLineMode(singleLineMode:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getSingleLineMode()
|
||
/// Sets whether the label is in single line mode.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Bool` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func singleLineMode(_ singleLineMode: Portico.Binding<Bool>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, singleLineMode, registry: ctx.registry, notifyDetail: "single-line-mode",
|
||
read: { [w] in w.getSingleLineMode() },
|
||
write: { [w] v in w.setSingleLineMode(singleLineMode: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setSingleLineMode(singleLineMode:)
|
||
/// Sets whether the label is in single line mode.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setSingleLineMode(singleLineMode:)`.
|
||
///
|
||
/// - Parameter singleLineMode: Whether the label is in single line mode.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func singleLineMode(_ singleLineMode: @escaping () -> Bool) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setSingleLineMode(singleLineMode: singleLineMode()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setTabs(tabs:)
|
||
/// Sets tab stops for the label.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter tabs: Custom tabs for this label.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func tabs(_ tabs: Gtk.TabArray?) -> Self {
|
||
appending { w, _ in
|
||
w.setTabs(tabs: tabs)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setTabs(tabs:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getTabs()
|
||
/// Sets tab stops for the label.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Gtk.TabArray?` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func tabs(_ tabs: Portico.Binding<Gtk.TabArray?>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, tabs, registry: ctx.registry, notifyDetail: "tabs",
|
||
read: { [w] in w.getTabs() },
|
||
write: { [w] v in w.setTabs(tabs: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Label.setTabs(tabs:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getTabs()
|
||
/// Sets tab stops for the label.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// `Binding` is invariant, so a `Binding<Gtk.TabArray>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.TabArray?>` to be able to clear the property.
|
||
/// When `Gtk.TabArray` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
/// A `nil` widget value is never written back into the binding.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func tabs(_ tabs: Portico.Binding<Gtk.TabArray>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, tabs, registry: ctx.registry, notifyDetail: "tabs",
|
||
read: { [w] in w.getTabs() },
|
||
write: { [w] v in w.setTabs(tabs: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setTabs(tabs:)
|
||
/// Sets tab stops for the label.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setTabs(tabs:)`.
|
||
///
|
||
/// - Parameter tabs: Custom tabs for this label.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func tabs(_ tabs: @escaping () -> Gtk.TabArray?) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setTabs(tabs: tabs()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setUseMarkup(setting:)
|
||
/// Sets whether the text of the label contains markup.
|
||
///
|
||
/// See [method`Gtk`.Label.set_markup].
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter useMarkup: True if the text of the label includes Pango markup.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func useMarkup(_ useMarkup: Bool) -> Self {
|
||
appending { w, _ in
|
||
w.setUseMarkup(setting: useMarkup)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setUseMarkup(setting:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getUseMarkup()
|
||
/// Sets whether the text of the label contains markup.
|
||
///
|
||
/// See [method`Gtk`.Label.set_markup].
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Bool` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func useMarkup(_ useMarkup: Portico.Binding<Bool>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, useMarkup, registry: ctx.registry, notifyDetail: "use-markup",
|
||
read: { [w] in w.getUseMarkup() },
|
||
write: { [w] v in w.setUseMarkup(setting: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setUseMarkup(setting:)
|
||
/// Sets whether the text of the label contains markup.
|
||
///
|
||
/// See [method`Gtk`.Label.set_markup].
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setUseMarkup(setting:)`.
|
||
///
|
||
/// - Parameter useMarkup: True if the text of the label includes Pango markup.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func useMarkup(_ useMarkup: @escaping () -> Bool) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setUseMarkup(setting: useMarkup()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setUseUnderline(setting:)
|
||
/// Sets whether underlines in the text indicate mnemonics.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter useUnderline: True if the text of the label indicates a mnemonic with an `_` before the mnemonic character.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func useUnderline(_ useUnderline: Bool) -> Self {
|
||
appending { w, _ in
|
||
w.setUseUnderline(setting: useUnderline)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setUseUnderline(setting:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getUseUnderline()
|
||
/// Sets whether underlines in the text indicate mnemonics.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Bool` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func useUnderline(_ useUnderline: Portico.Binding<Bool>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, useUnderline, registry: ctx.registry, notifyDetail: "use-underline",
|
||
read: { [w] in w.getUseUnderline() },
|
||
write: { [w] v in w.setUseUnderline(setting: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setUseUnderline(setting:)
|
||
/// Sets whether underlines in the text indicate mnemonics.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setUseUnderline(setting:)`.
|
||
///
|
||
/// - Parameter useUnderline: True if the text of the label indicates a mnemonic with an `_` before the mnemonic character.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func useUnderline(_ useUnderline: @escaping () -> Bool) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setUseUnderline(setting: useUnderline()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setWidthChars(nChars:)
|
||
/// Sets the desired width in characters of the label.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter widthChars: The desired width of the label, in characters.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func widthChars(_ widthChars: Int32) -> Self {
|
||
appending { w, _ in
|
||
w.setWidthChars(nChars: widthChars)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setWidthChars(nChars:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getWidthChars()
|
||
/// Sets the desired width in characters of the label.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Int32` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func widthChars(_ widthChars: Portico.Binding<Int32>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, widthChars, registry: ctx.registry, notifyDetail: "width-chars",
|
||
read: { [w] in w.getWidthChars() },
|
||
write: { [w] v in w.setWidthChars(nChars: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setWidthChars(nChars:)
|
||
/// Sets the desired width in characters of the label.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setWidthChars(nChars:)`.
|
||
///
|
||
/// - Parameter widthChars: The desired width of the label, in characters.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func widthChars(_ widthChars: @escaping () -> Int32) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setWidthChars(nChars: widthChars()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setWrap(wrap:)
|
||
/// Toggles line wrapping within the label.
|
||
///
|
||
/// 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 widget’s width, because GTK widgets conceptually
|
||
/// can’t make their requisition depend on the parent widget’s size.
|
||
/// For a label that wraps at a specific position, set the label’s width
|
||
/// using [method`Gtk`.Widget.set_size_request].
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter wrap: True if the label text will wrap if it gets too wide.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func wrap(_ wrap: Bool) -> Self {
|
||
appending { w, _ in
|
||
w.setWrap(wrap: wrap)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setWrap(wrap:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getWrap()
|
||
/// Toggles line wrapping within the label.
|
||
///
|
||
/// 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 widget’s width, because GTK widgets conceptually
|
||
/// can’t make their requisition depend on the parent widget’s size.
|
||
/// For a label that wraps at a specific position, set the label’s width
|
||
/// using [method`Gtk`.Widget.set_size_request].
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Bool` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func wrap(_ wrap: Portico.Binding<Bool>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, wrap, registry: ctx.registry, notifyDetail: "wrap",
|
||
read: { [w] in w.getWrap() },
|
||
write: { [w] v in w.setWrap(wrap: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setWrap(wrap:)
|
||
/// Toggles line wrapping within the label.
|
||
///
|
||
/// 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 widget’s width, because GTK widgets conceptually
|
||
/// can’t make their requisition depend on the parent widget’s size.
|
||
/// For a label that wraps at a specific position, set the label’s width
|
||
/// using [method`Gtk`.Widget.set_size_request].
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setWrap(wrap:)`.
|
||
///
|
||
/// - Parameter wrap: True if the label text will wrap if it gets too wide.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func wrap(_ wrap: @escaping () -> Bool) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setWrap(wrap: wrap()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setWrapMode(wrapMode:)
|
||
/// Controls how line wrapping is done.
|
||
///
|
||
/// This only affects the label if line wrapping is on. (See
|
||
/// [method`Gtk`.Label.set_wrap])
|
||
///
|
||
/// The default is [enum`Pango`.WrapMode.word], which means
|
||
/// wrap on word boundaries.
|
||
///
|
||
/// For sizing behavior, also consider the
|
||
/// [property`Gtk`.Label:natural-wrap-mode] property.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter wrapMode: Controls how the line wrapping is done.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func wrapMode(_ wrapMode: Pango.WrapMode) -> Self {
|
||
appending { w, _ in
|
||
w.setWrapMode(wrapMode: wrapMode)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setWrapMode(wrapMode:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getWrapMode()
|
||
/// Controls how line wrapping is done.
|
||
///
|
||
/// This only affects the label if line wrapping is on. (See
|
||
/// [method`Gtk`.Label.set_wrap])
|
||
///
|
||
/// The default is [enum`Pango`.WrapMode.word], which means
|
||
/// wrap on word boundaries.
|
||
///
|
||
/// For sizing behavior, also consider the
|
||
/// [property`Gtk`.Label:natural-wrap-mode] property.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Pango.WrapMode` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func wrapMode(_ wrapMode: Portico.Binding<Pango.WrapMode>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, wrapMode, registry: ctx.registry, notifyDetail: "wrap-mode",
|
||
read: { [w] in w.getWrapMode() },
|
||
write: { [w] v in w.setWrapMode(wrapMode: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setWrapMode(wrapMode:)
|
||
/// Controls how line wrapping is done.
|
||
///
|
||
/// This only affects the label if line wrapping is on. (See
|
||
/// [method`Gtk`.Label.set_wrap])
|
||
///
|
||
/// The default is [enum`Pango`.WrapMode.word], which means
|
||
/// wrap on word boundaries.
|
||
///
|
||
/// For sizing behavior, also consider the
|
||
/// [property`Gtk`.Label:natural-wrap-mode] property.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setWrapMode(wrapMode:)`.
|
||
///
|
||
/// - Parameter wrapMode: Controls how the line wrapping is done.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func wrapMode(_ wrapMode: @escaping () -> Pango.WrapMode) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setWrapMode(wrapMode: wrapMode()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setXalign(xalign:)
|
||
/// Sets the `xalign` of the label.
|
||
///
|
||
/// See the [property`Gtk`.Label:xalign] property.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter xalign: The horizontal alignment of the label text inside its size allocation.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func xalign(_ xalign: Float) -> Self {
|
||
appending { w, _ in
|
||
w.setXalign(xalign: xalign)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setXalign(xalign:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getXalign()
|
||
/// Sets the `xalign` of the label.
|
||
///
|
||
/// See the [property`Gtk`.Label:xalign] property.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Float` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func xalign(_ xalign: Portico.Binding<Float>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, xalign, registry: ctx.registry, notifyDetail: "xalign",
|
||
read: { [w] in w.getXalign() },
|
||
write: { [w] v in w.setXalign(xalign: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setXalign(xalign:)
|
||
/// Sets the `xalign` of the label.
|
||
///
|
||
/// See the [property`Gtk`.Label:xalign] property.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setXalign(xalign:)`.
|
||
///
|
||
/// - Parameter xalign: The horizontal alignment of the label text inside its size allocation.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func xalign(_ xalign: @escaping () -> Float) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setXalign(xalign: xalign()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Label.setYalign(yalign:)
|
||
/// Sets the `yalign` of the label.
|
||
///
|
||
/// See the [property`Gtk`.Label:yalign] property.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter yalign: The vertical alignment of the label text inside its size allocation.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func yalign(_ yalign: Float) -> Self {
|
||
appending { w, _ in
|
||
w.setYalign(yalign: yalign)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Label.setYalign(yalign:), GObject.Object.connectNotify(detail:_:), Gtk.Label.getYalign()
|
||
/// Sets the `yalign` of the label.
|
||
///
|
||
/// See the [property`Gtk`.Label:yalign] property.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Float` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func yalign(_ yalign: Portico.Binding<Float>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, yalign, registry: ctx.registry, notifyDetail: "yalign",
|
||
read: { [w] in w.getYalign() },
|
||
write: { [w] v in w.setYalign(yalign: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Label.setYalign(yalign:)
|
||
/// Sets the `yalign` of the label.
|
||
///
|
||
/// See the [property`Gtk`.Label:yalign] property.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Label.setYalign(yalign:)`.
|
||
///
|
||
/// - Parameter yalign: The vertical alignment of the label text inside its size allocation.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func yalign(_ yalign: @escaping () -> Float) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setYalign(yalign: yalign()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Label.connectActivateCurrentLink(_:)
|
||
/// Gets emitted when the user activates a link in the label.
|
||
///
|
||
/// The `::activate-current-link` is a [keybinding signal](class.SignalAction.html).
|
||
///
|
||
/// 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 <kbd>Enter</kbd> key.
|
||
///
|
||
/// - Parameter handler: Invoked when the widget emits the `activate-current-link` signal.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func onActivateCurrentLink(_ handler: @escaping () -> Void) -> Self {
|
||
appending { w, ctx in
|
||
ctx.registry.add(w.connectActivateCurrentLink { _ in handler() })
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Label.connectActivateLink(_:)
|
||
/// Gets emitted to activate a URI.
|
||
///
|
||
/// Applications may connect to it to override the default behaviour,
|
||
/// which is to call [method`Gtk`.FileLauncher.launch].
|
||
///
|
||
/// - Parameter handler: Invoked when the widget emits the `activate-link` signal. The closure receives the signal's arguments in order. Its return value is forwarded to GTK as the signal's result.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func onActivateLink(_ handler: @escaping (String) -> Bool) -> Self {
|
||
appending { w, ctx in
|
||
ctx.registry.add(w.connectActivateLink { _, a0 in handler(a0) })
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Label.connectCopyClipboard(_:)
|
||
/// Gets emitted to copy the selection to the clipboard.
|
||
///
|
||
/// The `::copy-clipboard` signal is a [keybinding signal](class.SignalAction.html).
|
||
///
|
||
/// The default binding for this signal is <kbd>Ctrl</kbd>+<kbd>c</kbd>.
|
||
///
|
||
/// - Parameter handler: Invoked when the widget emits the `copy-clipboard` signal.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func onCopyClipboard(_ handler: @escaping () -> Void) -> Self {
|
||
appending { w, ctx in
|
||
ctx.registry.add(w.connectCopyClipboard { _ in handler() })
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Label.connectMoveCursor(_:)
|
||
/// Gets emitted when the user initiates a cursor movement.
|
||
///
|
||
/// The `::move-cursor` signal is a [keybinding signal](class.SignalAction.html).
|
||
/// 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
|
||
/// [func`GObject`.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 <kbd>Shift</kbd> modifier extends the selection,
|
||
/// the variant without the <kbd>Shift</kbd> modifier does not.
|
||
/// There are too many key combinations to list them all here.
|
||
///
|
||
/// - <kbd>←</kbd>, <kbd>→</kbd>, <kbd>↑</kbd>, <kbd>↓</kbd>
|
||
/// move by individual characters/lines
|
||
/// - <kbd>Ctrl</kbd>+<kbd>←</kbd>, etc. move by words/paragraphs
|
||
/// - <kbd>Home</kbd> and <kbd>End</kbd> move to the ends of the buffer
|
||
///
|
||
/// - Parameter handler: Invoked when the widget emits the `move-cursor` signal. The closure receives the signal's arguments in order.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func onMoveCursor(_ handler: @escaping (Gtk.MovementStep, Int32, Bool) -> Void) -> Self {
|
||
appending { w, ctx in
|
||
ctx.registry.add(w.connectMoveCursor { _, a0, a1, a2 in handler(a0, a1, a2) })
|
||
}
|
||
}
|
||
|
||
}
|