929 lines
50 KiB
Swift
929 lines
50 KiB
Swift
// Generated by PorticoGen. DO NOT EDIT. See Sources/PorticoGen to make changes.
|
|
|
|
import Adw
|
|
import Gtk
|
|
import Gio
|
|
import Gdk
|
|
|
|
// PorticoGen: generateStruct | source: Adw.WrapBox
|
|
/// A box-like widget that can wrap into multiple lines.
|
|
///
|
|
/// <picture>
|
|
/// <source srcset="wrap-box-dark.png" media="(prefers-color-scheme: dark)">
|
|
/// <img src="wrap-box.png" alt="wrap-box">
|
|
/// </picture>
|
|
///
|
|
/// `AdwWrapBox` is similar to [class`Gtk`.Box], but can wrap lines when the
|
|
/// widgets cannot fit otherwise. Unlike [class`Gtk`.FlowBox], the children aren't
|
|
/// arranged into a grid and behave more like words in a wrapping label.
|
|
///
|
|
/// Like `GtkBox`, `AdwWrapBox` is orientable and has spacing:
|
|
///
|
|
/// - [property`WrapBox`:child-spacing] between children in the same line;
|
|
/// - [property`WrapBox`:line-spacing] between lines.
|
|
///
|
|
/// ::: note
|
|
/// Unlike `GtkBox`, `AdwWrapBox` cannot follow the CSS `border-spacing`
|
|
/// property.
|
|
///
|
|
/// Use the [property`WrapBox`:natural-line-length] property to determine the
|
|
/// layout's natural size, e.g. when using it in a [class`Gtk`.Popover].
|
|
///
|
|
/// Normally, a horizontal `AdwWrapBox` wraps left to right and top to bottom
|
|
/// for left-to-right languages. Both of these directions can be reversed, using
|
|
/// the [property`WrapBox`:pack-direction] and [property`WrapBox`:wrap-reverse]
|
|
/// properties. Additionally, the alignment of each line can be controlled with
|
|
/// the [property`WrapBox`:align] property.
|
|
///
|
|
/// Lines can be justified using the [property`WrapBox`:justify] property, filling
|
|
/// the entire line by either increasing child size or spacing depending on the
|
|
/// value. Set [property`WrapBox`:justify-last-line] to justify the last line as
|
|
/// well.
|
|
///
|
|
/// By default, `AdwWrapBox` wraps as soon as the previous line cannot fit any
|
|
/// more children without shrinking them past their natural size. Set
|
|
/// [property`WrapBox`:wrap-policy] to [enum`Adw`.WrapPolicy.minimum] to only wrap
|
|
/// once all the children in the previous line have been shrunk to their minimum
|
|
/// size.
|
|
///
|
|
/// To make each line take the same amount of space, set
|
|
/// [property`WrapBox`:line-homogeneous] to `TRUE`.
|
|
///
|
|
/// Spacing and natural line length can scale with the text scale factor, use the
|
|
/// [property`WrapBox`:child-spacing-unit], [property`WrapBox`:line-spacing-unit]
|
|
/// and/or [property`WrapBox`:natural-line-length-unit] properties to enable that
|
|
/// behavior.
|
|
///
|
|
/// See [class`WrapLayout`].
|
|
///
|
|
/// ## CSS nodes
|
|
///
|
|
/// `AdwWrapBox` uses a single CSS node with name `wrap-box`.
|
|
///
|
|
/// ## Accessibility
|
|
///
|
|
/// `AdwWrapBox` uses the [enum`Gtk`.AccessibleRole.group] role.
|
|
///
|
|
/// A Portico view that mounts a `Adw.WrapBox`.
|
|
@MainActor public struct WrapBox: View {
|
|
private let make: (MountContext) -> Adw.WrapBox
|
|
private var configure: [(Adw.WrapBox, MountContext) -> Void] = []
|
|
|
|
public var body: Never { fatalError() }
|
|
|
|
// PorticoGen: generateInits(static) | source: Adw.WrapBox.init()
|
|
/// Creates a new `AdwWrapBox`.
|
|
///
|
|
/// 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 align: The alignment of the children within each line.
|
|
/// - Parameter childSpacing: The spacing between widgets on the same line.
|
|
/// - Parameter childSpacingUnit: The length unit for child spacing.
|
|
/// - Parameter justify: Determines whether and how each complete line should be stretched to fill the entire widget.
|
|
/// - Parameter justifyLastLine: Whether the last line should be stretched to fill the entire widget.
|
|
/// - Parameter lineHomogeneous: Whether all lines should take the same amount of space.
|
|
/// - Parameter lineSpacing: The spacing between lines.
|
|
/// - Parameter lineSpacingUnit: The length unit for line spacing.
|
|
/// - Parameter naturalLineLength: Determines the natural size for each line.
|
|
/// - Parameter naturalLineLengthUnit: The length unit for natural line length.
|
|
/// - Parameter packDirection: The direction children are packed in each line.
|
|
/// - Parameter wrapPolicy: The policy for line wrapping.
|
|
/// - Parameter wrapReverse: Whether wrap direction should be reversed.
|
|
/// - Parameter children: A `ViewBuilder` closure whose views are added in order.
|
|
public init(align: Float? = nil, childSpacing: Int32? = nil, childSpacingUnit: Adw.LengthUnit? = nil, justify: Adw.JustifyMode? = nil, justifyLastLine: Bool? = nil, lineHomogeneous: Bool? = nil, lineSpacing: Int32? = nil, lineSpacingUnit: Adw.LengthUnit? = nil, naturalLineLength: Int32? = nil, naturalLineLengthUnit: Adw.LengthUnit? = nil, packDirection: Adw.PackDirection? = nil, wrapPolicy: Adw.WrapPolicy? = nil, wrapReverse: Bool? = nil, @ViewBuilder children: @escaping () -> [AnyView] = { [] }) {
|
|
make = { _ in Adw.WrapBox() }
|
|
configure.append { w, ctx in
|
|
if let align { w.setAlign(align: align) }
|
|
if let childSpacing { w.setChildSpacing(childSpacing: childSpacing) }
|
|
if let childSpacingUnit { w.setChildSpacingUnit(unit: childSpacingUnit) }
|
|
if let justify { w.setJustify(justify: justify) }
|
|
if let justifyLastLine { w.setJustifyLastLine(justifyLastLine: justifyLastLine) }
|
|
if let lineHomogeneous { w.setLineHomogeneous(homogeneous: lineHomogeneous) }
|
|
if let lineSpacing { w.setLineSpacing(lineSpacing: lineSpacing) }
|
|
if let lineSpacingUnit { w.setLineSpacingUnit(unit: lineSpacingUnit) }
|
|
if let naturalLineLength { w.setNaturalLineLength(naturalLineLength: naturalLineLength) }
|
|
if let naturalLineLengthUnit { w.setNaturalLineLengthUnit(unit: naturalLineLengthUnit) }
|
|
if let packDirection { w.setPackDirection(packDirection: packDirection) }
|
|
if let wrapPolicy { w.setWrapPolicy(wrapPolicy: wrapPolicy) }
|
|
if let wrapReverse { w.setWrapReverse(wrapReverse: wrapReverse) }
|
|
Portico.mountChildren(children, into: w, ctx) { c in w.append(child: c) }
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
extension WrapBox: WidgetView {
|
|
public typealias Target = Adw.WrapBox
|
|
|
|
@_spi(Portico) public func appending(
|
|
_ step: @escaping (Adw.WrapBox, MountContext) -> Void
|
|
) -> Self {
|
|
var c = self
|
|
c.configure.append(step)
|
|
return c
|
|
}
|
|
}
|
|
|
|
@_spi(Portico) extension WrapBox: Mountable {
|
|
@_spi(Portico) public func mount(_ ctx: MountContext) -> Gtk.Widget {
|
|
let w = make(ctx)
|
|
for step in configure { step(w, ctx) }
|
|
return w
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension | source: Adw.WrapBox
|
|
/// Modifiers for `Adw.WrapBox`, available on every Portico view whose
|
|
/// backing widget is `Adw.WrapBox` or one of its subclasses.
|
|
extension WidgetView where Target: Adw.WrapBox {
|
|
// PorticoGen: generateModifierExtension -> generateChildAdderModifiers(static) | source: Adw.WrapBox.append(child:)
|
|
/// Adds `child` as the last child to `self`.
|
|
///
|
|
/// 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: Adw.WrapBox.append(child:)
|
|
/// Adds `child` as the last child to `self`.
|
|
///
|
|
/// 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: Adw.WrapBox.setAlign(align:)
|
|
/// Sets the alignment of the children within each line.
|
|
///
|
|
/// 0 means the children are placed at the start of the line, 1 means they are
|
|
/// placed at the end of the line. 0.5 means they are placed in the middle of the
|
|
/// line.
|
|
///
|
|
/// Alignment is only used when [property`WrapBox`:justify] is set to
|
|
/// [enum`Adw`.JustifyMode.none], or on the last line when the
|
|
/// [property`WrapBox`:justify-last-line] is `FALSE`.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter align: The alignment of the children within each line.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func align(_ align: Float) -> Self {
|
|
appending { w, _ in
|
|
w.setAlign(align: align)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.WrapBox.setAlign(align:), GObject.Object.connectNotify(detail:_:), Adw.WrapBox.getAlign()
|
|
/// Sets the alignment of the children within each line.
|
|
///
|
|
/// 0 means the children are placed at the start of the line, 1 means they are
|
|
/// placed at the end of the line. 0.5 means they are placed in the middle of the
|
|
/// line.
|
|
///
|
|
/// Alignment is only used when [property`WrapBox`:justify] is set to
|
|
/// [enum`Adw`.JustifyMode.none], or on the last line when the
|
|
/// [property`WrapBox`:justify-last-line] is `FALSE`.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Float` 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 align(_ align: Portico.Binding<Float>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, align, registry: ctx.registry, notifyDetail: "align",
|
|
read: { [w] in w.getAlign() },
|
|
write: { [w] v in w.setAlign(align: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.WrapBox.setAlign(align:)
|
|
/// Sets the alignment of the children within each line.
|
|
///
|
|
/// 0 means the children are placed at the start of the line, 1 means they are
|
|
/// placed at the end of the line. 0.5 means they are placed in the middle of the
|
|
/// line.
|
|
///
|
|
/// Alignment is only used when [property`WrapBox`:justify] is set to
|
|
/// [enum`Adw`.JustifyMode.none], or on the last line when the
|
|
/// [property`WrapBox`:justify-last-line] is `FALSE`.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.WrapBox.setAlign(align:)`.
|
|
///
|
|
/// - Parameter align: The alignment of the children within each line.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func align(_ align: @escaping () -> Float) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setAlign(align: align()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.WrapBox.setChildSpacing(childSpacing:)
|
|
/// Sets the spacing between widgets on the same line.
|
|
///
|
|
/// See [property`WrapBox`:child-spacing-unit].
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter childSpacing: The spacing between widgets on the same line.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func childSpacing(_ childSpacing: Int32) -> Self {
|
|
appending { w, _ in
|
|
w.setChildSpacing(childSpacing: childSpacing)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.WrapBox.setChildSpacing(childSpacing:), GObject.Object.connectNotify(detail:_:), Adw.WrapBox.getChildSpacing()
|
|
/// Sets the spacing between widgets on the same line.
|
|
///
|
|
/// See [property`WrapBox`:child-spacing-unit].
|
|
///
|
|
/// 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 childSpacing(_ childSpacing: Portico.Binding<Int32>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, childSpacing, registry: ctx.registry, notifyDetail: "child-spacing",
|
|
read: { [w] in w.getChildSpacing() },
|
|
write: { [w] v in w.setChildSpacing(childSpacing: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.WrapBox.setChildSpacing(childSpacing:)
|
|
/// Sets the spacing between widgets on the same line.
|
|
///
|
|
/// See [property`WrapBox`:child-spacing-unit].
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.WrapBox.setChildSpacing(childSpacing:)`.
|
|
///
|
|
/// - Parameter childSpacing: The spacing between widgets on the same line.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func childSpacing(_ childSpacing: @escaping () -> Int32) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setChildSpacing(childSpacing: childSpacing()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.WrapBox.setChildSpacingUnit(unit:)
|
|
/// Sets the length unit for child spacing.
|
|
///
|
|
/// Allows the spacing to vary depending on the text scale factor.
|
|
///
|
|
/// See [property`WrapBox`:child-spacing].
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter childSpacingUnit: The length unit for child spacing.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func childSpacingUnit(_ childSpacingUnit: Adw.LengthUnit) -> Self {
|
|
appending { w, _ in
|
|
w.setChildSpacingUnit(unit: childSpacingUnit)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.WrapBox.setChildSpacingUnit(unit:), GObject.Object.connectNotify(detail:_:), Adw.WrapBox.getChildSpacingUnit()
|
|
/// Sets the length unit for child spacing.
|
|
///
|
|
/// Allows the spacing to vary depending on the text scale factor.
|
|
///
|
|
/// See [property`WrapBox`:child-spacing].
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Adw.LengthUnit` 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 childSpacingUnit(_ childSpacingUnit: Portico.Binding<Adw.LengthUnit>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, childSpacingUnit, registry: ctx.registry, notifyDetail: "child-spacing-unit",
|
|
read: { [w] in w.getChildSpacingUnit() },
|
|
write: { [w] v in w.setChildSpacingUnit(unit: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.WrapBox.setChildSpacingUnit(unit:)
|
|
/// Sets the length unit for child spacing.
|
|
///
|
|
/// Allows the spacing to vary depending on the text scale factor.
|
|
///
|
|
/// See [property`WrapBox`:child-spacing].
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.WrapBox.setChildSpacingUnit(unit:)`.
|
|
///
|
|
/// - Parameter childSpacingUnit: The length unit for child spacing.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func childSpacingUnit(_ childSpacingUnit: @escaping () -> Adw.LengthUnit) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setChildSpacingUnit(unit: childSpacingUnit()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.WrapBox.setJustify(justify:)
|
|
/// Determines whether and how each complete line should be stretched to fill
|
|
/// the entire widget.
|
|
///
|
|
/// If set to [enum`Adw`.JustifyMode.fill], each widget in the line will be
|
|
/// stretched, keeping consistent spacing, so that the line fills the entire
|
|
/// widget.
|
|
///
|
|
/// If set to [enum`Adw`.JustifyMode.spread], the spacing between widgets will be
|
|
/// increased, keeping widget sizes intact. The first and last widget will be
|
|
/// aligned with the beginning and end of the line. If the line only contains a
|
|
/// single widget, it will be stretched regardless.
|
|
///
|
|
/// If set to [enum`Adw`.JustifyMode.none], the line will not be stretched and the
|
|
/// children will be placed together within the line, according to
|
|
/// [property`WrapBox`:align].
|
|
///
|
|
/// By default this doesn't affect the last line, as it will be incomplete. Use
|
|
/// [property`WrapBox`:justify-last-line] to justify it as well.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter justify: Determines whether and how each complete line should be stretched to fill the entire widget.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func justify(_ justify: Adw.JustifyMode) -> Self {
|
|
appending { w, _ in
|
|
w.setJustify(justify: justify)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.WrapBox.setJustify(justify:), GObject.Object.connectNotify(detail:_:), Adw.WrapBox.getJustify()
|
|
/// Determines whether and how each complete line should be stretched to fill
|
|
/// the entire widget.
|
|
///
|
|
/// If set to [enum`Adw`.JustifyMode.fill], each widget in the line will be
|
|
/// stretched, keeping consistent spacing, so that the line fills the entire
|
|
/// widget.
|
|
///
|
|
/// If set to [enum`Adw`.JustifyMode.spread], the spacing between widgets will be
|
|
/// increased, keeping widget sizes intact. The first and last widget will be
|
|
/// aligned with the beginning and end of the line. If the line only contains a
|
|
/// single widget, it will be stretched regardless.
|
|
///
|
|
/// If set to [enum`Adw`.JustifyMode.none], the line will not be stretched and the
|
|
/// children will be placed together within the line, according to
|
|
/// [property`WrapBox`:align].
|
|
///
|
|
/// By default this doesn't affect the last line, as it will be incomplete. Use
|
|
/// [property`WrapBox`:justify-last-line] to justify it as well.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Adw.JustifyMode` 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 justify(_ justify: Portico.Binding<Adw.JustifyMode>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, justify, registry: ctx.registry, notifyDetail: "justify",
|
|
read: { [w] in w.getJustify() },
|
|
write: { [w] v in w.setJustify(justify: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.WrapBox.setJustify(justify:)
|
|
/// Determines whether and how each complete line should be stretched to fill
|
|
/// the entire widget.
|
|
///
|
|
/// If set to [enum`Adw`.JustifyMode.fill], each widget in the line will be
|
|
/// stretched, keeping consistent spacing, so that the line fills the entire
|
|
/// widget.
|
|
///
|
|
/// If set to [enum`Adw`.JustifyMode.spread], the spacing between widgets will be
|
|
/// increased, keeping widget sizes intact. The first and last widget will be
|
|
/// aligned with the beginning and end of the line. If the line only contains a
|
|
/// single widget, it will be stretched regardless.
|
|
///
|
|
/// If set to [enum`Adw`.JustifyMode.none], the line will not be stretched and the
|
|
/// children will be placed together within the line, according to
|
|
/// [property`WrapBox`:align].
|
|
///
|
|
/// By default this doesn't affect the last line, as it will be incomplete. Use
|
|
/// [property`WrapBox`:justify-last-line] to justify it as well.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.WrapBox.setJustify(justify:)`.
|
|
///
|
|
/// - Parameter justify: Determines whether and how each complete line should be stretched to fill the entire widget.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func justify(_ justify: @escaping () -> Adw.JustifyMode) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setJustify(justify: justify()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.WrapBox.setJustifyLastLine(justifyLastLine:)
|
|
/// Sets whether the last line should be stretched to fill the entire widget.
|
|
///
|
|
/// See [property`WrapBox`:justify].
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter justifyLastLine: Whether the last line should be stretched to fill the entire widget.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func justifyLastLine(_ justifyLastLine: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setJustifyLastLine(justifyLastLine: justifyLastLine)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.WrapBox.setJustifyLastLine(justifyLastLine:), GObject.Object.connectNotify(detail:_:), Adw.WrapBox.getJustifyLastLine()
|
|
/// Sets whether the last line should be stretched to fill the entire widget.
|
|
///
|
|
/// See [property`WrapBox`:justify].
|
|
///
|
|
/// 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 justifyLastLine(_ justifyLastLine: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, justifyLastLine, registry: ctx.registry, notifyDetail: "justify-last-line",
|
|
read: { [w] in w.getJustifyLastLine() },
|
|
write: { [w] v in w.setJustifyLastLine(justifyLastLine: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.WrapBox.setJustifyLastLine(justifyLastLine:)
|
|
/// Sets whether the last line should be stretched to fill the entire widget.
|
|
///
|
|
/// See [property`WrapBox`:justify].
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.WrapBox.setJustifyLastLine(justifyLastLine:)`.
|
|
///
|
|
/// - Parameter justifyLastLine: Whether the last line should be stretched to fill the entire widget.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func justifyLastLine(_ justifyLastLine: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setJustifyLastLine(justifyLastLine: justifyLastLine()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.WrapBox.setLineHomogeneous(homogeneous:)
|
|
/// Sets whether all lines should take the same amount of space.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter lineHomogeneous: Whether all lines should take the same amount of space.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func lineHomogeneous(_ lineHomogeneous: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setLineHomogeneous(homogeneous: lineHomogeneous)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.WrapBox.setLineHomogeneous(homogeneous:), GObject.Object.connectNotify(detail:_:), Adw.WrapBox.getLineHomogeneous()
|
|
/// Sets whether all lines should take the same amount of space.
|
|
///
|
|
/// 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 lineHomogeneous(_ lineHomogeneous: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, lineHomogeneous, registry: ctx.registry, notifyDetail: "line-homogeneous",
|
|
read: { [w] in w.getLineHomogeneous() },
|
|
write: { [w] v in w.setLineHomogeneous(homogeneous: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.WrapBox.setLineHomogeneous(homogeneous:)
|
|
/// Sets whether all lines should take the same amount of space.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.WrapBox.setLineHomogeneous(homogeneous:)`.
|
|
///
|
|
/// - Parameter lineHomogeneous: Whether all lines should take the same amount of space.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func lineHomogeneous(_ lineHomogeneous: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setLineHomogeneous(homogeneous: lineHomogeneous()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.WrapBox.setLineSpacing(lineSpacing:)
|
|
/// Sets the spacing between lines.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter lineSpacing: The spacing between lines.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func lineSpacing(_ lineSpacing: Int32) -> Self {
|
|
appending { w, _ in
|
|
w.setLineSpacing(lineSpacing: lineSpacing)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.WrapBox.setLineSpacing(lineSpacing:), GObject.Object.connectNotify(detail:_:), Adw.WrapBox.getLineSpacing()
|
|
/// Sets the spacing between lines.
|
|
///
|
|
/// 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 lineSpacing(_ lineSpacing: Portico.Binding<Int32>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, lineSpacing, registry: ctx.registry, notifyDetail: "line-spacing",
|
|
read: { [w] in w.getLineSpacing() },
|
|
write: { [w] v in w.setLineSpacing(lineSpacing: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.WrapBox.setLineSpacing(lineSpacing:)
|
|
/// Sets the spacing between lines.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.WrapBox.setLineSpacing(lineSpacing:)`.
|
|
///
|
|
/// - Parameter lineSpacing: The spacing between lines.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func lineSpacing(_ lineSpacing: @escaping () -> Int32) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setLineSpacing(lineSpacing: lineSpacing()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.WrapBox.setLineSpacingUnit(unit:)
|
|
/// Sets the length unit for line spacing.
|
|
///
|
|
/// Allows the spacing to vary depending on the text scale factor.
|
|
///
|
|
/// See [property`WrapBox`:line-spacing].
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter lineSpacingUnit: The length unit for line spacing.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func lineSpacingUnit(_ lineSpacingUnit: Adw.LengthUnit) -> Self {
|
|
appending { w, _ in
|
|
w.setLineSpacingUnit(unit: lineSpacingUnit)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.WrapBox.setLineSpacingUnit(unit:), GObject.Object.connectNotify(detail:_:), Adw.WrapBox.getLineSpacingUnit()
|
|
/// Sets the length unit for line spacing.
|
|
///
|
|
/// Allows the spacing to vary depending on the text scale factor.
|
|
///
|
|
/// See [property`WrapBox`:line-spacing].
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Adw.LengthUnit` 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 lineSpacingUnit(_ lineSpacingUnit: Portico.Binding<Adw.LengthUnit>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, lineSpacingUnit, registry: ctx.registry, notifyDetail: "line-spacing-unit",
|
|
read: { [w] in w.getLineSpacingUnit() },
|
|
write: { [w] v in w.setLineSpacingUnit(unit: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.WrapBox.setLineSpacingUnit(unit:)
|
|
/// Sets the length unit for line spacing.
|
|
///
|
|
/// Allows the spacing to vary depending on the text scale factor.
|
|
///
|
|
/// See [property`WrapBox`:line-spacing].
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.WrapBox.setLineSpacingUnit(unit:)`.
|
|
///
|
|
/// - Parameter lineSpacingUnit: The length unit for line spacing.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func lineSpacingUnit(_ lineSpacingUnit: @escaping () -> Adw.LengthUnit) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setLineSpacingUnit(unit: lineSpacingUnit()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.WrapBox.setNaturalLineLength(naturalLineLength:)
|
|
/// Sets the natural size for each line.
|
|
///
|
|
/// It should be used to limit the line lengths, for example when used in
|
|
/// popovers.
|
|
///
|
|
/// See [property`WrapBox`:natural-line-length-unit].
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter naturalLineLength: Determines the natural size for each line.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func naturalLineLength(_ naturalLineLength: Int32) -> Self {
|
|
appending { w, _ in
|
|
w.setNaturalLineLength(naturalLineLength: naturalLineLength)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.WrapBox.setNaturalLineLength(naturalLineLength:), GObject.Object.connectNotify(detail:_:), Adw.WrapBox.getNaturalLineLength()
|
|
/// Sets the natural size for each line.
|
|
///
|
|
/// It should be used to limit the line lengths, for example when used in
|
|
/// popovers.
|
|
///
|
|
/// See [property`WrapBox`:natural-line-length-unit].
|
|
///
|
|
/// 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 naturalLineLength(_ naturalLineLength: Portico.Binding<Int32>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, naturalLineLength, registry: ctx.registry, notifyDetail: "natural-line-length",
|
|
read: { [w] in w.getNaturalLineLength() },
|
|
write: { [w] v in w.setNaturalLineLength(naturalLineLength: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.WrapBox.setNaturalLineLength(naturalLineLength:)
|
|
/// Sets the natural size for each line.
|
|
///
|
|
/// It should be used to limit the line lengths, for example when used in
|
|
/// popovers.
|
|
///
|
|
/// See [property`WrapBox`:natural-line-length-unit].
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.WrapBox.setNaturalLineLength(naturalLineLength:)`.
|
|
///
|
|
/// - Parameter naturalLineLength: Determines the natural size for each line.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func naturalLineLength(_ naturalLineLength: @escaping () -> Int32) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setNaturalLineLength(naturalLineLength: naturalLineLength()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.WrapBox.setNaturalLineLengthUnit(unit:)
|
|
/// Sets the length unit for natural line length.
|
|
///
|
|
/// Allows the length to vary depending on the text scale factor.
|
|
///
|
|
/// See [property`WrapBox`:natural-line-length].
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter naturalLineLengthUnit: The length unit for natural line length.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func naturalLineLengthUnit(_ naturalLineLengthUnit: Adw.LengthUnit) -> Self {
|
|
appending { w, _ in
|
|
w.setNaturalLineLengthUnit(unit: naturalLineLengthUnit)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.WrapBox.setNaturalLineLengthUnit(unit:), GObject.Object.connectNotify(detail:_:), Adw.WrapBox.getNaturalLineLengthUnit()
|
|
/// Sets the length unit for natural line length.
|
|
///
|
|
/// Allows the length to vary depending on the text scale factor.
|
|
///
|
|
/// See [property`WrapBox`:natural-line-length].
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Adw.LengthUnit` 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 naturalLineLengthUnit(_ naturalLineLengthUnit: Portico.Binding<Adw.LengthUnit>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, naturalLineLengthUnit, registry: ctx.registry, notifyDetail: "natural-line-length-unit",
|
|
read: { [w] in w.getNaturalLineLengthUnit() },
|
|
write: { [w] v in w.setNaturalLineLengthUnit(unit: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.WrapBox.setNaturalLineLengthUnit(unit:)
|
|
/// Sets the length unit for natural line length.
|
|
///
|
|
/// Allows the length to vary depending on the text scale factor.
|
|
///
|
|
/// See [property`WrapBox`:natural-line-length].
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.WrapBox.setNaturalLineLengthUnit(unit:)`.
|
|
///
|
|
/// - Parameter naturalLineLengthUnit: The length unit for natural line length.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func naturalLineLengthUnit(_ naturalLineLengthUnit: @escaping () -> Adw.LengthUnit) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setNaturalLineLengthUnit(unit: naturalLineLengthUnit()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.WrapBox.setPackDirection(packDirection:)
|
|
/// Sets the direction children are packed in each line.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter packDirection: The direction children are packed in each line.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func packDirection(_ packDirection: Adw.PackDirection) -> Self {
|
|
appending { w, _ in
|
|
w.setPackDirection(packDirection: packDirection)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.WrapBox.setPackDirection(packDirection:), GObject.Object.connectNotify(detail:_:), Adw.WrapBox.getPackDirection()
|
|
/// Sets the direction children are packed in each line.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Adw.PackDirection` 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 packDirection(_ packDirection: Portico.Binding<Adw.PackDirection>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, packDirection, registry: ctx.registry, notifyDetail: "pack-direction",
|
|
read: { [w] in w.getPackDirection() },
|
|
write: { [w] v in w.setPackDirection(packDirection: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.WrapBox.setPackDirection(packDirection:)
|
|
/// Sets the direction children are packed in each line.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.WrapBox.setPackDirection(packDirection:)`.
|
|
///
|
|
/// - Parameter packDirection: The direction children are packed in each line.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func packDirection(_ packDirection: @escaping () -> Adw.PackDirection) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setPackDirection(packDirection: packDirection()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.WrapBox.setWrapPolicy(wrapPolicy:)
|
|
/// Sets the policy for line wrapping.
|
|
///
|
|
/// If set to [enum`Adw`.WrapPolicy.natural], the box will wrap to the next line
|
|
/// as soon as the previous line cannot fit any more children without shrinking
|
|
/// them past their natural size.
|
|
///
|
|
/// If set to [enum`Adw`.WrapPolicy.minimum], the box will try to fit as many
|
|
/// children into each line as possible, shrinking them down to their minimum\
|
|
/// size before wrapping to the next line.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter wrapPolicy: The policy for line wrapping.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func wrapPolicy(_ wrapPolicy: Adw.WrapPolicy) -> Self {
|
|
appending { w, _ in
|
|
w.setWrapPolicy(wrapPolicy: wrapPolicy)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.WrapBox.setWrapPolicy(wrapPolicy:), GObject.Object.connectNotify(detail:_:), Adw.WrapBox.getWrapPolicy()
|
|
/// Sets the policy for line wrapping.
|
|
///
|
|
/// If set to [enum`Adw`.WrapPolicy.natural], the box will wrap to the next line
|
|
/// as soon as the previous line cannot fit any more children without shrinking
|
|
/// them past their natural size.
|
|
///
|
|
/// If set to [enum`Adw`.WrapPolicy.minimum], the box will try to fit as many
|
|
/// children into each line as possible, shrinking them down to their minimum\
|
|
/// size before wrapping to the next line.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Adw.WrapPolicy` 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 wrapPolicy(_ wrapPolicy: Portico.Binding<Adw.WrapPolicy>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, wrapPolicy, registry: ctx.registry, notifyDetail: "wrap-policy",
|
|
read: { [w] in w.getWrapPolicy() },
|
|
write: { [w] v in w.setWrapPolicy(wrapPolicy: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.WrapBox.setWrapPolicy(wrapPolicy:)
|
|
/// Sets the policy for line wrapping.
|
|
///
|
|
/// If set to [enum`Adw`.WrapPolicy.natural], the box will wrap to the next line
|
|
/// as soon as the previous line cannot fit any more children without shrinking
|
|
/// them past their natural size.
|
|
///
|
|
/// If set to [enum`Adw`.WrapPolicy.minimum], the box will try to fit as many
|
|
/// children into each line as possible, shrinking them down to their minimum\
|
|
/// size before wrapping to the next line.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.WrapBox.setWrapPolicy(wrapPolicy:)`.
|
|
///
|
|
/// - Parameter wrapPolicy: The policy for line wrapping.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func wrapPolicy(_ wrapPolicy: @escaping () -> Adw.WrapPolicy) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setWrapPolicy(wrapPolicy: wrapPolicy()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.WrapBox.setWrapReverse(wrapReverse:)
|
|
/// Sets whether wrap direction should be reversed.
|
|
///
|
|
/// By default, lines wrap downwards in a horizontal box, and towards the end
|
|
/// in a vertical box. If set to `TRUE`, they wrap upwards or towards the start
|
|
/// respectively.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter wrapReverse: Whether wrap direction should be reversed.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func wrapReverse(_ wrapReverse: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setWrapReverse(wrapReverse: wrapReverse)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.WrapBox.setWrapReverse(wrapReverse:), GObject.Object.connectNotify(detail:_:), Adw.WrapBox.getWrapReverse()
|
|
/// Sets whether wrap direction should be reversed.
|
|
///
|
|
/// By default, lines wrap downwards in a horizontal box, and towards the end
|
|
/// in a vertical box. If set to `TRUE`, they wrap upwards or towards the start
|
|
/// respectively.
|
|
///
|
|
/// 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 wrapReverse(_ wrapReverse: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, wrapReverse, registry: ctx.registry, notifyDetail: "wrap-reverse",
|
|
read: { [w] in w.getWrapReverse() },
|
|
write: { [w] v in w.setWrapReverse(wrapReverse: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.WrapBox.setWrapReverse(wrapReverse:)
|
|
/// Sets whether wrap direction should be reversed.
|
|
///
|
|
/// By default, lines wrap downwards in a horizontal box, and towards the end
|
|
/// in a vertical box. If set to `TRUE`, they wrap upwards or towards the start
|
|
/// respectively.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.WrapBox.setWrapReverse(wrapReverse:)`.
|
|
///
|
|
/// - Parameter wrapReverse: Whether wrap direction should be reversed.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func wrapReverse(_ wrapReverse: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setWrapReverse(wrapReverse: wrapReverse()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
}
|