922 lines
50 KiB
Swift
922 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.OverlaySplitView
|
|
/// A widget presenting sidebar and content side by side or as an overlay.
|
|
///
|
|
/// <picture>
|
|
/// <source srcset="overlay-split-view-dark.png" media="(prefers-color-scheme: dark)">
|
|
/// <img src="overlay-split-view.png" alt="overlay-split-view">
|
|
/// </picture>
|
|
/// <picture>
|
|
/// <source srcset="overlay-split-view-collapsed-dark.png" media="(prefers-color-scheme: dark)">
|
|
/// <img src="overlay-split-view-collapsed.png" alt="overlay-split-view-collapsed">
|
|
/// </picture>
|
|
///
|
|
/// `AdwOverlaySplitView` has two children: sidebar and content, and displays
|
|
/// them side by side.
|
|
///
|
|
/// When [property`OverlaySplitView`:collapsed] is set to `TRUE`, the sidebar is
|
|
/// instead shown as an overlay above the content widget.
|
|
///
|
|
/// The sidebar can be hidden or shown using the
|
|
/// [property`OverlaySplitView`:show-sidebar] property.
|
|
///
|
|
/// Sidebar can be displayed before or after the content, this can be controlled
|
|
/// with the [property`OverlaySplitView`:sidebar-position] property.
|
|
///
|
|
/// Collapsing the split view automatically hides the sidebar widget, and
|
|
/// uncollapsing it shows the sidebar. If this behavior is not desired, the
|
|
/// [property`OverlaySplitView`:pin-sidebar] property can be used to override it.
|
|
///
|
|
/// `AdwOverlaySplitView` supports an edge swipe gesture for showing the sidebar,
|
|
/// and a swipe from the sidebar for hiding it. Gestures are only supported on
|
|
/// touchscreen, but not touchpad. Gestures can be controlled with the
|
|
/// [property`OverlaySplitView`:enable-show-gesture] and
|
|
/// [property`OverlaySplitView`:enable-hide-gesture] properties.
|
|
///
|
|
/// See also [class`NavigationSplitView`].
|
|
///
|
|
/// `AdwOverlaySplitView` is typically used together with an [class`Breakpoint`]
|
|
/// setting the `collapsed` property to `TRUE` on small widths, as follows:
|
|
///
|
|
/// ```xml
|
|
/// <object class="AdwWindow">
|
|
/// <property name="default-width">800</property>
|
|
/// <property name="default-height">800</property>
|
|
/// <child>
|
|
/// <object class="AdwBreakpoint">
|
|
/// <condition>max-width: 400sp</condition>
|
|
/// <setter object="split_view" property="collapsed">True</setter>
|
|
/// </object>
|
|
/// </child>
|
|
/// <property name="content">
|
|
/// <object class="AdwOverlaySplitView" id="split_view">
|
|
/// <property name="sidebar">
|
|
/// <!-- ... -->
|
|
/// </property>
|
|
/// <property name="content">
|
|
/// <!-- ... -->
|
|
/// </property>
|
|
/// </object>
|
|
/// </property>
|
|
/// </object>
|
|
/// ```
|
|
///
|
|
/// `AdwOverlaySplitView` is often used for implementing the
|
|
/// [utility pane](https://developer.gnome.org/hig/patterns/containers/utility-panes.html)
|
|
/// pattern.
|
|
///
|
|
/// ## Sizing
|
|
///
|
|
/// When not collapsed, `AdwOverlaySplitView` changes the sidebar width
|
|
/// depending on its own width.
|
|
///
|
|
/// If possible, it tries to allocate a fraction of the total width, controlled
|
|
/// with the [property`OverlaySplitView`:sidebar-width-fraction] property.
|
|
///
|
|
/// The sidebar also has minimum and maximum sizes, controlled with the
|
|
/// [property`OverlaySplitView`:min-sidebar-width] and
|
|
/// [property`OverlaySplitView`:max-sidebar-width] properties.
|
|
///
|
|
/// The minimum and maximum sizes are using the length unit specified with the
|
|
/// [property`OverlaySplitView`:sidebar-width-unit].
|
|
///
|
|
/// By default, sidebar is using 25% of the total width, with 180sp as the
|
|
/// minimum size and 280sp as the maximum size.
|
|
///
|
|
/// When collapsed, the preferred width fraction is ignored and the sidebar uses
|
|
/// [property`OverlaySplitView`:max-sidebar-width] when possible.
|
|
///
|
|
/// ## Header Bar Integration
|
|
///
|
|
/// When used inside `AdwOverlaySplitView`, [class`HeaderBar`] will automatically
|
|
/// hide the window buttons in the middle.
|
|
///
|
|
/// ## `AdwOverlaySplitView` as `GtkBuildable`
|
|
///
|
|
/// The `AdwOverlaySplitView` implementation of the [iface`Gtk`.Buildable]
|
|
/// interface supports setting the sidebar widget by specifying “sidebar” as the
|
|
/// “type” attribute of a `<child>` element, Specifying “content” child type or
|
|
/// omitting it results in setting the content widget.
|
|
///
|
|
/// ## CSS nodes
|
|
///
|
|
/// `AdwOverlaySplitView` has a single CSS node with the name
|
|
/// `overlay-split-view`.
|
|
///
|
|
/// It contains two nodes with the name `widget`, containing the sidebar and
|
|
/// content children.
|
|
///
|
|
/// When not collapsed, they have the `.sidebar-view` and `.content-view` style
|
|
/// classes respectively.
|
|
///
|
|
/// ```
|
|
/// overlay-split-view
|
|
/// ├── widget.sidebar-pane
|
|
/// │ ╰── [sidebar child]
|
|
/// ╰── widget.content-pane
|
|
/// ╰── [content child]
|
|
/// ```
|
|
///
|
|
/// When collapsed, the one containing the sidebar child has the `.background`
|
|
/// style class and the other one has no style classes.
|
|
///
|
|
/// ```
|
|
/// overlay-split-view
|
|
/// ├── widget.background
|
|
/// │ ╰── [sidebar child]
|
|
/// ╰── widget
|
|
/// ╰── [content child]
|
|
/// ```
|
|
///
|
|
/// ## Accessibility
|
|
///
|
|
/// `AdwOverlaySplitView` uses the [enum`Gtk`.AccessibleRole.group] role.
|
|
///
|
|
/// A Portico view that mounts a `Adw.OverlaySplitView`.
|
|
@MainActor public struct OverlaySplitView: View {
|
|
private let make: (MountContext) -> Adw.OverlaySplitView
|
|
private var configure: [(Adw.OverlaySplitView, MountContext) -> Void] = []
|
|
|
|
public var body: Never { fatalError() }
|
|
|
|
// PorticoGen: generateInits(static) | source: Adw.OverlaySplitView.init()
|
|
/// Creates a new `AdwOverlaySplitView`.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for values that change.
|
|
/// Each closure is evaluated once; children are added in order and slot closures mount their first view.
|
|
/// An empty closure adds no children and leaves slots unset.
|
|
/// Optional value parameters are applied only when non-`nil`; a `nil` argument leaves the widget's own default in place and cannot clear a nullable property - use the matching modifier for that.
|
|
///
|
|
/// - Parameter collapsed: Whether the split view is collapsed.
|
|
/// - Parameter enableHideGesture: Whether the sidebar can be closed with a swipe gesture.
|
|
/// - Parameter enableShowGesture: Whether the sidebar can be opened with an edge swipe gesture.
|
|
/// - Parameter maxSidebarWidth: The maximum sidebar width.
|
|
/// - Parameter minSidebarWidth: The minimum sidebar width.
|
|
/// - Parameter pinSidebar: Whether the sidebar widget is pinned.
|
|
/// - Parameter showSidebar: Whether the sidebar widget is shown.
|
|
/// - Parameter sidebarPosition: The sidebar position.
|
|
/// - Parameter sidebarWidthFraction: The preferred sidebar width as a fraction of the total width.
|
|
/// - Parameter sidebarWidthUnit: The length unit for minimum and maximum sidebar widths.
|
|
/// - Parameter content: A `ViewBuilder` closure whose first view is mounted into the `content` slot.
|
|
/// - Parameter sidebar: A `ViewBuilder` closure whose first view is mounted into the `sidebar` slot.
|
|
public init(collapsed: Bool? = nil, enableHideGesture: Bool? = nil, enableShowGesture: Bool? = nil, maxSidebarWidth: Double? = nil, minSidebarWidth: Double? = nil, pinSidebar: Bool? = nil, showSidebar: Bool? = nil, sidebarPosition: Adw.PackType? = nil, sidebarWidthFraction: Double? = nil, sidebarWidthUnit: Adw.LengthUnit? = nil, @ViewBuilder content: @escaping () -> [AnyView] = { [] }, @ViewBuilder sidebar: @escaping () -> [AnyView] = { [] }) {
|
|
make = { _ in Adw.OverlaySplitView() }
|
|
configure.append { w, ctx in
|
|
if let collapsed { w.setCollapsed(collapsed: collapsed) }
|
|
if let enableHideGesture { w.setEnableHideGesture(enableHideGesture: enableHideGesture) }
|
|
if let enableShowGesture { w.setEnableShowGesture(enableShowGesture: enableShowGesture) }
|
|
if let maxSidebarWidth { w.setMaxSidebarWidth(width: maxSidebarWidth) }
|
|
if let minSidebarWidth { w.setMinSidebarWidth(width: minSidebarWidth) }
|
|
if let pinSidebar { w.setPinSidebar(pinSidebar: pinSidebar) }
|
|
if let showSidebar { w.setShowSidebar(showSidebar: showSidebar) }
|
|
if let sidebarPosition { w.setSidebarPosition(position: sidebarPosition) }
|
|
if let sidebarWidthFraction { w.setSidebarWidthFraction(fraction: sidebarWidthFraction) }
|
|
if let sidebarWidthUnit { w.setSidebarWidthUnit(unit: sidebarWidthUnit) }
|
|
if let v = Portico.mountSlotChild(content, ctx, onUpdate: { v in w.setContent(content: v) }) { w.setContent(content: v) }
|
|
if let v = Portico.mountSlotChild(sidebar, ctx, onUpdate: { v in w.setSidebar(sidebar: v) }) { w.setSidebar(sidebar: v) }
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
extension OverlaySplitView: WidgetView {
|
|
public typealias Target = Adw.OverlaySplitView
|
|
|
|
@_spi(Portico) public func appending(
|
|
_ step: @escaping (Adw.OverlaySplitView, MountContext) -> Void
|
|
) -> Self {
|
|
var c = self
|
|
c.configure.append(step)
|
|
return c
|
|
}
|
|
}
|
|
|
|
@_spi(Portico) extension OverlaySplitView: 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.OverlaySplitView
|
|
/// Modifiers for `Adw.OverlaySplitView`, available on every Portico view whose
|
|
/// backing widget is `Adw.OverlaySplitView` or one of its subclasses.
|
|
extension WidgetView where Target: Adw.OverlaySplitView {
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.OverlaySplitView.setCollapsed(collapsed:)
|
|
/// Sets whether `self` view is collapsed.
|
|
///
|
|
/// When collapsed, the sidebar widget is presented as an overlay above the
|
|
/// content widget, otherwise they are displayed side by side.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter collapsed: Whether the split view is collapsed.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func collapsed(_ collapsed: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setCollapsed(collapsed: collapsed)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.OverlaySplitView.setCollapsed(collapsed:), GObject.Object.connectNotify(detail:_:), Adw.OverlaySplitView.getCollapsed()
|
|
/// Sets whether `self` view is collapsed.
|
|
///
|
|
/// When collapsed, the sidebar widget is presented as an overlay above the
|
|
/// content widget, otherwise they are displayed side by side.
|
|
///
|
|
/// 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 collapsed(_ collapsed: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, collapsed, registry: ctx.registry, notifyDetail: "collapsed",
|
|
read: { [w] in w.getCollapsed() },
|
|
write: { [w] v in w.setCollapsed(collapsed: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.OverlaySplitView.setCollapsed(collapsed:)
|
|
/// Sets whether `self` view is collapsed.
|
|
///
|
|
/// When collapsed, the sidebar widget is presented as an overlay above the
|
|
/// content widget, otherwise they are displayed side by side.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.OverlaySplitView.setCollapsed(collapsed:)`.
|
|
///
|
|
/// - Parameter collapsed: Whether the split view is collapsed.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func collapsed(_ collapsed: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setCollapsed(collapsed: collapsed()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.OverlaySplitView.setContent(content:)
|
|
/// Sets the content widget for `self`.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter content: The content widget.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func content(_ content: Adw.Widget?) -> Self {
|
|
appending { w, _ in
|
|
w.setContent(content: content)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(viewBuilder) | source: Adw.OverlaySplitView.setContent(content:)
|
|
/// Sets the content widget for `self`.
|
|
///
|
|
/// The closure is evaluated once when the modifier is applied. Its first view is mounted into the slot.
|
|
/// Additional views are ignored; an empty closure leaves the slot unset.
|
|
///
|
|
/// - Parameter content: The content widget.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func content(@ViewBuilder _ content: () -> [AnyView]) -> Self {
|
|
let contentViews = content()
|
|
return appending { w, ctx in
|
|
guard let v = contentViews.first else { return }
|
|
w.setContent(content: v.makeWidget(ctx))
|
|
}
|
|
}
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.OverlaySplitView.setContent(content:), GObject.Object.connectNotify(detail:_:), Adw.OverlaySplitView.getContent()
|
|
/// Sets the content widget for `self`.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Adw.Widget?` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
|
///
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func content<W: Gtk.Widget>(_ content: Portico.Binding<W?>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, content, registry: ctx.registry, notifyDetail: "content",
|
|
read: { [w] in w.getContent() as? W },
|
|
write: { [w] v in w.setContent(content: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Adw.OverlaySplitView.setContent(content:), GObject.Object.connectNotify(detail:_:), Adw.OverlaySplitView.getContent()
|
|
/// Sets the content widget for `self`.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// `Binding` is invariant, so a `Binding<Adw.Widget>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Adw.Widget?>` to be able to clear the property.
|
|
/// When `Adw.Widget` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
|
/// A `nil` widget value is never written back into the binding.
|
|
///
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func content<W: Gtk.Widget>(_ content: Portico.Binding<W>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, content, registry: ctx.registry, notifyDetail: "content",
|
|
read: { [w] in w.getContent() as? W },
|
|
write: { [w] v in w.setContent(content: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.OverlaySplitView.setContent(content:)
|
|
/// Sets the content widget for `self`.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.OverlaySplitView.setContent(content:)`.
|
|
///
|
|
/// - Parameter content: The content widget.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func content(_ content: @escaping () -> Adw.Widget?) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setContent(content: content()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.OverlaySplitView.setEnableHideGesture(enableHideGesture:)
|
|
/// Sets whether `self` can be closed with a swipe gesture.
|
|
///
|
|
/// Only touchscreen swipes are supported.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter enableHideGesture: Whether the sidebar can be closed with a swipe gesture.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func enableHideGesture(_ enableHideGesture: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setEnableHideGesture(enableHideGesture: enableHideGesture)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.OverlaySplitView.setEnableHideGesture(enableHideGesture:), GObject.Object.connectNotify(detail:_:), Adw.OverlaySplitView.getEnableHideGesture()
|
|
/// Sets whether `self` can be closed with a swipe gesture.
|
|
///
|
|
/// Only touchscreen swipes are supported.
|
|
///
|
|
/// 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 enableHideGesture(_ enableHideGesture: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, enableHideGesture, registry: ctx.registry, notifyDetail: "enable-hide-gesture",
|
|
read: { [w] in w.getEnableHideGesture() },
|
|
write: { [w] v in w.setEnableHideGesture(enableHideGesture: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.OverlaySplitView.setEnableHideGesture(enableHideGesture:)
|
|
/// Sets whether `self` can be closed with a swipe gesture.
|
|
///
|
|
/// Only touchscreen swipes are supported.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.OverlaySplitView.setEnableHideGesture(enableHideGesture:)`.
|
|
///
|
|
/// - Parameter enableHideGesture: Whether the sidebar can be closed with a swipe gesture.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func enableHideGesture(_ enableHideGesture: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setEnableHideGesture(enableHideGesture: enableHideGesture()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.OverlaySplitView.setEnableShowGesture(enableShowGesture:)
|
|
/// Sets whether `self` can be opened with an edge swipe gesture.
|
|
///
|
|
/// Only touchscreen swipes are supported.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter enableShowGesture: Whether the sidebar can be opened with an edge swipe gesture.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func enableShowGesture(_ enableShowGesture: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setEnableShowGesture(enableShowGesture: enableShowGesture)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.OverlaySplitView.setEnableShowGesture(enableShowGesture:), GObject.Object.connectNotify(detail:_:), Adw.OverlaySplitView.getEnableShowGesture()
|
|
/// Sets whether `self` can be opened with an edge swipe gesture.
|
|
///
|
|
/// Only touchscreen swipes are supported.
|
|
///
|
|
/// 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 enableShowGesture(_ enableShowGesture: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, enableShowGesture, registry: ctx.registry, notifyDetail: "enable-show-gesture",
|
|
read: { [w] in w.getEnableShowGesture() },
|
|
write: { [w] v in w.setEnableShowGesture(enableShowGesture: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.OverlaySplitView.setEnableShowGesture(enableShowGesture:)
|
|
/// Sets whether `self` can be opened with an edge swipe gesture.
|
|
///
|
|
/// Only touchscreen swipes are supported.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.OverlaySplitView.setEnableShowGesture(enableShowGesture:)`.
|
|
///
|
|
/// - Parameter enableShowGesture: Whether the sidebar can be opened with an edge swipe gesture.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func enableShowGesture(_ enableShowGesture: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setEnableShowGesture(enableShowGesture: enableShowGesture()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.OverlaySplitView.setMaxSidebarWidth(width:)
|
|
/// Sets the maximum sidebar width for `self`.
|
|
///
|
|
/// Maximum width is affected by [property`OverlaySplitView`:sidebar-width-unit].
|
|
///
|
|
/// The sidebar widget can still be allocated with larger width if its own
|
|
/// minimum width exceeds it.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter maxSidebarWidth: The maximum sidebar width.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func maxSidebarWidth(_ maxSidebarWidth: Double) -> Self {
|
|
appending { w, _ in
|
|
w.setMaxSidebarWidth(width: maxSidebarWidth)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.OverlaySplitView.setMaxSidebarWidth(width:), GObject.Object.connectNotify(detail:_:), Adw.OverlaySplitView.getMaxSidebarWidth()
|
|
/// Sets the maximum sidebar width for `self`.
|
|
///
|
|
/// Maximum width is affected by [property`OverlaySplitView`:sidebar-width-unit].
|
|
///
|
|
/// The sidebar widget can still be allocated with larger width if its own
|
|
/// minimum width exceeds it.
|
|
///
|
|
/// 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 maxSidebarWidth(_ maxSidebarWidth: Portico.Binding<Double>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, maxSidebarWidth, registry: ctx.registry, notifyDetail: "max-sidebar-width",
|
|
read: { [w] in w.getMaxSidebarWidth() },
|
|
write: { [w] v in w.setMaxSidebarWidth(width: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.OverlaySplitView.setMaxSidebarWidth(width:)
|
|
/// Sets the maximum sidebar width for `self`.
|
|
///
|
|
/// Maximum width is affected by [property`OverlaySplitView`:sidebar-width-unit].
|
|
///
|
|
/// The sidebar widget can still be allocated with larger width if its own
|
|
/// minimum width exceeds it.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.OverlaySplitView.setMaxSidebarWidth(width:)`.
|
|
///
|
|
/// - Parameter maxSidebarWidth: The maximum sidebar width.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func maxSidebarWidth(_ maxSidebarWidth: @escaping () -> Double) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setMaxSidebarWidth(width: maxSidebarWidth()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.OverlaySplitView.setMinSidebarWidth(width:)
|
|
/// Sets the minimum sidebar width for `self`.
|
|
///
|
|
/// Minimum width is affected by [property`OverlaySplitView`:sidebar-width-unit].
|
|
///
|
|
/// The sidebar widget can still be allocated with larger width if its own
|
|
/// minimum width exceeds it.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter minSidebarWidth: The minimum sidebar width.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func minSidebarWidth(_ minSidebarWidth: Double) -> Self {
|
|
appending { w, _ in
|
|
w.setMinSidebarWidth(width: minSidebarWidth)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.OverlaySplitView.setMinSidebarWidth(width:), GObject.Object.connectNotify(detail:_:), Adw.OverlaySplitView.getMinSidebarWidth()
|
|
/// Sets the minimum sidebar width for `self`.
|
|
///
|
|
/// Minimum width is affected by [property`OverlaySplitView`:sidebar-width-unit].
|
|
///
|
|
/// The sidebar widget can still be allocated with larger width if its own
|
|
/// minimum width exceeds it.
|
|
///
|
|
/// 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 minSidebarWidth(_ minSidebarWidth: Portico.Binding<Double>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, minSidebarWidth, registry: ctx.registry, notifyDetail: "min-sidebar-width",
|
|
read: { [w] in w.getMinSidebarWidth() },
|
|
write: { [w] v in w.setMinSidebarWidth(width: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.OverlaySplitView.setMinSidebarWidth(width:)
|
|
/// Sets the minimum sidebar width for `self`.
|
|
///
|
|
/// Minimum width is affected by [property`OverlaySplitView`:sidebar-width-unit].
|
|
///
|
|
/// The sidebar widget can still be allocated with larger width if its own
|
|
/// minimum width exceeds it.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.OverlaySplitView.setMinSidebarWidth(width:)`.
|
|
///
|
|
/// - Parameter minSidebarWidth: The minimum sidebar width.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func minSidebarWidth(_ minSidebarWidth: @escaping () -> Double) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setMinSidebarWidth(width: minSidebarWidth()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.OverlaySplitView.setPinSidebar(pinSidebar:)
|
|
/// Sets whether the sidebar widget is pinned for `self`.
|
|
///
|
|
/// By default, collapsing `self` automatically hides the sidebar widget, and
|
|
/// uncollapsing it shows the sidebar. If set to `TRUE`, sidebar visibility never
|
|
/// changes on its own.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter pinSidebar: Whether the sidebar widget is pinned.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func pinSidebar(_ pinSidebar: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setPinSidebar(pinSidebar: pinSidebar)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.OverlaySplitView.setPinSidebar(pinSidebar:), GObject.Object.connectNotify(detail:_:), Adw.OverlaySplitView.getPinSidebar()
|
|
/// Sets whether the sidebar widget is pinned for `self`.
|
|
///
|
|
/// By default, collapsing `self` automatically hides the sidebar widget, and
|
|
/// uncollapsing it shows the sidebar. If set to `TRUE`, sidebar visibility never
|
|
/// changes on its own.
|
|
///
|
|
/// 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 pinSidebar(_ pinSidebar: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, pinSidebar, registry: ctx.registry, notifyDetail: "pin-sidebar",
|
|
read: { [w] in w.getPinSidebar() },
|
|
write: { [w] v in w.setPinSidebar(pinSidebar: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.OverlaySplitView.setPinSidebar(pinSidebar:)
|
|
/// Sets whether the sidebar widget is pinned for `self`.
|
|
///
|
|
/// By default, collapsing `self` automatically hides the sidebar widget, and
|
|
/// uncollapsing it shows the sidebar. If set to `TRUE`, sidebar visibility never
|
|
/// changes on its own.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.OverlaySplitView.setPinSidebar(pinSidebar:)`.
|
|
///
|
|
/// - Parameter pinSidebar: Whether the sidebar widget is pinned.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func pinSidebar(_ pinSidebar: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setPinSidebar(pinSidebar: pinSidebar()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.OverlaySplitView.setShowSidebar(showSidebar:)
|
|
/// Sets whether the sidebar widget is shown for `self`.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter showSidebar: Whether the sidebar widget is shown.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func showSidebar(_ showSidebar: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setShowSidebar(showSidebar: showSidebar)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.OverlaySplitView.setShowSidebar(showSidebar:), GObject.Object.connectNotify(detail:_:), Adw.OverlaySplitView.getShowSidebar()
|
|
/// Sets whether the sidebar widget is shown for `self`.
|
|
///
|
|
/// 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 showSidebar(_ showSidebar: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, showSidebar, registry: ctx.registry, notifyDetail: "show-sidebar",
|
|
read: { [w] in w.getShowSidebar() },
|
|
write: { [w] v in w.setShowSidebar(showSidebar: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.OverlaySplitView.setShowSidebar(showSidebar:)
|
|
/// Sets whether the sidebar widget is shown for `self`.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.OverlaySplitView.setShowSidebar(showSidebar:)`.
|
|
///
|
|
/// - Parameter showSidebar: Whether the sidebar widget is shown.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func showSidebar(_ showSidebar: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setShowSidebar(showSidebar: showSidebar()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.OverlaySplitView.setSidebar(sidebar:)
|
|
/// Sets the sidebar widget for `self`.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter sidebar: The sidebar widget.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func sidebar(_ sidebar: Adw.Widget?) -> Self {
|
|
appending { w, _ in
|
|
w.setSidebar(sidebar: sidebar)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(viewBuilder) | source: Adw.OverlaySplitView.setSidebar(sidebar:)
|
|
/// Sets the sidebar widget for `self`.
|
|
///
|
|
/// The closure is evaluated once when the modifier is applied. Its first view is mounted into the slot.
|
|
/// Additional views are ignored; an empty closure leaves the slot unset.
|
|
///
|
|
/// - Parameter sidebar: The sidebar widget.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func sidebar(@ViewBuilder _ sidebar: () -> [AnyView]) -> Self {
|
|
let sidebarViews = sidebar()
|
|
return appending { w, ctx in
|
|
guard let v = sidebarViews.first else { return }
|
|
w.setSidebar(sidebar: v.makeWidget(ctx))
|
|
}
|
|
}
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.OverlaySplitView.setSidebar(sidebar:), GObject.Object.connectNotify(detail:_:), Adw.OverlaySplitView.getSidebar()
|
|
/// Sets the sidebar widget for `self`.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Adw.Widget?` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
|
///
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func sidebar<W: Gtk.Widget>(_ sidebar: Portico.Binding<W?>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, sidebar, registry: ctx.registry, notifyDetail: "sidebar",
|
|
read: { [w] in w.getSidebar() as? W },
|
|
write: { [w] v in w.setSidebar(sidebar: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Adw.OverlaySplitView.setSidebar(sidebar:), GObject.Object.connectNotify(detail:_:), Adw.OverlaySplitView.getSidebar()
|
|
/// Sets the sidebar widget for `self`.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// `Binding` is invariant, so a `Binding<Adw.Widget>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Adw.Widget?>` to be able to clear the property.
|
|
/// When `Adw.Widget` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
|
/// A `nil` widget value is never written back into the binding.
|
|
///
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func sidebar<W: Gtk.Widget>(_ sidebar: Portico.Binding<W>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, sidebar, registry: ctx.registry, notifyDetail: "sidebar",
|
|
read: { [w] in w.getSidebar() as? W },
|
|
write: { [w] v in w.setSidebar(sidebar: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.OverlaySplitView.setSidebar(sidebar:)
|
|
/// Sets the sidebar widget for `self`.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.OverlaySplitView.setSidebar(sidebar:)`.
|
|
///
|
|
/// - Parameter sidebar: The sidebar widget.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func sidebar(_ sidebar: @escaping () -> Adw.Widget?) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setSidebar(sidebar: sidebar()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.OverlaySplitView.setSidebarPosition(position:)
|
|
/// Sets the sidebar position for `self`.
|
|
///
|
|
/// If it's set to [enum`Gtk`.PackType.start], the sidebar is displayed before the
|
|
/// content; if [enum`Gtk`.PackType.end], it's displayed after the content.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter sidebarPosition: The sidebar position.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func sidebarPosition(_ sidebarPosition: Adw.PackType) -> Self {
|
|
appending { w, _ in
|
|
w.setSidebarPosition(position: sidebarPosition)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.OverlaySplitView.setSidebarPosition(position:), GObject.Object.connectNotify(detail:_:), Adw.OverlaySplitView.getSidebarPosition()
|
|
/// Sets the sidebar position for `self`.
|
|
///
|
|
/// If it's set to [enum`Gtk`.PackType.start], the sidebar is displayed before the
|
|
/// content; if [enum`Gtk`.PackType.end], it's displayed after the content.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Adw.PackType` 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 sidebarPosition(_ sidebarPosition: Portico.Binding<Adw.PackType>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, sidebarPosition, registry: ctx.registry, notifyDetail: "sidebar-position",
|
|
read: { [w] in w.getSidebarPosition() },
|
|
write: { [w] v in w.setSidebarPosition(position: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.OverlaySplitView.setSidebarPosition(position:)
|
|
/// Sets the sidebar position for `self`.
|
|
///
|
|
/// If it's set to [enum`Gtk`.PackType.start], the sidebar is displayed before the
|
|
/// content; if [enum`Gtk`.PackType.end], it's displayed after the content.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.OverlaySplitView.setSidebarPosition(position:)`.
|
|
///
|
|
/// - Parameter sidebarPosition: The sidebar position.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func sidebarPosition(_ sidebarPosition: @escaping () -> Adw.PackType) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setSidebarPosition(position: sidebarPosition()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.OverlaySplitView.setSidebarWidthFraction(fraction:)
|
|
/// Sets the preferred sidebar width as a fraction of the total width of `self`.
|
|
///
|
|
/// The preferred width is additionally limited by
|
|
/// [property`OverlaySplitView`:min-sidebar-width] and
|
|
/// [property`OverlaySplitView`:max-sidebar-width].
|
|
///
|
|
/// The sidebar widget can be allocated with larger width if its own minimum
|
|
/// width exceeds the preferred width.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter sidebarWidthFraction: The preferred sidebar width as a fraction of the total width.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func sidebarWidthFraction(_ sidebarWidthFraction: Double) -> Self {
|
|
appending { w, _ in
|
|
w.setSidebarWidthFraction(fraction: sidebarWidthFraction)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.OverlaySplitView.setSidebarWidthFraction(fraction:), GObject.Object.connectNotify(detail:_:), Adw.OverlaySplitView.getSidebarWidthFraction()
|
|
/// Sets the preferred sidebar width as a fraction of the total width of `self`.
|
|
///
|
|
/// The preferred width is additionally limited by
|
|
/// [property`OverlaySplitView`:min-sidebar-width] and
|
|
/// [property`OverlaySplitView`:max-sidebar-width].
|
|
///
|
|
/// The sidebar widget can be allocated with larger width if its own minimum
|
|
/// width exceeds the preferred width.
|
|
///
|
|
/// 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 sidebarWidthFraction(_ sidebarWidthFraction: Portico.Binding<Double>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, sidebarWidthFraction, registry: ctx.registry, notifyDetail: "sidebar-width-fraction",
|
|
read: { [w] in w.getSidebarWidthFraction() },
|
|
write: { [w] v in w.setSidebarWidthFraction(fraction: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.OverlaySplitView.setSidebarWidthFraction(fraction:)
|
|
/// Sets the preferred sidebar width as a fraction of the total width of `self`.
|
|
///
|
|
/// The preferred width is additionally limited by
|
|
/// [property`OverlaySplitView`:min-sidebar-width] and
|
|
/// [property`OverlaySplitView`:max-sidebar-width].
|
|
///
|
|
/// The sidebar widget can be allocated with larger width if its own minimum
|
|
/// width exceeds the preferred width.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.OverlaySplitView.setSidebarWidthFraction(fraction:)`.
|
|
///
|
|
/// - Parameter sidebarWidthFraction: The preferred sidebar width as a fraction of the total width.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func sidebarWidthFraction(_ sidebarWidthFraction: @escaping () -> Double) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setSidebarWidthFraction(fraction: sidebarWidthFraction()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.OverlaySplitView.setSidebarWidthUnit(unit:)
|
|
/// Sets the length unit for minimum and maximum sidebar widths.
|
|
///
|
|
/// See [property`OverlaySplitView`:min-sidebar-width] and
|
|
/// [property`OverlaySplitView`:max-sidebar-width].
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter sidebarWidthUnit: The length unit for minimum and maximum sidebar widths.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func sidebarWidthUnit(_ sidebarWidthUnit: Adw.LengthUnit) -> Self {
|
|
appending { w, _ in
|
|
w.setSidebarWidthUnit(unit: sidebarWidthUnit)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.OverlaySplitView.setSidebarWidthUnit(unit:), GObject.Object.connectNotify(detail:_:), Adw.OverlaySplitView.getSidebarWidthUnit()
|
|
/// Sets the length unit for minimum and maximum sidebar widths.
|
|
///
|
|
/// See [property`OverlaySplitView`:min-sidebar-width] and
|
|
/// [property`OverlaySplitView`:max-sidebar-width].
|
|
///
|
|
/// 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 sidebarWidthUnit(_ sidebarWidthUnit: Portico.Binding<Adw.LengthUnit>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, sidebarWidthUnit, registry: ctx.registry, notifyDetail: "sidebar-width-unit",
|
|
read: { [w] in w.getSidebarWidthUnit() },
|
|
write: { [w] v in w.setSidebarWidthUnit(unit: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.OverlaySplitView.setSidebarWidthUnit(unit:)
|
|
/// Sets the length unit for minimum and maximum sidebar widths.
|
|
///
|
|
/// See [property`OverlaySplitView`:min-sidebar-width] and
|
|
/// [property`OverlaySplitView`:max-sidebar-width].
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.OverlaySplitView.setSidebarWidthUnit(unit:)`.
|
|
///
|
|
/// - Parameter sidebarWidthUnit: The length unit for minimum and maximum sidebar widths.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func sidebarWidthUnit(_ sidebarWidthUnit: @escaping () -> Adw.LengthUnit) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setSidebarWidthUnit(unit: sidebarWidthUnit()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
}
|