622 lines
34 KiB
Swift
622 lines
34 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: Adw.ActionRow
|
|
/// A [class`Gtk`.ListBoxRow] used to present actions.
|
|
///
|
|
/// <picture>
|
|
/// <source srcset="action-row-dark.png" media="(prefers-color-scheme: dark)">
|
|
/// <img src="action-row.png" alt="action-row">
|
|
/// </picture>
|
|
///
|
|
/// The `AdwActionRow` widget can have a title, a subtitle and an icon. The row
|
|
/// can receive additional widgets at its end, or prefix widgets at its start.
|
|
///
|
|
/// It is convenient to present a preference and its related actions.
|
|
///
|
|
/// `AdwActionRow` is unactivatable by default, giving it an activatable widget
|
|
/// will automatically make it activatable, but unsetting it won't change the
|
|
/// row's activatability.
|
|
///
|
|
/// ## AdwActionRow as GtkBuildable
|
|
///
|
|
/// The `AdwActionRow` implementation of the [iface`Gtk`.Buildable] interface
|
|
/// supports adding a child at its end by specifying “suffix” or omitting the
|
|
/// “type” attribute of a <child> element.
|
|
///
|
|
/// It also supports adding a child as a prefix widget by specifying “prefix” as
|
|
/// the “type” attribute of a <child> element.
|
|
///
|
|
/// ## CSS nodes
|
|
///
|
|
/// `AdwActionRow` has a main CSS node with name `row`.
|
|
///
|
|
/// It contains the subnode `box.header` for its main horizontal box, and
|
|
/// `box.title` for the vertical box containing the title and subtitle labels.
|
|
///
|
|
/// It contains subnodes `label.title` and `label.subtitle` representing
|
|
/// respectively the title label and subtitle label.
|
|
///
|
|
/// ## Style classes
|
|
///
|
|
/// `AdwActionRow` can use the [`.property`](style-classes.html`property`-rows)
|
|
/// style class to emphasize the row subtitle instead of the row title, which is
|
|
/// useful for displaying read-only properties.
|
|
///
|
|
/// <picture>
|
|
/// <source srcset="property-row-dark.png" media="(prefers-color-scheme: dark)">
|
|
/// <img src="property-row.png" alt="property-row">
|
|
/// </picture>
|
|
///
|
|
/// When used together with the `.monospace` style class, only the subtitle
|
|
/// becomes monospace, not the title or any extra widgets.
|
|
///
|
|
/// A Portico view that mounts a `Adw.ActionRow`.
|
|
@MainActor public struct ActionRow: View {
|
|
private let make: (MountContext) -> Adw.ActionRow
|
|
private var configure: [(Adw.ActionRow, MountContext) -> Void] = []
|
|
|
|
public var body: Never { fatalError() }
|
|
|
|
// PorticoGen: generateInits(static) | source: Adw.ActionRow.init()
|
|
/// Creates a new `AdwActionRow`.
|
|
///
|
|
/// 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 iconName: The icon name for this row.
|
|
/// - Parameter subtitle: The subtitle for this row.
|
|
/// - Parameter subtitleLines: The number of lines at the end of which the subtitle label will be ellipsized.
|
|
/// - Parameter subtitleSelectable: Whether the user can copy the subtitle from the label.
|
|
/// - Parameter titleLines: The number of lines at the end of which the title label will be ellipsized.
|
|
/// - Parameter title: The title of the preference represented by this row.
|
|
/// - Parameter titleSelectable: Whether the user can copy the title from the label.
|
|
/// - Parameter useMarkup: Whether to use Pango markup for the title label.
|
|
/// - Parameter useUnderline: Whether an embedded underline in the title indicates a mnemonic.
|
|
/// - Parameter activatable: Determines whether the ::row-activated signal will be emitted for this row.
|
|
/// - Parameter selectable: Determines whether this row can be selected.
|
|
/// - Parameter child: A `ViewBuilder` closure whose first view is mounted into the `child` slot.
|
|
/// - Parameter activatableWidget: A `ViewBuilder` closure whose first view is mounted into the `activatableWidget` slot.
|
|
/// - Parameter onActivated: Invoked when the widget emits the `activated` signal.
|
|
/// - Parameter onActivate: Invoked when the widget emits the `activate` signal.
|
|
public init(iconName: String? = nil, subtitle: String? = nil, subtitleLines: Int32? = nil, subtitleSelectable: Bool? = nil, titleLines: Int32? = nil, title: String? = nil, titleSelectable: Bool? = nil, useMarkup: Bool? = nil, useUnderline: Bool? = nil, activatable: Bool? = nil, selectable: Bool? = nil, @ViewBuilder child: @escaping () -> [AnyView] = { [] }, @ViewBuilder activatableWidget: @escaping () -> [AnyView] = { [] }, onActivated: (() -> Void)? = nil, onActivate: (() -> Void)? = nil) {
|
|
make = { _ in Adw.ActionRow() }
|
|
configure.append { w, ctx in
|
|
if let iconName { w.setIconName(iconName: iconName) }
|
|
if let subtitle { w.setSubtitle(subtitle: subtitle) }
|
|
if let subtitleLines { w.setSubtitleLines(subtitleLines: subtitleLines) }
|
|
if let subtitleSelectable { w.setSubtitleSelectable(subtitleSelectable: subtitleSelectable) }
|
|
if let titleLines { w.setTitleLines(titleLines: titleLines) }
|
|
if let title { w.setTitle(title: title) }
|
|
if let titleSelectable { w.setTitleSelectable(titleSelectable: titleSelectable) }
|
|
if let useMarkup { w.setUseMarkup(useMarkup: useMarkup) }
|
|
if let useUnderline { w.setUseUnderline(useUnderline: useUnderline) }
|
|
if let activatable { w.setActivatable(activatable: activatable) }
|
|
if let selectable { w.setSelectable(selectable: selectable) }
|
|
if let v = Portico.mountSlotChild(child, ctx, onUpdate: { v in w.setChild(child: v) }) { w.setChild(child: v) }
|
|
if let v = Portico.mountSlotChild(activatableWidget, ctx, onUpdate: { v in w.setActivatableWidget(widget: v) }) { w.setActivatableWidget(widget: v) }
|
|
if let onActivated { ctx.registry.add(w.connectActivated { _ in onActivated() }) }
|
|
if let onActivate { ctx.registry.add(w.connectActivate { _ in onActivate() }) }
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
extension ActionRow: WidgetView {
|
|
public typealias Target = Adw.ActionRow
|
|
|
|
@_spi(Portico) public func appending(
|
|
_ step: @escaping (Adw.ActionRow, MountContext) -> Void
|
|
) -> Self {
|
|
var c = self
|
|
c.configure.append(step)
|
|
return c
|
|
}
|
|
}
|
|
|
|
@_spi(Portico) extension ActionRow: 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: Adw.ActionRow
|
|
/// Modifiers for `Adw.ActionRow`, available on every Portico view whose
|
|
/// backing widget is `Adw.ActionRow` or one of its subclasses.
|
|
extension WidgetView where Target: Adw.ActionRow {
|
|
// PorticoGen: generateModifierExtension -> generateChildAdderModifiers(static) | source: Adw.ActionRow.addPrefix(widget:)
|
|
/// Adds a prefix widget to `self`.
|
|
///
|
|
/// Applied once at mount; use the `@ViewBuilder` overload for multiple children.
|
|
///
|
|
/// - Parameter child: A child widget to add.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func addPrefix(_ child: Gtk.Widget) -> Self {
|
|
appending { w, _ in
|
|
w.addPrefix(widget: child)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateChildAdderModifiers(viewBuilder) | source: Adw.ActionRow.addPrefix(widget:)
|
|
/// Adds a prefix widget to `self`.
|
|
///
|
|
/// Every view the closure produces is added at mount, in order.
|
|
///
|
|
/// - Parameter child: A closure producing child views.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func addPrefix(@ViewBuilder _ child: () -> [AnyView]) -> Self {
|
|
let childViews = child()
|
|
return appending { w, ctx in
|
|
for v in childViews { w.addPrefix(widget: v.makeWidget(ctx)) }
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateChildAdderModifiers(static) | source: Adw.ActionRow.addSuffix(widget:)
|
|
/// Adds a suffix widget to `self`.
|
|
///
|
|
/// Applied once at mount; use the `@ViewBuilder` overload for multiple children.
|
|
///
|
|
/// - Parameter child: A child widget to add.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func addSuffix(_ child: Gtk.Widget) -> Self {
|
|
appending { w, _ in
|
|
w.addSuffix(widget: child)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateChildAdderModifiers(viewBuilder) | source: Adw.ActionRow.addSuffix(widget:)
|
|
/// Adds a suffix widget to `self`.
|
|
///
|
|
/// Every view the closure produces is added at mount, in order.
|
|
///
|
|
/// - Parameter child: A closure producing child views.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func addSuffix(@ViewBuilder _ child: () -> [AnyView]) -> Self {
|
|
let childViews = child()
|
|
return appending { w, ctx in
|
|
for v in childViews { w.addSuffix(widget: v.makeWidget(ctx)) }
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ActionRow.setActivatableWidget(widget:)
|
|
/// Sets the widget to activate when `self` is activated.
|
|
///
|
|
/// The row can be activated either by clicking on it, calling
|
|
/// [method`ActionRow`.activate], or via mnemonics in the title.
|
|
/// See the [property`PreferencesRow`:use-underline] property to enable mnemonics.
|
|
///
|
|
/// The target widget will be activated by emitting the
|
|
/// [signal`Gtk`.Widget::mnemonic-activate] signal on it.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter activatableWidget: The widget to activate when the row is activated.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func activatableWidget(_ activatableWidget: Adw.Widget?) -> Self {
|
|
appending { w, _ in
|
|
w.setActivatableWidget(widget: activatableWidget)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(viewBuilder) | source: Adw.ActionRow.setActivatableWidget(widget:)
|
|
/// Sets the widget to activate when `self` is activated.
|
|
///
|
|
/// The row can be activated either by clicking on it, calling
|
|
/// [method`ActionRow`.activate], or via mnemonics in the title.
|
|
/// See the [property`PreferencesRow`:use-underline] property to enable mnemonics.
|
|
///
|
|
/// The target widget will be activated by emitting the
|
|
/// [signal`Gtk`.Widget::mnemonic-activate] signal on it.
|
|
///
|
|
/// 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 activatableWidget: The widget to activate when the row is activated.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func activatableWidget(@ViewBuilder _ activatableWidget: () -> [AnyView]) -> Self {
|
|
let activatableWidgetViews = activatableWidget()
|
|
return appending { w, ctx in
|
|
guard let v = activatableWidgetViews.first else { return }
|
|
w.setActivatableWidget(widget: v.makeWidget(ctx))
|
|
}
|
|
}
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ActionRow.setActivatableWidget(widget:), GObject.Object.connectNotify(detail:_:), Adw.ActionRow.getActivatableWidget()
|
|
/// Sets the widget to activate when `self` is activated.
|
|
///
|
|
/// The row can be activated either by clicking on it, calling
|
|
/// [method`ActionRow`.activate], or via mnemonics in the title.
|
|
/// See the [property`PreferencesRow`:use-underline] property to enable mnemonics.
|
|
///
|
|
/// The target widget will be activated by emitting the
|
|
/// [signal`Gtk`.Widget::mnemonic-activate] signal on it.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Adw.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 activatableWidget<W: Gtk.Widget>(_ activatableWidget: Portico.Binding<W?>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, activatableWidget, registry: ctx.registry, notifyDetail: "activatable-widget",
|
|
read: { [w] in w.getActivatableWidget() as? W },
|
|
write: { [w] v in w.setActivatableWidget(widget: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Adw.ActionRow.setActivatableWidget(widget:), GObject.Object.connectNotify(detail:_:), Adw.ActionRow.getActivatableWidget()
|
|
/// Sets the widget to activate when `self` is activated.
|
|
///
|
|
/// The row can be activated either by clicking on it, calling
|
|
/// [method`ActionRow`.activate], or via mnemonics in the title.
|
|
/// See the [property`PreferencesRow`:use-underline] property to enable mnemonics.
|
|
///
|
|
/// The target widget will be activated by emitting the
|
|
/// [signal`Gtk`.Widget::mnemonic-activate] signal on it.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// `Binding` is invariant, so a `Binding<Adw.Widget>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Adw.Widget?>` to be able to clear the property.
|
|
/// When `Adw.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 activatableWidget<W: Gtk.Widget>(_ activatableWidget: Portico.Binding<W>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, activatableWidget, registry: ctx.registry, notifyDetail: "activatable-widget",
|
|
read: { [w] in w.getActivatableWidget() as? W },
|
|
write: { [w] v in w.setActivatableWidget(widget: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ActionRow.setActivatableWidget(widget:)
|
|
/// Sets the widget to activate when `self` is activated.
|
|
///
|
|
/// The row can be activated either by clicking on it, calling
|
|
/// [method`ActionRow`.activate], or via mnemonics in the title.
|
|
/// See the [property`PreferencesRow`:use-underline] property to enable mnemonics.
|
|
///
|
|
/// The target widget will be activated by emitting the
|
|
/// [signal`Gtk`.Widget::mnemonic-activate] signal on it.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ActionRow.setActivatableWidget(widget:)`.
|
|
///
|
|
/// - Parameter activatableWidget: The widget to activate when the row is activated.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func activatableWidget(_ activatableWidget: @escaping () -> Adw.Widget?) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setActivatableWidget(widget: activatableWidget()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ActionRow.setIconName(iconName:)
|
|
/// Sets the icon name for `self`.
|
|
///
|
|
/// 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 iconName: The icon name for this row.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
@_disfavoredOverload
|
|
public func iconName<S: StringProtocol>(_ iconName: S?) -> Self {
|
|
appending { w, _ in
|
|
w.setIconName(iconName: iconName.map { String($0) })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ActionRow.setIconName(iconName:), GObject.Object.connectNotify(detail:_:), Adw.ActionRow.getIconName()
|
|
/// Sets the icon name for `self`.
|
|
///
|
|
/// 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 iconName(_ iconName: Portico.Binding<String?>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, iconName, registry: ctx.registry, notifyDetail: "icon-name",
|
|
read: { [w] in w.getIconName() },
|
|
write: { [w] v in w.setIconName(iconName: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Adw.ActionRow.setIconName(iconName:), GObject.Object.connectNotify(detail:_:), Adw.ActionRow.getIconName()
|
|
/// Sets the icon name for `self`.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// `Binding` is invariant, so a `Binding<String>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<String?>` to be able to clear the property.
|
|
/// 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.
|
|
/// A `nil` widget value is never written back into the binding.
|
|
///
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func iconName(_ iconName: Portico.Binding<String>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, iconName, registry: ctx.registry, notifyDetail: "icon-name",
|
|
read: { [w] in w.getIconName() },
|
|
write: { [w] v in w.setIconName(iconName: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ActionRow.setIconName(iconName:)
|
|
/// Sets the icon name for `self`.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ActionRow.setIconName(iconName:)`.
|
|
///
|
|
/// - Parameter iconName: The icon name for this row.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func iconName(_ iconName: @escaping () -> String?) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setIconName(iconName: iconName()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(interpolation) | source: Adw.ActionRow.setIconName(iconName:)
|
|
/// Sets the icon name for `self`.
|
|
///
|
|
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Adw.ActionRow.setIconName(iconName:)`. A literal with no interpolation is applied once, with no subscription.
|
|
///
|
|
/// - Parameter iconName: The icon name for this row.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func iconName(_ iconName: Portico.InterpolatedText?) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindOptionalInterpolation(iconName, registry: ctx.registry) { [w] v in w.setIconName(iconName: v) }
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ActionRow.setSubtitle(subtitle:)
|
|
/// Sets the subtitle for `self`.
|
|
///
|
|
/// The subtitle is interpreted as Pango markup unless
|
|
/// [property`PreferencesRow`:use-markup] is set to `FALSE`.
|
|
///
|
|
/// 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 subtitle: The subtitle for this row.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
@_disfavoredOverload
|
|
public func subtitle<S: StringProtocol>(_ subtitle: S) -> Self {
|
|
appending { w, _ in
|
|
w.setSubtitle(subtitle: String(subtitle))
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ActionRow.setSubtitle(subtitle:), GObject.Object.connectNotify(detail:_:), Adw.ActionRow.getSubtitle()
|
|
/// Sets the subtitle for `self`.
|
|
///
|
|
/// The subtitle is interpreted as Pango markup unless
|
|
/// [property`PreferencesRow`:use-markup] is set to `FALSE`.
|
|
///
|
|
/// 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 subtitle(_ subtitle: Portico.Binding<String>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, subtitle, registry: ctx.registry, notifyDetail: "subtitle",
|
|
read: { [w] in w.getSubtitle() },
|
|
write: { [w] v in w.setSubtitle(subtitle: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ActionRow.setSubtitle(subtitle:)
|
|
/// Sets the subtitle for `self`.
|
|
///
|
|
/// The subtitle is interpreted as Pango markup unless
|
|
/// [property`PreferencesRow`:use-markup] is set to `FALSE`.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ActionRow.setSubtitle(subtitle:)`.
|
|
///
|
|
/// - Parameter subtitle: The subtitle for this row.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func subtitle(_ subtitle: @escaping () -> String) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setSubtitle(subtitle: subtitle()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(interpolation) | source: Adw.ActionRow.setSubtitle(subtitle:)
|
|
/// Sets the subtitle for `self`.
|
|
///
|
|
/// The subtitle is interpreted as Pango markup unless
|
|
/// [property`PreferencesRow`:use-markup] is set to `FALSE`.
|
|
///
|
|
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Adw.ActionRow.setSubtitle(subtitle:)`. A literal with no interpolation is applied once, with no subscription.
|
|
///
|
|
/// - Parameter subtitle: The subtitle for this row.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func subtitle(_ subtitle: Portico.InterpolatedText) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindInterpolation(subtitle, registry: ctx.registry) { [w] v in w.setSubtitle(subtitle: v) }
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ActionRow.setSubtitleLines(subtitleLines:)
|
|
/// Sets the number of lines at the end of which the subtitle label will be
|
|
/// ellipsized.
|
|
///
|
|
/// If the value is 0, the number of lines won't be limited.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter subtitleLines: The number of lines at the end of which the subtitle label will be ellipsized.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func subtitleLines(_ subtitleLines: Int32) -> Self {
|
|
appending { w, _ in
|
|
w.setSubtitleLines(subtitleLines: subtitleLines)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ActionRow.setSubtitleLines(subtitleLines:), GObject.Object.connectNotify(detail:_:), Adw.ActionRow.getSubtitleLines()
|
|
/// Sets the number of lines at the end of which the subtitle label will be
|
|
/// ellipsized.
|
|
///
|
|
/// If the value is 0, the number of lines won't be limited.
|
|
///
|
|
/// 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 subtitleLines(_ subtitleLines: Portico.Binding<Int32>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, subtitleLines, registry: ctx.registry, notifyDetail: "subtitle-lines",
|
|
read: { [w] in w.getSubtitleLines() },
|
|
write: { [w] v in w.setSubtitleLines(subtitleLines: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ActionRow.setSubtitleLines(subtitleLines:)
|
|
/// Sets the number of lines at the end of which the subtitle label will be
|
|
/// ellipsized.
|
|
///
|
|
/// If the value is 0, the number of lines won't be limited.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ActionRow.setSubtitleLines(subtitleLines:)`.
|
|
///
|
|
/// - Parameter subtitleLines: The number of lines at the end of which the subtitle label will be ellipsized.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func subtitleLines(_ subtitleLines: @escaping () -> Int32) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setSubtitleLines(subtitleLines: subtitleLines()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ActionRow.setSubtitleSelectable(subtitleSelectable:)
|
|
/// Sets whether the user can copy the subtitle from the label
|
|
///
|
|
/// See also [property`Gtk`.Label:selectable].
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter subtitleSelectable: Whether the user can copy the subtitle from the label.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func subtitleSelectable(_ subtitleSelectable: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setSubtitleSelectable(subtitleSelectable: subtitleSelectable)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ActionRow.setSubtitleSelectable(subtitleSelectable:), GObject.Object.connectNotify(detail:_:), Adw.ActionRow.getSubtitleSelectable()
|
|
/// Sets whether the user can copy the subtitle from the label
|
|
///
|
|
/// See also [property`Gtk`.Label:selectable].
|
|
///
|
|
/// 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 subtitleSelectable(_ subtitleSelectable: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, subtitleSelectable, registry: ctx.registry, notifyDetail: "subtitle-selectable",
|
|
read: { [w] in w.getSubtitleSelectable() },
|
|
write: { [w] v in w.setSubtitleSelectable(subtitleSelectable: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ActionRow.setSubtitleSelectable(subtitleSelectable:)
|
|
/// Sets whether the user can copy the subtitle from the label
|
|
///
|
|
/// See also [property`Gtk`.Label:selectable].
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ActionRow.setSubtitleSelectable(subtitleSelectable:)`.
|
|
///
|
|
/// - Parameter subtitleSelectable: Whether the user can copy the subtitle from the label.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func subtitleSelectable(_ subtitleSelectable: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setSubtitleSelectable(subtitleSelectable: subtitleSelectable()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ActionRow.setTitleLines(titleLines:)
|
|
/// Sets the number of lines at the end of which the title label will be
|
|
/// ellipsized.
|
|
///
|
|
/// If the value is 0, the number of lines won't be limited.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter titleLines: The number of lines at the end of which the title label will be ellipsized.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func titleLines(_ titleLines: Int32) -> Self {
|
|
appending { w, _ in
|
|
w.setTitleLines(titleLines: titleLines)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ActionRow.setTitleLines(titleLines:), GObject.Object.connectNotify(detail:_:), Adw.ActionRow.getTitleLines()
|
|
/// Sets the number of lines at the end of which the title label will be
|
|
/// ellipsized.
|
|
///
|
|
/// If the value is 0, the number of lines won't be limited.
|
|
///
|
|
/// 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 titleLines(_ titleLines: Portico.Binding<Int32>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, titleLines, registry: ctx.registry, notifyDetail: "title-lines",
|
|
read: { [w] in w.getTitleLines() },
|
|
write: { [w] v in w.setTitleLines(titleLines: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ActionRow.setTitleLines(titleLines:)
|
|
/// Sets the number of lines at the end of which the title label will be
|
|
/// ellipsized.
|
|
///
|
|
/// If the value is 0, the number of lines won't be limited.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ActionRow.setTitleLines(titleLines:)`.
|
|
///
|
|
/// - Parameter titleLines: The number of lines at the end of which the title label will be ellipsized.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func titleLines(_ titleLines: @escaping () -> Int32) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setTitleLines(titleLines: titleLines()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Adw.ActionRow.connectActivated(_:)
|
|
/// This signal is emitted after the row has been activated.
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `activated` signal.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onActivated(_ handler: @escaping () -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectActivated { _ in handler() })
|
|
}
|
|
}
|
|
|
|
}
|