442 lines
25 KiB
Swift
442 lines
25 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.PreferencesPage
|
|
/// A page from [class`PreferencesDialog`].
|
|
///
|
|
/// <picture>
|
|
/// <source srcset="preferences-page-dark.png" media="(prefers-color-scheme: dark)">
|
|
/// <img src="preferences-page.png" alt="preferences-page">
|
|
/// </picture>
|
|
///
|
|
/// The `AdwPreferencesPage` widget gathers preferences groups into a single page
|
|
/// of a preferences window.
|
|
///
|
|
/// ## CSS nodes
|
|
///
|
|
/// `AdwPreferencesPage` has a single CSS node with name `preferencespage`.
|
|
///
|
|
/// ## Accessibility
|
|
///
|
|
/// `AdwPreferencesPage` uses the [enum`Gtk`.AccessibleRole.group] role.
|
|
///
|
|
/// A Portico view that mounts a `Adw.PreferencesPage`.
|
|
@MainActor public struct PreferencesPage: View {
|
|
private let make: (MountContext) -> Adw.PreferencesPage
|
|
private var configure: [(Adw.PreferencesPage, MountContext) -> Void] = []
|
|
|
|
public var body: Never { fatalError() }
|
|
|
|
// PorticoGen: generateInits(static) | source: Adw.PreferencesPage.init()
|
|
/// Creates a new `AdwPreferencesPage`.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for values that change.
|
|
/// 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 banner: A [class`Banner`] displayed at the top of the page.
|
|
/// - Parameter description: The description to be displayed at the top of the page.
|
|
/// - Parameter descriptionCentered: Whether the description should be centered.
|
|
/// - Parameter iconName: The icon name for this page.
|
|
/// - Parameter title: The title for this page.
|
|
/// - Parameter useUnderline: Whether an embedded underline in the title indicates a mnemonic.
|
|
public init(banner: Adw.Banner? = nil, description: String? = nil, descriptionCentered: Bool? = nil, iconName: String? = nil, title: String? = nil, useUnderline: Bool? = nil) {
|
|
make = { _ in Adw.PreferencesPage() }
|
|
configure.append { w, _ in
|
|
if let banner { w.setBanner(banner: banner) }
|
|
if let description { w.setDescription(description: description) }
|
|
if let descriptionCentered { w.setDescriptionCentered(centered: descriptionCentered) }
|
|
if let iconName { w.setIconName(iconName: iconName) }
|
|
if let title { w.setTitle(title: title) }
|
|
if let useUnderline { w.setUseUnderline(useUnderline: useUnderline) }
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
extension PreferencesPage: WidgetView {
|
|
public typealias Target = Adw.PreferencesPage
|
|
|
|
@_spi(Portico) public func appending(
|
|
_ step: @escaping (Adw.PreferencesPage, MountContext) -> Void
|
|
) -> Self {
|
|
var c = self
|
|
c.configure.append(step)
|
|
return c
|
|
}
|
|
}
|
|
|
|
@_spi(Portico) extension PreferencesPage: 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.PreferencesPage
|
|
/// Modifiers for `Adw.PreferencesPage`, available on every Portico view whose
|
|
/// backing widget is `Adw.PreferencesPage` or one of its subclasses.
|
|
extension WidgetView where Target: Adw.PreferencesPage {
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.PreferencesPage.setBanner(banner:)
|
|
/// Sets the banner displayed at the top of the page.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter banner: A [class`Banner`] displayed at the top of the page.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func banner(_ banner: Adw.Banner?) -> Self {
|
|
appending { w, _ in
|
|
w.setBanner(banner: banner)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.PreferencesPage.setBanner(banner:), GObject.Object.connectNotify(detail:_:), Adw.PreferencesPage.getBanner()
|
|
/// Sets the banner displayed at the top of the page.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Adw.Banner?` 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 banner<W: Adw.Banner>(_ banner: Portico.Binding<W?>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, banner, registry: ctx.registry, notifyDetail: "banner",
|
|
read: { [w] in w.getBanner() as? W },
|
|
write: { [w] v in w.setBanner(banner: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Adw.PreferencesPage.setBanner(banner:), GObject.Object.connectNotify(detail:_:), Adw.PreferencesPage.getBanner()
|
|
/// Sets the banner displayed at the top of the page.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// `Binding` is invariant, so a `Binding<Adw.Banner>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Adw.Banner?>` to be able to clear the property.
|
|
/// When `Adw.Banner` 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 banner<W: Adw.Banner>(_ banner: Portico.Binding<W>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, banner, registry: ctx.registry, notifyDetail: "banner",
|
|
read: { [w] in w.getBanner() as? W },
|
|
write: { [w] v in w.setBanner(banner: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.PreferencesPage.setBanner(banner:)
|
|
/// Sets the banner displayed at the top of the page.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.PreferencesPage.setBanner(banner:)`.
|
|
///
|
|
/// - Parameter banner: A [class`Banner`] displayed at the top of the page.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func banner(_ banner: @escaping () -> Adw.Banner?) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setBanner(banner: banner()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.PreferencesPage.setDescription(description:)
|
|
/// Sets the description of `self`.
|
|
///
|
|
/// The description is displayed at the top of the page.
|
|
///
|
|
/// 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 description: The description to be displayed at the top of the page.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
@_disfavoredOverload
|
|
public func description<S: StringProtocol>(_ description: S) -> Self {
|
|
appending { w, _ in
|
|
w.setDescription(description: String(description))
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.PreferencesPage.setDescription(description:), GObject.Object.connectNotify(detail:_:), Adw.PreferencesPage.getDescription()
|
|
/// Sets the description of `self`.
|
|
///
|
|
/// The description is displayed at the top of the page.
|
|
///
|
|
/// 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 description(_ description: Portico.Binding<String>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, description, registry: ctx.registry, notifyDetail: "description",
|
|
read: { [w] in w.getDescription() },
|
|
write: { [w] v in w.setDescription(description: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.PreferencesPage.setDescription(description:)
|
|
/// Sets the description of `self`.
|
|
///
|
|
/// The description is displayed at the top of the page.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.PreferencesPage.setDescription(description:)`.
|
|
///
|
|
/// - Parameter description: The description to be displayed at the top of the page.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func description(_ description: @escaping () -> String) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setDescription(description: description()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(interpolation) | source: Adw.PreferencesPage.setDescription(description:)
|
|
/// Sets the description of `self`.
|
|
///
|
|
/// The description is displayed at the top of the page.
|
|
///
|
|
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Adw.PreferencesPage.setDescription(description:)`. A literal with no interpolation is applied once, with no subscription.
|
|
///
|
|
/// - Parameter description: The description to be displayed at the top of the page.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func description(_ description: Portico.InterpolatedText) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindInterpolation(description, registry: ctx.registry) { [w] v in w.setDescription(description: v) }
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.PreferencesPage.setDescriptionCentered(centered:)
|
|
/// Sets whether the description should be centered.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter descriptionCentered: Whether the description should be centered.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func descriptionCentered(_ descriptionCentered: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setDescriptionCentered(centered: descriptionCentered)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.PreferencesPage.setDescriptionCentered(centered:), GObject.Object.connectNotify(detail:_:), Adw.PreferencesPage.getDescriptionCentered()
|
|
/// Sets whether the description should be centered.
|
|
///
|
|
/// 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 descriptionCentered(_ descriptionCentered: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, descriptionCentered, registry: ctx.registry, notifyDetail: "description-centered",
|
|
read: { [w] in w.getDescriptionCentered() },
|
|
write: { [w] v in w.setDescriptionCentered(centered: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.PreferencesPage.setDescriptionCentered(centered:)
|
|
/// Sets whether the description should be centered.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.PreferencesPage.setDescriptionCentered(centered:)`.
|
|
///
|
|
/// - Parameter descriptionCentered: Whether the description should be centered.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func descriptionCentered(_ descriptionCentered: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setDescriptionCentered(centered: descriptionCentered()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.PreferencesPage.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 page.
|
|
/// - 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.PreferencesPage.setIconName(iconName:), GObject.Object.connectNotify(detail:_:), Adw.PreferencesPage.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.PreferencesPage.setIconName(iconName:), GObject.Object.connectNotify(detail:_:), Adw.PreferencesPage.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.PreferencesPage.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.PreferencesPage.setIconName(iconName:)`.
|
|
///
|
|
/// - Parameter iconName: The icon name for this page.
|
|
/// - 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.PreferencesPage.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.PreferencesPage.setIconName(iconName:)`. A literal with no interpolation is applied once, with no subscription.
|
|
///
|
|
/// - Parameter iconName: The icon name for this page.
|
|
/// - 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.PreferencesPage.setTitle(title:)
|
|
/// Sets the title of `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 title: The title for this page.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
@_disfavoredOverload
|
|
public func title<S: StringProtocol>(_ title: S) -> Self {
|
|
appending { w, _ in
|
|
w.setTitle(title: String(title))
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.PreferencesPage.setTitle(title:), GObject.Object.connectNotify(detail:_:), Adw.PreferencesPage.getTitle()
|
|
/// Sets the title of `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 title(_ title: Portico.Binding<String>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, title, registry: ctx.registry, notifyDetail: "title",
|
|
read: { [w] in w.getTitle() },
|
|
write: { [w] v in w.setTitle(title: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.PreferencesPage.setTitle(title:)
|
|
/// Sets the title of `self`.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.PreferencesPage.setTitle(title:)`.
|
|
///
|
|
/// - Parameter title: The title for this page.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func title(_ title: @escaping () -> String) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setTitle(title: title()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(interpolation) | source: Adw.PreferencesPage.setTitle(title:)
|
|
/// Sets the title of `self`.
|
|
///
|
|
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Adw.PreferencesPage.setTitle(title:)`. A literal with no interpolation is applied once, with no subscription.
|
|
///
|
|
/// - Parameter title: The title for this page.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func title(_ title: Portico.InterpolatedText) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindInterpolation(title, registry: ctx.registry) { [w] v in w.setTitle(title: v) }
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.PreferencesPage.setUseUnderline(useUnderline:)
|
|
/// Sets whether an embedded underline in the title indicates a mnemonic.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter useUnderline: Whether an embedded underline in the title indicates a mnemonic.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func useUnderline(_ useUnderline: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setUseUnderline(useUnderline: useUnderline)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.PreferencesPage.setUseUnderline(useUnderline:), GObject.Object.connectNotify(detail:_:), Adw.PreferencesPage.getUseUnderline()
|
|
/// Sets whether an embedded underline in the title indicates a mnemonic.
|
|
///
|
|
/// 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(useUnderline: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.PreferencesPage.setUseUnderline(useUnderline:)
|
|
/// Sets whether an embedded underline in the title indicates a mnemonic.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.PreferencesPage.setUseUnderline(useUnderline:)`.
|
|
///
|
|
/// - Parameter useUnderline: Whether an embedded underline in the title indicates a mnemonic.
|
|
/// - 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(useUnderline: useUnderline()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
}
|