portico/Sources/Portico/Generated/FlowBox.swift

636 lines
34 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: generateStruct | source: Gtk.FlowBox
/// Puts child widgets in a reflowing grid.
///
/// <picture>
/// <source srcset="flow-box-dark.png" media="(prefers-color-scheme: dark)">
/// <img alt="An example GtkFlowBox" src="flow-box.png">
/// </picture>
///
/// For instance, with the horizontal orientation, the widgets will be
/// arranged from left to right, starting a new row under the previous
/// row when necessary. Reducing the width in this case will require more
/// rows, so a larger height will be requested.
///
/// Likewise, with the vertical orientation, the widgets will be arranged
/// from top to bottom, starting a new column to the right when necessary.
/// Reducing the height will require more columns, so a larger width will
/// be requested.
///
/// The size request of a `GtkFlowBox` alone may not be what you expect;
/// if you need to be able to shrink it along both axes and dynamically
/// reflow its children, you may have to wrap it in a `GtkScrolledWindow`
/// to enable that.
///
/// The children of a `GtkFlowBox` can be dynamically sorted and filtered.
///
/// Although a `GtkFlowBox` must have only `GtkFlowBoxChild` children, you
/// can add any kind of widget to it via [method`Gtk`.FlowBox.insert], and a
/// `GtkFlowBoxChild` widget will automatically be inserted between the box
/// and the widget.
///
/// Also see [class`Gtk`.ListBox].
///
/// # Shortcuts and Gestures
///
/// The following signals have default keybindings:
///
/// - [signal`Gtk`.FlowBox::move-cursor]
/// - [signal`Gtk`.FlowBox::select-all]
/// - [signal`Gtk`.FlowBox::toggle-cursor-child]
/// - [signal`Gtk`.FlowBox::unselect-all]
///
/// # CSS nodes
///
/// ```
/// flowbox
/// flowboxchild
/// <child>
/// flowboxchild
/// <child>
///
/// [rubberband]
/// ```
///
/// `GtkFlowBox` uses a single CSS node with name flowbox. `GtkFlowBoxChild`
/// uses a single CSS node with name flowboxchild. For rubberband selection,
/// a subnode with name rubberband is used.
///
/// # Accessibility
///
/// `GtkFlowBox` uses the [enum`Gtk`.AccessibleRole.grid] role, and `GtkFlowBoxChild`
/// uses the [enum`Gtk`.AccessibleRole.grid_cell] role.
///
/// A Portico view that mounts a `Gtk.FlowBox`.
@MainActor public struct FlowBox: View {
private let make: (MountContext) -> Gtk.FlowBox
private var configure: [(Gtk.FlowBox, MountContext) -> Void] = []
public var body: Never { fatalError() }
// PorticoGen: generateInits(static) | source: Gtk.FlowBox.init()
/// Creates a `GtkFlowBox`.
///
/// Applied once at mount; use the `Binding` or closure overload for values that change.
/// Each closure is evaluated once; children are added in order and slot closures mount their first view.
/// An empty closure adds no children and leaves slots unset.
/// A `ForEach` in the `children:` closure spreads its rows directly into this widget, with no wrapper, when the widget supports ordered insertion.
/// Optional value parameters are applied only when non-`nil`; a `nil` argument leaves the widget's own default in place and cannot clear a nullable property - use the matching modifier for that.
///
/// - Parameter activateOnSingleClick: Determines whether children can be activated with a single click, or require a double-click.
/// - Parameter columnSpacing: The amount of horizontal space between two children.
/// - Parameter homogeneous: Determines whether all children should be allocated the same size.
/// - Parameter maxChildrenPerLine: The maximum amount of children to request space for consecutively in the given orientation.
/// - Parameter minChildrenPerLine: The minimum number of children to allocate consecutively in the given orientation.
/// - Parameter rowSpacing: The amount of vertical space between two children.
/// - Parameter selectionMode: The selection mode used by the flow box.
/// - Parameter children: A `ViewBuilder` closure whose views are added in order.
/// - Parameter onActivateCursorChild: Invoked when the widget emits the `activate-cursor-child` signal.
/// - Parameter onChildActivated: Invoked when the widget emits the `child-activated` signal. The closure receives the signal's arguments in order.
/// - Parameter onMoveCursor: Invoked when the widget emits the `move-cursor` signal. The closure receives the signal's arguments in order. Its return value is forwarded to GTK as the signal's result.
/// - Parameter onSelectAll: Invoked when the widget emits the `select-all` signal.
/// - Parameter onSelectedChildrenChanged: Invoked when the widget emits the `selected-children-changed` signal.
/// - Parameter onToggleCursorChild: Invoked when the widget emits the `toggle-cursor-child` signal.
/// - Parameter onUnselectAll: Invoked when the widget emits the `unselect-all` signal.
public init(activateOnSingleClick: Bool? = nil, columnSpacing: UInt32? = nil, homogeneous: Bool? = nil, maxChildrenPerLine: UInt32? = nil, minChildrenPerLine: UInt32? = nil, rowSpacing: UInt32? = nil, selectionMode: Gtk.SelectionMode? = nil, @ViewBuilder children: @escaping () -> [AnyView] = { [] }, onActivateCursorChild: (() -> Void)? = nil, onChildActivated: ((Gtk.FlowBoxChild) -> Void)? = nil, onMoveCursor: ((Gtk.MovementStep, Int32, Bool, Bool) -> Bool)? = nil, onSelectAll: (() -> Void)? = nil, onSelectedChildrenChanged: (() -> Void)? = nil, onToggleCursorChild: (() -> Void)? = nil, onUnselectAll: (() -> Void)? = nil) {
make = { _ in Gtk.FlowBox() }
configure.append { w, ctx in
if let activateOnSingleClick { w.setActivateOnSingleClick(single: activateOnSingleClick) }
if let columnSpacing { w.setColumnSpacing(spacing: columnSpacing) }
if let homogeneous { w.setHomogeneous(homogeneous: homogeneous) }
if let maxChildrenPerLine { w.setMaxChildrenPerLine(nChildren: maxChildrenPerLine) }
if let minChildrenPerLine { w.setMinChildrenPerLine(nChildren: minChildrenPerLine) }
if let rowSpacing { w.setRowSpacing(spacing: rowSpacing) }
if let selectionMode { w.setSelectionMode(mode: selectionMode) }
Portico.mountChildren(children, into: w, ctx) { c in w.append(child: c) }
if let onActivateCursorChild { ctx.registry.add(w.connectActivateCursorChild { _ in onActivateCursorChild() }) }
if let onChildActivated { ctx.registry.add(w.connectChildActivated { _, a0 in onChildActivated(a0) }) }
if let onMoveCursor { ctx.registry.add(w.connectMoveCursor { _, a0, a1, a2, a3 in onMoveCursor(a0, a1, a2, a3) }) }
if let onSelectAll { ctx.registry.add(w.connectSelectAll { _ in onSelectAll() }) }
if let onSelectedChildrenChanged { ctx.registry.add(w.connectSelectedChildrenChanged { _ in onSelectedChildrenChanged() }) }
if let onToggleCursorChild { ctx.registry.add(w.connectToggleCursorChild { _ in onToggleCursorChild() }) }
if let onUnselectAll { ctx.registry.add(w.connectUnselectAll { _ in onUnselectAll() }) }
}
}
}
extension FlowBox: WidgetView {
public typealias Target = Gtk.FlowBox
@_spi(Portico) public func appending(
_ step: @escaping (Gtk.FlowBox, MountContext) -> Void
) -> Self {
var c = self
c.configure.append(step)
return c
}
}
@_spi(Portico) extension FlowBox: Mountable {
@_spi(Portico) public func mount(_ ctx: MountContext) -> Gtk.Widget {
let w = make(ctx)
for step in configure { step(w, ctx) }
return w
}
}
// PorticoGen: generateModifierExtension | source: Gtk.FlowBox
/// Modifiers for `Gtk.FlowBox`, available on every Portico view whose
/// backing widget is `Gtk.FlowBox` or one of its subclasses.
extension WidgetView where Target: Gtk.FlowBox {
// PorticoGen: generateModifierExtension -> generateChildAdderModifiers(static) | source: Gtk.FlowBox.append(child:)
/// Adds `child` to the end of `self`.
///
/// If a sort function is set, the widget will
/// actually be inserted at the calculated position.
///
/// See also: [method`Gtk`.FlowBox.insert].
///
/// Applied once at mount; use the `@ViewBuilder` overload for multiple children.
///
/// - Parameter child: A child widget to add.
/// - Returns: A copy of this view with the modifier applied.
public func append(_ child: Gtk.Widget) -> Self {
appending { w, _ in
w.append(child: child)
}
}
// PorticoGen: generateModifierExtension -> generateChildAdderModifiers(viewBuilder) | source: Gtk.FlowBox.append(child:)
/// Adds `child` to the end of `self`.
///
/// If a sort function is set, the widget will
/// actually be inserted at the calculated position.
///
/// See also: [method`Gtk`.FlowBox.insert].
///
/// Every view the closure produces is added at mount, in order.
///
/// - Parameter child: A closure producing child views.
/// - Returns: A copy of this view with the modifier applied.
public func append(@ViewBuilder _ child: () -> [AnyView]) -> Self {
let childViews = child()
return appending { w, ctx in
for v in childViews { w.append(child: v.makeWidget(ctx)) }
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.FlowBox.setActivateOnSingleClick(single:)
/// If `single` is `true`, children will be activated when you click
/// on them, otherwise you need to double-click.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter activateOnSingleClick: Determines whether children can be activated with a single click, or require a double-click.
/// - Returns: A copy of this view with the modifier applied.
public func activateOnSingleClick(_ activateOnSingleClick: Bool) -> Self {
appending { w, _ in
w.setActivateOnSingleClick(single: activateOnSingleClick)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.FlowBox.setActivateOnSingleClick(single:), GObject.Object.connectNotify(detail:_:), Gtk.FlowBox.getActivateOnSingleClick()
/// If `single` is `true`, children will be activated when you click
/// on them, otherwise you need to double-click.
///
/// 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 activateOnSingleClick(_ activateOnSingleClick: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, activateOnSingleClick, registry: ctx.registry, notifyDetail: "activate-on-single-click",
read: { [w] in w.getActivateOnSingleClick() },
write: { [w] v in w.setActivateOnSingleClick(single: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.FlowBox.setActivateOnSingleClick(single:)
/// If `single` is `true`, children will be activated when you click
/// on them, otherwise you need to double-click.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.FlowBox.setActivateOnSingleClick(single:)`.
///
/// - Parameter activateOnSingleClick: Determines whether children can be activated with a single click, or require a double-click.
/// - Returns: A copy of this view with the modifier applied.
public func activateOnSingleClick(_ activateOnSingleClick: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setActivateOnSingleClick(single: activateOnSingleClick()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.FlowBox.setColumnSpacing(spacing:)
/// Sets the horizontal space to add between children.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter columnSpacing: The amount of horizontal space between two children.
/// - Returns: A copy of this view with the modifier applied.
public func columnSpacing(_ columnSpacing: UInt32) -> Self {
appending { w, _ in
w.setColumnSpacing(spacing: columnSpacing)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.FlowBox.setColumnSpacing(spacing:), GObject.Object.connectNotify(detail:_:), Gtk.FlowBox.getColumnSpacing()
/// Sets the horizontal space to add between children.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `UInt32` 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 columnSpacing(_ columnSpacing: Portico.Binding<UInt32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, columnSpacing, registry: ctx.registry, notifyDetail: "column-spacing",
read: { [w] in w.getColumnSpacing() },
write: { [w] v in w.setColumnSpacing(spacing: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.FlowBox.setColumnSpacing(spacing:)
/// Sets the horizontal space to add between children.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.FlowBox.setColumnSpacing(spacing:)`.
///
/// - Parameter columnSpacing: The amount of horizontal space between two children.
/// - Returns: A copy of this view with the modifier applied.
public func columnSpacing(_ columnSpacing: @escaping () -> UInt32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setColumnSpacing(spacing: columnSpacing()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.FlowBox.setHomogeneous(homogeneous:)
/// Sets whether or not all children of `box` are given
/// equal space in the box.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter homogeneous: Determines whether all children should be allocated the same size.
/// - Returns: A copy of this view with the modifier applied.
public func homogeneous(_ homogeneous: Bool) -> Self {
appending { w, _ in
w.setHomogeneous(homogeneous: homogeneous)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.FlowBox.setHomogeneous(homogeneous:), GObject.Object.connectNotify(detail:_:), Gtk.FlowBox.getHomogeneous()
/// Sets whether or not all children of `box` are given
/// equal space in the box.
///
/// 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 homogeneous(_ homogeneous: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, homogeneous, registry: ctx.registry, notifyDetail: "homogeneous",
read: { [w] in w.getHomogeneous() },
write: { [w] v in w.setHomogeneous(homogeneous: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.FlowBox.setHomogeneous(homogeneous:)
/// Sets whether or not all children of `box` are given
/// equal space in the box.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.FlowBox.setHomogeneous(homogeneous:)`.
///
/// - Parameter homogeneous: Determines whether all children should be allocated the same size.
/// - Returns: A copy of this view with the modifier applied.
public func homogeneous(_ homogeneous: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setHomogeneous(homogeneous: homogeneous()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.FlowBox.setMaxChildrenPerLine(nChildren:)
/// Sets the maximum number of children to request and
/// allocate space for in `box`s orientation.
///
/// Setting the maximum number of children per line
/// limits the overall natural size request to be no more
/// than `n_children` children long in the given orientation.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter maxChildrenPerLine: The maximum amount of children to request space for consecutively in the given orientation.
/// - Returns: A copy of this view with the modifier applied.
public func maxChildrenPerLine(_ maxChildrenPerLine: UInt32) -> Self {
appending { w, _ in
w.setMaxChildrenPerLine(nChildren: maxChildrenPerLine)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.FlowBox.setMaxChildrenPerLine(nChildren:), GObject.Object.connectNotify(detail:_:), Gtk.FlowBox.getMaxChildrenPerLine()
/// Sets the maximum number of children to request and
/// allocate space for in `box`s orientation.
///
/// Setting the maximum number of children per line
/// limits the overall natural size request to be no more
/// than `n_children` children long in the given orientation.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `UInt32` 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 maxChildrenPerLine(_ maxChildrenPerLine: Portico.Binding<UInt32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, maxChildrenPerLine, registry: ctx.registry, notifyDetail: "max-children-per-line",
read: { [w] in w.getMaxChildrenPerLine() },
write: { [w] v in w.setMaxChildrenPerLine(nChildren: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.FlowBox.setMaxChildrenPerLine(nChildren:)
/// Sets the maximum number of children to request and
/// allocate space for in `box`s orientation.
///
/// Setting the maximum number of children per line
/// limits the overall natural size request to be no more
/// than `n_children` children long in the given orientation.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.FlowBox.setMaxChildrenPerLine(nChildren:)`.
///
/// - Parameter maxChildrenPerLine: The maximum amount of children to request space for consecutively in the given orientation.
/// - Returns: A copy of this view with the modifier applied.
public func maxChildrenPerLine(_ maxChildrenPerLine: @escaping () -> UInt32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setMaxChildrenPerLine(nChildren: maxChildrenPerLine()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.FlowBox.setMinChildrenPerLine(nChildren:)
/// Sets the minimum number of children to line up
/// in `box`s orientation before flowing.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter minChildrenPerLine: The minimum number of children to allocate consecutively in the given orientation.
/// - Returns: A copy of this view with the modifier applied.
public func minChildrenPerLine(_ minChildrenPerLine: UInt32) -> Self {
appending { w, _ in
w.setMinChildrenPerLine(nChildren: minChildrenPerLine)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.FlowBox.setMinChildrenPerLine(nChildren:), GObject.Object.connectNotify(detail:_:), Gtk.FlowBox.getMinChildrenPerLine()
/// Sets the minimum number of children to line up
/// in `box`s orientation before flowing.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `UInt32` 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 minChildrenPerLine(_ minChildrenPerLine: Portico.Binding<UInt32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, minChildrenPerLine, registry: ctx.registry, notifyDetail: "min-children-per-line",
read: { [w] in w.getMinChildrenPerLine() },
write: { [w] v in w.setMinChildrenPerLine(nChildren: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.FlowBox.setMinChildrenPerLine(nChildren:)
/// Sets the minimum number of children to line up
/// in `box`s orientation before flowing.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.FlowBox.setMinChildrenPerLine(nChildren:)`.
///
/// - Parameter minChildrenPerLine: The minimum number of children to allocate consecutively in the given orientation.
/// - Returns: A copy of this view with the modifier applied.
public func minChildrenPerLine(_ minChildrenPerLine: @escaping () -> UInt32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setMinChildrenPerLine(nChildren: minChildrenPerLine()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.FlowBox.setRowSpacing(spacing:)
/// Sets the vertical space to add between children.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter rowSpacing: The amount of vertical space between two children.
/// - Returns: A copy of this view with the modifier applied.
public func rowSpacing(_ rowSpacing: UInt32) -> Self {
appending { w, _ in
w.setRowSpacing(spacing: rowSpacing)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.FlowBox.setRowSpacing(spacing:), GObject.Object.connectNotify(detail:_:), Gtk.FlowBox.getRowSpacing()
/// Sets the vertical space to add between children.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `UInt32` 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 rowSpacing(_ rowSpacing: Portico.Binding<UInt32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, rowSpacing, registry: ctx.registry, notifyDetail: "row-spacing",
read: { [w] in w.getRowSpacing() },
write: { [w] v in w.setRowSpacing(spacing: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.FlowBox.setRowSpacing(spacing:)
/// Sets the vertical space to add between children.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.FlowBox.setRowSpacing(spacing:)`.
///
/// - Parameter rowSpacing: The amount of vertical space between two children.
/// - Returns: A copy of this view with the modifier applied.
public func rowSpacing(_ rowSpacing: @escaping () -> UInt32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setRowSpacing(spacing: rowSpacing()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.FlowBox.setSelectionMode(mode:)
/// Sets how selection works in `box`.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter selectionMode: The selection mode used by the flow box.
/// - Returns: A copy of this view with the modifier applied.
public func selectionMode(_ selectionMode: Gtk.SelectionMode) -> Self {
appending { w, _ in
w.setSelectionMode(mode: selectionMode)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.FlowBox.setSelectionMode(mode:), GObject.Object.connectNotify(detail:_:), Gtk.FlowBox.getSelectionMode()
/// Sets how selection works in `box`.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.SelectionMode` 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 selectionMode(_ selectionMode: Portico.Binding<Gtk.SelectionMode>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, selectionMode, registry: ctx.registry, notifyDetail: "selection-mode",
read: { [w] in w.getSelectionMode() },
write: { [w] v in w.setSelectionMode(mode: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.FlowBox.setSelectionMode(mode:)
/// Sets how selection works in `box`.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.FlowBox.setSelectionMode(mode:)`.
///
/// - Parameter selectionMode: The selection mode used by the flow box.
/// - Returns: A copy of this view with the modifier applied.
public func selectionMode(_ selectionMode: @escaping () -> Gtk.SelectionMode) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setSelectionMode(mode: selectionMode()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.FlowBox.connectActivateCursorChild(_:)
/// Emitted when the user activates the `box`.
///
/// This is a [keybinding signal](class.SignalAction.html).
///
/// - Parameter handler: Invoked when the widget emits the `activate-cursor-child` signal.
/// - Returns: A copy of this view with the modifier applied.
public func onActivateCursorChild(_ handler: @escaping () -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectActivateCursorChild { _ in handler() })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.FlowBox.connectChildActivated(_:)
/// Emitted when a child has been activated by the user.
///
/// - Parameter handler: Invoked when the widget emits the `child-activated` signal. The closure receives the signal's arguments in order.
/// - Returns: A copy of this view with the modifier applied.
public func onChildActivated(_ handler: @escaping (Gtk.FlowBoxChild) -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectChildActivated { _, a0 in handler(a0) })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.FlowBox.connectMoveCursor(_:)
/// Emitted when the user initiates a cursor movement.
///
/// This is a [keybinding signal](class.SignalAction.html).
/// Applications should not connect to it, but may emit it with
/// g_signal_emit_by_name() if they need to control the cursor
/// programmatically.
///
/// The default bindings for this signal come in two variants,
/// the variant with the Shift modifier extends the selection,
/// the variant without the Shift modifier does not.
/// There are too many key combinations to list them all here.
///
/// - <kbd></kbd>, <kbd></kbd>, <kbd></kbd>, <kbd></kbd>
/// move by individual children
/// - <kbd>Home</kbd>, <kbd>End</kbd> move to the ends of the box
/// - <kbd>PgUp</kbd>, <kbd>PgDn</kbd> move vertically by pages
///
/// - Parameter handler: Invoked when the widget emits the `move-cursor` 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 onMoveCursor(_ handler: @escaping (Gtk.MovementStep, Int32, Bool, Bool) -> Bool) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectMoveCursor { _, a0, a1, a2, a3 in handler(a0, a1, a2, a3) })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.FlowBox.connectSelectAll(_:)
/// Emitted to select all children of the box,
/// if the selection mode permits it.
///
/// This is a [keybinding signal](class.SignalAction.html).
///
/// The default bindings for this signal is <kbd>Ctrl</kbd>-<kbd>a</kbd>.
///
/// - Parameter handler: Invoked when the widget emits the `select-all` signal.
/// - Returns: A copy of this view with the modifier applied.
public func onSelectAll(_ handler: @escaping () -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectSelectAll { _ in handler() })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.FlowBox.connectSelectedChildrenChanged(_:)
/// Emitted when the set of selected children changes.
///
/// Use [method`Gtk`.FlowBox.selected_foreach] or
/// [method`Gtk`.FlowBox.get_selected_children] to obtain the
/// selected children.
///
/// - Parameter handler: Invoked when the widget emits the `selected-children-changed` signal.
/// - Returns: A copy of this view with the modifier applied.
public func onSelectedChildrenChanged(_ handler: @escaping () -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectSelectedChildrenChanged { _ in handler() })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.FlowBox.connectToggleCursorChild(_:)
/// Emitted to toggle the selection of the child that has the focus.
///
/// This is a [keybinding signal](class.SignalAction.html).
///
/// The default binding for this signal is <kbd>Ctrl</kbd>-<kbd>Space</kbd>.
///
/// - Parameter handler: Invoked when the widget emits the `toggle-cursor-child` signal.
/// - Returns: A copy of this view with the modifier applied.
public func onToggleCursorChild(_ handler: @escaping () -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectToggleCursorChild { _ in handler() })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.FlowBox.connectUnselectAll(_:)
/// Emitted to unselect all children of the box,
/// if the selection mode permits it.
///
/// This is a [keybinding signal](class.SignalAction.html).
///
/// The default bindings for this signal is <kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>a</kbd>.
///
/// - Parameter handler: Invoked when the widget emits the `unselect-all` signal.
/// - Returns: A copy of this view with the modifier applied.
public func onUnselectAll(_ handler: @escaping () -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectUnselectAll { _ in handler() })
}
}
}