portico/Sources/Portico/Generated/Widget.swift

4144 lines
220 KiB
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters

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

// Generated by PorticoGen. DO NOT EDIT. See Sources/PorticoGen to make changes.
import Adw
import Gtk
import Gio
import Gdk
// PorticoGen: generateModifierExtension | source: Gtk.Widget
/// Modifiers for `Gtk.Widget`, available on every Portico view whose
/// backing widget is `Gtk.Widget` or one of its subclasses.
extension WidgetView where Target: Gtk.Widget {
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setCanFocus(canFocus:)
/// Sets whether the input focus can enter the widget or
/// any of its children.
///
/// Applications should set `can_focus` to false to mark a
/// widget as for pointer/touch use only.
///
/// Note that having `can_focus` be true is only one of the
/// necessary conditions for being focusable. A widget must
/// also be sensitive and focusable and not have an ancestor
/// that is marked as not can-focus in order to receive input
/// focus.
///
/// See [method`Gtk`.Widget.grab_focus] for actually setting
/// the input focus on a widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter canFocus: Whether the widget or any of its descendents can accept the input focus.
/// - Returns: A copy of this view with the modifier applied.
public func canFocus(_ canFocus: Bool) -> Self {
appending { w, _ in
w.setCanFocus(canFocus: canFocus)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setCanFocus(canFocus:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getCanFocus()
/// Sets whether the input focus can enter the widget or
/// any of its children.
///
/// Applications should set `can_focus` to false to mark a
/// widget as for pointer/touch use only.
///
/// Note that having `can_focus` be true is only one of the
/// necessary conditions for being focusable. A widget must
/// also be sensitive and focusable and not have an ancestor
/// that is marked as not can-focus in order to receive input
/// focus.
///
/// See [method`Gtk`.Widget.grab_focus] for actually setting
/// the input focus on a widget.
///
/// 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 canFocus(_ canFocus: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, canFocus, registry: ctx.registry, notifyDetail: "can-focus",
read: { [w] in w.getCanFocus() },
write: { [w] v in w.setCanFocus(canFocus: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setCanFocus(canFocus:)
/// Sets whether the input focus can enter the widget or
/// any of its children.
///
/// Applications should set `can_focus` to false to mark a
/// widget as for pointer/touch use only.
///
/// Note that having `can_focus` be true is only one of the
/// necessary conditions for being focusable. A widget must
/// also be sensitive and focusable and not have an ancestor
/// that is marked as not can-focus in order to receive input
/// focus.
///
/// See [method`Gtk`.Widget.grab_focus] for actually setting
/// the input focus on a widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setCanFocus(canFocus:)`.
///
/// - Parameter canFocus: Whether the widget or any of its descendents can accept the input focus.
/// - Returns: A copy of this view with the modifier applied.
public func canFocus(_ canFocus: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setCanFocus(canFocus: canFocus()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setCanTarget(canTarget:)
/// Sets whether the widget can be the target of pointer events.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter canTarget: Whether the widget can receive pointer events.
/// - Returns: A copy of this view with the modifier applied.
public func canTarget(_ canTarget: Bool) -> Self {
appending { w, _ in
w.setCanTarget(canTarget: canTarget)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setCanTarget(canTarget:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getCanTarget()
/// Sets whether the widget can be the target of pointer events.
///
/// 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 canTarget(_ canTarget: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, canTarget, registry: ctx.registry, notifyDetail: "can-target",
read: { [w] in w.getCanTarget() },
write: { [w] v in w.setCanTarget(canTarget: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setCanTarget(canTarget:)
/// Sets whether the widget can be the target of pointer events.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setCanTarget(canTarget:)`.
///
/// - Parameter canTarget: Whether the widget can receive pointer events.
/// - Returns: A copy of this view with the modifier applied.
public func canTarget(_ canTarget: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setCanTarget(canTarget: canTarget()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setCursor(cursor:)
/// Sets the cursor to be shown when the pointer hovers over
/// the widget.
///
/// If the `cursor` is `NULL`, `widget` will use the cursor
/// inherited from its parent.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter cursor: The cursor used by `widget`.
/// - Returns: A copy of this view with the modifier applied.
public func cursor(_ cursor: Gtk.Cursor?) -> Self {
appending { w, _ in
w.setCursor(cursor: cursor)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setCursor(cursor:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getCursor()
/// Sets the cursor to be shown when the pointer hovers over
/// the widget.
///
/// If the `cursor` is `NULL`, `widget` will use the cursor
/// inherited from its parent.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.Cursor?` 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 cursor(_ cursor: Portico.Binding<Gtk.Cursor?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, cursor, registry: ctx.registry, notifyDetail: "cursor",
read: { [w] in w.getCursor() },
write: { [w] v in w.setCursor(cursor: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Widget.setCursor(cursor:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getCursor()
/// Sets the cursor to be shown when the pointer hovers over
/// the widget.
///
/// If the `cursor` is `NULL`, `widget` will use the cursor
/// inherited from its parent.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Gtk.Cursor>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.Cursor?>` to be able to clear the property.
/// When `Gtk.Cursor` 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 cursor(_ cursor: Portico.Binding<Gtk.Cursor>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, cursor, registry: ctx.registry, notifyDetail: "cursor",
read: { [w] in w.getCursor() },
write: { [w] v in w.setCursor(cursor: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setCursor(cursor:)
/// Sets the cursor to be shown when the pointer hovers over
/// the widget.
///
/// If the `cursor` is `NULL`, `widget` will use the cursor
/// inherited from its parent.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setCursor(cursor:)`.
///
/// - Parameter cursor: The cursor used by `widget`.
/// - Returns: A copy of this view with the modifier applied.
public func cursor(_ cursor: @escaping () -> Gtk.Cursor?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setCursor(cursor: cursor()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setFocusOnClick(focusOnClick:)
/// Sets whether the widget should grab focus when it is clicked
/// with the mouse.
///
/// Making mouse clicks not grab focus is useful in places like
/// toolbars where you dont want the keyboard focus removed from
/// the main area of the application.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter focusOnClick: Whether the widget should grab focus when it is clicked with the mouse.
/// - Returns: A copy of this view with the modifier applied.
public func focusOnClick(_ focusOnClick: Bool) -> Self {
appending { w, _ in
w.setFocusOnClick(focusOnClick: focusOnClick)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setFocusOnClick(focusOnClick:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getFocusOnClick()
/// Sets whether the widget should grab focus when it is clicked
/// with the mouse.
///
/// Making mouse clicks not grab focus is useful in places like
/// toolbars where you dont want the keyboard focus removed from
/// the main area of the application.
///
/// 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 focusOnClick(_ focusOnClick: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, focusOnClick, registry: ctx.registry, notifyDetail: "focus-on-click",
read: { [w] in w.getFocusOnClick() },
write: { [w] v in w.setFocusOnClick(focusOnClick: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setFocusOnClick(focusOnClick:)
/// Sets whether the widget should grab focus when it is clicked
/// with the mouse.
///
/// Making mouse clicks not grab focus is useful in places like
/// toolbars where you dont want the keyboard focus removed from
/// the main area of the application.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setFocusOnClick(focusOnClick:)`.
///
/// - Parameter focusOnClick: Whether the widget should grab focus when it is clicked with the mouse.
/// - Returns: A copy of this view with the modifier applied.
public func focusOnClick(_ focusOnClick: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setFocusOnClick(focusOnClick: focusOnClick()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setFocusable(focusable:)
/// Sets whether the widget can own the input focus.
///
/// Widget implementations should set `focusable` to true in
/// their init() function if they want to receive keyboard input.
///
/// Note that having `focusable` be true is only one of the
/// necessary conditions for being focusable. A widget must
/// also be sensitive and can-focus and not have an ancestor
/// that is marked as not can-focus in order to receive input
/// focus.
///
/// See [method`Gtk`.Widget.grab_focus] for actually setting
/// the input focus on a widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter focusable: Whether this widget itself will accept the input focus.
/// - Returns: A copy of this view with the modifier applied.
public func focusable(_ focusable: Bool) -> Self {
appending { w, _ in
w.setFocusable(focusable: focusable)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setFocusable(focusable:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getFocusable()
/// Sets whether the widget can own the input focus.
///
/// Widget implementations should set `focusable` to true in
/// their init() function if they want to receive keyboard input.
///
/// Note that having `focusable` be true is only one of the
/// necessary conditions for being focusable. A widget must
/// also be sensitive and can-focus and not have an ancestor
/// that is marked as not can-focus in order to receive input
/// focus.
///
/// See [method`Gtk`.Widget.grab_focus] for actually setting
/// the input focus on a widget.
///
/// 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 focusable(_ focusable: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, focusable, registry: ctx.registry, notifyDetail: "focusable",
read: { [w] in w.getFocusable() },
write: { [w] v in w.setFocusable(focusable: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setFocusable(focusable:)
/// Sets whether the widget can own the input focus.
///
/// Widget implementations should set `focusable` to true in
/// their init() function if they want to receive keyboard input.
///
/// Note that having `focusable` be true is only one of the
/// necessary conditions for being focusable. A widget must
/// also be sensitive and can-focus and not have an ancestor
/// that is marked as not can-focus in order to receive input
/// focus.
///
/// See [method`Gtk`.Widget.grab_focus] for actually setting
/// the input focus on a widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setFocusable(focusable:)`.
///
/// - Parameter focusable: Whether this widget itself will accept the input focus.
/// - Returns: A copy of this view with the modifier applied.
public func focusable(_ focusable: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setFocusable(focusable: focusable()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setHalign(align:)
/// Sets the horizontal alignment of the widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter halign: How to distribute horizontal space if widget gets extra space.
/// - Returns: A copy of this view with the modifier applied.
public func halign(_ halign: Gtk.Align) -> Self {
appending { w, _ in
w.setHalign(align: halign)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setHalign(align:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getHalign()
/// Sets the horizontal alignment of the widget.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.Align` 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 halign(_ halign: Portico.Binding<Gtk.Align>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, halign, registry: ctx.registry, notifyDetail: "halign",
read: { [w] in w.getHalign() },
write: { [w] v in w.setHalign(align: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setHalign(align:)
/// Sets the horizontal alignment of the widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setHalign(align:)`.
///
/// - Parameter halign: How to distribute horizontal space if widget gets extra space.
/// - Returns: A copy of this view with the modifier applied.
public func halign(_ halign: @escaping () -> Gtk.Align) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setHalign(align: halign()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setHasTooltip(hasTooltip:)
/// Sets the `has-tooltip` property on the widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter hasTooltip: Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip] signal on `widget`.
/// - Returns: A copy of this view with the modifier applied.
public func hasTooltip(_ hasTooltip: Bool) -> Self {
appending { w, _ in
w.setHasTooltip(hasTooltip: hasTooltip)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setHasTooltip(hasTooltip:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getHasTooltip()
/// Sets the `has-tooltip` property on the widget.
///
/// 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 hasTooltip(_ hasTooltip: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, hasTooltip, registry: ctx.registry, notifyDetail: "has-tooltip",
read: { [w] in w.getHasTooltip() },
write: { [w] v in w.setHasTooltip(hasTooltip: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setHasTooltip(hasTooltip:)
/// Sets the `has-tooltip` property on the widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setHasTooltip(hasTooltip:)`.
///
/// - Parameter hasTooltip: Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip] signal on `widget`.
/// - Returns: A copy of this view with the modifier applied.
public func hasTooltip(_ hasTooltip: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setHasTooltip(hasTooltip: hasTooltip()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setHexpand(expand:)
/// Sets whether the widget would like any available extra horizontal
/// space.
///
/// When a user resizes a window, widgets with expand set to true generally
/// receive the extra space. For example, a list or scrollable area
/// or document in your window would often be set to expand.
///
/// Call this function to set the expand flag if you would like your
/// widget to become larger horizontally when the window has extra
/// room.
///
/// By default, widgets automatically expand if any of their children
/// want to expand. (To see if a widget will automatically expand given
/// its current children and state, call [method`Gtk`.Widget.compute_expand].
/// A widget can decide how the expandability of children affects its
/// own expansion by overriding the `compute_expand` virtual method on
/// `GtkWidget`.).
///
/// Setting hexpand explicitly with this function will override the
/// automatic expand behavior.
///
/// This function forces the widget to expand or not to expand,
/// regardless of children. The override occurs because
/// [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
/// [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
/// value to be used, rather than looking at children and widget state.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter hexpand: Whether to expand horizontally.
/// - Returns: A copy of this view with the modifier applied.
public func hexpand(_ hexpand: Bool) -> Self {
appending { w, _ in
w.setHexpand(expand: hexpand)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setHexpand(expand:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getHexpand()
/// Sets whether the widget would like any available extra horizontal
/// space.
///
/// When a user resizes a window, widgets with expand set to true generally
/// receive the extra space. For example, a list or scrollable area
/// or document in your window would often be set to expand.
///
/// Call this function to set the expand flag if you would like your
/// widget to become larger horizontally when the window has extra
/// room.
///
/// By default, widgets automatically expand if any of their children
/// want to expand. (To see if a widget will automatically expand given
/// its current children and state, call [method`Gtk`.Widget.compute_expand].
/// A widget can decide how the expandability of children affects its
/// own expansion by overriding the `compute_expand` virtual method on
/// `GtkWidget`.).
///
/// Setting hexpand explicitly with this function will override the
/// automatic expand behavior.
///
/// This function forces the widget to expand or not to expand,
/// regardless of children. The override occurs because
/// [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
/// [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
/// value to be used, rather than looking at children and widget state.
///
/// 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 hexpand(_ hexpand: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, hexpand, registry: ctx.registry, notifyDetail: "hexpand",
read: { [w] in w.getHexpand() },
write: { [w] v in w.setHexpand(expand: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setHexpand(expand:)
/// Sets whether the widget would like any available extra horizontal
/// space.
///
/// When a user resizes a window, widgets with expand set to true generally
/// receive the extra space. For example, a list or scrollable area
/// or document in your window would often be set to expand.
///
/// Call this function to set the expand flag if you would like your
/// widget to become larger horizontally when the window has extra
/// room.
///
/// By default, widgets automatically expand if any of their children
/// want to expand. (To see if a widget will automatically expand given
/// its current children and state, call [method`Gtk`.Widget.compute_expand].
/// A widget can decide how the expandability of children affects its
/// own expansion by overriding the `compute_expand` virtual method on
/// `GtkWidget`.).
///
/// Setting hexpand explicitly with this function will override the
/// automatic expand behavior.
///
/// This function forces the widget to expand or not to expand,
/// regardless of children. The override occurs because
/// [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
/// [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
/// value to be used, rather than looking at children and widget state.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setHexpand(expand:)`.
///
/// - Parameter hexpand: Whether to expand horizontally.
/// - Returns: A copy of this view with the modifier applied.
public func hexpand(_ hexpand: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setHexpand(expand: hexpand()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setHexpandSet(`set`:)
/// Sets whether the hexpand flag will be used.
///
/// The [property`Gtk`.Widget:hexpand-set] property will be set
/// automatically when you call [method`Gtk`.Widget.set_hexpand]
/// to set hexpand, so the most likely reason to use this function
/// would be to unset an explicit expand flag.
///
/// If hexpand is set, then it overrides any computed
/// expand value based on child widgets. If hexpand is not
/// set, then the expand value depends on whether any
/// children of the widget would like to expand.
///
/// There are few reasons to use this function, but its here
/// for completeness and consistency.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter hexpandSet: Whether to use the `hexpand` property.
/// - Returns: A copy of this view with the modifier applied.
public func hexpandSet(_ hexpandSet: Bool) -> Self {
appending { w, _ in
w.setHexpandSet(`set`: hexpandSet)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setHexpandSet(`set`:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getHexpandSet()
/// Sets whether the hexpand flag will be used.
///
/// The [property`Gtk`.Widget:hexpand-set] property will be set
/// automatically when you call [method`Gtk`.Widget.set_hexpand]
/// to set hexpand, so the most likely reason to use this function
/// would be to unset an explicit expand flag.
///
/// If hexpand is set, then it overrides any computed
/// expand value based on child widgets. If hexpand is not
/// set, then the expand value depends on whether any
/// children of the widget would like to expand.
///
/// There are few reasons to use this function, but its here
/// for completeness and consistency.
///
/// 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 hexpandSet(_ hexpandSet: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, hexpandSet, registry: ctx.registry, notifyDetail: "hexpand-set",
read: { [w] in w.getHexpandSet() },
write: { [w] v in w.setHexpandSet(`set`: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setHexpandSet(`set`:)
/// Sets whether the hexpand flag will be used.
///
/// The [property`Gtk`.Widget:hexpand-set] property will be set
/// automatically when you call [method`Gtk`.Widget.set_hexpand]
/// to set hexpand, so the most likely reason to use this function
/// would be to unset an explicit expand flag.
///
/// If hexpand is set, then it overrides any computed
/// expand value based on child widgets. If hexpand is not
/// set, then the expand value depends on whether any
/// children of the widget would like to expand.
///
/// There are few reasons to use this function, but its here
/// for completeness and consistency.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setHexpandSet(`set`:)`.
///
/// - Parameter hexpandSet: Whether to use the `hexpand` property.
/// - Returns: A copy of this view with the modifier applied.
public func hexpandSet(_ hexpandSet: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setHexpandSet(`set`: hexpandSet()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setLayoutManager(layoutManager:)
/// Sets the layout manager to use for measuring and allocating children
/// of the widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter layoutManager: The [class`Gtk`.LayoutManager] instance to use to compute the preferred size of the widget, and allocate its children.
/// - Returns: A copy of this view with the modifier applied.
public func layoutManager(_ layoutManager: Gtk.LayoutManager?) -> Self {
appending { w, _ in
w.setLayoutManager(layoutManager: layoutManager)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setLayoutManager(layoutManager:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getLayoutManager()
/// Sets the layout manager to use for measuring and allocating children
/// of the widget.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.LayoutManager?` 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 layoutManager(_ layoutManager: Portico.Binding<Gtk.LayoutManager?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, layoutManager, registry: ctx.registry, notifyDetail: "layout-manager",
read: { [w] in w.getLayoutManager() },
write: { [w] v in w.setLayoutManager(layoutManager: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Widget.setLayoutManager(layoutManager:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getLayoutManager()
/// Sets the layout manager to use for measuring and allocating children
/// of the widget.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Gtk.LayoutManager>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.LayoutManager?>` to be able to clear the property.
/// When `Gtk.LayoutManager` 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 layoutManager(_ layoutManager: Portico.Binding<Gtk.LayoutManager>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, layoutManager, registry: ctx.registry, notifyDetail: "layout-manager",
read: { [w] in w.getLayoutManager() },
write: { [w] v in w.setLayoutManager(layoutManager: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setLayoutManager(layoutManager:)
/// Sets the layout manager to use for measuring and allocating children
/// of the widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setLayoutManager(layoutManager:)`.
///
/// - Parameter layoutManager: The [class`Gtk`.LayoutManager] instance to use to compute the preferred size of the widget, and allocate its children.
/// - Returns: A copy of this view with the modifier applied.
public func layoutManager(_ layoutManager: @escaping () -> Gtk.LayoutManager?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setLayoutManager(layoutManager: layoutManager()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setLimitEvents(limitEvents:)
/// Sets whether the widget acts like a modal dialog,
/// with respect to event delivery.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter limitEvents: Makes this widget act like a modal dialog, with respect to event delivery.
/// - Returns: A copy of this view with the modifier applied.
public func limitEvents(_ limitEvents: Bool) -> Self {
appending { w, _ in
w.setLimitEvents(limitEvents: limitEvents)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setLimitEvents(limitEvents:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getLimitEvents()
/// Sets whether the widget acts like a modal dialog,
/// with respect to event delivery.
///
/// 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 limitEvents(_ limitEvents: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, limitEvents, registry: ctx.registry, notifyDetail: "limit-events",
read: { [w] in w.getLimitEvents() },
write: { [w] v in w.setLimitEvents(limitEvents: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setLimitEvents(limitEvents:)
/// Sets whether the widget acts like a modal dialog,
/// with respect to event delivery.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setLimitEvents(limitEvents:)`.
///
/// - Parameter limitEvents: Makes this widget act like a modal dialog, with respect to event delivery.
/// - Returns: A copy of this view with the modifier applied.
public func limitEvents(_ limitEvents: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setLimitEvents(limitEvents: limitEvents()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setMarginBottom(margin:)
/// Sets the bottom margin of the widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter marginBottom: Margin on bottom side of widget.
/// - Returns: A copy of this view with the modifier applied.
public func marginBottom(_ marginBottom: Int32) -> Self {
appending { w, _ in
w.setMarginBottom(margin: marginBottom)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setMarginBottom(margin:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getMarginBottom()
/// Sets the bottom margin of the widget.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Int32` 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 marginBottom(_ marginBottom: Portico.Binding<Int32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, marginBottom, registry: ctx.registry, notifyDetail: "margin-bottom",
read: { [w] in w.getMarginBottom() },
write: { [w] v in w.setMarginBottom(margin: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setMarginBottom(margin:)
/// Sets the bottom margin of the widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setMarginBottom(margin:)`.
///
/// - Parameter marginBottom: Margin on bottom side of widget.
/// - Returns: A copy of this view with the modifier applied.
public func marginBottom(_ marginBottom: @escaping () -> Int32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setMarginBottom(margin: marginBottom()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setMarginEnd(margin:)
/// Sets the end margin of the widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter marginEnd: Margin on end of widget, horizontally.
/// - Returns: A copy of this view with the modifier applied.
public func marginEnd(_ marginEnd: Int32) -> Self {
appending { w, _ in
w.setMarginEnd(margin: marginEnd)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setMarginEnd(margin:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getMarginEnd()
/// Sets the end margin of the widget.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Int32` 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 marginEnd(_ marginEnd: Portico.Binding<Int32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, marginEnd, registry: ctx.registry, notifyDetail: "margin-end",
read: { [w] in w.getMarginEnd() },
write: { [w] v in w.setMarginEnd(margin: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setMarginEnd(margin:)
/// Sets the end margin of the widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setMarginEnd(margin:)`.
///
/// - Parameter marginEnd: Margin on end of widget, horizontally.
/// - Returns: A copy of this view with the modifier applied.
public func marginEnd(_ marginEnd: @escaping () -> Int32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setMarginEnd(margin: marginEnd()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setMarginStart(margin:)
/// Sets the start margin of the widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter marginStart: Margin on start of widget, horizontally.
/// - Returns: A copy of this view with the modifier applied.
public func marginStart(_ marginStart: Int32) -> Self {
appending { w, _ in
w.setMarginStart(margin: marginStart)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setMarginStart(margin:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getMarginStart()
/// Sets the start margin of the widget.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Int32` 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 marginStart(_ marginStart: Portico.Binding<Int32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, marginStart, registry: ctx.registry, notifyDetail: "margin-start",
read: { [w] in w.getMarginStart() },
write: { [w] v in w.setMarginStart(margin: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setMarginStart(margin:)
/// Sets the start margin of the widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setMarginStart(margin:)`.
///
/// - Parameter marginStart: Margin on start of widget, horizontally.
/// - Returns: A copy of this view with the modifier applied.
public func marginStart(_ marginStart: @escaping () -> Int32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setMarginStart(margin: marginStart()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setMarginTop(margin:)
/// Sets the top margin of the widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter marginTop: Margin on top side of widget.
/// - Returns: A copy of this view with the modifier applied.
public func marginTop(_ marginTop: Int32) -> Self {
appending { w, _ in
w.setMarginTop(margin: marginTop)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setMarginTop(margin:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getMarginTop()
/// Sets the top margin of the widget.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Int32` 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 marginTop(_ marginTop: Portico.Binding<Int32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, marginTop, registry: ctx.registry, notifyDetail: "margin-top",
read: { [w] in w.getMarginTop() },
write: { [w] v in w.setMarginTop(margin: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setMarginTop(margin:)
/// Sets the top margin of the widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setMarginTop(margin:)`.
///
/// - Parameter marginTop: Margin on top side of widget.
/// - Returns: A copy of this view with the modifier applied.
public func marginTop(_ marginTop: @escaping () -> Int32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setMarginTop(margin: marginTop()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setName(name:)
/// Sets a widgets name.
///
/// Setting a name allows you to refer to the widget from a
/// CSS file. You can apply a style to widgets with a particular name
/// in the CSS file. See the documentation for the CSS syntax (on the
/// same page as the docs for [class`Gtk`.StyleContext].
///
/// Note that the CSS syntax has certain special characters to delimit
/// and represent elements in a selector (period, #, >, *...), so using
/// these will make your widget impossible to match by name. Any combination
/// of alphanumeric symbols, dashes and underscores will suffice.
///
/// 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 name: The name of the widget.
/// - Returns: A copy of this view with the modifier applied.
@_disfavoredOverload
public func name<S: StringProtocol>(_ name: S) -> Self {
appending { w, _ in
w.setName(name: String(name))
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setName(name:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getName()
/// Sets a widgets name.
///
/// Setting a name allows you to refer to the widget from a
/// CSS file. You can apply a style to widgets with a particular name
/// in the CSS file. See the documentation for the CSS syntax (on the
/// same page as the docs for [class`Gtk`.StyleContext].
///
/// Note that the CSS syntax has certain special characters to delimit
/// and represent elements in a selector (period, #, >, *...), so using
/// these will make your widget impossible to match by name. Any combination
/// of alphanumeric symbols, dashes and underscores will suffice.
///
/// 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 name(_ name: Portico.Binding<String>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, name, registry: ctx.registry, notifyDetail: "name",
read: { [w] in w.getName() },
write: { [w] v in w.setName(name: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setName(name:)
/// Sets a widgets name.
///
/// Setting a name allows you to refer to the widget from a
/// CSS file. You can apply a style to widgets with a particular name
/// in the CSS file. See the documentation for the CSS syntax (on the
/// same page as the docs for [class`Gtk`.StyleContext].
///
/// Note that the CSS syntax has certain special characters to delimit
/// and represent elements in a selector (period, #, >, *...), so using
/// these will make your widget impossible to match by name. Any combination
/// of alphanumeric symbols, dashes and underscores will suffice.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setName(name:)`.
///
/// - Parameter name: The name of the widget.
/// - Returns: A copy of this view with the modifier applied.
public func name(_ name: @escaping () -> String) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setName(name: name()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(interpolation) | source: Gtk.Widget.setName(name:)
/// Sets a widgets name.
///
/// Setting a name allows you to refer to the widget from a
/// CSS file. You can apply a style to widgets with a particular name
/// in the CSS file. See the documentation for the CSS syntax (on the
/// same page as the docs for [class`Gtk`.StyleContext].
///
/// Note that the CSS syntax has certain special characters to delimit
/// and represent elements in a selector (period, #, >, *...), so using
/// these will make your widget impossible to match by name. Any combination
/// of alphanumeric symbols, dashes and underscores will suffice.
///
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Gtk.Widget.setName(name:)`. A literal with no interpolation is applied once, with no subscription.
///
/// - Parameter name: The name of the widget.
/// - Returns: A copy of this view with the modifier applied.
public func name(_ name: Portico.InterpolatedText) -> Self {
appending { w, ctx in
Portico.bindInterpolation(name, registry: ctx.registry) { [w] v in w.setName(name: v) }
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setOpacity(opacity:)
/// Requests the widget to be rendered partially transparent.
///
/// An opacity of 0 is fully transparent and an opacity of 1
/// is fully opaque.
///
/// Opacity works on both toplevel widgets and child widgets, although
/// there are some limitations: For toplevel widgets, applying opacity
/// depends on the capabilities of the windowing system. On X11, this
/// has any effect only on X displays with a compositing manager, see
/// [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
/// always work, although setting a windows opacity after the window
/// has been shown may cause some flicker.
///
/// Note that the opacity is inherited through inclusion if you set
/// a toplevel to be partially translucent, all of its content will
/// appear translucent, since it is ultimatively rendered on that
/// toplevel. The opacity value itself is not inherited by child
/// widgets (since that would make widgets deeper in the hierarchy
/// progressively more translucent). As a consequence, [class`Gtk`.Popover]
/// instances and other [iface`Gtk`.Native] widgets with their own surface
/// will use their own opacity value, and thus by default appear
/// non-translucent, even if they are attached to a toplevel that
/// is translucent.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter opacity: The requested opacity of the widget.
/// - Returns: A copy of this view with the modifier applied.
public func opacity(_ opacity: Double) -> Self {
appending { w, _ in
w.setOpacity(opacity: opacity)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setOpacity(opacity:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getOpacity()
/// Requests the widget to be rendered partially transparent.
///
/// An opacity of 0 is fully transparent and an opacity of 1
/// is fully opaque.
///
/// Opacity works on both toplevel widgets and child widgets, although
/// there are some limitations: For toplevel widgets, applying opacity
/// depends on the capabilities of the windowing system. On X11, this
/// has any effect only on X displays with a compositing manager, see
/// [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
/// always work, although setting a windows opacity after the window
/// has been shown may cause some flicker.
///
/// Note that the opacity is inherited through inclusion if you set
/// a toplevel to be partially translucent, all of its content will
/// appear translucent, since it is ultimatively rendered on that
/// toplevel. The opacity value itself is not inherited by child
/// widgets (since that would make widgets deeper in the hierarchy
/// progressively more translucent). As a consequence, [class`Gtk`.Popover]
/// instances and other [iface`Gtk`.Native] widgets with their own surface
/// will use their own opacity value, and thus by default appear
/// non-translucent, even if they are attached to a toplevel that
/// is translucent.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Double` 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 opacity(_ opacity: Portico.Binding<Double>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, opacity, registry: ctx.registry, notifyDetail: "opacity",
read: { [w] in w.getOpacity() },
write: { [w] v in w.setOpacity(opacity: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setOpacity(opacity:)
/// Requests the widget to be rendered partially transparent.
///
/// An opacity of 0 is fully transparent and an opacity of 1
/// is fully opaque.
///
/// Opacity works on both toplevel widgets and child widgets, although
/// there are some limitations: For toplevel widgets, applying opacity
/// depends on the capabilities of the windowing system. On X11, this
/// has any effect only on X displays with a compositing manager, see
/// [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
/// always work, although setting a windows opacity after the window
/// has been shown may cause some flicker.
///
/// Note that the opacity is inherited through inclusion if you set
/// a toplevel to be partially translucent, all of its content will
/// appear translucent, since it is ultimatively rendered on that
/// toplevel. The opacity value itself is not inherited by child
/// widgets (since that would make widgets deeper in the hierarchy
/// progressively more translucent). As a consequence, [class`Gtk`.Popover]
/// instances and other [iface`Gtk`.Native] widgets with their own surface
/// will use their own opacity value, and thus by default appear
/// non-translucent, even if they are attached to a toplevel that
/// is translucent.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setOpacity(opacity:)`.
///
/// - Parameter opacity: The requested opacity of the widget.
/// - Returns: A copy of this view with the modifier applied.
public func opacity(_ opacity: @escaping () -> Double) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setOpacity(opacity: opacity()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setOverflow(overflow:)
/// Sets how the widget treats content that is drawn outside the
/// it's content area.
///
/// See the definition of [enum`Gtk`.Overflow] for details.
///
/// This setting is provided for widget implementations and
/// should not be used by application code.
///
/// The default value is [enum`Gtk`.Overflow.visible].
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter overflow: How content outside the widget's content area is treated.
/// - Returns: A copy of this view with the modifier applied.
public func overflow(_ overflow: Gtk.Overflow) -> Self {
appending { w, _ in
w.setOverflow(overflow: overflow)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setOverflow(overflow:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getOverflow()
/// Sets how the widget treats content that is drawn outside the
/// it's content area.
///
/// See the definition of [enum`Gtk`.Overflow] for details.
///
/// This setting is provided for widget implementations and
/// should not be used by application code.
///
/// The default value is [enum`Gtk`.Overflow.visible].
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.Overflow` 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 overflow(_ overflow: Portico.Binding<Gtk.Overflow>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, overflow, registry: ctx.registry, notifyDetail: "overflow",
read: { [w] in w.getOverflow() },
write: { [w] v in w.setOverflow(overflow: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setOverflow(overflow:)
/// Sets how the widget treats content that is drawn outside the
/// it's content area.
///
/// See the definition of [enum`Gtk`.Overflow] for details.
///
/// This setting is provided for widget implementations and
/// should not be used by application code.
///
/// The default value is [enum`Gtk`.Overflow.visible].
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setOverflow(overflow:)`.
///
/// - Parameter overflow: How content outside the widget's content area is treated.
/// - Returns: A copy of this view with the modifier applied.
public func overflow(_ overflow: @escaping () -> Gtk.Overflow) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setOverflow(overflow: overflow()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setReceivesDefault(receivesDefault:)
/// Sets whether the widget will be treated as the default
/// widget within its toplevel when it has the focus, even if
/// another widget is the default.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter receivesDefault: Whether the widget will receive the default action when it is focused.
/// - Returns: A copy of this view with the modifier applied.
public func receivesDefault(_ receivesDefault: Bool) -> Self {
appending { w, _ in
w.setReceivesDefault(receivesDefault: receivesDefault)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setReceivesDefault(receivesDefault:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getReceivesDefault()
/// Sets whether the widget will be treated as the default
/// widget within its toplevel when it has the focus, even if
/// another widget is the 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 receivesDefault(_ receivesDefault: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, receivesDefault, registry: ctx.registry, notifyDetail: "receives-default",
read: { [w] in w.getReceivesDefault() },
write: { [w] v in w.setReceivesDefault(receivesDefault: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setReceivesDefault(receivesDefault:)
/// Sets whether the widget will be treated as the default
/// widget within its toplevel when it has the focus, even if
/// another widget is the default.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setReceivesDefault(receivesDefault:)`.
///
/// - Parameter receivesDefault: Whether the widget will receive the default action when it is focused.
/// - Returns: A copy of this view with the modifier applied.
public func receivesDefault(_ receivesDefault: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setReceivesDefault(receivesDefault: receivesDefault()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setSensitive(sensitive:)
/// Sets the sensitivity of the widget.
///
/// A widget is sensitive if the user can interact with it.
/// Insensitive widgets are grayed out and the user cant
/// interact with them. Insensitive widgets are known as
/// inactive, disabled, or ghosted in some other toolkits.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter sensitive: Whether the widget responds to input.
/// - Returns: A copy of this view with the modifier applied.
public func sensitive(_ sensitive: Bool) -> Self {
appending { w, _ in
w.setSensitive(sensitive: sensitive)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setSensitive(sensitive:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getSensitive()
/// Sets the sensitivity of the widget.
///
/// A widget is sensitive if the user can interact with it.
/// Insensitive widgets are grayed out and the user cant
/// interact with them. Insensitive widgets are known as
/// inactive, disabled, or ghosted in some other toolkits.
///
/// 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 sensitive(_ sensitive: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, sensitive, registry: ctx.registry, notifyDetail: "sensitive",
read: { [w] in w.getSensitive() },
write: { [w] v in w.setSensitive(sensitive: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setSensitive(sensitive:)
/// Sets the sensitivity of the widget.
///
/// A widget is sensitive if the user can interact with it.
/// Insensitive widgets are grayed out and the user cant
/// interact with them. Insensitive widgets are known as
/// inactive, disabled, or ghosted in some other toolkits.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setSensitive(sensitive:)`.
///
/// - Parameter sensitive: Whether the widget responds to input.
/// - Returns: A copy of this view with the modifier applied.
public func sensitive(_ sensitive: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setSensitive(sensitive: sensitive()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setTooltipMarkup(markup:)
/// Sets the contents of the tooltip for widget.
///
/// `markup` must contain Pango markup.
///
/// This function will take care of setting the
/// [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
/// default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_markup].
///
/// 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 tooltipMarkup: Sets the text of tooltip to be the given string, which is marked up with Pango markup.
/// - Returns: A copy of this view with the modifier applied.
@_disfavoredOverload
public func tooltipMarkup<S: StringProtocol>(_ tooltipMarkup: S?) -> Self {
appending { w, _ in
w.setTooltipMarkup(markup: tooltipMarkup.map { String($0) })
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setTooltipMarkup(markup:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getTooltipMarkup()
/// Sets the contents of the tooltip for widget.
///
/// `markup` must contain Pango markup.
///
/// This function will take care of setting the
/// [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
/// default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_markup].
///
/// 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 tooltipMarkup(_ tooltipMarkup: Portico.Binding<String?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, tooltipMarkup, registry: ctx.registry, notifyDetail: "tooltip-markup",
read: { [w] in w.getTooltipMarkup() },
write: { [w] v in w.setTooltipMarkup(markup: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Widget.setTooltipMarkup(markup:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getTooltipMarkup()
/// Sets the contents of the tooltip for widget.
///
/// `markup` must contain Pango markup.
///
/// This function will take care of setting the
/// [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
/// default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_markup].
///
/// 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 tooltipMarkup(_ tooltipMarkup: Portico.Binding<String>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, tooltipMarkup, registry: ctx.registry, notifyDetail: "tooltip-markup",
read: { [w] in w.getTooltipMarkup() },
write: { [w] v in w.setTooltipMarkup(markup: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setTooltipMarkup(markup:)
/// Sets the contents of the tooltip for widget.
///
/// `markup` must contain Pango markup.
///
/// This function will take care of setting the
/// [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
/// default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_markup].
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setTooltipMarkup(markup:)`.
///
/// - Parameter tooltipMarkup: Sets the text of tooltip to be the given string, which is marked up with Pango markup.
/// - Returns: A copy of this view with the modifier applied.
public func tooltipMarkup(_ tooltipMarkup: @escaping () -> String?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setTooltipMarkup(markup: tooltipMarkup()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(interpolation) | source: Gtk.Widget.setTooltipMarkup(markup:)
/// Sets the contents of the tooltip for widget.
///
/// `markup` must contain Pango markup.
///
/// This function will take care of setting the
/// [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
/// default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_markup].
///
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Gtk.Widget.setTooltipMarkup(markup:)`. A literal with no interpolation is applied once, with no subscription.
///
/// - Parameter tooltipMarkup: Sets the text of tooltip to be the given string, which is marked up with Pango markup.
/// - Returns: A copy of this view with the modifier applied.
public func tooltipMarkup(_ tooltipMarkup: Portico.InterpolatedText?) -> Self {
appending { w, ctx in
Portico.bindOptionalInterpolation(tooltipMarkup, registry: ctx.registry) { [w] v in w.setTooltipMarkup(markup: v) }
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setTooltipText(text:)
/// Sets the contents of the tooltip for the widget.
///
/// If `text` contains any markup, it will be escaped.
///
/// This function will take care of setting
/// [property`Gtk`.Widget:has-tooltip] as a side effect,
/// and of the default handler for the
/// [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_text].
///
/// 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 tooltipText: Sets the text of tooltip to be the given string.
/// - Returns: A copy of this view with the modifier applied.
@_disfavoredOverload
public func tooltipText<S: StringProtocol>(_ tooltipText: S?) -> Self {
appending { w, _ in
w.setTooltipText(text: tooltipText.map { String($0) })
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setTooltipText(text:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getTooltipText()
/// Sets the contents of the tooltip for the widget.
///
/// If `text` contains any markup, it will be escaped.
///
/// This function will take care of setting
/// [property`Gtk`.Widget:has-tooltip] as a side effect,
/// and of the default handler for the
/// [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_text].
///
/// 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 tooltipText(_ tooltipText: Portico.Binding<String?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, tooltipText, registry: ctx.registry, notifyDetail: "tooltip-text",
read: { [w] in w.getTooltipText() },
write: { [w] v in w.setTooltipText(text: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Widget.setTooltipText(text:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getTooltipText()
/// Sets the contents of the tooltip for the widget.
///
/// If `text` contains any markup, it will be escaped.
///
/// This function will take care of setting
/// [property`Gtk`.Widget:has-tooltip] as a side effect,
/// and of the default handler for the
/// [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_text].
///
/// 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 tooltipText(_ tooltipText: Portico.Binding<String>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, tooltipText, registry: ctx.registry, notifyDetail: "tooltip-text",
read: { [w] in w.getTooltipText() },
write: { [w] v in w.setTooltipText(text: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setTooltipText(text:)
/// Sets the contents of the tooltip for the widget.
///
/// If `text` contains any markup, it will be escaped.
///
/// This function will take care of setting
/// [property`Gtk`.Widget:has-tooltip] as a side effect,
/// and of the default handler for the
/// [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_text].
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setTooltipText(text:)`.
///
/// - Parameter tooltipText: Sets the text of tooltip to be the given string.
/// - Returns: A copy of this view with the modifier applied.
public func tooltipText(_ tooltipText: @escaping () -> String?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setTooltipText(text: tooltipText()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(interpolation) | source: Gtk.Widget.setTooltipText(text:)
/// Sets the contents of the tooltip for the widget.
///
/// If `text` contains any markup, it will be escaped.
///
/// This function will take care of setting
/// [property`Gtk`.Widget:has-tooltip] as a side effect,
/// and of the default handler for the
/// [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_text].
///
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Gtk.Widget.setTooltipText(text:)`. A literal with no interpolation is applied once, with no subscription.
///
/// - Parameter tooltipText: Sets the text of tooltip to be the given string.
/// - Returns: A copy of this view with the modifier applied.
public func tooltipText(_ tooltipText: Portico.InterpolatedText?) -> Self {
appending { w, ctx in
Portico.bindOptionalInterpolation(tooltipText, registry: ctx.registry) { [w] v in w.setTooltipText(text: v) }
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setValign(align:)
/// Sets the vertical alignment of the widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter valign: How to distribute vertical space if widget gets extra space.
/// - Returns: A copy of this view with the modifier applied.
public func valign(_ valign: Gtk.Align) -> Self {
appending { w, _ in
w.setValign(align: valign)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setValign(align:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getValign()
/// Sets the vertical alignment of the widget.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.Align` 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 valign(_ valign: Portico.Binding<Gtk.Align>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, valign, registry: ctx.registry, notifyDetail: "valign",
read: { [w] in w.getValign() },
write: { [w] v in w.setValign(align: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setValign(align:)
/// Sets the vertical alignment of the widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setValign(align:)`.
///
/// - Parameter valign: How to distribute vertical space if widget gets extra space.
/// - Returns: A copy of this view with the modifier applied.
public func valign(_ valign: @escaping () -> Gtk.Align) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setValign(align: valign()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setVexpand(expand:)
/// Sets whether the widget would like any available extra vertical
/// space.
///
/// See [method`Gtk`.Widget.set_hexpand] for more detail.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter vexpand: Whether to expand vertically.
/// - Returns: A copy of this view with the modifier applied.
public func vexpand(_ vexpand: Bool) -> Self {
appending { w, _ in
w.setVexpand(expand: vexpand)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setVexpand(expand:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getVexpand()
/// Sets whether the widget would like any available extra vertical
/// space.
///
/// See [method`Gtk`.Widget.set_hexpand] for more detail.
///
/// 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 vexpand(_ vexpand: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, vexpand, registry: ctx.registry, notifyDetail: "vexpand",
read: { [w] in w.getVexpand() },
write: { [w] v in w.setVexpand(expand: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setVexpand(expand:)
/// Sets whether the widget would like any available extra vertical
/// space.
///
/// See [method`Gtk`.Widget.set_hexpand] for more detail.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setVexpand(expand:)`.
///
/// - Parameter vexpand: Whether to expand vertically.
/// - Returns: A copy of this view with the modifier applied.
public func vexpand(_ vexpand: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setVexpand(expand: vexpand()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setVexpandSet(`set`:)
/// Sets whether the vexpand flag will be used.
///
/// See [method`Gtk`.Widget.set_hexpand_set] for more detail.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter vexpandSet: Whether to use the `vexpand` property.
/// - Returns: A copy of this view with the modifier applied.
public func vexpandSet(_ vexpandSet: Bool) -> Self {
appending { w, _ in
w.setVexpandSet(`set`: vexpandSet)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setVexpandSet(`set`:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getVexpandSet()
/// Sets whether the vexpand flag will be used.
///
/// See [method`Gtk`.Widget.set_hexpand_set] for more detail.
///
/// 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 vexpandSet(_ vexpandSet: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, vexpandSet, registry: ctx.registry, notifyDetail: "vexpand-set",
read: { [w] in w.getVexpandSet() },
write: { [w] v in w.setVexpandSet(`set`: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setVexpandSet(`set`:)
/// Sets whether the vexpand flag will be used.
///
/// See [method`Gtk`.Widget.set_hexpand_set] for more detail.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setVexpandSet(`set`:)`.
///
/// - Parameter vexpandSet: Whether to use the `vexpand` property.
/// - Returns: A copy of this view with the modifier applied.
public func vexpandSet(_ vexpandSet: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setVexpandSet(`set`: vexpandSet()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setVisible(visible:)
/// Sets the visibility state of `widget`.
///
/// Note that setting this to true doesnt mean the widget is
/// actually viewable, see [method`Gtk`.Widget.get_visible].
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter visible: Whether the widget is visible.
/// - Returns: A copy of this view with the modifier applied.
public func visible(_ visible: Bool) -> Self {
appending { w, _ in
Portico.WidgetVisibility.setUser(w, visible)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(visible) | source: Gtk.Widget.setVisible(visible:), Gtk.Widget.getVisible()
/// Sets the visibility state of `widget`.
///
/// The branch and user visibility layers are combined; branch transitions do not write back into the binding.
///
/// - Returns: A copy of this view with the modifier applied.
public func visible(_ visible: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, visible, registry: ctx.registry, notifyDetail: "visible",
read: { [w] in Portico.WidgetVisibility.userValue(w) },
write: { [w] v in Portico.WidgetVisibility.setUser(w, v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setVisible(visible:)
/// Sets the visibility state of `widget`.
///
/// Note that setting this to true doesnt mean the widget is
/// actually viewable, see [method`Gtk`.Widget.get_visible].
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setVisible(visible:)`.
///
/// - Parameter visible: Whether the widget is visible.
/// - Returns: A copy of this view with the modifier applied.
public func visible(_ visible: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in Portico.WidgetVisibility.setUser(w, visible()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Widget.connectDestroy(_:)
/// Signals that all holders of a reference to the widget should release
/// the reference that they hold.
///
/// May result in finalization of the widget if all references are released.
///
/// This signal is not suitable for saving widget state.
///
/// - Parameter handler: Invoked when the widget emits the `destroy` signal.
/// - Returns: A copy of this view with the modifier applied.
public func onDestroy(_ handler: @escaping () -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectDestroy { _ in handler() })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Widget.connectDirectionChanged(_:)
/// Emitted when the text direction of a widget changes.
///
/// - Parameter handler: Invoked when the widget emits the `direction-changed` signal. The closure receives the signal's arguments in order.
/// - Returns: A copy of this view with the modifier applied.
public func onDirectionChanged(_ handler: @escaping (Gtk.TextDirection) -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectDirectionChanged { _, a0 in handler(a0) })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Widget.connectHide(_:)
/// Emitted when `widget` is hidden.
///
/// - Parameter handler: Invoked when the widget emits the `hide` signal.
/// - Returns: A copy of this view with the modifier applied.
public func onHide(_ handler: @escaping () -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectHide { _ in handler() })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Widget.connectKeynavFailed(_:)
/// Emitted if keyboard navigation fails.
///
/// See [method`Gtk`.Widget.keynav_failed] for details.
///
/// - Parameter handler: Invoked when the widget emits the `keynav-failed` 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 onKeynavFailed(_ handler: @escaping (Gtk.DirectionType) -> Bool) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectKeynavFailed { _, a0 in handler(a0) })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Widget.connectMap(_:)
/// Emitted when `widget` is going to be mapped.
///
/// A widget is mapped when the widget is visible (which is controlled with
/// [property`Gtk`.Widget:visible]) and all its parents up to the toplevel widget
/// are also visible.
///
/// The `::map` signal can be used to determine whether a widget will be drawn,
/// for instance it can resume an animation that was stopped during the
/// emission of [signal`Gtk`.Widget::unmap].
///
/// - Parameter handler: Invoked when the widget emits the `map` signal.
/// - Returns: A copy of this view with the modifier applied.
public func onMap(_ handler: @escaping () -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectMap { _ in handler() })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Widget.connectMnemonicActivate(_:)
/// Emitted when a widget is activated via a mnemonic.
///
/// The default handler for this signal activates `widget` if `group_cycling`
/// is false, or just makes `widget` grab focus if `group_cycling` is true.
///
/// - Parameter handler: Invoked when the widget emits the `mnemonic-activate` 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 onMnemonicActivate(_ handler: @escaping (Bool) -> Bool) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectMnemonicActivate { _, a0 in handler(a0) })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Widget.connectMoveFocus(_:)
/// Emitted when the focus is moved.
///
/// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
///
/// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
/// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
///
/// - Parameter handler: Invoked when the widget emits the `move-focus` signal. The closure receives the signal's arguments in order.
/// - Returns: A copy of this view with the modifier applied.
public func onMoveFocus(_ handler: @escaping (Gtk.DirectionType) -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectMoveFocus { _, a0 in handler(a0) })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Widget.connectQueryTooltip(_:)
/// Emitted when the widgets tooltip is about to be shown.
///
/// This happens when the [property`Gtk`.Widget:has-tooltip] property
/// is true and the hover timeout has expired with the cursor hovering
/// above `widget`; or emitted when `widget` got focus in keyboard mode.
///
/// Using the given coordinates, the signal handler should determine
/// whether a tooltip should be shown for `widget`. If this is the case
/// true should be returned, false otherwise. Note that if `keyboard_mode`
/// is true, the values of `x` and `y` are undefined and should not be used.
///
/// The signal handler is free to manipulate `tooltip` with the therefore
/// destined function calls.
///
/// - Parameter handler: Invoked when the widget emits the `query-tooltip` 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 onQueryTooltip(_ handler: @escaping (Int32, Int32, Bool, Gtk.Tooltip) -> Bool) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectQueryTooltip { _, a0, a1, a2, a3 in handler(a0, a1, a2, a3) })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Widget.connectRealize(_:)
/// Emitted when `widget` is associated with a `GdkSurface`.
///
/// This means that [method`Gtk`.Widget.realize] has been called
/// or the widget has been mapped (that is, it is going to be drawn).
///
/// - Parameter handler: Invoked when the widget emits the `realize` signal.
/// - Returns: A copy of this view with the modifier applied.
public func onRealize(_ handler: @escaping () -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectRealize { _ in handler() })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Widget.connectShow(_:)
/// Emitted when `widget` is shown.
///
/// - Parameter handler: Invoked when the widget emits the `show` signal.
/// - Returns: A copy of this view with the modifier applied.
public func onShow(_ handler: @escaping () -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectShow { _ in handler() })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Widget.connectStateFlagsChanged(_:)
/// Emitted when the widget state changes.
///
/// See [method`Gtk`.Widget.get_state_flags].
///
/// - Parameter handler: Invoked when the widget emits the `state-flags-changed` signal. The closure receives the signal's arguments in order.
/// - Returns: A copy of this view with the modifier applied.
public func onStateFlagsChanged(_ handler: @escaping (Gtk.StateFlags) -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectStateFlagsChanged { _, a0 in handler(a0) })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Widget.connectUnmap(_:)
/// Emitted when `widget` is going to be unmapped.
///
/// A widget is unmapped when either it or any of its parents up to the
/// toplevel widget have been set as hidden.
///
/// As `::unmap` indicates that a widget will not be shown any longer,
/// it can be used to, for example, stop an animation on the widget.
///
/// - Parameter handler: Invoked when the widget emits the `unmap` signal.
/// - Returns: A copy of this view with the modifier applied.
public func onUnmap(_ handler: @escaping () -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectUnmap { _ in handler() })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Widget.connectUnrealize(_:)
/// Emitted when the `GdkSurface` associated with `widget` is destroyed.
///
/// This means that [method`Gtk`.Widget.unrealize] has been called
/// or the widget has been unmapped (that is, it is going to be hidden).
///
/// - Parameter handler: Invoked when the widget emits the `unrealize` signal.
/// - Returns: A copy of this view with the modifier applied.
public func onUnrealize(_ handler: @escaping () -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectUnrealize { _ in handler() })
}
}
}
// PorticoGen: generateViewExtension | source: Gtk.Widget
/// Widget-level modifiers for any `View`.
///
/// These erase to `AnyView` so they compose with views that do not conform
/// to `WidgetView`. `WidgetView` conformers prefer the `Self`-returning
/// `WidgetView where Target: Gtk.Widget` overloads by Swift's overload
/// resolution, preserving their concrete type for chaining.
extension View {
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setCanFocus(canFocus:)
/// Sets whether the input focus can enter the widget or
/// any of its children.
///
/// Applications should set `can_focus` to false to mark a
/// widget as for pointer/touch use only.
///
/// Note that having `can_focus` be true is only one of the
/// necessary conditions for being focusable. A widget must
/// also be sensitive and focusable and not have an ancestor
/// that is marked as not can-focus in order to receive input
/// focus.
///
/// See [method`Gtk`.Widget.grab_focus] for actually setting
/// the input focus on a widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter canFocus: Whether the widget or any of its descendents can accept the input focus.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func canFocus(_ canFocus: Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setCanFocus(canFocus: canFocus)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setCanFocus(canFocus:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getCanFocus()
/// Sets whether the input focus can enter the widget or
/// any of its children.
///
/// Applications should set `can_focus` to false to mark a
/// widget as for pointer/touch use only.
///
/// Note that having `can_focus` be true is only one of the
/// necessary conditions for being focusable. A widget must
/// also be sensitive and focusable and not have an ancestor
/// that is marked as not can-focus in order to receive input
/// focus.
///
/// See [method`Gtk`.Widget.grab_focus] for actually setting
/// the input focus on a widget.
///
/// 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: An `AnyView` wrapping this view with the modifier applied.
public func canFocus(_ canFocus: Portico.Binding<Bool>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, canFocus, registry: ctx.registry, notifyDetail: "can-focus",
read: { [w] in w.getCanFocus() },
write: { [w] v in w.setCanFocus(canFocus: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setCanFocus(canFocus:)
/// Sets whether the input focus can enter the widget or
/// any of its children.
///
/// Applications should set `can_focus` to false to mark a
/// widget as for pointer/touch use only.
///
/// Note that having `can_focus` be true is only one of the
/// necessary conditions for being focusable. A widget must
/// also be sensitive and focusable and not have an ancestor
/// that is marked as not can-focus in order to receive input
/// focus.
///
/// See [method`Gtk`.Widget.grab_focus] for actually setting
/// the input focus on a widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setCanFocus(canFocus:)`.
///
/// - Parameter canFocus: Whether the widget or any of its descendents can accept the input focus.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func canFocus(_ canFocus: @escaping () -> Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setCanFocus(canFocus: canFocus()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setCanTarget(canTarget:)
/// Sets whether the widget can be the target of pointer events.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter canTarget: Whether the widget can receive pointer events.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func canTarget(_ canTarget: Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setCanTarget(canTarget: canTarget)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setCanTarget(canTarget:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getCanTarget()
/// Sets whether the widget can be the target of pointer events.
///
/// 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: An `AnyView` wrapping this view with the modifier applied.
public func canTarget(_ canTarget: Portico.Binding<Bool>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, canTarget, registry: ctx.registry, notifyDetail: "can-target",
read: { [w] in w.getCanTarget() },
write: { [w] v in w.setCanTarget(canTarget: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setCanTarget(canTarget:)
/// Sets whether the widget can be the target of pointer events.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setCanTarget(canTarget:)`.
///
/// - Parameter canTarget: Whether the widget can receive pointer events.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func canTarget(_ canTarget: @escaping () -> Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setCanTarget(canTarget: canTarget()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setCursor(cursor:)
/// Sets the cursor to be shown when the pointer hovers over
/// the widget.
///
/// If the `cursor` is `NULL`, `widget` will use the cursor
/// inherited from its parent.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter cursor: The cursor used by `widget`.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func cursor(_ cursor: Gtk.Cursor?) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setCursor(cursor: cursor)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setCursor(cursor:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getCursor()
/// Sets the cursor to be shown when the pointer hovers over
/// the widget.
///
/// If the `cursor` is `NULL`, `widget` will use the cursor
/// inherited from its parent.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.Cursor?` 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: An `AnyView` wrapping this view with the modifier applied.
public func cursor(_ cursor: Portico.Binding<Gtk.Cursor?>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, cursor, registry: ctx.registry, notifyDetail: "cursor",
read: { [w] in w.getCursor() },
write: { [w] v in w.setCursor(cursor: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Widget.setCursor(cursor:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getCursor()
/// Sets the cursor to be shown when the pointer hovers over
/// the widget.
///
/// If the `cursor` is `NULL`, `widget` will use the cursor
/// inherited from its parent.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Gtk.Cursor>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.Cursor?>` to be able to clear the property.
/// When `Gtk.Cursor` 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: An `AnyView` wrapping this view with the modifier applied.
public func cursor(_ cursor: Portico.Binding<Gtk.Cursor>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, cursor, registry: ctx.registry, notifyDetail: "cursor",
read: { [w] in w.getCursor() },
write: { [w] v in w.setCursor(cursor: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setCursor(cursor:)
/// Sets the cursor to be shown when the pointer hovers over
/// the widget.
///
/// If the `cursor` is `NULL`, `widget` will use the cursor
/// inherited from its parent.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setCursor(cursor:)`.
///
/// - Parameter cursor: The cursor used by `widget`.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func cursor(_ cursor: @escaping () -> Gtk.Cursor?) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setCursor(cursor: cursor()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setFocusOnClick(focusOnClick:)
/// Sets whether the widget should grab focus when it is clicked
/// with the mouse.
///
/// Making mouse clicks not grab focus is useful in places like
/// toolbars where you dont want the keyboard focus removed from
/// the main area of the application.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter focusOnClick: Whether the widget should grab focus when it is clicked with the mouse.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func focusOnClick(_ focusOnClick: Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setFocusOnClick(focusOnClick: focusOnClick)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setFocusOnClick(focusOnClick:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getFocusOnClick()
/// Sets whether the widget should grab focus when it is clicked
/// with the mouse.
///
/// Making mouse clicks not grab focus is useful in places like
/// toolbars where you dont want the keyboard focus removed from
/// the main area of the application.
///
/// 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: An `AnyView` wrapping this view with the modifier applied.
public func focusOnClick(_ focusOnClick: Portico.Binding<Bool>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, focusOnClick, registry: ctx.registry, notifyDetail: "focus-on-click",
read: { [w] in w.getFocusOnClick() },
write: { [w] v in w.setFocusOnClick(focusOnClick: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setFocusOnClick(focusOnClick:)
/// Sets whether the widget should grab focus when it is clicked
/// with the mouse.
///
/// Making mouse clicks not grab focus is useful in places like
/// toolbars where you dont want the keyboard focus removed from
/// the main area of the application.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setFocusOnClick(focusOnClick:)`.
///
/// - Parameter focusOnClick: Whether the widget should grab focus when it is clicked with the mouse.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func focusOnClick(_ focusOnClick: @escaping () -> Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setFocusOnClick(focusOnClick: focusOnClick()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setFocusable(focusable:)
/// Sets whether the widget can own the input focus.
///
/// Widget implementations should set `focusable` to true in
/// their init() function if they want to receive keyboard input.
///
/// Note that having `focusable` be true is only one of the
/// necessary conditions for being focusable. A widget must
/// also be sensitive and can-focus and not have an ancestor
/// that is marked as not can-focus in order to receive input
/// focus.
///
/// See [method`Gtk`.Widget.grab_focus] for actually setting
/// the input focus on a widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter focusable: Whether this widget itself will accept the input focus.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func focusable(_ focusable: Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setFocusable(focusable: focusable)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setFocusable(focusable:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getFocusable()
/// Sets whether the widget can own the input focus.
///
/// Widget implementations should set `focusable` to true in
/// their init() function if they want to receive keyboard input.
///
/// Note that having `focusable` be true is only one of the
/// necessary conditions for being focusable. A widget must
/// also be sensitive and can-focus and not have an ancestor
/// that is marked as not can-focus in order to receive input
/// focus.
///
/// See [method`Gtk`.Widget.grab_focus] for actually setting
/// the input focus on a widget.
///
/// 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: An `AnyView` wrapping this view with the modifier applied.
public func focusable(_ focusable: Portico.Binding<Bool>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, focusable, registry: ctx.registry, notifyDetail: "focusable",
read: { [w] in w.getFocusable() },
write: { [w] v in w.setFocusable(focusable: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setFocusable(focusable:)
/// Sets whether the widget can own the input focus.
///
/// Widget implementations should set `focusable` to true in
/// their init() function if they want to receive keyboard input.
///
/// Note that having `focusable` be true is only one of the
/// necessary conditions for being focusable. A widget must
/// also be sensitive and can-focus and not have an ancestor
/// that is marked as not can-focus in order to receive input
/// focus.
///
/// See [method`Gtk`.Widget.grab_focus] for actually setting
/// the input focus on a widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setFocusable(focusable:)`.
///
/// - Parameter focusable: Whether this widget itself will accept the input focus.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func focusable(_ focusable: @escaping () -> Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setFocusable(focusable: focusable()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setHalign(align:)
/// Sets the horizontal alignment of the widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter halign: How to distribute horizontal space if widget gets extra space.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func halign(_ halign: Gtk.Align) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setHalign(align: halign)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setHalign(align:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getHalign()
/// Sets the horizontal alignment of the widget.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.Align` 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: An `AnyView` wrapping this view with the modifier applied.
public func halign(_ halign: Portico.Binding<Gtk.Align>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, halign, registry: ctx.registry, notifyDetail: "halign",
read: { [w] in w.getHalign() },
write: { [w] v in w.setHalign(align: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setHalign(align:)
/// Sets the horizontal alignment of the widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setHalign(align:)`.
///
/// - Parameter halign: How to distribute horizontal space if widget gets extra space.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func halign(_ halign: @escaping () -> Gtk.Align) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setHalign(align: halign()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setHasTooltip(hasTooltip:)
/// Sets the `has-tooltip` property on the widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter hasTooltip: Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip] signal on `widget`.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func hasTooltip(_ hasTooltip: Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setHasTooltip(hasTooltip: hasTooltip)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setHasTooltip(hasTooltip:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getHasTooltip()
/// Sets the `has-tooltip` property on the widget.
///
/// 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: An `AnyView` wrapping this view with the modifier applied.
public func hasTooltip(_ hasTooltip: Portico.Binding<Bool>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, hasTooltip, registry: ctx.registry, notifyDetail: "has-tooltip",
read: { [w] in w.getHasTooltip() },
write: { [w] v in w.setHasTooltip(hasTooltip: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setHasTooltip(hasTooltip:)
/// Sets the `has-tooltip` property on the widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setHasTooltip(hasTooltip:)`.
///
/// - Parameter hasTooltip: Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip] signal on `widget`.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func hasTooltip(_ hasTooltip: @escaping () -> Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setHasTooltip(hasTooltip: hasTooltip()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setHexpand(expand:)
/// Sets whether the widget would like any available extra horizontal
/// space.
///
/// When a user resizes a window, widgets with expand set to true generally
/// receive the extra space. For example, a list or scrollable area
/// or document in your window would often be set to expand.
///
/// Call this function to set the expand flag if you would like your
/// widget to become larger horizontally when the window has extra
/// room.
///
/// By default, widgets automatically expand if any of their children
/// want to expand. (To see if a widget will automatically expand given
/// its current children and state, call [method`Gtk`.Widget.compute_expand].
/// A widget can decide how the expandability of children affects its
/// own expansion by overriding the `compute_expand` virtual method on
/// `GtkWidget`.).
///
/// Setting hexpand explicitly with this function will override the
/// automatic expand behavior.
///
/// This function forces the widget to expand or not to expand,
/// regardless of children. The override occurs because
/// [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
/// [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
/// value to be used, rather than looking at children and widget state.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter hexpand: Whether to expand horizontally.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func hexpand(_ hexpand: Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setHexpand(expand: hexpand)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setHexpand(expand:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getHexpand()
/// Sets whether the widget would like any available extra horizontal
/// space.
///
/// When a user resizes a window, widgets with expand set to true generally
/// receive the extra space. For example, a list or scrollable area
/// or document in your window would often be set to expand.
///
/// Call this function to set the expand flag if you would like your
/// widget to become larger horizontally when the window has extra
/// room.
///
/// By default, widgets automatically expand if any of their children
/// want to expand. (To see if a widget will automatically expand given
/// its current children and state, call [method`Gtk`.Widget.compute_expand].
/// A widget can decide how the expandability of children affects its
/// own expansion by overriding the `compute_expand` virtual method on
/// `GtkWidget`.).
///
/// Setting hexpand explicitly with this function will override the
/// automatic expand behavior.
///
/// This function forces the widget to expand or not to expand,
/// regardless of children. The override occurs because
/// [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
/// [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
/// value to be used, rather than looking at children and widget state.
///
/// 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: An `AnyView` wrapping this view with the modifier applied.
public func hexpand(_ hexpand: Portico.Binding<Bool>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, hexpand, registry: ctx.registry, notifyDetail: "hexpand",
read: { [w] in w.getHexpand() },
write: { [w] v in w.setHexpand(expand: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setHexpand(expand:)
/// Sets whether the widget would like any available extra horizontal
/// space.
///
/// When a user resizes a window, widgets with expand set to true generally
/// receive the extra space. For example, a list or scrollable area
/// or document in your window would often be set to expand.
///
/// Call this function to set the expand flag if you would like your
/// widget to become larger horizontally when the window has extra
/// room.
///
/// By default, widgets automatically expand if any of their children
/// want to expand. (To see if a widget will automatically expand given
/// its current children and state, call [method`Gtk`.Widget.compute_expand].
/// A widget can decide how the expandability of children affects its
/// own expansion by overriding the `compute_expand` virtual method on
/// `GtkWidget`.).
///
/// Setting hexpand explicitly with this function will override the
/// automatic expand behavior.
///
/// This function forces the widget to expand or not to expand,
/// regardless of children. The override occurs because
/// [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
/// [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
/// value to be used, rather than looking at children and widget state.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setHexpand(expand:)`.
///
/// - Parameter hexpand: Whether to expand horizontally.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func hexpand(_ hexpand: @escaping () -> Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setHexpand(expand: hexpand()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setHexpandSet(`set`:)
/// Sets whether the hexpand flag will be used.
///
/// The [property`Gtk`.Widget:hexpand-set] property will be set
/// automatically when you call [method`Gtk`.Widget.set_hexpand]
/// to set hexpand, so the most likely reason to use this function
/// would be to unset an explicit expand flag.
///
/// If hexpand is set, then it overrides any computed
/// expand value based on child widgets. If hexpand is not
/// set, then the expand value depends on whether any
/// children of the widget would like to expand.
///
/// There are few reasons to use this function, but its here
/// for completeness and consistency.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter hexpandSet: Whether to use the `hexpand` property.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func hexpandSet(_ hexpandSet: Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setHexpandSet(`set`: hexpandSet)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setHexpandSet(`set`:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getHexpandSet()
/// Sets whether the hexpand flag will be used.
///
/// The [property`Gtk`.Widget:hexpand-set] property will be set
/// automatically when you call [method`Gtk`.Widget.set_hexpand]
/// to set hexpand, so the most likely reason to use this function
/// would be to unset an explicit expand flag.
///
/// If hexpand is set, then it overrides any computed
/// expand value based on child widgets. If hexpand is not
/// set, then the expand value depends on whether any
/// children of the widget would like to expand.
///
/// There are few reasons to use this function, but its here
/// for completeness and consistency.
///
/// 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: An `AnyView` wrapping this view with the modifier applied.
public func hexpandSet(_ hexpandSet: Portico.Binding<Bool>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, hexpandSet, registry: ctx.registry, notifyDetail: "hexpand-set",
read: { [w] in w.getHexpandSet() },
write: { [w] v in w.setHexpandSet(`set`: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setHexpandSet(`set`:)
/// Sets whether the hexpand flag will be used.
///
/// The [property`Gtk`.Widget:hexpand-set] property will be set
/// automatically when you call [method`Gtk`.Widget.set_hexpand]
/// to set hexpand, so the most likely reason to use this function
/// would be to unset an explicit expand flag.
///
/// If hexpand is set, then it overrides any computed
/// expand value based on child widgets. If hexpand is not
/// set, then the expand value depends on whether any
/// children of the widget would like to expand.
///
/// There are few reasons to use this function, but its here
/// for completeness and consistency.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setHexpandSet(`set`:)`.
///
/// - Parameter hexpandSet: Whether to use the `hexpand` property.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func hexpandSet(_ hexpandSet: @escaping () -> Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setHexpandSet(`set`: hexpandSet()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setLayoutManager(layoutManager:)
/// Sets the layout manager to use for measuring and allocating children
/// of the widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter layoutManager: The [class`Gtk`.LayoutManager] instance to use to compute the preferred size of the widget, and allocate its children.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func layoutManager(_ layoutManager: Gtk.LayoutManager?) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setLayoutManager(layoutManager: layoutManager)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setLayoutManager(layoutManager:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getLayoutManager()
/// Sets the layout manager to use for measuring and allocating children
/// of the widget.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.LayoutManager?` 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: An `AnyView` wrapping this view with the modifier applied.
public func layoutManager(_ layoutManager: Portico.Binding<Gtk.LayoutManager?>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, layoutManager, registry: ctx.registry, notifyDetail: "layout-manager",
read: { [w] in w.getLayoutManager() },
write: { [w] v in w.setLayoutManager(layoutManager: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Widget.setLayoutManager(layoutManager:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getLayoutManager()
/// Sets the layout manager to use for measuring and allocating children
/// of the widget.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Gtk.LayoutManager>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.LayoutManager?>` to be able to clear the property.
/// When `Gtk.LayoutManager` 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: An `AnyView` wrapping this view with the modifier applied.
public func layoutManager(_ layoutManager: Portico.Binding<Gtk.LayoutManager>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, layoutManager, registry: ctx.registry, notifyDetail: "layout-manager",
read: { [w] in w.getLayoutManager() },
write: { [w] v in w.setLayoutManager(layoutManager: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setLayoutManager(layoutManager:)
/// Sets the layout manager to use for measuring and allocating children
/// of the widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setLayoutManager(layoutManager:)`.
///
/// - Parameter layoutManager: The [class`Gtk`.LayoutManager] instance to use to compute the preferred size of the widget, and allocate its children.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func layoutManager(_ layoutManager: @escaping () -> Gtk.LayoutManager?) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setLayoutManager(layoutManager: layoutManager()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setLimitEvents(limitEvents:)
/// Sets whether the widget acts like a modal dialog,
/// with respect to event delivery.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter limitEvents: Makes this widget act like a modal dialog, with respect to event delivery.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func limitEvents(_ limitEvents: Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setLimitEvents(limitEvents: limitEvents)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setLimitEvents(limitEvents:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getLimitEvents()
/// Sets whether the widget acts like a modal dialog,
/// with respect to event delivery.
///
/// 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: An `AnyView` wrapping this view with the modifier applied.
public func limitEvents(_ limitEvents: Portico.Binding<Bool>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, limitEvents, registry: ctx.registry, notifyDetail: "limit-events",
read: { [w] in w.getLimitEvents() },
write: { [w] v in w.setLimitEvents(limitEvents: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setLimitEvents(limitEvents:)
/// Sets whether the widget acts like a modal dialog,
/// with respect to event delivery.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setLimitEvents(limitEvents:)`.
///
/// - Parameter limitEvents: Makes this widget act like a modal dialog, with respect to event delivery.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func limitEvents(_ limitEvents: @escaping () -> Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setLimitEvents(limitEvents: limitEvents()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setMarginBottom(margin:)
/// Sets the bottom margin of the widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter marginBottom: Margin on bottom side of widget.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func marginBottom(_ marginBottom: Int32) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setMarginBottom(margin: marginBottom)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setMarginBottom(margin:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getMarginBottom()
/// Sets the bottom margin of the widget.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Int32` 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: An `AnyView` wrapping this view with the modifier applied.
public func marginBottom(_ marginBottom: Portico.Binding<Int32>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, marginBottom, registry: ctx.registry, notifyDetail: "margin-bottom",
read: { [w] in w.getMarginBottom() },
write: { [w] v in w.setMarginBottom(margin: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setMarginBottom(margin:)
/// Sets the bottom margin of the widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setMarginBottom(margin:)`.
///
/// - Parameter marginBottom: Margin on bottom side of widget.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func marginBottom(_ marginBottom: @escaping () -> Int32) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setMarginBottom(margin: marginBottom()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setMarginEnd(margin:)
/// Sets the end margin of the widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter marginEnd: Margin on end of widget, horizontally.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func marginEnd(_ marginEnd: Int32) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setMarginEnd(margin: marginEnd)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setMarginEnd(margin:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getMarginEnd()
/// Sets the end margin of the widget.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Int32` 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: An `AnyView` wrapping this view with the modifier applied.
public func marginEnd(_ marginEnd: Portico.Binding<Int32>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, marginEnd, registry: ctx.registry, notifyDetail: "margin-end",
read: { [w] in w.getMarginEnd() },
write: { [w] v in w.setMarginEnd(margin: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setMarginEnd(margin:)
/// Sets the end margin of the widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setMarginEnd(margin:)`.
///
/// - Parameter marginEnd: Margin on end of widget, horizontally.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func marginEnd(_ marginEnd: @escaping () -> Int32) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setMarginEnd(margin: marginEnd()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setMarginStart(margin:)
/// Sets the start margin of the widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter marginStart: Margin on start of widget, horizontally.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func marginStart(_ marginStart: Int32) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setMarginStart(margin: marginStart)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setMarginStart(margin:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getMarginStart()
/// Sets the start margin of the widget.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Int32` 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: An `AnyView` wrapping this view with the modifier applied.
public func marginStart(_ marginStart: Portico.Binding<Int32>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, marginStart, registry: ctx.registry, notifyDetail: "margin-start",
read: { [w] in w.getMarginStart() },
write: { [w] v in w.setMarginStart(margin: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setMarginStart(margin:)
/// Sets the start margin of the widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setMarginStart(margin:)`.
///
/// - Parameter marginStart: Margin on start of widget, horizontally.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func marginStart(_ marginStart: @escaping () -> Int32) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setMarginStart(margin: marginStart()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setMarginTop(margin:)
/// Sets the top margin of the widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter marginTop: Margin on top side of widget.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func marginTop(_ marginTop: Int32) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setMarginTop(margin: marginTop)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setMarginTop(margin:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getMarginTop()
/// Sets the top margin of the widget.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Int32` 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: An `AnyView` wrapping this view with the modifier applied.
public func marginTop(_ marginTop: Portico.Binding<Int32>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, marginTop, registry: ctx.registry, notifyDetail: "margin-top",
read: { [w] in w.getMarginTop() },
write: { [w] v in w.setMarginTop(margin: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setMarginTop(margin:)
/// Sets the top margin of the widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setMarginTop(margin:)`.
///
/// - Parameter marginTop: Margin on top side of widget.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func marginTop(_ marginTop: @escaping () -> Int32) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setMarginTop(margin: marginTop()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setName(name:)
/// Sets a widgets name.
///
/// Setting a name allows you to refer to the widget from a
/// CSS file. You can apply a style to widgets with a particular name
/// in the CSS file. See the documentation for the CSS syntax (on the
/// same page as the docs for [class`Gtk`.StyleContext].
///
/// Note that the CSS syntax has certain special characters to delimit
/// and represent elements in a selector (period, #, >, *...), so using
/// these will make your widget impossible to match by name. Any combination
/// of alphanumeric symbols, dashes and underscores will suffice.
///
/// 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 name: The name of the widget.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
@_disfavoredOverload
public func name<S: StringProtocol>(_ name: S) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setName(name: String(name))
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setName(name:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getName()
/// Sets a widgets name.
///
/// Setting a name allows you to refer to the widget from a
/// CSS file. You can apply a style to widgets with a particular name
/// in the CSS file. See the documentation for the CSS syntax (on the
/// same page as the docs for [class`Gtk`.StyleContext].
///
/// Note that the CSS syntax has certain special characters to delimit
/// and represent elements in a selector (period, #, >, *...), so using
/// these will make your widget impossible to match by name. Any combination
/// of alphanumeric symbols, dashes and underscores will suffice.
///
/// 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: An `AnyView` wrapping this view with the modifier applied.
public func name(_ name: Portico.Binding<String>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, name, registry: ctx.registry, notifyDetail: "name",
read: { [w] in w.getName() },
write: { [w] v in w.setName(name: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setName(name:)
/// Sets a widgets name.
///
/// Setting a name allows you to refer to the widget from a
/// CSS file. You can apply a style to widgets with a particular name
/// in the CSS file. See the documentation for the CSS syntax (on the
/// same page as the docs for [class`Gtk`.StyleContext].
///
/// Note that the CSS syntax has certain special characters to delimit
/// and represent elements in a selector (period, #, >, *...), so using
/// these will make your widget impossible to match by name. Any combination
/// of alphanumeric symbols, dashes and underscores will suffice.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setName(name:)`.
///
/// - Parameter name: The name of the widget.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func name(_ name: @escaping () -> String) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setName(name: name()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(interpolation) | source: Gtk.Widget.setName(name:)
/// Sets a widgets name.
///
/// Setting a name allows you to refer to the widget from a
/// CSS file. You can apply a style to widgets with a particular name
/// in the CSS file. See the documentation for the CSS syntax (on the
/// same page as the docs for [class`Gtk`.StyleContext].
///
/// Note that the CSS syntax has certain special characters to delimit
/// and represent elements in a selector (period, #, >, *...), so using
/// these will make your widget impossible to match by name. Any combination
/// of alphanumeric symbols, dashes and underscores will suffice.
///
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Gtk.Widget.setName(name:)`. A literal with no interpolation is applied once, with no subscription.
///
/// - Parameter name: The name of the widget.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func name(_ name: Portico.InterpolatedText) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindInterpolation(name, registry: ctx.registry) { [w] v in w.setName(name: v) }
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setOpacity(opacity:)
/// Requests the widget to be rendered partially transparent.
///
/// An opacity of 0 is fully transparent and an opacity of 1
/// is fully opaque.
///
/// Opacity works on both toplevel widgets and child widgets, although
/// there are some limitations: For toplevel widgets, applying opacity
/// depends on the capabilities of the windowing system. On X11, this
/// has any effect only on X displays with a compositing manager, see
/// [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
/// always work, although setting a windows opacity after the window
/// has been shown may cause some flicker.
///
/// Note that the opacity is inherited through inclusion if you set
/// a toplevel to be partially translucent, all of its content will
/// appear translucent, since it is ultimatively rendered on that
/// toplevel. The opacity value itself is not inherited by child
/// widgets (since that would make widgets deeper in the hierarchy
/// progressively more translucent). As a consequence, [class`Gtk`.Popover]
/// instances and other [iface`Gtk`.Native] widgets with their own surface
/// will use their own opacity value, and thus by default appear
/// non-translucent, even if they are attached to a toplevel that
/// is translucent.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter opacity: The requested opacity of the widget.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func opacity(_ opacity: Double) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setOpacity(opacity: opacity)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setOpacity(opacity:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getOpacity()
/// Requests the widget to be rendered partially transparent.
///
/// An opacity of 0 is fully transparent and an opacity of 1
/// is fully opaque.
///
/// Opacity works on both toplevel widgets and child widgets, although
/// there are some limitations: For toplevel widgets, applying opacity
/// depends on the capabilities of the windowing system. On X11, this
/// has any effect only on X displays with a compositing manager, see
/// [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
/// always work, although setting a windows opacity after the window
/// has been shown may cause some flicker.
///
/// Note that the opacity is inherited through inclusion if you set
/// a toplevel to be partially translucent, all of its content will
/// appear translucent, since it is ultimatively rendered on that
/// toplevel. The opacity value itself is not inherited by child
/// widgets (since that would make widgets deeper in the hierarchy
/// progressively more translucent). As a consequence, [class`Gtk`.Popover]
/// instances and other [iface`Gtk`.Native] widgets with their own surface
/// will use their own opacity value, and thus by default appear
/// non-translucent, even if they are attached to a toplevel that
/// is translucent.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Double` 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: An `AnyView` wrapping this view with the modifier applied.
public func opacity(_ opacity: Portico.Binding<Double>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, opacity, registry: ctx.registry, notifyDetail: "opacity",
read: { [w] in w.getOpacity() },
write: { [w] v in w.setOpacity(opacity: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setOpacity(opacity:)
/// Requests the widget to be rendered partially transparent.
///
/// An opacity of 0 is fully transparent and an opacity of 1
/// is fully opaque.
///
/// Opacity works on both toplevel widgets and child widgets, although
/// there are some limitations: For toplevel widgets, applying opacity
/// depends on the capabilities of the windowing system. On X11, this
/// has any effect only on X displays with a compositing manager, see
/// [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
/// always work, although setting a windows opacity after the window
/// has been shown may cause some flicker.
///
/// Note that the opacity is inherited through inclusion if you set
/// a toplevel to be partially translucent, all of its content will
/// appear translucent, since it is ultimatively rendered on that
/// toplevel. The opacity value itself is not inherited by child
/// widgets (since that would make widgets deeper in the hierarchy
/// progressively more translucent). As a consequence, [class`Gtk`.Popover]
/// instances and other [iface`Gtk`.Native] widgets with their own surface
/// will use their own opacity value, and thus by default appear
/// non-translucent, even if they are attached to a toplevel that
/// is translucent.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setOpacity(opacity:)`.
///
/// - Parameter opacity: The requested opacity of the widget.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func opacity(_ opacity: @escaping () -> Double) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setOpacity(opacity: opacity()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setOverflow(overflow:)
/// Sets how the widget treats content that is drawn outside the
/// it's content area.
///
/// See the definition of [enum`Gtk`.Overflow] for details.
///
/// This setting is provided for widget implementations and
/// should not be used by application code.
///
/// The default value is [enum`Gtk`.Overflow.visible].
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter overflow: How content outside the widget's content area is treated.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func overflow(_ overflow: Gtk.Overflow) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setOverflow(overflow: overflow)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setOverflow(overflow:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getOverflow()
/// Sets how the widget treats content that is drawn outside the
/// it's content area.
///
/// See the definition of [enum`Gtk`.Overflow] for details.
///
/// This setting is provided for widget implementations and
/// should not be used by application code.
///
/// The default value is [enum`Gtk`.Overflow.visible].
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.Overflow` 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: An `AnyView` wrapping this view with the modifier applied.
public func overflow(_ overflow: Portico.Binding<Gtk.Overflow>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, overflow, registry: ctx.registry, notifyDetail: "overflow",
read: { [w] in w.getOverflow() },
write: { [w] v in w.setOverflow(overflow: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setOverflow(overflow:)
/// Sets how the widget treats content that is drawn outside the
/// it's content area.
///
/// See the definition of [enum`Gtk`.Overflow] for details.
///
/// This setting is provided for widget implementations and
/// should not be used by application code.
///
/// The default value is [enum`Gtk`.Overflow.visible].
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setOverflow(overflow:)`.
///
/// - Parameter overflow: How content outside the widget's content area is treated.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func overflow(_ overflow: @escaping () -> Gtk.Overflow) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setOverflow(overflow: overflow()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setReceivesDefault(receivesDefault:)
/// Sets whether the widget will be treated as the default
/// widget within its toplevel when it has the focus, even if
/// another widget is the default.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter receivesDefault: Whether the widget will receive the default action when it is focused.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func receivesDefault(_ receivesDefault: Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setReceivesDefault(receivesDefault: receivesDefault)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setReceivesDefault(receivesDefault:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getReceivesDefault()
/// Sets whether the widget will be treated as the default
/// widget within its toplevel when it has the focus, even if
/// another widget is the 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: An `AnyView` wrapping this view with the modifier applied.
public func receivesDefault(_ receivesDefault: Portico.Binding<Bool>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, receivesDefault, registry: ctx.registry, notifyDetail: "receives-default",
read: { [w] in w.getReceivesDefault() },
write: { [w] v in w.setReceivesDefault(receivesDefault: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setReceivesDefault(receivesDefault:)
/// Sets whether the widget will be treated as the default
/// widget within its toplevel when it has the focus, even if
/// another widget is the default.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setReceivesDefault(receivesDefault:)`.
///
/// - Parameter receivesDefault: Whether the widget will receive the default action when it is focused.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func receivesDefault(_ receivesDefault: @escaping () -> Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setReceivesDefault(receivesDefault: receivesDefault()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setSensitive(sensitive:)
/// Sets the sensitivity of the widget.
///
/// A widget is sensitive if the user can interact with it.
/// Insensitive widgets are grayed out and the user cant
/// interact with them. Insensitive widgets are known as
/// inactive, disabled, or ghosted in some other toolkits.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter sensitive: Whether the widget responds to input.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func sensitive(_ sensitive: Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setSensitive(sensitive: sensitive)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setSensitive(sensitive:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getSensitive()
/// Sets the sensitivity of the widget.
///
/// A widget is sensitive if the user can interact with it.
/// Insensitive widgets are grayed out and the user cant
/// interact with them. Insensitive widgets are known as
/// inactive, disabled, or ghosted in some other toolkits.
///
/// 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: An `AnyView` wrapping this view with the modifier applied.
public func sensitive(_ sensitive: Portico.Binding<Bool>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, sensitive, registry: ctx.registry, notifyDetail: "sensitive",
read: { [w] in w.getSensitive() },
write: { [w] v in w.setSensitive(sensitive: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setSensitive(sensitive:)
/// Sets the sensitivity of the widget.
///
/// A widget is sensitive if the user can interact with it.
/// Insensitive widgets are grayed out and the user cant
/// interact with them. Insensitive widgets are known as
/// inactive, disabled, or ghosted in some other toolkits.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setSensitive(sensitive:)`.
///
/// - Parameter sensitive: Whether the widget responds to input.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func sensitive(_ sensitive: @escaping () -> Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setSensitive(sensitive: sensitive()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setTooltipMarkup(markup:)
/// Sets the contents of the tooltip for widget.
///
/// `markup` must contain Pango markup.
///
/// This function will take care of setting the
/// [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
/// default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_markup].
///
/// 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 tooltipMarkup: Sets the text of tooltip to be the given string, which is marked up with Pango markup.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
@_disfavoredOverload
public func tooltipMarkup<S: StringProtocol>(_ tooltipMarkup: S?) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setTooltipMarkup(markup: tooltipMarkup.map { String($0) })
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setTooltipMarkup(markup:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getTooltipMarkup()
/// Sets the contents of the tooltip for widget.
///
/// `markup` must contain Pango markup.
///
/// This function will take care of setting the
/// [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
/// default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_markup].
///
/// 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: An `AnyView` wrapping this view with the modifier applied.
public func tooltipMarkup(_ tooltipMarkup: Portico.Binding<String?>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, tooltipMarkup, registry: ctx.registry, notifyDetail: "tooltip-markup",
read: { [w] in w.getTooltipMarkup() },
write: { [w] v in w.setTooltipMarkup(markup: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Widget.setTooltipMarkup(markup:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getTooltipMarkup()
/// Sets the contents of the tooltip for widget.
///
/// `markup` must contain Pango markup.
///
/// This function will take care of setting the
/// [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
/// default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_markup].
///
/// 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: An `AnyView` wrapping this view with the modifier applied.
public func tooltipMarkup(_ tooltipMarkup: Portico.Binding<String>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, tooltipMarkup, registry: ctx.registry, notifyDetail: "tooltip-markup",
read: { [w] in w.getTooltipMarkup() },
write: { [w] v in w.setTooltipMarkup(markup: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setTooltipMarkup(markup:)
/// Sets the contents of the tooltip for widget.
///
/// `markup` must contain Pango markup.
///
/// This function will take care of setting the
/// [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
/// default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_markup].
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setTooltipMarkup(markup:)`.
///
/// - Parameter tooltipMarkup: Sets the text of tooltip to be the given string, which is marked up with Pango markup.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func tooltipMarkup(_ tooltipMarkup: @escaping () -> String?) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setTooltipMarkup(markup: tooltipMarkup()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(interpolation) | source: Gtk.Widget.setTooltipMarkup(markup:)
/// Sets the contents of the tooltip for widget.
///
/// `markup` must contain Pango markup.
///
/// This function will take care of setting the
/// [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
/// default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_markup].
///
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Gtk.Widget.setTooltipMarkup(markup:)`. A literal with no interpolation is applied once, with no subscription.
///
/// - Parameter tooltipMarkup: Sets the text of tooltip to be the given string, which is marked up with Pango markup.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func tooltipMarkup(_ tooltipMarkup: Portico.InterpolatedText?) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindOptionalInterpolation(tooltipMarkup, registry: ctx.registry) { [w] v in w.setTooltipMarkup(markup: v) }
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setTooltipText(text:)
/// Sets the contents of the tooltip for the widget.
///
/// If `text` contains any markup, it will be escaped.
///
/// This function will take care of setting
/// [property`Gtk`.Widget:has-tooltip] as a side effect,
/// and of the default handler for the
/// [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_text].
///
/// 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 tooltipText: Sets the text of tooltip to be the given string.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
@_disfavoredOverload
public func tooltipText<S: StringProtocol>(_ tooltipText: S?) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setTooltipText(text: tooltipText.map { String($0) })
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setTooltipText(text:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getTooltipText()
/// Sets the contents of the tooltip for the widget.
///
/// If `text` contains any markup, it will be escaped.
///
/// This function will take care of setting
/// [property`Gtk`.Widget:has-tooltip] as a side effect,
/// and of the default handler for the
/// [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_text].
///
/// 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: An `AnyView` wrapping this view with the modifier applied.
public func tooltipText(_ tooltipText: Portico.Binding<String?>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, tooltipText, registry: ctx.registry, notifyDetail: "tooltip-text",
read: { [w] in w.getTooltipText() },
write: { [w] v in w.setTooltipText(text: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Widget.setTooltipText(text:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getTooltipText()
/// Sets the contents of the tooltip for the widget.
///
/// If `text` contains any markup, it will be escaped.
///
/// This function will take care of setting
/// [property`Gtk`.Widget:has-tooltip] as a side effect,
/// and of the default handler for the
/// [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_text].
///
/// 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: An `AnyView` wrapping this view with the modifier applied.
public func tooltipText(_ tooltipText: Portico.Binding<String>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, tooltipText, registry: ctx.registry, notifyDetail: "tooltip-text",
read: { [w] in w.getTooltipText() },
write: { [w] v in w.setTooltipText(text: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setTooltipText(text:)
/// Sets the contents of the tooltip for the widget.
///
/// If `text` contains any markup, it will be escaped.
///
/// This function will take care of setting
/// [property`Gtk`.Widget:has-tooltip] as a side effect,
/// and of the default handler for the
/// [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_text].
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setTooltipText(text:)`.
///
/// - Parameter tooltipText: Sets the text of tooltip to be the given string.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func tooltipText(_ tooltipText: @escaping () -> String?) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setTooltipText(text: tooltipText()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(interpolation) | source: Gtk.Widget.setTooltipText(text:)
/// Sets the contents of the tooltip for the widget.
///
/// If `text` contains any markup, it will be escaped.
///
/// This function will take care of setting
/// [property`Gtk`.Widget:has-tooltip] as a side effect,
/// and of the default handler for the
/// [signal`Gtk`.Widget::query-tooltip] signal.
///
/// See also [method`Gtk`.Tooltip.set_text].
///
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Gtk.Widget.setTooltipText(text:)`. A literal with no interpolation is applied once, with no subscription.
///
/// - Parameter tooltipText: Sets the text of tooltip to be the given string.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func tooltipText(_ tooltipText: Portico.InterpolatedText?) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindOptionalInterpolation(tooltipText, registry: ctx.registry) { [w] v in w.setTooltipText(text: v) }
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setValign(align:)
/// Sets the vertical alignment of the widget.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter valign: How to distribute vertical space if widget gets extra space.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func valign(_ valign: Gtk.Align) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setValign(align: valign)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setValign(align:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getValign()
/// Sets the vertical alignment of the widget.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.Align` 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: An `AnyView` wrapping this view with the modifier applied.
public func valign(_ valign: Portico.Binding<Gtk.Align>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, valign, registry: ctx.registry, notifyDetail: "valign",
read: { [w] in w.getValign() },
write: { [w] v in w.setValign(align: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setValign(align:)
/// Sets the vertical alignment of the widget.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setValign(align:)`.
///
/// - Parameter valign: How to distribute vertical space if widget gets extra space.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func valign(_ valign: @escaping () -> Gtk.Align) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setValign(align: valign()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setVexpand(expand:)
/// Sets whether the widget would like any available extra vertical
/// space.
///
/// See [method`Gtk`.Widget.set_hexpand] for more detail.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter vexpand: Whether to expand vertically.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func vexpand(_ vexpand: Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setVexpand(expand: vexpand)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setVexpand(expand:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getVexpand()
/// Sets whether the widget would like any available extra vertical
/// space.
///
/// See [method`Gtk`.Widget.set_hexpand] for more detail.
///
/// 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: An `AnyView` wrapping this view with the modifier applied.
public func vexpand(_ vexpand: Portico.Binding<Bool>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, vexpand, registry: ctx.registry, notifyDetail: "vexpand",
read: { [w] in w.getVexpand() },
write: { [w] v in w.setVexpand(expand: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setVexpand(expand:)
/// Sets whether the widget would like any available extra vertical
/// space.
///
/// See [method`Gtk`.Widget.set_hexpand] for more detail.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setVexpand(expand:)`.
///
/// - Parameter vexpand: Whether to expand vertically.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func vexpand(_ vexpand: @escaping () -> Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setVexpand(expand: vexpand()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setVexpandSet(`set`:)
/// Sets whether the vexpand flag will be used.
///
/// See [method`Gtk`.Widget.set_hexpand_set] for more detail.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter vexpandSet: Whether to use the `vexpand` property.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func vexpandSet(_ vexpandSet: Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
w.setVexpandSet(`set`: vexpandSet)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Widget.setVexpandSet(`set`:), GObject.Object.connectNotify(detail:_:), Gtk.Widget.getVexpandSet()
/// Sets whether the vexpand flag will be used.
///
/// See [method`Gtk`.Widget.set_hexpand_set] for more detail.
///
/// 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: An `AnyView` wrapping this view with the modifier applied.
public func vexpandSet(_ vexpandSet: Portico.Binding<Bool>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, vexpandSet, registry: ctx.registry, notifyDetail: "vexpand-set",
read: { [w] in w.getVexpandSet() },
write: { [w] v in w.setVexpandSet(`set`: v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setVexpandSet(`set`:)
/// Sets whether the vexpand flag will be used.
///
/// See [method`Gtk`.Widget.set_hexpand_set] for more detail.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setVexpandSet(`set`:)`.
///
/// - Parameter vexpandSet: Whether to use the `vexpand` property.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func vexpandSet(_ vexpandSet: @escaping () -> Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in w.setVexpandSet(`set`: vexpandSet()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(static) | source: Gtk.Widget.setVisible(visible:)
/// Sets the visibility state of `widget`.
///
/// Note that setting this to true doesnt mean the widget is
/// actually viewable, see [method`Gtk`.Widget.get_visible].
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter visible: Whether the widget is visible.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func visible(_ visible: Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.WidgetVisibility.setUser(w, visible)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers -> bindingModifier(visible) | source: Gtk.Widget.setVisible(visible:), Gtk.Widget.getVisible()
/// Sets the visibility state of `widget`.
///
/// The branch and user visibility layers are combined; branch transitions do not write back into the binding.
///
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func visible(_ visible: Portico.Binding<Bool>) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
Portico.bindProperty(
w, visible, registry: ctx.registry, notifyDetail: "visible",
read: { [w] in Portico.WidgetVisibility.userValue(w) },
write: { [w] v in Portico.WidgetVisibility.setUser(w, v) }
)
return w
})
}
// PorticoGen: generateViewExtension -> generatePropertyModifiers(closure) | source: Gtk.Widget.setVisible(visible:)
/// Sets the visibility state of `widget`.
///
/// Note that setting this to true doesnt mean the widget is
/// actually viewable, see [method`Gtk`.Widget.get_visible].
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Widget.setVisible(visible:)`.
///
/// - Parameter visible: Whether the widget is visible.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func visible(_ visible: @escaping () -> Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
let tracker = DependencyTracker { [w] in Portico.WidgetVisibility.setUser(w, visible()) }
tracker.run()
ctx.registry.add(tracker)
return w
})
}
// PorticoGen: generateViewExtension -> generateSignalModifier | source: Gtk.Widget.connectDestroy(_:)
/// Signals that all holders of a reference to the widget should release
/// the reference that they hold.
///
/// May result in finalization of the widget if all references are released.
///
/// This signal is not suitable for saving widget state.
///
/// - Parameter handler: Invoked when the widget emits the `destroy` signal.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func onDestroy(_ handler: @escaping () -> Void) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
ctx.registry.add(w.connectDestroy { _ in handler() })
return w
})
}
// PorticoGen: generateViewExtension -> generateSignalModifier | source: Gtk.Widget.connectDirectionChanged(_:)
/// Emitted when the text direction of a widget changes.
///
/// - Parameter handler: Invoked when the widget emits the `direction-changed` signal. The closure receives the signal's arguments in order.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func onDirectionChanged(_ handler: @escaping (Gtk.TextDirection) -> Void) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
ctx.registry.add(w.connectDirectionChanged { _, a0 in handler(a0) })
return w
})
}
// PorticoGen: generateViewExtension -> generateSignalModifier | source: Gtk.Widget.connectHide(_:)
/// Emitted when `widget` is hidden.
///
/// - Parameter handler: Invoked when the widget emits the `hide` signal.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func onHide(_ handler: @escaping () -> Void) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
ctx.registry.add(w.connectHide { _ in handler() })
return w
})
}
// PorticoGen: generateViewExtension -> generateSignalModifier | source: Gtk.Widget.connectKeynavFailed(_:)
/// Emitted if keyboard navigation fails.
///
/// See [method`Gtk`.Widget.keynav_failed] for details.
///
/// - Parameter handler: Invoked when the widget emits the `keynav-failed` signal. The closure receives the signal's arguments in order. Its return value is forwarded to GTK as the signal's result.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func onKeynavFailed(_ handler: @escaping (Gtk.DirectionType) -> Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
ctx.registry.add(w.connectKeynavFailed { _, a0 in handler(a0) })
return w
})
}
// PorticoGen: generateViewExtension -> generateSignalModifier | source: Gtk.Widget.connectMap(_:)
/// Emitted when `widget` is going to be mapped.
///
/// A widget is mapped when the widget is visible (which is controlled with
/// [property`Gtk`.Widget:visible]) and all its parents up to the toplevel widget
/// are also visible.
///
/// The `::map` signal can be used to determine whether a widget will be drawn,
/// for instance it can resume an animation that was stopped during the
/// emission of [signal`Gtk`.Widget::unmap].
///
/// - Parameter handler: Invoked when the widget emits the `map` signal.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func onMap(_ handler: @escaping () -> Void) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
ctx.registry.add(w.connectMap { _ in handler() })
return w
})
}
// PorticoGen: generateViewExtension -> generateSignalModifier | source: Gtk.Widget.connectMnemonicActivate(_:)
/// Emitted when a widget is activated via a mnemonic.
///
/// The default handler for this signal activates `widget` if `group_cycling`
/// is false, or just makes `widget` grab focus if `group_cycling` is true.
///
/// - Parameter handler: Invoked when the widget emits the `mnemonic-activate` signal. The closure receives the signal's arguments in order. Its return value is forwarded to GTK as the signal's result.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func onMnemonicActivate(_ handler: @escaping (Bool) -> Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
ctx.registry.add(w.connectMnemonicActivate { _, a0 in handler(a0) })
return w
})
}
// PorticoGen: generateViewExtension -> generateSignalModifier | source: Gtk.Widget.connectMoveFocus(_:)
/// Emitted when the focus is moved.
///
/// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
///
/// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
/// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
///
/// - Parameter handler: Invoked when the widget emits the `move-focus` signal. The closure receives the signal's arguments in order.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func onMoveFocus(_ handler: @escaping (Gtk.DirectionType) -> Void) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
ctx.registry.add(w.connectMoveFocus { _, a0 in handler(a0) })
return w
})
}
// PorticoGen: generateViewExtension -> generateSignalModifier | source: Gtk.Widget.connectQueryTooltip(_:)
/// Emitted when the widgets tooltip is about to be shown.
///
/// This happens when the [property`Gtk`.Widget:has-tooltip] property
/// is true and the hover timeout has expired with the cursor hovering
/// above `widget`; or emitted when `widget` got focus in keyboard mode.
///
/// Using the given coordinates, the signal handler should determine
/// whether a tooltip should be shown for `widget`. If this is the case
/// true should be returned, false otherwise. Note that if `keyboard_mode`
/// is true, the values of `x` and `y` are undefined and should not be used.
///
/// The signal handler is free to manipulate `tooltip` with the therefore
/// destined function calls.
///
/// - Parameter handler: Invoked when the widget emits the `query-tooltip` signal. The closure receives the signal's arguments in order. Its return value is forwarded to GTK as the signal's result.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func onQueryTooltip(_ handler: @escaping (Int32, Int32, Bool, Gtk.Tooltip) -> Bool) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
ctx.registry.add(w.connectQueryTooltip { _, a0, a1, a2, a3 in handler(a0, a1, a2, a3) })
return w
})
}
// PorticoGen: generateViewExtension -> generateSignalModifier | source: Gtk.Widget.connectRealize(_:)
/// Emitted when `widget` is associated with a `GdkSurface`.
///
/// This means that [method`Gtk`.Widget.realize] has been called
/// or the widget has been mapped (that is, it is going to be drawn).
///
/// - Parameter handler: Invoked when the widget emits the `realize` signal.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func onRealize(_ handler: @escaping () -> Void) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
ctx.registry.add(w.connectRealize { _ in handler() })
return w
})
}
// PorticoGen: generateViewExtension -> generateSignalModifier | source: Gtk.Widget.connectShow(_:)
/// Emitted when `widget` is shown.
///
/// - Parameter handler: Invoked when the widget emits the `show` signal.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func onShow(_ handler: @escaping () -> Void) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
ctx.registry.add(w.connectShow { _ in handler() })
return w
})
}
// PorticoGen: generateViewExtension -> generateSignalModifier | source: Gtk.Widget.connectStateFlagsChanged(_:)
/// Emitted when the widget state changes.
///
/// See [method`Gtk`.Widget.get_state_flags].
///
/// - Parameter handler: Invoked when the widget emits the `state-flags-changed` signal. The closure receives the signal's arguments in order.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func onStateFlagsChanged(_ handler: @escaping (Gtk.StateFlags) -> Void) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
ctx.registry.add(w.connectStateFlagsChanged { _, a0 in handler(a0) })
return w
})
}
// PorticoGen: generateViewExtension -> generateSignalModifier | source: Gtk.Widget.connectUnmap(_:)
/// Emitted when `widget` is going to be unmapped.
///
/// A widget is unmapped when either it or any of its parents up to the
/// toplevel widget have been set as hidden.
///
/// As `::unmap` indicates that a widget will not be shown any longer,
/// it can be used to, for example, stop an animation on the widget.
///
/// - Parameter handler: Invoked when the widget emits the `unmap` signal.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func onUnmap(_ handler: @escaping () -> Void) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
ctx.registry.add(w.connectUnmap { _ in handler() })
return w
})
}
// PorticoGen: generateViewExtension -> generateSignalModifier | source: Gtk.Widget.connectUnrealize(_:)
/// Emitted when the `GdkSurface` associated with `widget` is destroyed.
///
/// This means that [method`Gtk`.Widget.unrealize] has been called
/// or the widget has been unmapped (that is, it is going to be hidden).
///
/// - Parameter handler: Invoked when the widget emits the `unrealize` signal.
/// - Returns: An `AnyView` wrapping this view with the modifier applied.
public func onUnrealize(_ handler: @escaping () -> Void) -> AnyView {
AnyView(makeWidget: { ctx in
let w = AnyView(self).makeWidget(ctx)
ctx.registry.add(w.connectUnrealize { _ in handler() })
return w
})
}
}