628 lines
33 KiB
Swift
628 lines
33 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.ExpanderRow
|
|
/// A [class`Gtk`.ListBoxRow] used to reveal widgets.
|
|
///
|
|
/// <picture>
|
|
/// <source srcset="expander-row-dark.png" media="(prefers-color-scheme: dark)">
|
|
/// <img src="expander-row.png" alt="expander-row">
|
|
/// </picture>
|
|
///
|
|
/// The `AdwExpanderRow` widget allows the user to reveal or hide widgets below
|
|
/// it. It also allows the user to enable the expansion of the row, allowing to
|
|
/// disable all that the row contains.
|
|
///
|
|
/// ## AdwExpanderRow as GtkBuildable
|
|
///
|
|
/// The `AdwExpanderRow` implementation of the [iface`Gtk`.Buildable] interface
|
|
/// supports adding a child as an suffix widget by specifying “suffix” as the
|
|
/// “type” attribute of a <child> element.
|
|
///
|
|
/// It also supports adding it as a prefix widget by specifying “prefix” as the
|
|
/// “type” attribute of a <child> element.
|
|
///
|
|
/// ## CSS nodes
|
|
///
|
|
/// `AdwExpanderRow` has a main CSS node with name `row` and the `.expander`
|
|
/// style class. It has the `.empty` style class when it contains no children.
|
|
///
|
|
/// It contains the subnodes `row.header` for its main embedded row,
|
|
/// `list.nested` for the list it can expand, and `image.expander-row-arrow` for
|
|
/// its arrow.
|
|
///
|
|
/// ## Style classes
|
|
///
|
|
/// `AdwExpanderRow` can use the [`.`](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.
|
|
///
|
|
/// 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.ExpanderRow`.
|
|
@MainActor public struct ExpanderRow: View {
|
|
private let make: (MountContext) -> Adw.ExpanderRow
|
|
private var configure: [(Adw.ExpanderRow, MountContext) -> Void] = []
|
|
|
|
public var body: Never { fatalError() }
|
|
|
|
// PorticoGen: generateInits(static) | source: Adw.ExpanderRow.init()
|
|
/// Creates a new `AdwExpanderRow`.
|
|
///
|
|
/// 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 enableExpansion: Whether expansion is enabled.
|
|
/// - Parameter expanded: Whether the row is expanded.
|
|
/// - Parameter iconName: The icon name for this row.
|
|
/// - Parameter showEnableSwitch: Whether the switch enabling the expansion is visible.
|
|
/// - 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 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 onActivate: Invoked when the widget emits the `activate` signal.
|
|
public init(enableExpansion: Bool? = nil, expanded: Bool? = nil, iconName: String? = nil, showEnableSwitch: Bool? = nil, subtitle: String? = nil, subtitleLines: Int32? = 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] = { [] }, onActivate: (() -> Void)? = nil) {
|
|
make = { _ in Adw.ExpanderRow() }
|
|
configure.append { w, ctx in
|
|
if let enableExpansion { w.setEnableExpansion(enableExpansion: enableExpansion) }
|
|
if let expanded { w.setExpanded(expanded: expanded) }
|
|
if let iconName { w.setIconName(iconName: iconName) }
|
|
if let showEnableSwitch { w.setShowEnableSwitch(showEnableSwitch: showEnableSwitch) }
|
|
if let subtitle { w.setSubtitle(subtitle: subtitle) }
|
|
if let subtitleLines { w.setSubtitleLines(subtitleLines: subtitleLines) }
|
|
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 onActivate { ctx.registry.add(w.connectActivate { _ in onActivate() }) }
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
extension ExpanderRow: WidgetView {
|
|
public typealias Target = Adw.ExpanderRow
|
|
|
|
@_spi(Portico) public func appending(
|
|
_ step: @escaping (Adw.ExpanderRow, MountContext) -> Void
|
|
) -> Self {
|
|
var c = self
|
|
c.configure.append(step)
|
|
return c
|
|
}
|
|
}
|
|
|
|
@_spi(Portico) extension ExpanderRow: 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.ExpanderRow
|
|
/// Modifiers for `Adw.ExpanderRow`, available on every Portico view whose
|
|
/// backing widget is `Adw.ExpanderRow` or one of its subclasses.
|
|
extension WidgetView where Target: Adw.ExpanderRow {
|
|
// PorticoGen: generateModifierExtension -> generateChildAdderModifiers(static) | source: Adw.ExpanderRow.addAction(widget:)
|
|
/// Adds an action 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 addAction(_ child: Gtk.Widget) -> Self {
|
|
appending { w, _ in
|
|
w.addAction(widget: child)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateChildAdderModifiers(viewBuilder) | source: Adw.ExpanderRow.addAction(widget:)
|
|
/// Adds an action 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 addAction(@ViewBuilder _ child: () -> [AnyView]) -> Self {
|
|
let childViews = child()
|
|
return appending { w, ctx in
|
|
for v in childViews { w.addAction(widget: v.makeWidget(ctx)) }
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateChildAdderModifiers(static) | source: Adw.ExpanderRow.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.ExpanderRow.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.ExpanderRow.addRow(child:)
|
|
/// Adds a widget to `self`.
|
|
///
|
|
/// The widget will appear in the expanding list below `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 addRow(_ child: Gtk.Widget) -> Self {
|
|
appending { w, _ in
|
|
w.addRow(child: child)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateChildAdderModifiers(viewBuilder) | source: Adw.ExpanderRow.addRow(child:)
|
|
/// Adds a widget to `self`.
|
|
///
|
|
/// The widget will appear in the expanding list below `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 addRow(@ViewBuilder _ child: () -> [AnyView]) -> Self {
|
|
let childViews = child()
|
|
return appending { w, ctx in
|
|
for v in childViews { w.addRow(child: v.makeWidget(ctx)) }
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateChildAdderModifiers(static) | source: Adw.ExpanderRow.addSuffix(widget:)
|
|
/// Adds an 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.ExpanderRow.addSuffix(widget:)
|
|
/// Adds an 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.ExpanderRow.setEnableExpansion(enableExpansion:)
|
|
/// Sets whether the expansion of `self` is enabled.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter enableExpansion: Whether expansion is enabled.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func enableExpansion(_ enableExpansion: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setEnableExpansion(enableExpansion: enableExpansion)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ExpanderRow.setEnableExpansion(enableExpansion:), GObject.Object.connectNotify(detail:_:), Adw.ExpanderRow.getEnableExpansion()
|
|
/// Sets whether the expansion of `self` is enabled.
|
|
///
|
|
/// 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 enableExpansion(_ enableExpansion: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, enableExpansion, registry: ctx.registry, notifyDetail: "enable-expansion",
|
|
read: { [w] in w.getEnableExpansion() },
|
|
write: { [w] v in w.setEnableExpansion(enableExpansion: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ExpanderRow.setEnableExpansion(enableExpansion:)
|
|
/// Sets whether the expansion of `self` is enabled.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ExpanderRow.setEnableExpansion(enableExpansion:)`.
|
|
///
|
|
/// - Parameter enableExpansion: Whether expansion is enabled.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func enableExpansion(_ enableExpansion: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setEnableExpansion(enableExpansion: enableExpansion()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ExpanderRow.setExpanded(expanded:)
|
|
/// Sets whether `self` is expanded.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter expanded: Whether the row is expanded.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func expanded(_ expanded: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setExpanded(expanded: expanded)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ExpanderRow.setExpanded(expanded:), GObject.Object.connectNotify(detail:_:), Adw.ExpanderRow.getExpanded()
|
|
/// Sets whether `self` is expanded.
|
|
///
|
|
/// 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 expanded(_ expanded: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, expanded, registry: ctx.registry, notifyDetail: "expanded",
|
|
read: { [w] in w.getExpanded() },
|
|
write: { [w] v in w.setExpanded(expanded: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ExpanderRow.setExpanded(expanded:)
|
|
/// Sets whether `self` is expanded.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ExpanderRow.setExpanded(expanded:)`.
|
|
///
|
|
/// - Parameter expanded: Whether the row is expanded.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func expanded(_ expanded: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setExpanded(expanded: expanded()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ExpanderRow.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.ExpanderRow.setIconName(iconName:), GObject.Object.connectNotify(detail:_:), Adw.ExpanderRow.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.ExpanderRow.setIconName(iconName:), GObject.Object.connectNotify(detail:_:), Adw.ExpanderRow.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.ExpanderRow.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.ExpanderRow.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.ExpanderRow.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.ExpanderRow.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.ExpanderRow.setShowEnableSwitch(showEnableSwitch:)
|
|
/// Sets whether the switch enabling the expansion of `self` is visible.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter showEnableSwitch: Whether the switch enabling the expansion is visible.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func showEnableSwitch(_ showEnableSwitch: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setShowEnableSwitch(showEnableSwitch: showEnableSwitch)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ExpanderRow.setShowEnableSwitch(showEnableSwitch:), GObject.Object.connectNotify(detail:_:), Adw.ExpanderRow.getShowEnableSwitch()
|
|
/// Sets whether the switch enabling the expansion of `self` is visible.
|
|
///
|
|
/// 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 showEnableSwitch(_ showEnableSwitch: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, showEnableSwitch, registry: ctx.registry, notifyDetail: "show-enable-switch",
|
|
read: { [w] in w.getShowEnableSwitch() },
|
|
write: { [w] v in w.setShowEnableSwitch(showEnableSwitch: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ExpanderRow.setShowEnableSwitch(showEnableSwitch:)
|
|
/// Sets whether the switch enabling the expansion of `self` is visible.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ExpanderRow.setShowEnableSwitch(showEnableSwitch:)`.
|
|
///
|
|
/// - Parameter showEnableSwitch: Whether the switch enabling the expansion is visible.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func showEnableSwitch(_ showEnableSwitch: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setShowEnableSwitch(showEnableSwitch: showEnableSwitch()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ExpanderRow.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.ExpanderRow.setSubtitle(subtitle:), GObject.Object.connectNotify(detail:_:), Adw.ExpanderRow.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.ExpanderRow.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.ExpanderRow.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.ExpanderRow.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.ExpanderRow.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.ExpanderRow.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.ExpanderRow.setSubtitleLines(subtitleLines:), GObject.Object.connectNotify(detail:_:), Adw.ExpanderRow.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.ExpanderRow.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.ExpanderRow.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.ExpanderRow.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.ExpanderRow.setTitleLines(titleLines:), GObject.Object.connectNotify(detail:_:), Adw.ExpanderRow.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.ExpanderRow.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.ExpanderRow.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)
|
|
}
|
|
}
|
|
|
|
}
|