portico/Sources/Portico/Generated/LayoutSlot.swift

54 lines
1.7 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.LayoutSlot
/// A child slot within [class`Layout`].
///
/// While it contains a layout child, the [property`Gtk`.Widget:visible] property
/// of the slot is updated to match that of the layout child.
///
/// See [class`MultiLayoutView`].
///
/// A Portico view that mounts a `Adw.LayoutSlot`.
@MainActor public struct LayoutSlot: View {
private let make: (MountContext) -> Adw.LayoutSlot
private var configure: [(Adw.LayoutSlot, MountContext) -> Void] = []
public var body: Never { fatalError() }
// PorticoGen: generateInits(static) | source: Adw.LayoutSlot.init(id:)
/// Creates a new `AdwLayoutSlot` with its ID set to `id`.
///
/// 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 id: The slot ID.
public init(id: String) {
make = { _ in Adw.LayoutSlot(id: id) }
}
}
extension LayoutSlot: WidgetView {
public typealias Target = Adw.LayoutSlot
@_spi(Portico) public func appending(
_ step: @escaping (Adw.LayoutSlot, MountContext) -> Void
) -> Self {
var c = self
c.configure.append(step)
return c
}
}
@_spi(Portico) extension LayoutSlot: Mountable {
@_spi(Portico) public func mount(_ ctx: MountContext) -> Gtk.Widget {
let w = make(ctx)
for step in configure { step(w, ctx) }
return w
}
}