168 lines
5.7 KiB
Swift
168 lines
5.7 KiB
Swift
// Generated by PorticoGen. DO NOT EDIT — see Sources/PorticoGen to make changes.
|
|
|
|
import Adw
|
|
import Gtk
|
|
import Gio
|
|
import Gdk
|
|
|
|
/// A NavigationView widget backed by `Adw.NavigationView`.
|
|
@MainActor public struct NavigationView: View {
|
|
private let make: (MountContext) -> Adw.NavigationView
|
|
private var configure: [(Adw.NavigationView, MountContext) -> Void] = []
|
|
|
|
public var body: Never { fatalError() }
|
|
|
|
public init() {
|
|
make = { _ in Adw.NavigationView() }
|
|
}
|
|
|
|
}
|
|
|
|
extension NavigationView: WidgetView {
|
|
public typealias Target = Adw.NavigationView
|
|
|
|
@_spi(Portico) public func appending(
|
|
_ step: @escaping (Adw.NavigationView, MountContext) -> Void
|
|
) -> Self {
|
|
var c = self
|
|
c.configure.append(step)
|
|
return c
|
|
}
|
|
}
|
|
|
|
@_spi(Portico) extension NavigationView: Mountable {
|
|
@_spi(Portico) public func mount(_ ctx: MountContext) -> Gtk.Widget {
|
|
let w = make(ctx)
|
|
for step in configure { step(w, ctx) }
|
|
return w
|
|
}
|
|
}
|
|
|
|
/// Modifiers for `Adw.NavigationView`, available on every Portico view whose
|
|
/// backing widget is `Adw.NavigationView` or one of its subclasses.
|
|
extension WidgetView where Target: Adw.NavigationView {
|
|
/// Sets animateTransitions (static).
|
|
public func animateTransitions(_ animateTransitions: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setAnimateTransitions(animateTransitions: animateTransitions)
|
|
}
|
|
}
|
|
|
|
/// Sets animateTransitions (reactive, binding).
|
|
public func animateTransitions(_ animateTransitions: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
w.setAnimateTransitions(animateTransitions: animateTransitions.wrappedValue)
|
|
ctx.registry.add(animateTransitions.subscribe { [w] v in w.setAnimateTransitions(animateTransitions: v) })
|
|
}
|
|
}
|
|
|
|
/// Sets animateTransitions (reactive, tracked closure).
|
|
public func animateTransitions(_ animateTransitions: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setAnimateTransitions(animateTransitions: animateTransitions()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
/// Sets hhomogeneous (static).
|
|
public func hhomogeneous(_ hhomogeneous: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setHhomogeneous(hhomogeneous: hhomogeneous)
|
|
}
|
|
}
|
|
|
|
/// Sets hhomogeneous (reactive, binding).
|
|
public func hhomogeneous(_ hhomogeneous: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
w.setHhomogeneous(hhomogeneous: hhomogeneous.wrappedValue)
|
|
ctx.registry.add(hhomogeneous.subscribe { [w] v in w.setHhomogeneous(hhomogeneous: v) })
|
|
}
|
|
}
|
|
|
|
/// Sets hhomogeneous (reactive, tracked closure).
|
|
public func hhomogeneous(_ hhomogeneous: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setHhomogeneous(hhomogeneous: hhomogeneous()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
/// Sets popOnEscape (static).
|
|
public func popOnEscape(_ popOnEscape: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setPopOnEscape(popOnEscape: popOnEscape)
|
|
}
|
|
}
|
|
|
|
/// Sets popOnEscape (reactive, binding).
|
|
public func popOnEscape(_ popOnEscape: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
w.setPopOnEscape(popOnEscape: popOnEscape.wrappedValue)
|
|
ctx.registry.add(popOnEscape.subscribe { [w] v in w.setPopOnEscape(popOnEscape: v) })
|
|
}
|
|
}
|
|
|
|
/// Sets popOnEscape (reactive, tracked closure).
|
|
public func popOnEscape(_ popOnEscape: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setPopOnEscape(popOnEscape: popOnEscape()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
/// Sets vhomogeneous (static).
|
|
public func vhomogeneous(_ vhomogeneous: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setVhomogeneous(vhomogeneous: vhomogeneous)
|
|
}
|
|
}
|
|
|
|
/// Sets vhomogeneous (reactive, binding).
|
|
public func vhomogeneous(_ vhomogeneous: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
w.setVhomogeneous(vhomogeneous: vhomogeneous.wrappedValue)
|
|
ctx.registry.add(vhomogeneous.subscribe { [w] v in w.setVhomogeneous(vhomogeneous: v) })
|
|
}
|
|
}
|
|
|
|
/// Sets vhomogeneous (reactive, tracked closure).
|
|
public func vhomogeneous(_ vhomogeneous: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setVhomogeneous(vhomogeneous: vhomogeneous()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
/// Connects the `GetNextPage` signal.
|
|
public func onGetNextPage(_ handler: @escaping () -> Adw.NavigationPage?) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectGetNextPage { _ in handler() })
|
|
}
|
|
}
|
|
|
|
/// Connects the `Popped` signal.
|
|
public func onPopped(_ handler: @escaping (Adw.NavigationPage) -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectPopped { _, a0 in handler(a0) })
|
|
}
|
|
}
|
|
|
|
/// Connects the `Pushed` signal.
|
|
public func onPushed(_ handler: @escaping () -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectPushed { _ in handler() })
|
|
}
|
|
}
|
|
|
|
/// Connects the `Replaced` signal.
|
|
public func onReplaced(_ handler: @escaping () -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectReplaced { _ in handler() })
|
|
}
|
|
}
|
|
|
|
}
|