192 lines
16 KiB
Swift
192 lines
16 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: Gtk.PageSetupUnixDialog
|
||
/// Presents a page setup dialog for platforms which don’t provide
|
||
/// a native page setup dialog, like Unix.
|
||
///
|
||
/// <picture>
|
||
/// <source srcset="pagesetupdialog-dark.png" media="(prefers-color-scheme: dark)">
|
||
/// <img alt="An example GtkPageSetupUnixDialog" src="pagesetupdialog.png">
|
||
/// </picture>
|
||
///
|
||
/// It can be used very much like any other GTK dialog, at the
|
||
/// cost of the portability offered by the high-level printing
|
||
/// API in [class`Gtk`.PrintOperation].
|
||
///
|
||
/// ## CSS nodes
|
||
///
|
||
/// `GtkPageSetupUnixDialog` has a single CSS node with the name `window` and
|
||
/// style class `.pagesetup`.
|
||
///
|
||
/// A Portico view that mounts a `Gtk.PageSetupUnixDialog`.
|
||
@MainActor public struct PageSetupUnixDialog: View {
|
||
private let make: (MountContext) -> Gtk.PageSetupUnixDialog
|
||
private var configure: [(Gtk.PageSetupUnixDialog, MountContext) -> Void] = []
|
||
|
||
public var body: Never { fatalError() }
|
||
|
||
// PorticoGen: generateInits(static) | source: Gtk.PageSetupUnixDialog.init(title:parent:)
|
||
/// Creates a new page setup dialog.
|
||
///
|
||
/// 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 title: The `title` value forwarded to `Gtk.PageSetupUnixDialog`.
|
||
/// - Parameter parent: The `parent` value forwarded to `Gtk.PageSetupUnixDialog`.
|
||
/// - Parameter application: The `GtkApplication` associated with the window.
|
||
/// - Parameter decorated: Whether the window should have a frame (also known as *decorations*).
|
||
/// - Parameter deletable: Whether the window frame should have a close button.
|
||
/// - Parameter destroyWithParent: If this window should be destroyed when the parent is destroyed.
|
||
/// - Parameter display: The display that will display this window.
|
||
/// - Parameter focusVisible: Whether 'focus rectangles' are currently visible in this window.
|
||
/// - Parameter gravity: The gravity to use when resizing the window programmatically.
|
||
/// - Parameter handleMenubarAccel: Whether the window frame should handle <kbd>F10</kbd> for activating menubars.
|
||
/// - Parameter hideOnClose: If this window should be hidden instead of destroyed when the user clicks the close button.
|
||
/// - Parameter iconName: Specifies the name of the themed icon to use as the window icon.
|
||
/// - Parameter mnemonicsVisible: Whether mnemonics are currently visible in this window.
|
||
/// - Parameter modal: If true, the window is modal.
|
||
/// - Parameter resizable: If true, users can resize the window.
|
||
/// - Parameter startupId: A write-only property for setting window's startup notification identifier.
|
||
/// - Parameter transientFor: The transient parent of the window.
|
||
/// - Parameter child: A `ViewBuilder` closure whose first view is mounted into the `child` slot.
|
||
/// - Parameter defaultWidget: A `ViewBuilder` closure whose first view is mounted into the `defaultWidget` slot.
|
||
/// - Parameter focusWidget: A `ViewBuilder` closure whose first view is mounted into the `focusWidget` slot.
|
||
/// - Parameter titlebar: A `ViewBuilder` closure whose first view is mounted into the `titlebar` slot.
|
||
/// - Parameter onClose: Invoked when the widget emits the `close` signal.
|
||
/// - Parameter onResponse: Invoked when the widget emits the `response` signal. The closure receives the signal's arguments in order.
|
||
/// - Parameter onActivateDefault: Invoked when the widget emits the `activate-default` signal.
|
||
/// - Parameter onActivateFocus: Invoked when the widget emits the `activate-focus` signal.
|
||
/// - Parameter onCloseRequest: Invoked when the widget emits the `close-request` signal. Its return value is forwarded to GTK as the signal's result.
|
||
/// - Parameter onEnableDebugging: Invoked when the widget emits the `enable-debugging` signal. The closure receives the signal's arguments in order. Its return value is forwarded to GTK as the signal's result.
|
||
/// - Parameter onKeysChanged: Invoked when the widget emits the `keys-changed` signal.
|
||
@_disfavoredOverload
|
||
public init<S: StringProtocol>(title: S?, parent: Gtk.Window?, application: Gtk.Application? = nil, decorated: Bool? = nil, deletable: Bool? = nil, destroyWithParent: Bool? = nil, display: Gtk.Display? = nil, focusVisible: Bool? = nil, gravity: Gtk.WindowGravity? = nil, handleMenubarAccel: Bool? = nil, hideOnClose: Bool? = nil, iconName: String? = nil, mnemonicsVisible: Bool? = nil, modal: Bool? = nil, resizable: Bool? = nil, startupId: String? = nil, transientFor: Gtk.Window? = nil, @ViewBuilder child: @escaping () -> [AnyView] = { [] }, @ViewBuilder defaultWidget: @escaping () -> [AnyView] = { [] }, @ViewBuilder focusWidget: @escaping () -> [AnyView] = { [] }, @ViewBuilder titlebar: @escaping () -> [AnyView] = { [] }, onClose: (() -> Void)? = nil, onResponse: ((Int32) -> Void)? = nil, onActivateDefault: (() -> Void)? = nil, onActivateFocus: (() -> Void)? = nil, onCloseRequest: (() -> Bool)? = nil, onEnableDebugging: ((Bool) -> Bool)? = nil, onKeysChanged: (() -> Void)? = nil) {
|
||
make = { _ in Gtk.PageSetupUnixDialog(title: title.map { String($0) }, parent: parent) }
|
||
configure.append { w, ctx in
|
||
if let application { w.setApplication(application: application) }
|
||
if let decorated { w.setDecorated(setting: decorated) }
|
||
if let deletable { w.setDeletable(setting: deletable) }
|
||
if let destroyWithParent { w.setDestroyWithParent(setting: destroyWithParent) }
|
||
if let display { w.setDisplay(display: display) }
|
||
if let focusVisible { w.setFocusVisible(setting: focusVisible) }
|
||
if let gravity { w.setGravity(gravity: gravity) }
|
||
if let handleMenubarAccel { w.setHandleMenubarAccel(handleMenubarAccel: handleMenubarAccel) }
|
||
if let hideOnClose { w.setHideOnClose(setting: hideOnClose) }
|
||
if let iconName { w.setIconName(name: iconName) }
|
||
if let mnemonicsVisible { w.setMnemonicsVisible(setting: mnemonicsVisible) }
|
||
if let modal { w.setModal(modal: modal) }
|
||
if let resizable { w.setResizable(resizable: resizable) }
|
||
if let startupId { w.setStartupId(startupId: startupId) }
|
||
if let transientFor { w.setTransientFor(parent: transientFor) }
|
||
if let v = Portico.mountSlotChild(child, ctx, onUpdate: { v in w.setChild(child: v) }) { w.setChild(child: v) }
|
||
if let v = Portico.mountSlotChild(defaultWidget, ctx, onUpdate: { v in w.setDefaultWidget(defaultWidget: v) }) { w.setDefaultWidget(defaultWidget: v) }
|
||
if let v = Portico.mountSlotChild(focusWidget, ctx, onUpdate: { v in w.setFocus(focus: v) }) { w.setFocus(focus: v) }
|
||
if let v = Portico.mountSlotChild(titlebar, ctx, onUpdate: { v in w.setTitlebar(titlebar: v) }) { w.setTitlebar(titlebar: v) }
|
||
if let onClose { ctx.registry.add(w.connectClose { _ in onClose() }) }
|
||
if let onResponse { ctx.registry.add(w.connectResponse { _, a0 in onResponse(a0) }) }
|
||
if let onActivateDefault { ctx.registry.add(w.connectActivateDefault { _ in onActivateDefault() }) }
|
||
if let onActivateFocus { ctx.registry.add(w.connectActivateFocus { _ in onActivateFocus() }) }
|
||
if let onCloseRequest { ctx.registry.add(w.connectCloseRequest { _ in onCloseRequest() }) }
|
||
if let onEnableDebugging { ctx.registry.add(w.connectEnableDebugging { _, a0 in onEnableDebugging(a0) }) }
|
||
if let onKeysChanged { ctx.registry.add(w.connectKeysChanged { _ in onKeysChanged() }) }
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateInits(interpolation) | source: Gtk.PageSetupUnixDialog.init(title:parent:), Gtk.PageSetupUnixDialog.setTitle(title:)
|
||
/// Creates a new page setup dialog.
|
||
///
|
||
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Gtk.PageSetupUnixDialog.setTitle(title:)`. 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 title: The `title` value forwarded to `Gtk.PageSetupUnixDialog`.
|
||
/// - Parameter parent: The `parent` value forwarded to `Gtk.PageSetupUnixDialog`.
|
||
/// - Parameter application: The `GtkApplication` associated with the window.
|
||
/// - Parameter decorated: Whether the window should have a frame (also known as *decorations*).
|
||
/// - Parameter deletable: Whether the window frame should have a close button.
|
||
/// - Parameter destroyWithParent: If this window should be destroyed when the parent is destroyed.
|
||
/// - Parameter display: The display that will display this window.
|
||
/// - Parameter focusVisible: Whether 'focus rectangles' are currently visible in this window.
|
||
/// - Parameter gravity: The gravity to use when resizing the window programmatically.
|
||
/// - Parameter handleMenubarAccel: Whether the window frame should handle <kbd>F10</kbd> for activating menubars.
|
||
/// - Parameter hideOnClose: If this window should be hidden instead of destroyed when the user clicks the close button.
|
||
/// - Parameter iconName: Specifies the name of the themed icon to use as the window icon.
|
||
/// - Parameter mnemonicsVisible: Whether mnemonics are currently visible in this window.
|
||
/// - Parameter modal: If true, the window is modal.
|
||
/// - Parameter resizable: If true, users can resize the window.
|
||
/// - Parameter startupId: A write-only property for setting window's startup notification identifier.
|
||
/// - Parameter transientFor: The transient parent of the window.
|
||
/// - Parameter child: A `ViewBuilder` closure whose first view is mounted into the `child` slot.
|
||
/// - Parameter defaultWidget: A `ViewBuilder` closure whose first view is mounted into the `defaultWidget` slot.
|
||
/// - Parameter focusWidget: A `ViewBuilder` closure whose first view is mounted into the `focusWidget` slot.
|
||
/// - Parameter titlebar: A `ViewBuilder` closure whose first view is mounted into the `titlebar` slot.
|
||
/// - Parameter onClose: Invoked when the widget emits the `close` signal.
|
||
/// - Parameter onResponse: Invoked when the widget emits the `response` signal. The closure receives the signal's arguments in order.
|
||
/// - Parameter onActivateDefault: Invoked when the widget emits the `activate-default` signal.
|
||
/// - Parameter onActivateFocus: Invoked when the widget emits the `activate-focus` signal.
|
||
/// - Parameter onCloseRequest: Invoked when the widget emits the `close-request` signal. Its return value is forwarded to GTK as the signal's result.
|
||
/// - Parameter onEnableDebugging: Invoked when the widget emits the `enable-debugging` signal. The closure receives the signal's arguments in order. Its return value is forwarded to GTK as the signal's result.
|
||
/// - Parameter onKeysChanged: Invoked when the widget emits the `keys-changed` signal.
|
||
public init(title: Portico.InterpolatedText?, parent: Gtk.Window?, application: Gtk.Application? = nil, decorated: Bool? = nil, deletable: Bool? = nil, destroyWithParent: Bool? = nil, display: Gtk.Display? = nil, focusVisible: Bool? = nil, gravity: Gtk.WindowGravity? = nil, handleMenubarAccel: Bool? = nil, hideOnClose: Bool? = nil, iconName: String? = nil, mnemonicsVisible: Bool? = nil, modal: Bool? = nil, resizable: Bool? = nil, startupId: String? = nil, transientFor: Gtk.Window? = nil, @ViewBuilder child: @escaping () -> [AnyView] = { [] }, @ViewBuilder defaultWidget: @escaping () -> [AnyView] = { [] }, @ViewBuilder focusWidget: @escaping () -> [AnyView] = { [] }, @ViewBuilder titlebar: @escaping () -> [AnyView] = { [] }, onClose: (() -> Void)? = nil, onResponse: ((Int32) -> Void)? = nil, onActivateDefault: (() -> Void)? = nil, onActivateFocus: (() -> Void)? = nil, onCloseRequest: (() -> Bool)? = nil, onEnableDebugging: ((Bool) -> Bool)? = nil, onKeysChanged: (() -> Void)? = nil) {
|
||
make = { _ in Gtk.PageSetupUnixDialog(title: title?.untrackedText, parent: parent) }
|
||
configure.append { w, ctx in
|
||
Portico.bindOptionalInterpolation(title, registry: ctx.registry) { [w] v in w.setTitle(title: v) }
|
||
if let application { w.setApplication(application: application) }
|
||
if let decorated { w.setDecorated(setting: decorated) }
|
||
if let deletable { w.setDeletable(setting: deletable) }
|
||
if let destroyWithParent { w.setDestroyWithParent(setting: destroyWithParent) }
|
||
if let display { w.setDisplay(display: display) }
|
||
if let focusVisible { w.setFocusVisible(setting: focusVisible) }
|
||
if let gravity { w.setGravity(gravity: gravity) }
|
||
if let handleMenubarAccel { w.setHandleMenubarAccel(handleMenubarAccel: handleMenubarAccel) }
|
||
if let hideOnClose { w.setHideOnClose(setting: hideOnClose) }
|
||
if let iconName { w.setIconName(name: iconName) }
|
||
if let mnemonicsVisible { w.setMnemonicsVisible(setting: mnemonicsVisible) }
|
||
if let modal { w.setModal(modal: modal) }
|
||
if let resizable { w.setResizable(resizable: resizable) }
|
||
if let startupId { w.setStartupId(startupId: startupId) }
|
||
if let transientFor { w.setTransientFor(parent: transientFor) }
|
||
if let v = Portico.mountSlotChild(child, ctx, onUpdate: { v in w.setChild(child: v) }) { w.setChild(child: v) }
|
||
if let v = Portico.mountSlotChild(defaultWidget, ctx, onUpdate: { v in w.setDefaultWidget(defaultWidget: v) }) { w.setDefaultWidget(defaultWidget: v) }
|
||
if let v = Portico.mountSlotChild(focusWidget, ctx, onUpdate: { v in w.setFocus(focus: v) }) { w.setFocus(focus: v) }
|
||
if let v = Portico.mountSlotChild(titlebar, ctx, onUpdate: { v in w.setTitlebar(titlebar: v) }) { w.setTitlebar(titlebar: v) }
|
||
if let onClose { ctx.registry.add(w.connectClose { _ in onClose() }) }
|
||
if let onResponse { ctx.registry.add(w.connectResponse { _, a0 in onResponse(a0) }) }
|
||
if let onActivateDefault { ctx.registry.add(w.connectActivateDefault { _ in onActivateDefault() }) }
|
||
if let onActivateFocus { ctx.registry.add(w.connectActivateFocus { _ in onActivateFocus() }) }
|
||
if let onCloseRequest { ctx.registry.add(w.connectCloseRequest { _ in onCloseRequest() }) }
|
||
if let onEnableDebugging { ctx.registry.add(w.connectEnableDebugging { _, a0 in onEnableDebugging(a0) }) }
|
||
if let onKeysChanged { ctx.registry.add(w.connectKeysChanged { _ in onKeysChanged() }) }
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
extension PageSetupUnixDialog: WidgetView {
|
||
public typealias Target = Gtk.PageSetupUnixDialog
|
||
|
||
@_spi(Portico) public func appending(
|
||
_ step: @escaping (Gtk.PageSetupUnixDialog, MountContext) -> Void
|
||
) -> Self {
|
||
var c = self
|
||
c.configure.append(step)
|
||
return c
|
||
}
|
||
}
|
||
|
||
@_spi(Portico) extension PageSetupUnixDialog: Mountable {
|
||
@_spi(Portico) public func mount(_ ctx: MountContext) -> Gtk.Widget {
|
||
let w = make(ctx)
|
||
for step in configure { step(w, ctx) }
|
||
return w
|
||
}
|
||
}
|