2042 lines
114 KiB
Swift
2042 lines
114 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.Window
|
||
/// A freeform window.
|
||
///
|
||
/// <picture>
|
||
/// <source srcset="window-dark.png" media="(prefers-color-scheme: dark)">
|
||
/// <img src="window.png" alt="window">
|
||
/// </picture>
|
||
///
|
||
/// The `AdwWindow` widget is a subclass of [class`Gtk`.Window] which has no
|
||
/// titlebar area. Instead, [class`ToolbarView`] can be used together with
|
||
/// [class`HeaderBar`] or [class`Gtk`.HeaderBar] as follows:
|
||
///
|
||
/// ```xml
|
||
/// <object class="AdwWindow">
|
||
/// <property name="content">
|
||
/// <object class="AdwToolbarView">
|
||
/// <child type="top">
|
||
/// <object class="AdwHeaderBar"/>
|
||
/// </child>
|
||
/// <property name="content">
|
||
/// <!-- ... -->
|
||
/// </property>
|
||
/// </object>
|
||
/// </property>
|
||
/// </object>
|
||
/// ```
|
||
///
|
||
/// Using [property`Gtk`.Window:titlebar] or [property`Gtk`.Window:child]
|
||
/// is not supported and will result in a crash. Use [property`Window`:content]
|
||
/// instead.
|
||
///
|
||
/// ## Dialogs
|
||
///
|
||
/// `AdwWindow` can contain [class`Dialog`]. Use [method`Dialog`.present] with the
|
||
/// window or a widget within a window to show a dialog.
|
||
///
|
||
/// ## Breakpoints
|
||
///
|
||
/// `AdwWindow` can be used with [class`Breakpoint`] the same way as
|
||
/// [class`BreakpointBin`]. Refer to that widget's documentation for details.
|
||
///
|
||
/// Example:
|
||
///
|
||
/// ```xml
|
||
/// <object class="AdwWindow">
|
||
/// <property name="content">
|
||
/// <object class="AdwToolbarView">
|
||
/// <child type="top">
|
||
/// <object class="AdwHeaderBar"/>
|
||
/// </child>
|
||
/// <property name="content">
|
||
/// <!-- ... -->
|
||
/// </property>
|
||
/// <child type="bottom">
|
||
/// <object class="GtkActionBar" id="bottom_bar">
|
||
/// <property name="revealed">True</property>
|
||
/// <property name="visible">False</property>
|
||
/// </object>
|
||
/// </child>
|
||
/// </object>
|
||
/// </property>
|
||
/// <child>
|
||
/// <object class="AdwBreakpoint">
|
||
/// <condition>max-width: 500px</condition>
|
||
/// <setter object="bottom_bar" property="visible">True</setter>
|
||
/// </object>
|
||
/// </child>
|
||
/// </object>
|
||
/// ```
|
||
///
|
||
/// When breakpoints are used, the minimum size must be larger than the smallest
|
||
/// UI state. `AdwWindow` defaults to the minimum size of 360×200 px. If that's
|
||
/// too small, set the [property`Gtk`.Widget:width-request] and
|
||
/// [property`Gtk`.Widget:height-request] properties manually.
|
||
///
|
||
/// ## Adaptive Preview
|
||
///
|
||
/// `AdwWindow` has a debug tool called adaptive preview. It can be opened from
|
||
/// GTK Inspector or by pressing <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>M</kbd>,
|
||
/// and controlled via the [property`Window`:adaptive-preview] property.
|
||
///
|
||
/// A Portico view that mounts a `Adw.Window`.
|
||
@MainActor public struct Window: View {
|
||
private let make: (MountContext) -> Adw.Window
|
||
private var configure: [(Adw.Window, MountContext) -> Void] = []
|
||
|
||
public var body: Never { fatalError() }
|
||
|
||
// PorticoGen: generateInits(static) | source: Adw.Window.init()
|
||
/// Creates a new `AdwWindow`.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for values that change.
|
||
/// 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 adaptivePreview: Whether adaptive preview is currently open.
|
||
/// - 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 title: The title of the window.
|
||
/// - Parameter transientFor: The transient parent of the window.
|
||
/// - Parameter content: A `ViewBuilder` closure whose first view is mounted into the `content` slot.
|
||
/// - 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 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(adaptivePreview: Bool? = nil, 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, title: String? = nil, transientFor: Gtk.Window? = nil, @ViewBuilder content: @escaping () -> [AnyView] = { [] }, @ViewBuilder child: @escaping () -> [AnyView] = { [] }, @ViewBuilder defaultWidget: @escaping () -> [AnyView] = { [] }, @ViewBuilder focusWidget: @escaping () -> [AnyView] = { [] }, @ViewBuilder titlebar: @escaping () -> [AnyView] = { [] }, onActivateDefault: (() -> Void)? = nil, onActivateFocus: (() -> Void)? = nil, onCloseRequest: (() -> Bool)? = nil, onEnableDebugging: ((Bool) -> Bool)? = nil, onKeysChanged: (() -> Void)? = nil) {
|
||
make = { _ in Adw.Window() }
|
||
configure.append { w, ctx in
|
||
if let adaptivePreview { w.setAdaptivePreview(adaptivePreview: adaptivePreview) }
|
||
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 title { w.setTitle(title: title) }
|
||
if let transientFor { w.setTransientFor(parent: transientFor) }
|
||
if let v = Portico.mountSlotChild(content, ctx, onUpdate: { v in w.setContent(content: v) }) { w.setContent(content: v) }
|
||
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 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 Window: WidgetView {
|
||
public typealias Target = Adw.Window
|
||
|
||
@_spi(Portico) public func appending(
|
||
_ step: @escaping (Adw.Window, MountContext) -> Void
|
||
) -> Self {
|
||
var c = self
|
||
c.configure.append(step)
|
||
return c
|
||
}
|
||
}
|
||
|
||
@_spi(Portico) extension Window: 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.Window
|
||
/// Modifiers for `Adw.Window`, available on every Portico view whose
|
||
/// backing widget is `Adw.Window` or one of its subclasses.
|
||
extension WidgetView where Target: Adw.Window {
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.Window.setAdaptivePreview(adaptivePreview:)
|
||
/// Sets whether adaptive preview for `self` is currently open.
|
||
///
|
||
/// Adaptive preview is a debugging tool used for testing the window
|
||
/// contents at specific screen sizes, simulating mobile environment.
|
||
///
|
||
/// Adaptive preview can always be accessed from inspector. This function
|
||
/// allows applications to open it manually.
|
||
///
|
||
/// Most applications should not use this function.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter adaptivePreview: Whether adaptive preview is currently open.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func adaptivePreview(_ adaptivePreview: Bool) -> Self {
|
||
appending { w, _ in
|
||
w.setAdaptivePreview(adaptivePreview: adaptivePreview)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.Window.setAdaptivePreview(adaptivePreview:), GObject.Object.connectNotify(detail:_:), Adw.Window.getAdaptivePreview()
|
||
/// Sets whether adaptive preview for `self` is currently open.
|
||
///
|
||
/// Adaptive preview is a debugging tool used for testing the window
|
||
/// contents at specific screen sizes, simulating mobile environment.
|
||
///
|
||
/// Adaptive preview can always be accessed from inspector. This function
|
||
/// allows applications to open it manually.
|
||
///
|
||
/// Most applications should not use this function.
|
||
///
|
||
/// 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 adaptivePreview(_ adaptivePreview: Portico.Binding<Bool>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, adaptivePreview, registry: ctx.registry, notifyDetail: "adaptive-preview",
|
||
read: { [w] in w.getAdaptivePreview() },
|
||
write: { [w] v in w.setAdaptivePreview(adaptivePreview: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.Window.setAdaptivePreview(adaptivePreview:)
|
||
/// Sets whether adaptive preview for `self` is currently open.
|
||
///
|
||
/// Adaptive preview is a debugging tool used for testing the window
|
||
/// contents at specific screen sizes, simulating mobile environment.
|
||
///
|
||
/// Adaptive preview can always be accessed from inspector. This function
|
||
/// allows applications to open it manually.
|
||
///
|
||
/// Most applications should not use this function.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.Window.setAdaptivePreview(adaptivePreview:)`.
|
||
///
|
||
/// - Parameter adaptivePreview: Whether adaptive preview is currently open.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func adaptivePreview(_ adaptivePreview: @escaping () -> Bool) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setAdaptivePreview(adaptivePreview: adaptivePreview()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.Window.setContent(content:)
|
||
/// Sets the content widget of `self`.
|
||
///
|
||
/// This method should always be used instead of [method`Gtk`.Window.set_child].
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter content: The content widget.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func content(_ content: Adw.Widget?) -> Self {
|
||
appending { w, _ in
|
||
w.setContent(content: content)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(viewBuilder) | source: Adw.Window.setContent(content:)
|
||
/// Sets the content widget of `self`.
|
||
///
|
||
/// This method should always be used instead of [method`Gtk`.Window.set_child].
|
||
///
|
||
/// 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 content: The content widget.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func content(@ViewBuilder _ content: () -> [AnyView]) -> Self {
|
||
let contentViews = content()
|
||
return appending { w, ctx in
|
||
guard let v = contentViews.first else { return }
|
||
w.setContent(content: v.makeWidget(ctx))
|
||
}
|
||
}
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.Window.setContent(content:), GObject.Object.connectNotify(detail:_:), Adw.Window.getContent()
|
||
/// Sets the content widget of `self`.
|
||
///
|
||
/// This method should always be used instead of [method`Gtk`.Window.set_child].
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Adw.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 content<W: Gtk.Widget>(_ content: Portico.Binding<W?>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, content, registry: ctx.registry, notifyDetail: "content",
|
||
read: { [w] in w.getContent() as? W },
|
||
write: { [w] v in w.setContent(content: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Adw.Window.setContent(content:), GObject.Object.connectNotify(detail:_:), Adw.Window.getContent()
|
||
/// Sets the content widget of `self`.
|
||
///
|
||
/// This method should always be used instead of [method`Gtk`.Window.set_child].
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// `Binding` is invariant, so a `Binding<Adw.Widget>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Adw.Widget?>` to be able to clear the property.
|
||
/// When `Adw.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 content<W: Gtk.Widget>(_ content: Portico.Binding<W>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, content, registry: ctx.registry, notifyDetail: "content",
|
||
read: { [w] in w.getContent() as? W },
|
||
write: { [w] v in w.setContent(content: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.Window.setContent(content:)
|
||
/// Sets the content widget of `self`.
|
||
///
|
||
/// This method should always be used instead of [method`Gtk`.Window.set_child].
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.Window.setContent(content:)`.
|
||
///
|
||
/// - Parameter content: The content widget.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func content(_ content: @escaping () -> Adw.Widget?) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setContent(content: content()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension | source: Gtk.Window
|
||
/// Modifiers for `Gtk.Window`, available on every Portico view whose
|
||
/// backing widget is `Gtk.Window` or one of its subclasses.
|
||
extension WidgetView where Target: Gtk.Window {
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setApplication(application:)
|
||
/// Sets or unsets the application object associated with the window.
|
||
///
|
||
/// The application will be kept alive for at least as long as it has
|
||
/// any windows associated with it (see [method`Gio`.Application.hold]
|
||
/// for a way to keep it alive without windows).
|
||
///
|
||
/// Normally, the connection between the application and the window will
|
||
/// remain until the window is destroyed, but you can explicitly remove
|
||
/// it by setting the `application` to `nil`.
|
||
///
|
||
/// This is equivalent to calling [method`Gtk`.Application.remove_window]
|
||
/// and/or [method`Gtk`.Application.add_window] on the old/new applications
|
||
/// as relevant.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter application: The `GtkApplication` associated with the window.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func application(_ application: Gtk.Application?) -> Self {
|
||
appending { w, _ in
|
||
w.setApplication(application: application)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Window.setApplication(application:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getApplication()
|
||
/// Sets or unsets the application object associated with the window.
|
||
///
|
||
/// The application will be kept alive for at least as long as it has
|
||
/// any windows associated with it (see [method`Gio`.Application.hold]
|
||
/// for a way to keep it alive without windows).
|
||
///
|
||
/// Normally, the connection between the application and the window will
|
||
/// remain until the window is destroyed, but you can explicitly remove
|
||
/// it by setting the `application` to `nil`.
|
||
///
|
||
/// This is equivalent to calling [method`Gtk`.Application.remove_window]
|
||
/// and/or [method`Gtk`.Application.add_window] on the old/new applications
|
||
/// as relevant.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Gtk.Application?` 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 application(_ application: Portico.Binding<Gtk.Application?>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, application, registry: ctx.registry, notifyDetail: "application",
|
||
read: { [w] in w.getApplication() },
|
||
write: { [w] v in w.setApplication(application: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Window.setApplication(application:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getApplication()
|
||
/// Sets or unsets the application object associated with the window.
|
||
///
|
||
/// The application will be kept alive for at least as long as it has
|
||
/// any windows associated with it (see [method`Gio`.Application.hold]
|
||
/// for a way to keep it alive without windows).
|
||
///
|
||
/// Normally, the connection between the application and the window will
|
||
/// remain until the window is destroyed, but you can explicitly remove
|
||
/// it by setting the `application` to `nil`.
|
||
///
|
||
/// This is equivalent to calling [method`Gtk`.Application.remove_window]
|
||
/// and/or [method`Gtk`.Application.add_window] on the old/new applications
|
||
/// as relevant.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// `Binding` is invariant, so a `Binding<Gtk.Application>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.Application?>` to be able to clear the property.
|
||
/// When `Gtk.Application` 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 application(_ application: Portico.Binding<Gtk.Application>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, application, registry: ctx.registry, notifyDetail: "application",
|
||
read: { [w] in w.getApplication() },
|
||
write: { [w] v in w.setApplication(application: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Window.setApplication(application:)
|
||
/// Sets or unsets the application object associated with the window.
|
||
///
|
||
/// The application will be kept alive for at least as long as it has
|
||
/// any windows associated with it (see [method`Gio`.Application.hold]
|
||
/// for a way to keep it alive without windows).
|
||
///
|
||
/// Normally, the connection between the application and the window will
|
||
/// remain until the window is destroyed, but you can explicitly remove
|
||
/// it by setting the `application` to `nil`.
|
||
///
|
||
/// This is equivalent to calling [method`Gtk`.Application.remove_window]
|
||
/// and/or [method`Gtk`.Application.add_window] on the old/new applications
|
||
/// as relevant.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setApplication(application:)`.
|
||
///
|
||
/// - Parameter application: The `GtkApplication` associated with the window.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func application(_ application: @escaping () -> Gtk.Application?) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setApplication(application: application()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setChild(child:)
|
||
/// Sets the child widget of the window.
|
||
///
|
||
/// 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.Window.setChild(child:)
|
||
/// Sets the child widget of the window.
|
||
///
|
||
/// 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.Window.setChild(child:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getChild()
|
||
/// Sets the child widget of the window.
|
||
///
|
||
/// 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.Window.setChild(child:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getChild()
|
||
/// Sets the child widget of the window.
|
||
///
|
||
/// 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.Window.setChild(child:)
|
||
/// Sets the child widget of the window.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.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.Window.setDecorated(setting:)
|
||
/// Sets whether the window should be decorated.
|
||
///
|
||
/// By default, windows are decorated with a title bar, resize
|
||
/// controls, etc. Some window managers allow GTK to disable these
|
||
/// decorations, creating a borderless window. If you set the decorated
|
||
/// property to false using this function, GTK will do its best to
|
||
/// convince the window manager not to decorate the window. Depending on
|
||
/// the system, this function may not have any effect when called on a
|
||
/// window that is already visible, so you should call it before calling
|
||
/// [method`Gtk`.Widget.show].
|
||
///
|
||
/// On Windows, this function always works, since there’s no window manager
|
||
/// policy involved.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter decorated: Whether the window should have a frame (also known as *decorations*).
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func decorated(_ decorated: Bool) -> Self {
|
||
appending { w, _ in
|
||
w.setDecorated(setting: decorated)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Window.setDecorated(setting:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getDecorated()
|
||
/// Sets whether the window should be decorated.
|
||
///
|
||
/// By default, windows are decorated with a title bar, resize
|
||
/// controls, etc. Some window managers allow GTK to disable these
|
||
/// decorations, creating a borderless window. If you set the decorated
|
||
/// property to false using this function, GTK will do its best to
|
||
/// convince the window manager not to decorate the window. Depending on
|
||
/// the system, this function may not have any effect when called on a
|
||
/// window that is already visible, so you should call it before calling
|
||
/// [method`Gtk`.Widget.show].
|
||
///
|
||
/// On Windows, this function always works, since there’s no window manager
|
||
/// policy involved.
|
||
///
|
||
/// 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 decorated(_ decorated: Portico.Binding<Bool>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, decorated, registry: ctx.registry, notifyDetail: "decorated",
|
||
read: { [w] in w.getDecorated() },
|
||
write: { [w] v in w.setDecorated(setting: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Window.setDecorated(setting:)
|
||
/// Sets whether the window should be decorated.
|
||
///
|
||
/// By default, windows are decorated with a title bar, resize
|
||
/// controls, etc. Some window managers allow GTK to disable these
|
||
/// decorations, creating a borderless window. If you set the decorated
|
||
/// property to false using this function, GTK will do its best to
|
||
/// convince the window manager not to decorate the window. Depending on
|
||
/// the system, this function may not have any effect when called on a
|
||
/// window that is already visible, so you should call it before calling
|
||
/// [method`Gtk`.Widget.show].
|
||
///
|
||
/// On Windows, this function always works, since there’s no window manager
|
||
/// policy involved.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setDecorated(setting:)`.
|
||
///
|
||
/// - Parameter decorated: Whether the window should have a frame (also known as *decorations*).
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func decorated(_ decorated: @escaping () -> Bool) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setDecorated(setting: decorated()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setDefaultWidget(defaultWidget:)
|
||
/// Sets the default widget.
|
||
///
|
||
/// The default widget is the widget that is activated
|
||
/// when the user presses <kbd>Enter</kbd> in a dialog
|
||
/// (for example).
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter defaultWidget: The default widget.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func defaultWidget(_ defaultWidget: Gtk.Widget?) -> Self {
|
||
appending { w, _ in
|
||
w.setDefaultWidget(defaultWidget: defaultWidget)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(viewBuilder) | source: Gtk.Window.setDefaultWidget(defaultWidget:)
|
||
/// Sets the default widget.
|
||
///
|
||
/// The default widget is the widget that is activated
|
||
/// when the user presses <kbd>Enter</kbd> in a dialog
|
||
/// (for example).
|
||
///
|
||
/// 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 defaultWidget: The default widget.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func defaultWidget(@ViewBuilder _ defaultWidget: () -> [AnyView]) -> Self {
|
||
let defaultWidgetViews = defaultWidget()
|
||
return appending { w, ctx in
|
||
guard let v = defaultWidgetViews.first else { return }
|
||
w.setDefaultWidget(defaultWidget: v.makeWidget(ctx))
|
||
}
|
||
}
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Window.setDefaultWidget(defaultWidget:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getDefaultWidget()
|
||
/// Sets the default widget.
|
||
///
|
||
/// The default widget is the widget that is activated
|
||
/// when the user presses <kbd>Enter</kbd> in a dialog
|
||
/// (for example).
|
||
///
|
||
/// 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 defaultWidget<W: Gtk.Widget>(_ defaultWidget: Portico.Binding<W?>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, defaultWidget, registry: ctx.registry, notifyDetail: "default-widget",
|
||
read: { [w] in w.getDefaultWidget() as? W },
|
||
write: { [w] v in w.setDefaultWidget(defaultWidget: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Window.setDefaultWidget(defaultWidget:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getDefaultWidget()
|
||
/// Sets the default widget.
|
||
///
|
||
/// The default widget is the widget that is activated
|
||
/// when the user presses <kbd>Enter</kbd> in a dialog
|
||
/// (for example).
|
||
///
|
||
/// 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 defaultWidget<W: Gtk.Widget>(_ defaultWidget: Portico.Binding<W>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, defaultWidget, registry: ctx.registry, notifyDetail: "default-widget",
|
||
read: { [w] in w.getDefaultWidget() as? W },
|
||
write: { [w] v in w.setDefaultWidget(defaultWidget: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Window.setDefaultWidget(defaultWidget:)
|
||
/// Sets the default widget.
|
||
///
|
||
/// The default widget is the widget that is activated
|
||
/// when the user presses <kbd>Enter</kbd> in a dialog
|
||
/// (for example).
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setDefaultWidget(defaultWidget:)`.
|
||
///
|
||
/// - Parameter defaultWidget: The default widget.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func defaultWidget(_ defaultWidget: @escaping () -> Gtk.Widget?) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setDefaultWidget(defaultWidget: defaultWidget()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setDeletable(setting:)
|
||
/// Sets whether the window should be deletable.
|
||
///
|
||
/// By default, windows have a close button in the window frame.
|
||
/// Some window managers allow GTK to disable this button. If you
|
||
/// set the deletable property to false using this function, GTK
|
||
/// will do its best to convince the window manager not to show a
|
||
/// close button. Depending on the system, this function may not
|
||
/// have any effect when called on a window that is already visible,
|
||
/// so you should call it before calling [method`Gtk`.Widget.show].
|
||
///
|
||
/// On Windows, this function always works, since there’s no window
|
||
/// manager policy involved.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter deletable: Whether the window frame should have a close button.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func deletable(_ deletable: Bool) -> Self {
|
||
appending { w, _ in
|
||
w.setDeletable(setting: deletable)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Window.setDeletable(setting:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getDeletable()
|
||
/// Sets whether the window should be deletable.
|
||
///
|
||
/// By default, windows have a close button in the window frame.
|
||
/// Some window managers allow GTK to disable this button. If you
|
||
/// set the deletable property to false using this function, GTK
|
||
/// will do its best to convince the window manager not to show a
|
||
/// close button. Depending on the system, this function may not
|
||
/// have any effect when called on a window that is already visible,
|
||
/// so you should call it before calling [method`Gtk`.Widget.show].
|
||
///
|
||
/// On Windows, this function always works, since there’s no window
|
||
/// manager policy involved.
|
||
///
|
||
/// 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 deletable(_ deletable: Portico.Binding<Bool>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, deletable, registry: ctx.registry, notifyDetail: "deletable",
|
||
read: { [w] in w.getDeletable() },
|
||
write: { [w] v in w.setDeletable(setting: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Window.setDeletable(setting:)
|
||
/// Sets whether the window should be deletable.
|
||
///
|
||
/// By default, windows have a close button in the window frame.
|
||
/// Some window managers allow GTK to disable this button. If you
|
||
/// set the deletable property to false using this function, GTK
|
||
/// will do its best to convince the window manager not to show a
|
||
/// close button. Depending on the system, this function may not
|
||
/// have any effect when called on a window that is already visible,
|
||
/// so you should call it before calling [method`Gtk`.Widget.show].
|
||
///
|
||
/// On Windows, this function always works, since there’s no window
|
||
/// manager policy involved.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setDeletable(setting:)`.
|
||
///
|
||
/// - Parameter deletable: Whether the window frame should have a close button.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func deletable(_ deletable: @escaping () -> Bool) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setDeletable(setting: deletable()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setDestroyWithParent(setting:)
|
||
/// Sets whether to destroy the window when the transient parent is destroyed.
|
||
///
|
||
/// This is useful for dialogs that shouldn’t persist beyond the lifetime
|
||
/// of the main window they are associated with, for example.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter destroyWithParent: If this window should be destroyed when the parent is destroyed.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func destroyWithParent(_ destroyWithParent: Bool) -> Self {
|
||
appending { w, _ in
|
||
w.setDestroyWithParent(setting: destroyWithParent)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Window.setDestroyWithParent(setting:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getDestroyWithParent()
|
||
/// Sets whether to destroy the window when the transient parent is destroyed.
|
||
///
|
||
/// This is useful for dialogs that shouldn’t persist beyond the lifetime
|
||
/// of the main window they are associated with, for example.
|
||
///
|
||
/// 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 destroyWithParent(_ destroyWithParent: Portico.Binding<Bool>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, destroyWithParent, registry: ctx.registry, notifyDetail: "destroy-with-parent",
|
||
read: { [w] in w.getDestroyWithParent() },
|
||
write: { [w] v in w.setDestroyWithParent(setting: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Window.setDestroyWithParent(setting:)
|
||
/// Sets whether to destroy the window when the transient parent is destroyed.
|
||
///
|
||
/// This is useful for dialogs that shouldn’t persist beyond the lifetime
|
||
/// of the main window they are associated with, for example.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setDestroyWithParent(setting:)`.
|
||
///
|
||
/// - Parameter destroyWithParent: If this window should be destroyed when the parent is destroyed.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func destroyWithParent(_ destroyWithParent: @escaping () -> Bool) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setDestroyWithParent(setting: destroyWithParent()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setDisplay(display:)
|
||
/// Sets the display where the window is displayed.
|
||
///
|
||
/// If the window is already mapped, it will be unmapped,
|
||
/// and then remapped on the new display.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter display: The display that will display this window.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func display(_ display: Gtk.Display) -> Self {
|
||
appending { w, _ in
|
||
w.setDisplay(display: display)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Window.setDisplay(display:), GObject.Object.connectNotify(detail:_:)
|
||
/// Sets the display where the window is displayed.
|
||
///
|
||
/// If the window is already mapped, it will be unmapped,
|
||
/// and then remapped on the new display.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Gtk.Display` 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 display(_ display: Portico.Binding<Gtk.Display>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, display, registry: ctx.registry, notifyDetail: "display",
|
||
read: { [w] in w.display },
|
||
write: { [w] v in w.setDisplay(display: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Window.setDisplay(display:)
|
||
/// Sets the display where the window is displayed.
|
||
///
|
||
/// If the window is already mapped, it will be unmapped,
|
||
/// and then remapped on the new display.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setDisplay(display:)`.
|
||
///
|
||
/// - Parameter display: The display that will display this window.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func display(_ display: @escaping () -> Gtk.Display) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setDisplay(display: display()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setFocusVisible(setting:)
|
||
/// Sets whether “focus rectangles” are supposed to be visible.
|
||
///
|
||
/// This property is maintained by GTK based on user input,
|
||
/// and should not be set by applications.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter focusVisible: Whether 'focus rectangles' are currently visible in this window.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func focusVisible(_ focusVisible: Bool) -> Self {
|
||
appending { w, _ in
|
||
w.setFocusVisible(setting: focusVisible)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Window.setFocusVisible(setting:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getFocusVisible()
|
||
/// Sets whether “focus rectangles” are supposed to be visible.
|
||
///
|
||
/// This property is maintained by GTK based on user input,
|
||
/// and should not be set by applications.
|
||
///
|
||
/// 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 focusVisible(_ focusVisible: Portico.Binding<Bool>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, focusVisible, registry: ctx.registry, notifyDetail: "focus-visible",
|
||
read: { [w] in w.getFocusVisible() },
|
||
write: { [w] v in w.setFocusVisible(setting: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Window.setFocusVisible(setting:)
|
||
/// Sets whether “focus rectangles” are supposed to be visible.
|
||
///
|
||
/// This property is maintained by GTK based on user input,
|
||
/// and should not be set by applications.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setFocusVisible(setting:)`.
|
||
///
|
||
/// - Parameter focusVisible: Whether 'focus rectangles' are currently visible in this window.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func focusVisible(_ focusVisible: @escaping () -> Bool) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setFocusVisible(setting: focusVisible()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setFocus(focus:)
|
||
/// Sets the focus widget.
|
||
///
|
||
/// If `focus` is not the current focus widget, and is focusable,
|
||
/// sets it as the focus widget for the window. If `focus` is `nil`,
|
||
/// unsets the focus widget for this window. To set the focus to a
|
||
/// particular widget in the toplevel, it is usually more convenient
|
||
/// to use [method`Gtk`.Widget.grab_focus] instead of this function.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter focusWidget: The focus widget.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func focusWidget(_ focusWidget: Gtk.Widget?) -> Self {
|
||
appending { w, _ in
|
||
w.setFocus(focus: focusWidget)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(viewBuilder) | source: Gtk.Window.setFocus(focus:)
|
||
/// Sets the focus widget.
|
||
///
|
||
/// If `focus` is not the current focus widget, and is focusable,
|
||
/// sets it as the focus widget for the window. If `focus` is `nil`,
|
||
/// unsets the focus widget for this window. To set the focus to a
|
||
/// particular widget in the toplevel, it is usually more convenient
|
||
/// to use [method`Gtk`.Widget.grab_focus] instead of this function.
|
||
///
|
||
/// 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 focusWidget: The focus widget.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func focusWidget(@ViewBuilder _ focusWidget: () -> [AnyView]) -> Self {
|
||
let focusWidgetViews = focusWidget()
|
||
return appending { w, ctx in
|
||
guard let v = focusWidgetViews.first else { return }
|
||
w.setFocus(focus: v.makeWidget(ctx))
|
||
}
|
||
}
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Window.setFocus(focus:), GObject.Object.connectNotify(detail:_:)
|
||
/// Sets the focus widget.
|
||
///
|
||
/// If `focus` is not the current focus widget, and is focusable,
|
||
/// sets it as the focus widget for the window. If `focus` is `nil`,
|
||
/// unsets the focus widget for this window. To set the focus to a
|
||
/// particular widget in the toplevel, it is usually more convenient
|
||
/// to use [method`Gtk`.Widget.grab_focus] instead of this function.
|
||
///
|
||
/// 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 focusWidget<W: Gtk.Widget>(_ focusWidget: Portico.Binding<W?>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, focusWidget, registry: ctx.registry, notifyDetail: "focus-widget",
|
||
read: { [w] in w.focusWidget as? W },
|
||
write: { [w] v in w.setFocus(focus: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Window.setFocus(focus:), GObject.Object.connectNotify(detail:_:)
|
||
/// Sets the focus widget.
|
||
///
|
||
/// If `focus` is not the current focus widget, and is focusable,
|
||
/// sets it as the focus widget for the window. If `focus` is `nil`,
|
||
/// unsets the focus widget for this window. To set the focus to a
|
||
/// particular widget in the toplevel, it is usually more convenient
|
||
/// to use [method`Gtk`.Widget.grab_focus] instead of this function.
|
||
///
|
||
/// 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 focusWidget<W: Gtk.Widget>(_ focusWidget: Portico.Binding<W>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, focusWidget, registry: ctx.registry, notifyDetail: "focus-widget",
|
||
read: { [w] in w.focusWidget as? W },
|
||
write: { [w] v in w.setFocus(focus: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Window.setFocus(focus:)
|
||
/// Sets the focus widget.
|
||
///
|
||
/// If `focus` is not the current focus widget, and is focusable,
|
||
/// sets it as the focus widget for the window. If `focus` is `nil`,
|
||
/// unsets the focus widget for this window. To set the focus to a
|
||
/// particular widget in the toplevel, it is usually more convenient
|
||
/// to use [method`Gtk`.Widget.grab_focus] instead of this function.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setFocus(focus:)`.
|
||
///
|
||
/// - Parameter focusWidget: The focus widget.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func focusWidget(_ focusWidget: @escaping () -> Gtk.Widget?) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setFocus(focus: focusWidget()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setGravity(gravity:)
|
||
/// Sets the gravity that is used when changing the window size programmatically.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter gravity: The gravity to use when resizing the window programmatically.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func gravity(_ gravity: Gtk.WindowGravity) -> Self {
|
||
appending { w, _ in
|
||
w.setGravity(gravity: gravity)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Window.setGravity(gravity:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getGravity()
|
||
/// Sets the gravity that is used when changing the window size programmatically.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Gtk.WindowGravity` 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 gravity(_ gravity: Portico.Binding<Gtk.WindowGravity>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, gravity, registry: ctx.registry, notifyDetail: "gravity",
|
||
read: { [w] in w.getGravity() },
|
||
write: { [w] v in w.setGravity(gravity: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Window.setGravity(gravity:)
|
||
/// Sets the gravity that is used when changing the window size programmatically.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setGravity(gravity:)`.
|
||
///
|
||
/// - Parameter gravity: The gravity to use when resizing the window programmatically.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func gravity(_ gravity: @escaping () -> Gtk.WindowGravity) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setGravity(gravity: gravity()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setHandleMenubarAccel(handleMenubarAccel:)
|
||
/// Sets whether this window should react to <kbd>F10</kbd>
|
||
/// presses by activating a menubar it contains.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter handleMenubarAccel: Whether the window frame should handle <kbd>F10</kbd> for activating menubars.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func handleMenubarAccel(_ handleMenubarAccel: Bool) -> Self {
|
||
appending { w, _ in
|
||
w.setHandleMenubarAccel(handleMenubarAccel: handleMenubarAccel)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Window.setHandleMenubarAccel(handleMenubarAccel:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getHandleMenubarAccel()
|
||
/// Sets whether this window should react to <kbd>F10</kbd>
|
||
/// presses by activating a menubar it contains.
|
||
///
|
||
/// 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 handleMenubarAccel(_ handleMenubarAccel: Portico.Binding<Bool>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, handleMenubarAccel, registry: ctx.registry, notifyDetail: "handle-menubar-accel",
|
||
read: { [w] in w.getHandleMenubarAccel() },
|
||
write: { [w] v in w.setHandleMenubarAccel(handleMenubarAccel: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Window.setHandleMenubarAccel(handleMenubarAccel:)
|
||
/// Sets whether this window should react to <kbd>F10</kbd>
|
||
/// presses by activating a menubar it contains.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setHandleMenubarAccel(handleMenubarAccel:)`.
|
||
///
|
||
/// - Parameter handleMenubarAccel: Whether the window frame should handle <kbd>F10</kbd> for activating menubars.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func handleMenubarAccel(_ handleMenubarAccel: @escaping () -> Bool) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setHandleMenubarAccel(handleMenubarAccel: handleMenubarAccel()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setHideOnClose(setting:)
|
||
/// Sets whether clicking the close button will hide the window instead
|
||
/// of destroying it.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter hideOnClose: If this window should be hidden instead of destroyed when the user clicks the close button.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func hideOnClose(_ hideOnClose: Bool) -> Self {
|
||
appending { w, _ in
|
||
w.setHideOnClose(setting: hideOnClose)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Window.setHideOnClose(setting:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getHideOnClose()
|
||
/// Sets whether clicking the close button will hide the window instead
|
||
/// of destroying it.
|
||
///
|
||
/// 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 hideOnClose(_ hideOnClose: Portico.Binding<Bool>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, hideOnClose, registry: ctx.registry, notifyDetail: "hide-on-close",
|
||
read: { [w] in w.getHideOnClose() },
|
||
write: { [w] v in w.setHideOnClose(setting: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Window.setHideOnClose(setting:)
|
||
/// Sets whether clicking the close button will hide the window instead
|
||
/// of destroying it.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setHideOnClose(setting:)`.
|
||
///
|
||
/// - Parameter hideOnClose: If this window should be hidden instead of destroyed when the user clicks the close button.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func hideOnClose(_ hideOnClose: @escaping () -> Bool) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setHideOnClose(setting: hideOnClose()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setIconName(name:)
|
||
/// Sets the icon for the window from a named themed icon.
|
||
///
|
||
/// See the docs for [class`Gtk`.IconTheme] for more details.
|
||
/// On some platforms, the window icon is not used at all.
|
||
///
|
||
/// Note that this has nothing to do with the WM_ICON_NAME
|
||
/// property which is mentioned in the ICCCM.
|
||
///
|
||
/// 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: Specifies the name of the themed icon to use as the window icon.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
@_disfavoredOverload
|
||
public func iconName<S: StringProtocol>(_ iconName: S?) -> Self {
|
||
appending { w, _ in
|
||
w.setIconName(name: iconName.map { String($0) })
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Window.setIconName(name:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getIconName()
|
||
/// Sets the icon for the window from a named themed icon.
|
||
///
|
||
/// See the docs for [class`Gtk`.IconTheme] for more details.
|
||
/// On some platforms, the window icon is not used at all.
|
||
///
|
||
/// Note that this has nothing to do with the WM_ICON_NAME
|
||
/// property which is mentioned in the ICCCM.
|
||
///
|
||
/// 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(name: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Window.setIconName(name:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getIconName()
|
||
/// Sets the icon for the window from a named themed icon.
|
||
///
|
||
/// See the docs for [class`Gtk`.IconTheme] for more details.
|
||
/// On some platforms, the window icon is not used at all.
|
||
///
|
||
/// Note that this has nothing to do with the WM_ICON_NAME
|
||
/// property which is mentioned in the ICCCM.
|
||
///
|
||
/// 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(name: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Window.setIconName(name:)
|
||
/// Sets the icon for the window from a named themed icon.
|
||
///
|
||
/// See the docs for [class`Gtk`.IconTheme] for more details.
|
||
/// On some platforms, the window icon is not used at all.
|
||
///
|
||
/// Note that this has nothing to do with the WM_ICON_NAME
|
||
/// property which is mentioned in the ICCCM.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setIconName(name:)`.
|
||
///
|
||
/// - Parameter iconName: Specifies the name of the themed icon to use as the window icon.
|
||
/// - 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(name: iconName()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(interpolation) | source: Gtk.Window.setIconName(name:)
|
||
/// Sets the icon for the window from a named themed icon.
|
||
///
|
||
/// See the docs for [class`Gtk`.IconTheme] for more details.
|
||
/// On some platforms, the window icon is not used at all.
|
||
///
|
||
/// Note that this has nothing to do with the WM_ICON_NAME
|
||
/// property which is mentioned in the ICCCM.
|
||
///
|
||
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Gtk.Window.setIconName(name:)`. A literal with no interpolation is applied once, with no subscription.
|
||
///
|
||
/// - Parameter iconName: Specifies the name of the themed icon to use as the window icon.
|
||
/// - 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(name: v) }
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setMnemonicsVisible(setting:)
|
||
/// Sets whether mnemonics are supposed to be visible.
|
||
///
|
||
/// This property is maintained by GTK based on user input,
|
||
/// and should not be set by applications.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter mnemonicsVisible: Whether mnemonics are currently visible in this window.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func mnemonicsVisible(_ mnemonicsVisible: Bool) -> Self {
|
||
appending { w, _ in
|
||
w.setMnemonicsVisible(setting: mnemonicsVisible)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Window.setMnemonicsVisible(setting:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getMnemonicsVisible()
|
||
/// Sets whether mnemonics are supposed to be visible.
|
||
///
|
||
/// This property is maintained by GTK based on user input,
|
||
/// and should not be set by applications.
|
||
///
|
||
/// 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 mnemonicsVisible(_ mnemonicsVisible: Portico.Binding<Bool>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, mnemonicsVisible, registry: ctx.registry, notifyDetail: "mnemonics-visible",
|
||
read: { [w] in w.getMnemonicsVisible() },
|
||
write: { [w] v in w.setMnemonicsVisible(setting: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Window.setMnemonicsVisible(setting:)
|
||
/// Sets whether mnemonics are supposed to be visible.
|
||
///
|
||
/// This property is maintained by GTK based on user input,
|
||
/// and should not be set by applications.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setMnemonicsVisible(setting:)`.
|
||
///
|
||
/// - Parameter mnemonicsVisible: Whether mnemonics are currently visible in this window.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func mnemonicsVisible(_ mnemonicsVisible: @escaping () -> Bool) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setMnemonicsVisible(setting: mnemonicsVisible()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setModal(modal:)
|
||
/// Sets a window modal or non-modal.
|
||
///
|
||
/// Modal windows prevent interaction with other windows in the same
|
||
/// application. To keep modal dialogs on top of main application windows,
|
||
/// use [method`Gtk`.Window.set_transient_for] to make the dialog transient
|
||
/// for the parent; most window managers will then disallow lowering the
|
||
/// dialog below the parent.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter modal: If true, the window is modal.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func modal(_ modal: Bool) -> Self {
|
||
appending { w, _ in
|
||
w.setModal(modal: modal)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Window.setModal(modal:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getModal()
|
||
/// Sets a window modal or non-modal.
|
||
///
|
||
/// Modal windows prevent interaction with other windows in the same
|
||
/// application. To keep modal dialogs on top of main application windows,
|
||
/// use [method`Gtk`.Window.set_transient_for] to make the dialog transient
|
||
/// for the parent; most window managers will then disallow lowering the
|
||
/// dialog below the parent.
|
||
///
|
||
/// 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 modal(_ modal: Portico.Binding<Bool>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, modal, registry: ctx.registry, notifyDetail: "modal",
|
||
read: { [w] in w.getModal() },
|
||
write: { [w] v in w.setModal(modal: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Window.setModal(modal:)
|
||
/// Sets a window modal or non-modal.
|
||
///
|
||
/// Modal windows prevent interaction with other windows in the same
|
||
/// application. To keep modal dialogs on top of main application windows,
|
||
/// use [method`Gtk`.Window.set_transient_for] to make the dialog transient
|
||
/// for the parent; most window managers will then disallow lowering the
|
||
/// dialog below the parent.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setModal(modal:)`.
|
||
///
|
||
/// - Parameter modal: If true, the window is modal.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func modal(_ modal: @escaping () -> Bool) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setModal(modal: modal()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setResizable(resizable:)
|
||
/// Sets whether the user can resize a window.
|
||
///
|
||
/// Windows are user resizable by default.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter resizable: If true, users can resize the window.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func resizable(_ resizable: Bool) -> Self {
|
||
appending { w, _ in
|
||
w.setResizable(resizable: resizable)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Window.setResizable(resizable:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getResizable()
|
||
/// Sets whether the user can resize a window.
|
||
///
|
||
/// Windows are user resizable by default.
|
||
///
|
||
/// 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 resizable(_ resizable: Portico.Binding<Bool>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, resizable, registry: ctx.registry, notifyDetail: "resizable",
|
||
read: { [w] in w.getResizable() },
|
||
write: { [w] v in w.setResizable(resizable: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Window.setResizable(resizable:)
|
||
/// Sets whether the user can resize a window.
|
||
///
|
||
/// Windows are user resizable by default.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setResizable(resizable:)`.
|
||
///
|
||
/// - Parameter resizable: If true, users can resize the window.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func resizable(_ resizable: @escaping () -> Bool) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setResizable(resizable: resizable()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setStartupId(startupId:)
|
||
/// Sets the startup notification ID.
|
||
///
|
||
/// Startup notification identifiers are used by desktop environment
|
||
/// to track application startup, to provide user feedback and other
|
||
/// features. This function changes the corresponding property on the
|
||
/// underlying `GdkSurface`.
|
||
///
|
||
/// Normally, startup identifier is managed automatically and you should
|
||
/// only use this function in special cases like transferring focus from
|
||
/// other processes. You should use this function before calling
|
||
/// [method`Gtk`.Window.present] or any equivalent function generating
|
||
/// a window map event.
|
||
///
|
||
/// This function is only useful on Wayland or X11, not with other GDK
|
||
/// backends.
|
||
///
|
||
/// 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 startupId: A write-only property for setting window's startup notification identifier.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
@_disfavoredOverload
|
||
public func startupId<S: StringProtocol>(_ startupId: S) -> Self {
|
||
appending { w, _ in
|
||
w.setStartupId(startupId: String(startupId))
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(oneWay) | source: Gtk.Window.setStartupId(startupId:)
|
||
/// Sets the startup notification ID.
|
||
///
|
||
/// Startup notification identifiers are used by desktop environment
|
||
/// to track application startup, to provide user feedback and other
|
||
/// features. This function changes the corresponding property on the
|
||
/// underlying `GdkSurface`.
|
||
///
|
||
/// Normally, startup identifier is managed automatically and you should
|
||
/// only use this function in special cases like transferring focus from
|
||
/// other processes. You should use this function before calling
|
||
/// [method`Gtk`.Window.present] or any equivalent function generating
|
||
/// a window map event.
|
||
///
|
||
/// This function is only useful on Wayland or X11, not with other GDK
|
||
/// backends.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// Binds one way only (binding to widget): `Gtk.Window` exposes no getter for `startupId` that is safe to read back, so changes made in the UI do not propagate to the binding.
|
||
///
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func startupId(_ startupId: Portico.Binding<String>) -> Self {
|
||
appending { w, ctx in
|
||
w.setStartupId(startupId: startupId.untrackedValue)
|
||
ctx.registry.add(startupId.subscribe { [w] v in w.setStartupId(startupId: v) })
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Window.setStartupId(startupId:)
|
||
/// Sets the startup notification ID.
|
||
///
|
||
/// Startup notification identifiers are used by desktop environment
|
||
/// to track application startup, to provide user feedback and other
|
||
/// features. This function changes the corresponding property on the
|
||
/// underlying `GdkSurface`.
|
||
///
|
||
/// Normally, startup identifier is managed automatically and you should
|
||
/// only use this function in special cases like transferring focus from
|
||
/// other processes. You should use this function before calling
|
||
/// [method`Gtk`.Window.present] or any equivalent function generating
|
||
/// a window map event.
|
||
///
|
||
/// This function is only useful on Wayland or X11, not with other GDK
|
||
/// backends.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setStartupId(startupId:)`.
|
||
///
|
||
/// - Parameter startupId: A write-only property for setting window's startup notification identifier.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func startupId(_ startupId: @escaping () -> String) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setStartupId(startupId: startupId()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(interpolation) | source: Gtk.Window.setStartupId(startupId:)
|
||
/// Sets the startup notification ID.
|
||
///
|
||
/// Startup notification identifiers are used by desktop environment
|
||
/// to track application startup, to provide user feedback and other
|
||
/// features. This function changes the corresponding property on the
|
||
/// underlying `GdkSurface`.
|
||
///
|
||
/// Normally, startup identifier is managed automatically and you should
|
||
/// only use this function in special cases like transferring focus from
|
||
/// other processes. You should use this function before calling
|
||
/// [method`Gtk`.Window.present] or any equivalent function generating
|
||
/// a window map event.
|
||
///
|
||
/// This function is only useful on Wayland or X11, not with other GDK
|
||
/// backends.
|
||
///
|
||
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Gtk.Window.setStartupId(startupId:)`. A literal with no interpolation is applied once, with no subscription.
|
||
///
|
||
/// - Parameter startupId: A write-only property for setting window's startup notification identifier.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func startupId(_ startupId: Portico.InterpolatedText) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindInterpolation(startupId, registry: ctx.registry) { [w] v in w.setStartupId(startupId: v) }
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setTitle(title:)
|
||
/// Sets the title of the window.
|
||
///
|
||
/// The title of a window will be displayed in its title bar; on the
|
||
/// X Window System, the title bar is rendered by the window manager
|
||
/// so exactly how the title appears to users may vary according to a
|
||
/// user’s exact configuration. The title should help a user distinguish
|
||
/// this window from other windows they may have open. A good title might
|
||
/// include the application name and current document filename, for example.
|
||
///
|
||
/// Passing `NULL` does the same as setting the title to an empty string.
|
||
///
|
||
/// 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 of the window.
|
||
/// - 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: title.map { String($0) })
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Window.setTitle(title:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getTitle()
|
||
/// Sets the title of the window.
|
||
///
|
||
/// The title of a window will be displayed in its title bar; on the
|
||
/// X Window System, the title bar is rendered by the window manager
|
||
/// so exactly how the title appears to users may vary according to a
|
||
/// user’s exact configuration. The title should help a user distinguish
|
||
/// this window from other windows they may have open. A good title might
|
||
/// include the application name and current document filename, for example.
|
||
///
|
||
/// Passing `NULL` does the same as setting the title to an empty string.
|
||
///
|
||
/// 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 -> bindingModifier(lifted,twoWay) | source: Gtk.Window.setTitle(title:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getTitle()
|
||
/// Sets the title of the window.
|
||
///
|
||
/// The title of a window will be displayed in its title bar; on the
|
||
/// X Window System, the title bar is rendered by the window manager
|
||
/// so exactly how the title appears to users may vary according to a
|
||
/// user’s exact configuration. The title should help a user distinguish
|
||
/// this window from other windows they may have open. A good title might
|
||
/// include the application name and current document filename, for example.
|
||
///
|
||
/// Passing `NULL` does the same as setting the title to an empty string.
|
||
///
|
||
/// 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 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: Gtk.Window.setTitle(title:)
|
||
/// Sets the title of the window.
|
||
///
|
||
/// The title of a window will be displayed in its title bar; on the
|
||
/// X Window System, the title bar is rendered by the window manager
|
||
/// so exactly how the title appears to users may vary according to a
|
||
/// user’s exact configuration. The title should help a user distinguish
|
||
/// this window from other windows they may have open. A good title might
|
||
/// include the application name and current document filename, for example.
|
||
///
|
||
/// Passing `NULL` does the same as setting the title to an empty string.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setTitle(title:)`.
|
||
///
|
||
/// - Parameter title: The title of the window.
|
||
/// - 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: Gtk.Window.setTitle(title:)
|
||
/// Sets the title of the window.
|
||
///
|
||
/// The title of a window will be displayed in its title bar; on the
|
||
/// X Window System, the title bar is rendered by the window manager
|
||
/// so exactly how the title appears to users may vary according to a
|
||
/// user’s exact configuration. The title should help a user distinguish
|
||
/// this window from other windows they may have open. A good title might
|
||
/// include the application name and current document filename, for example.
|
||
///
|
||
/// Passing `NULL` does the same as setting the title to an empty string.
|
||
///
|
||
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Gtk.Window.setTitle(title:)`. A literal with no interpolation is applied once, with no subscription.
|
||
///
|
||
/// - Parameter title: The title of the window.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func title(_ title: Portico.InterpolatedText?) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindOptionalInterpolation(title, registry: ctx.registry) { [w] v in w.setTitle(title: v) }
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setTitlebar(titlebar:)
|
||
/// Sets a custom titlebar for the window.
|
||
///
|
||
/// A typical widget used here is [class`Gtk`.HeaderBar], as it
|
||
/// provides various features expected of a titlebar while allowing
|
||
/// the addition of child widgets to it.
|
||
///
|
||
/// If you set a custom titlebar, GTK will do its best to convince
|
||
/// the window manager not to put its own titlebar on the window.
|
||
/// Depending on the system, this function may not work for a window
|
||
/// that is already visible, so you set the titlebar before calling
|
||
/// [method`Gtk`.Widget.show].
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter titlebar: The titlebar widget.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func titlebar(_ titlebar: Gtk.Widget?) -> Self {
|
||
appending { w, _ in
|
||
w.setTitlebar(titlebar: titlebar)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(viewBuilder) | source: Gtk.Window.setTitlebar(titlebar:)
|
||
/// Sets a custom titlebar for the window.
|
||
///
|
||
/// A typical widget used here is [class`Gtk`.HeaderBar], as it
|
||
/// provides various features expected of a titlebar while allowing
|
||
/// the addition of child widgets to it.
|
||
///
|
||
/// If you set a custom titlebar, GTK will do its best to convince
|
||
/// the window manager not to put its own titlebar on the window.
|
||
/// Depending on the system, this function may not work for a window
|
||
/// that is already visible, so you set the titlebar before calling
|
||
/// [method`Gtk`.Widget.show].
|
||
///
|
||
/// 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 titlebar: The titlebar widget.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func titlebar(@ViewBuilder _ titlebar: () -> [AnyView]) -> Self {
|
||
let titlebarViews = titlebar()
|
||
return appending { w, ctx in
|
||
guard let v = titlebarViews.first else { return }
|
||
w.setTitlebar(titlebar: v.makeWidget(ctx))
|
||
}
|
||
}
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Window.setTitlebar(titlebar:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getTitlebar()
|
||
/// Sets a custom titlebar for the window.
|
||
///
|
||
/// A typical widget used here is [class`Gtk`.HeaderBar], as it
|
||
/// provides various features expected of a titlebar while allowing
|
||
/// the addition of child widgets to it.
|
||
///
|
||
/// If you set a custom titlebar, GTK will do its best to convince
|
||
/// the window manager not to put its own titlebar on the window.
|
||
/// Depending on the system, this function may not work for a window
|
||
/// that is already visible, so you set the titlebar before calling
|
||
/// [method`Gtk`.Widget.show].
|
||
///
|
||
/// 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 titlebar<W: Gtk.Widget>(_ titlebar: Portico.Binding<W?>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, titlebar, registry: ctx.registry, notifyDetail: "titlebar",
|
||
read: { [w] in w.getTitlebar() as? W },
|
||
write: { [w] v in w.setTitlebar(titlebar: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Window.setTitlebar(titlebar:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getTitlebar()
|
||
/// Sets a custom titlebar for the window.
|
||
///
|
||
/// A typical widget used here is [class`Gtk`.HeaderBar], as it
|
||
/// provides various features expected of a titlebar while allowing
|
||
/// the addition of child widgets to it.
|
||
///
|
||
/// If you set a custom titlebar, GTK will do its best to convince
|
||
/// the window manager not to put its own titlebar on the window.
|
||
/// Depending on the system, this function may not work for a window
|
||
/// that is already visible, so you set the titlebar before calling
|
||
/// [method`Gtk`.Widget.show].
|
||
///
|
||
/// 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 titlebar<W: Gtk.Widget>(_ titlebar: Portico.Binding<W>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, titlebar, registry: ctx.registry, notifyDetail: "titlebar",
|
||
read: { [w] in w.getTitlebar() as? W },
|
||
write: { [w] v in w.setTitlebar(titlebar: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Window.setTitlebar(titlebar:)
|
||
/// Sets a custom titlebar for the window.
|
||
///
|
||
/// A typical widget used here is [class`Gtk`.HeaderBar], as it
|
||
/// provides various features expected of a titlebar while allowing
|
||
/// the addition of child widgets to it.
|
||
///
|
||
/// If you set a custom titlebar, GTK will do its best to convince
|
||
/// the window manager not to put its own titlebar on the window.
|
||
/// Depending on the system, this function may not work for a window
|
||
/// that is already visible, so you set the titlebar before calling
|
||
/// [method`Gtk`.Widget.show].
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setTitlebar(titlebar:)`.
|
||
///
|
||
/// - Parameter titlebar: The titlebar widget.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func titlebar(_ titlebar: @escaping () -> Gtk.Widget?) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setTitlebar(titlebar: titlebar()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Window.setTransientFor(parent:)
|
||
/// Sets a transient parent for the window.
|
||
///
|
||
/// Dialog windows should be set transient for the main application
|
||
/// window they were spawned from. This allows window managers to e.g.
|
||
/// keep the dialog on top of the main window, or center the dialog
|
||
/// over the main window. [ctor`Gtk`.Dialog.new_with_buttons] and other
|
||
/// convenience functions in GTK will sometimes call this function on
|
||
/// your behalf.
|
||
///
|
||
/// Passing `NULL` for `parent` unsets the current transient window.
|
||
///
|
||
/// On Windows, this function puts the child window on top of the parent,
|
||
/// much as the window manager would have done on X.
|
||
///
|
||
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
||
///
|
||
/// - Parameter transientFor: The transient parent of the window.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func transientFor(_ transientFor: Gtk.Window?) -> Self {
|
||
appending { w, _ in
|
||
w.setTransientFor(parent: transientFor)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Window.setTransientFor(parent:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getTransientFor()
|
||
/// Sets a transient parent for the window.
|
||
///
|
||
/// Dialog windows should be set transient for the main application
|
||
/// window they were spawned from. This allows window managers to e.g.
|
||
/// keep the dialog on top of the main window, or center the dialog
|
||
/// over the main window. [ctor`Gtk`.Dialog.new_with_buttons] and other
|
||
/// convenience functions in GTK will sometimes call this function on
|
||
/// your behalf.
|
||
///
|
||
/// Passing `NULL` for `parent` unsets the current transient window.
|
||
///
|
||
/// On Windows, this function puts the child window on top of the parent,
|
||
/// much as the window manager would have done on X.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// When `Gtk.Window?` 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 transientFor<W: Gtk.Window>(_ transientFor: Portico.Binding<W?>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, transientFor, registry: ctx.registry, notifyDetail: "transient-for",
|
||
read: { [w] in w.getTransientFor() as? W },
|
||
write: { [w] v in w.setTransientFor(parent: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Window.setTransientFor(parent:), GObject.Object.connectNotify(detail:_:), Gtk.Window.getTransientFor()
|
||
/// Sets a transient parent for the window.
|
||
///
|
||
/// Dialog windows should be set transient for the main application
|
||
/// window they were spawned from. This allows window managers to e.g.
|
||
/// keep the dialog on top of the main window, or center the dialog
|
||
/// over the main window. [ctor`Gtk`.Dialog.new_with_buttons] and other
|
||
/// convenience functions in GTK will sometimes call this function on
|
||
/// your behalf.
|
||
///
|
||
/// Passing `NULL` for `parent` unsets the current transient window.
|
||
///
|
||
/// On Windows, this function puts the child window on top of the parent,
|
||
/// much as the window manager would have done on X.
|
||
///
|
||
/// Applied at mount and re-applied on every change the binding publishes.
|
||
/// `Binding` is invariant, so a `Binding<Gtk.Window>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.Window?>` to be able to clear the property.
|
||
/// When `Gtk.Window` 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 transientFor<W: Gtk.Window>(_ transientFor: Portico.Binding<W>) -> Self {
|
||
appending { w, ctx in
|
||
Portico.bindProperty(
|
||
w, transientFor, registry: ctx.registry, notifyDetail: "transient-for",
|
||
read: { [w] in w.getTransientFor() as? W },
|
||
write: { [w] v in w.setTransientFor(parent: v) }
|
||
)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Window.setTransientFor(parent:)
|
||
/// Sets a transient parent for the window.
|
||
///
|
||
/// Dialog windows should be set transient for the main application
|
||
/// window they were spawned from. This allows window managers to e.g.
|
||
/// keep the dialog on top of the main window, or center the dialog
|
||
/// over the main window. [ctor`Gtk`.Dialog.new_with_buttons] and other
|
||
/// convenience functions in GTK will sometimes call this function on
|
||
/// your behalf.
|
||
///
|
||
/// Passing `NULL` for `parent` unsets the current transient window.
|
||
///
|
||
/// On Windows, this function puts the child window on top of the parent,
|
||
/// much as the window manager would have done on X.
|
||
///
|
||
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Window.setTransientFor(parent:)`.
|
||
///
|
||
/// - Parameter transientFor: The transient parent of the window.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func transientFor(_ transientFor: @escaping () -> Gtk.Window?) -> Self {
|
||
appending { w, ctx in
|
||
let tracker = DependencyTracker { [w] in w.setTransientFor(parent: transientFor()) }
|
||
tracker.run()
|
||
ctx.registry.add(tracker)
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Window.connectActivateDefault(_:)
|
||
/// Emitted when the user activates the default widget.
|
||
///
|
||
/// This is a [keybinding signal](class.SignalAction.html).
|
||
///
|
||
/// The keybindings for this signal are all forms of the <kbd>Enter</kbd> key.
|
||
///
|
||
/// - Parameter handler: Invoked when the widget emits the `activate-default` signal.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func onActivateDefault(_ handler: @escaping () -> Void) -> Self {
|
||
appending { w, ctx in
|
||
ctx.registry.add(w.connectActivateDefault { _ in handler() })
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Window.connectActivateFocus(_:)
|
||
/// Emitted when the user activates the currently focused
|
||
/// widget of `window`.
|
||
///
|
||
/// This is a [keybinding signal](class.SignalAction.html).
|
||
///
|
||
/// The default binding for this signal is <kbd>␣</kbd>.
|
||
///
|
||
/// - Parameter handler: Invoked when the widget emits the `activate-focus` signal.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func onActivateFocus(_ handler: @escaping () -> Void) -> Self {
|
||
appending { w, ctx in
|
||
ctx.registry.add(w.connectActivateFocus { _ in handler() })
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Window.connectCloseRequest(_:)
|
||
/// Emitted when the user clicks on the close button of the window.
|
||
///
|
||
/// - Parameter handler: Invoked when the widget emits the `close-request` signal. Its return value is forwarded to GTK as the signal's result.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func onCloseRequest(_ handler: @escaping () -> Bool) -> Self {
|
||
appending { w, ctx in
|
||
ctx.registry.add(w.connectCloseRequest { _ in handler() })
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Window.connectEnableDebugging(_:)
|
||
/// Emitted when the user enables or disables interactive debugging.
|
||
///
|
||
/// When `toggle` is true, interactive debugging is toggled on or off,
|
||
/// when it is false, the debugger will be pointed at the widget
|
||
/// under the pointer.
|
||
///
|
||
/// This is a [keybinding signal](class.SignalAction.html).
|
||
///
|
||
/// The default bindings for this signal are
|
||
/// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> and
|
||
/// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd>.
|
||
///
|
||
/// - Parameter handler: 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.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func onEnableDebugging(_ handler: @escaping (Bool) -> Bool) -> Self {
|
||
appending { w, ctx in
|
||
ctx.registry.add(w.connectEnableDebugging { _, a0 in handler(a0) })
|
||
}
|
||
}
|
||
|
||
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Window.connectKeysChanged(_:)
|
||
/// Emitted when the set of accelerators or mnemonics that
|
||
/// are associated with the window changes.
|
||
///
|
||
/// - Parameter handler: Invoked when the widget emits the `keys-changed` signal.
|
||
/// - Returns: A copy of this view with the modifier applied.
|
||
public func onKeysChanged(_ handler: @escaping () -> Void) -> Self {
|
||
appending { w, ctx in
|
||
ctx.registry.add(w.connectKeysChanged { _ in handler() })
|
||
}
|
||
}
|
||
|
||
}
|