portico/Sources/Portico/Generated/Frame.swift

496 lines
28 KiB
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Generated by PorticoGen. DO NOT EDIT. See Sources/PorticoGen to make changes.
import Adw
import Gtk
import Gio
import Gdk
// PorticoGen: generateStruct | source: Gtk.Frame
/// Surrounds its child with a decorative frame and an optional label.
///
/// <picture>
/// <source srcset="frame-dark.png" media="(prefers-color-scheme: dark)">
/// <img alt="An example GtkFrame" src="frame.png">
/// </picture>
///
/// If present, the label is drawn inside the top edge of the frame.
/// The horizontal position of the label can be controlled with
/// [method`Gtk`.Frame.set_label_align].
///
/// `GtkFrame` clips its child. You can use this to add rounded corners
/// to widgets, but be aware that it also cuts off shadows.
///
/// # GtkFrame as GtkBuildable
///
/// An example of a UI definition fragment with GtkFrame:
///
/// ```xml
/// <object class="GtkFrame">
/// <property name="label-widget">
/// <object class="GtkLabel" id="frame_label"/>
/// </property>
/// <property name="child">
/// <object class="GtkEntry" id="frame_content"/>
/// </property>
/// </object>
/// ```
///
/// # CSS nodes
///
/// ```
/// frame
/// <label widget>
/// <child>
/// ```
///
/// `GtkFrame` has a main CSS node with name frame, which is used to draw the
/// visible border. You can set the appearance of the border using CSS properties
/// like border-style on this node.
///
/// # Accessibility
///
/// `GtkFrame` uses the [enum`Gtk`.AccessibleRole.group] role.
///
/// A Portico view that mounts a `Gtk.Frame`.
@MainActor public struct Frame: View {
private let make: (MountContext) -> Gtk.Frame
private var configure: [(Gtk.Frame, MountContext) -> Void] = []
public var body: Never { fatalError() }
// PorticoGen: generateInits(static) | source: Gtk.Frame.init(label:)
/// Creates a new `GtkFrame`, with optional label `label`.
///
/// If `label` is `nil`, the label is omitted.
///
/// Applied once at mount; use the `Binding`, closure, or `InterpolatedText` overload for values that change.
/// A string literal containing interpolation selects the `InterpolatedText` overload instead, which updates live.
/// 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 label: Text of the frame's label.
/// - Parameter labelXalign: The horizontal alignment of the label.
/// - Parameter child: A `ViewBuilder` closure whose first view is mounted into the `child` slot.
/// - Parameter labelWidget: A `ViewBuilder` closure whose first view is mounted into the `labelWidget` slot.
@_disfavoredOverload
public init<S: StringProtocol>(label: S?, labelXalign: Float? = nil, @ViewBuilder child: @escaping () -> [AnyView] = { [] }, @ViewBuilder labelWidget: @escaping () -> [AnyView] = { [] }) {
make = { _ in Gtk.Frame(label: label.map { String($0) }) }
configure.append { w, ctx in
if let labelXalign { w.setLabelAlign(xalign: labelXalign) }
if let v = Portico.mountSlotChild(child, ctx, onUpdate: { v in w.setChild(child: v) }) { w.setChild(child: v) }
if let v = Portico.mountSlotChild(labelWidget, ctx, onUpdate: { v in w.setLabelWidget(labelWidget: v) }) { w.setLabelWidget(labelWidget: v) }
}
}
// PorticoGen: generateInits(binding) | source: Gtk.Frame.init(label:), Gtk.Frame.setLabel(label:)
/// Creates a new `GtkFrame`, with optional label `label`.
///
/// If `label` is `nil`, the label is omitted.
///
/// The initial value is the binding's current value; every later change is pushed into the widget through `Gtk.Frame.setLabel(label:)` without rebuilding the view.
/// 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.
/// Optional `Binding` parameters bind through `Portico.bindProperty`, so they are two-way wherever the wrapper exposes a safe getter.
///
/// - Parameter label: Text of the frame's label.
/// - Parameter labelXalign: The horizontal alignment of the label.
/// - Parameter child: A `ViewBuilder` closure whose first view is mounted into the `child` slot.
/// - Parameter labelWidget: A `ViewBuilder` closure whose first view is mounted into the `labelWidget` slot.
public init(label: Portico.Binding<String?>, labelXalign: Portico.Binding<Float>? = nil, @ViewBuilder child: @escaping () -> [AnyView] = { [] }, @ViewBuilder labelWidget: @escaping () -> [AnyView] = { [] }) {
make = { _ in Gtk.Frame(label: label.wrappedValue) }
configure.append { w, ctx in
ctx.registry.add(label.subscribe { [w] v in w.setLabel(label: v) })
if let labelXalign {
Portico.bindProperty(w, labelXalign, registry: ctx.registry, notifyDetail: "label-xalign", read: { [w] in w.labelXalign }, write: { [w] v in w.setLabelAlign(xalign: v) })
}
if let v = Portico.mountSlotChild(child, ctx, onUpdate: { v in w.setChild(child: v) }) { w.setChild(child: v) }
if let v = Portico.mountSlotChild(labelWidget, ctx, onUpdate: { v in w.setLabelWidget(labelWidget: v) }) { w.setLabelWidget(labelWidget: v) }
}
}
// PorticoGen: generateInits(closure) | source: Gtk.Frame.init(label:), Gtk.Frame.setLabel(label:)
/// Creates a new `GtkFrame`, with optional label `label`.
///
/// If `label` is `nil`, the label is omitted.
///
/// Each closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Frame.setLabel(label:)`.
/// 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 label: Text of the frame's label.
/// - Parameter labelXalign: The horizontal alignment of the label.
/// - Parameter child: A `ViewBuilder` closure whose first view is mounted into the `child` slot.
/// - Parameter labelWidget: A `ViewBuilder` closure whose first view is mounted into the `labelWidget` slot.
public init(label: @escaping () -> String?, labelXalign: Float? = nil, @ViewBuilder child: @escaping () -> [AnyView] = { [] }, @ViewBuilder labelWidget: @escaping () -> [AnyView] = { [] }) {
make = { _ in Gtk.Frame(label: label()) }
configure.append { w, ctx in
let t0 = DependencyTracker { [w] in w.setLabel(label: label()) }
t0.run()
ctx.registry.add(t0)
if let labelXalign { w.setLabelAlign(xalign: labelXalign) }
if let v = Portico.mountSlotChild(child, ctx, onUpdate: { v in w.setChild(child: v) }) { w.setChild(child: v) }
if let v = Portico.mountSlotChild(labelWidget, ctx, onUpdate: { v in w.setLabelWidget(labelWidget: v) }) { w.setLabelWidget(labelWidget: v) }
}
}
// PorticoGen: generateInits(interpolation) | source: Gtk.Frame.init(label:), Gtk.Frame.setLabel(label:)
/// Creates a new `GtkFrame`, with optional label `label`.
///
/// If `label` is `nil`, the label is omitted.
///
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Gtk.Frame.setLabel(label:)`. A literal with no interpolation is applied once, with no subscription.
/// 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 label: Text of the frame's label.
/// - Parameter labelXalign: The horizontal alignment of the label.
/// - Parameter child: A `ViewBuilder` closure whose first view is mounted into the `child` slot.
/// - Parameter labelWidget: A `ViewBuilder` closure whose first view is mounted into the `labelWidget` slot.
public init(label: Portico.InterpolatedText?, labelXalign: Float? = nil, @ViewBuilder child: @escaping () -> [AnyView] = { [] }, @ViewBuilder labelWidget: @escaping () -> [AnyView] = { [] }) {
make = { _ in Gtk.Frame(label: label?.untrackedText) }
configure.append { w, ctx in
Portico.bindOptionalInterpolation(label, registry: ctx.registry) { [w] v in w.setLabel(label: v) }
if let labelXalign { w.setLabelAlign(xalign: labelXalign) }
if let v = Portico.mountSlotChild(child, ctx, onUpdate: { v in w.setChild(child: v) }) { w.setChild(child: v) }
if let v = Portico.mountSlotChild(labelWidget, ctx, onUpdate: { v in w.setLabelWidget(labelWidget: v) }) { w.setLabelWidget(labelWidget: v) }
}
}
}
extension Frame: WidgetView {
public typealias Target = Gtk.Frame
@_spi(Portico) public func appending(
_ step: @escaping (Gtk.Frame, MountContext) -> Void
) -> Self {
var c = self
c.configure.append(step)
return c
}
}
@_spi(Portico) extension Frame: Mountable {
@_spi(Portico) public func mount(_ ctx: MountContext) -> Gtk.Widget {
let w = make(ctx)
for step in configure { step(w, ctx) }
return w
}
}
// PorticoGen: generateModifierExtension | source: Gtk.Frame
/// Modifiers for `Gtk.Frame`, available on every Portico view whose
/// backing widget is `Gtk.Frame` or one of its subclasses.
extension WidgetView where Target: Gtk.Frame {
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Frame.setChild(child:)
/// Sets the child widget of `frame`.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter child: The child widget.
/// - Returns: A copy of this view with the modifier applied.
public func child(_ child: Gtk.Widget?) -> Self {
appending { w, _ in
w.setChild(child: child)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(viewBuilder) | source: Gtk.Frame.setChild(child:)
/// Sets the child widget of `frame`.
///
/// 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 child: The child widget.
/// - Returns: A copy of this view with the modifier applied.
public func child(@ViewBuilder _ child: () -> [AnyView]) -> Self {
let childViews = child()
return appending { w, ctx in
guard let v = childViews.first else { return }
w.setChild(child: v.makeWidget(ctx))
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Frame.setChild(child:), GObject.Object.connectNotify(detail:_:), Gtk.Frame.getChild()
/// Sets the child widget of `frame`.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.Widget?` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
///
/// - Returns: A copy of this view with the modifier applied.
public func child<W: Gtk.Widget>(_ child: Portico.Binding<W?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, child, registry: ctx.registry, notifyDetail: "child",
read: { [w] in w.getChild() as? W },
write: { [w] v in w.setChild(child: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Frame.setChild(child:), GObject.Object.connectNotify(detail:_:), Gtk.Frame.getChild()
/// Sets the child widget of `frame`.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Gtk.Widget>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.Widget?>` to be able to clear the property.
/// When `Gtk.Widget` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
/// A `nil` widget value is never written back into the binding.
///
/// - Returns: A copy of this view with the modifier applied.
public func child<W: Gtk.Widget>(_ child: Portico.Binding<W>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, child, registry: ctx.registry, notifyDetail: "child",
read: { [w] in w.getChild() as? W },
write: { [w] v in w.setChild(child: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Frame.setChild(child:)
/// Sets the child widget of `frame`.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Frame.setChild(child:)`.
///
/// - Parameter child: The child widget.
/// - Returns: A copy of this view with the modifier applied.
public func child(_ child: @escaping () -> Gtk.Widget?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setChild(child: child()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Frame.setLabel(label:)
/// Creates a new `GtkLabel` with the `label` and sets it as the frame's
/// label widget.
///
/// Applied once at mount; use the `Binding`, closure, or `InterpolatedText` overload for a value that changes.
/// A string literal containing interpolation selects the `InterpolatedText` overload instead, which updates live.
///
/// - Parameter label: Text of the frame's label.
/// - Returns: A copy of this view with the modifier applied.
@_disfavoredOverload
public func label<S: StringProtocol>(_ label: S?) -> Self {
appending { w, _ in
w.setLabel(label: label.map { String($0) })
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Frame.setLabel(label:), GObject.Object.connectNotify(detail:_:), Gtk.Frame.getLabel()
/// Creates a new `GtkLabel` with the `label` and sets it as the frame's
/// label widget.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `String?` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
///
/// - Returns: A copy of this view with the modifier applied.
public func label(_ label: Portico.Binding<String?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, label, registry: ctx.registry, notifyDetail: "label",
read: { [w] in w.getLabel() },
write: { [w] v in w.setLabel(label: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Frame.setLabel(label:), GObject.Object.connectNotify(detail:_:), Gtk.Frame.getLabel()
/// Creates a new `GtkLabel` with the `label` and sets it as the frame's
/// label widget.
///
/// 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 label(_ label: Portico.Binding<String>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, label, registry: ctx.registry, notifyDetail: "label",
read: { [w] in w.getLabel() },
write: { [w] v in w.setLabel(label: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Frame.setLabel(label:)
/// Creates a new `GtkLabel` with the `label` and sets it as the frame's
/// label widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Frame.setLabel(label:)`.
///
/// - Parameter label: Text of the frame's label.
/// - Returns: A copy of this view with the modifier applied.
public func label(_ label: @escaping () -> String?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setLabel(label: label()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(interpolation) | source: Gtk.Frame.setLabel(label:)
/// Creates a new `GtkLabel` with the `label` and sets it as the frame's
/// label widget.
///
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Gtk.Frame.setLabel(label:)`. A literal with no interpolation is applied once, with no subscription.
///
/// - Parameter label: Text of the frame's label.
/// - Returns: A copy of this view with the modifier applied.
public func label(_ label: Portico.InterpolatedText?) -> Self {
appending { w, ctx in
Portico.bindOptionalInterpolation(label, registry: ctx.registry) { [w] v in w.setLabel(label: v) }
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Frame.setLabelWidget(labelWidget:)
/// Sets the label widget for the frame.
///
/// This is the widget that will appear embedded in the top edge
/// of the frame as a title.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter labelWidget: Widget to display in place of the usual frame label.
/// - Returns: A copy of this view with the modifier applied.
public func labelWidget(_ labelWidget: Gtk.Widget?) -> Self {
appending { w, _ in
w.setLabelWidget(labelWidget: labelWidget)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(viewBuilder) | source: Gtk.Frame.setLabelWidget(labelWidget:)
/// Sets the label widget for the frame.
///
/// This is the widget that will appear embedded in the top edge
/// of the frame as a title.
///
/// 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 labelWidget: Widget to display in place of the usual frame label.
/// - Returns: A copy of this view with the modifier applied.
public func labelWidget(@ViewBuilder _ labelWidget: () -> [AnyView]) -> Self {
let labelWidgetViews = labelWidget()
return appending { w, ctx in
guard let v = labelWidgetViews.first else { return }
w.setLabelWidget(labelWidget: v.makeWidget(ctx))
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Frame.setLabelWidget(labelWidget:), GObject.Object.connectNotify(detail:_:), Gtk.Frame.getLabelWidget()
/// Sets the label widget for the frame.
///
/// This is the widget that will appear embedded in the top edge
/// of the frame as a title.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.Widget?` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
///
/// - Returns: A copy of this view with the modifier applied.
public func labelWidget<W: Gtk.Widget>(_ labelWidget: Portico.Binding<W?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, labelWidget, registry: ctx.registry, notifyDetail: "label-widget",
read: { [w] in w.getLabelWidget() as? W },
write: { [w] v in w.setLabelWidget(labelWidget: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Frame.setLabelWidget(labelWidget:), GObject.Object.connectNotify(detail:_:), Gtk.Frame.getLabelWidget()
/// Sets the label widget for the frame.
///
/// This is the widget that will appear embedded in the top edge
/// of the frame as a title.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Gtk.Widget>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.Widget?>` to be able to clear the property.
/// When `Gtk.Widget` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
/// A `nil` widget value is never written back into the binding.
///
/// - Returns: A copy of this view with the modifier applied.
public func labelWidget<W: Gtk.Widget>(_ labelWidget: Portico.Binding<W>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, labelWidget, registry: ctx.registry, notifyDetail: "label-widget",
read: { [w] in w.getLabelWidget() as? W },
write: { [w] v in w.setLabelWidget(labelWidget: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Frame.setLabelWidget(labelWidget:)
/// Sets the label widget for the frame.
///
/// This is the widget that will appear embedded in the top edge
/// of the frame as a title.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Frame.setLabelWidget(labelWidget:)`.
///
/// - Parameter labelWidget: Widget to display in place of the usual frame label.
/// - Returns: A copy of this view with the modifier applied.
public func labelWidget(_ labelWidget: @escaping () -> Gtk.Widget?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setLabelWidget(labelWidget: labelWidget()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Frame.setLabelAlign(xalign:)
/// Sets the X alignment of the frame widgets label.
///
/// The default value for a newly created frame is 0.0.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter labelXalign: The horizontal alignment of the label.
/// - Returns: A copy of this view with the modifier applied.
public func labelXalign(_ labelXalign: Float) -> Self {
appending { w, _ in
w.setLabelAlign(xalign: labelXalign)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Frame.setLabelAlign(xalign:), GObject.Object.connectNotify(detail:_:)
/// Sets the X alignment of the frame widgets label.
///
/// The default value for a newly created frame is 0.0.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Float` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
///
/// - Returns: A copy of this view with the modifier applied.
public func labelXalign(_ labelXalign: Portico.Binding<Float>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, labelXalign, registry: ctx.registry, notifyDetail: "label-xalign",
read: { [w] in w.labelXalign },
write: { [w] v in w.setLabelAlign(xalign: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Frame.setLabelAlign(xalign:)
/// Sets the X alignment of the frame widgets label.
///
/// The default value for a newly created frame is 0.0.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Frame.setLabelAlign(xalign:)`.
///
/// - Parameter labelXalign: The horizontal alignment of the label.
/// - Returns: A copy of this view with the modifier applied.
public func labelXalign(_ labelXalign: @escaping () -> Float) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setLabelAlign(xalign: labelXalign()) }
tracker.run()
ctx.registry.add(tracker)
}
}
}