788 lines
42 KiB
Swift
788 lines
42 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.ToolbarView
|
|
/// A widget containing a page, as well as top and/or bottom bars.
|
|
///
|
|
/// <picture>
|
|
/// <source srcset="toolbar-view-dark.png" media="(prefers-color-scheme: dark)">
|
|
/// <img src="toolbar-view.png" alt="toolbar-view">
|
|
/// </picture>
|
|
///
|
|
/// `AdwToolbarView` has a single content widget and one or multiple top and
|
|
/// bottom bars, shown at the top and bottom sides respectively.
|
|
///
|
|
/// Example of an `AdwToolbarView` UI definition:
|
|
/// ```xml
|
|
/// <object class="AdwToolbarView">
|
|
/// <child type="top">
|
|
/// <object class="AdwHeaderBar"/>
|
|
/// </child>
|
|
/// <property name="content">
|
|
/// <object class="AdwPreferencesPage">
|
|
/// <!-- ... -->
|
|
/// </object>
|
|
/// </property>
|
|
/// </object>
|
|
/// ```
|
|
///
|
|
/// The following kinds of top and bottom bars are supported:
|
|
///
|
|
/// - [class`HeaderBar`]
|
|
/// - [class`TabBar`]
|
|
/// - [class`ViewSwitcherBar`]
|
|
/// - [class`Gtk`.ActionBar]
|
|
/// - [class`Gtk`.HeaderBar]
|
|
/// - [class`Gtk`.PopoverMenuBar]
|
|
/// - [class`Gtk`.SearchBar]
|
|
/// - Any [class`Gtk`.Box] or a similar widget with the
|
|
/// [`.toolbar`](style-classes.html`toolbars`) style class
|
|
///
|
|
/// By default, top and bottom bars are flat and scrolling content has a subtle
|
|
/// undershoot shadow, same as when using the
|
|
/// [`.undershoot-top`](style-classes.html`undershoot`-indicators) and
|
|
/// [`.undershoot-bottom`](style-classes.html`undershoot`-indicators) style
|
|
/// classes. This works well in most cases, e.g. with [class`StatusPage`] or
|
|
/// [class`PreferencesPage`], where the background at the top and bottom parts of
|
|
/// the page is uniform. Additionally, windows with sidebars should always use
|
|
/// this style.
|
|
///
|
|
/// [property`ToolbarView`:top-bar-style] and
|
|
/// [property`ToolbarView`:bottom-bar-style] properties can be used add an opaque
|
|
/// background and a persistent shadow to top and bottom bars, this can be useful
|
|
/// for content such as [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
|
|
/// where some elements are adjacent to the top/bottom bars, or [class`TabView`],
|
|
/// where each page can have a different background.
|
|
///
|
|
/// <picture style="min-width: 33%; display: inline-block;">
|
|
/// <source srcset="toolbar-view-flat-1-dark.png" media="(prefers-color-scheme: dark)">
|
|
/// <img src="toolbar-view-flat-1.png" alt="toolbar-view-flat-1">
|
|
/// </picture>
|
|
/// <picture style="min-width: 33%; display: inline-block;">
|
|
/// <source srcset="toolbar-view-flat-2-dark.png" media="(prefers-color-scheme: dark)">
|
|
/// <img src="toolbar-view-flat-2.png" alt="toolbar-view-flat-2">
|
|
/// </picture>
|
|
/// <picture style="min-width: 33%; display: inline-block;">
|
|
/// <source srcset="toolbar-view-raised-dark.png" media="(prefers-color-scheme: dark)">
|
|
/// <img src="toolbar-view-raised.png" alt="toolbar-view-raised">
|
|
/// </picture>
|
|
///
|
|
/// `AdwToolbarView` ensures the top and bottom bars have consistent backdrop
|
|
/// styles and vertical spacing. For comparison:
|
|
///
|
|
/// <picture style="min-width: 40%; display: inline-block;">
|
|
/// <source srcset="toolbar-view-spacing-dark.png" media="(prefers-color-scheme: dark)">
|
|
/// <img src="toolbar-view-spacing.png" alt="toolbar-view-spacing">
|
|
/// </picture>
|
|
/// <picture style="min-width: 40%; display: inline-block;">
|
|
/// <source srcset="toolbar-view-spacing-box-dark.png" media="(prefers-color-scheme: dark)">
|
|
/// <img src="toolbar-view-spacing-box.png" alt="toolbar-view-spacing-box">
|
|
/// </picture>
|
|
///
|
|
/// Any top and bottom bars can also be dragged to move the window, equivalent
|
|
/// to putting them into a [class`Gtk`.WindowHandle].
|
|
///
|
|
/// Content is typically place between top and bottom bars, but can also extend
|
|
/// behind them. This is controlled with the
|
|
/// [property`ToolbarView`:extend-content-to-top-edge] and
|
|
/// [property`ToolbarView`:extend-content-to-bottom-edge] properties.
|
|
///
|
|
/// Top and bottom bars can be hidden and revealed with an animation using the
|
|
/// [property`ToolbarView`:reveal-top-bars] and
|
|
/// [property`ToolbarView`:reveal-bottom-bars] properties.
|
|
///
|
|
/// ## `AdwToolbarView` as `GtkBuildable`
|
|
///
|
|
/// The `AdwToolbarView` implementation of the [iface`Gtk`.Buildable] interface
|
|
/// supports adding a top bar by specifying “top” as the “type” attribute of a
|
|
/// `<child>` element, or adding a bottom bar by specifying “bottom”.
|
|
///
|
|
/// ## Accessibility
|
|
///
|
|
/// `AdwToolbarView` uses the [enum`Gtk`.AccessibleRole.group] role.
|
|
///
|
|
/// A Portico view that mounts a `Adw.ToolbarView`.
|
|
@MainActor public struct ToolbarView: View {
|
|
private let make: (MountContext) -> Adw.ToolbarView
|
|
private var configure: [(Adw.ToolbarView, MountContext) -> Void] = []
|
|
|
|
public var body: Never { fatalError() }
|
|
|
|
// PorticoGen: generateInits(static) | source: Adw.ToolbarView.init()
|
|
/// Creates a new `AdwToolbarView`.
|
|
///
|
|
/// 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 bottomBarStyle: Appearance of the bottom bars.
|
|
/// - Parameter extendContentToBottomEdge: Whether the content widget can extend behind bottom bars.
|
|
/// - Parameter extendContentToTopEdge: Whether the content widget can extend behind top bars.
|
|
/// - Parameter revealBottomBars: Whether bottom bars are visible.
|
|
/// - Parameter revealTopBars: Whether top bars are revealed.
|
|
/// - Parameter topBarStyle: Appearance of the top bars.
|
|
/// - Parameter content: A `ViewBuilder` closure whose first view is mounted into the `content` slot.
|
|
public init(bottomBarStyle: Adw.ToolbarStyle? = nil, extendContentToBottomEdge: Bool? = nil, extendContentToTopEdge: Bool? = nil, revealBottomBars: Bool? = nil, revealTopBars: Bool? = nil, topBarStyle: Adw.ToolbarStyle? = nil, @ViewBuilder content: @escaping () -> [AnyView] = { [] }) {
|
|
make = { _ in Adw.ToolbarView() }
|
|
configure.append { w, ctx in
|
|
if let bottomBarStyle { w.setBottomBarStyle(style: bottomBarStyle) }
|
|
if let extendContentToBottomEdge { w.setExtendContentToBottomEdge(extend: extendContentToBottomEdge) }
|
|
if let extendContentToTopEdge { w.setExtendContentToTopEdge(extend: extendContentToTopEdge) }
|
|
if let revealBottomBars { w.setRevealBottomBars(reveal: revealBottomBars) }
|
|
if let revealTopBars { w.setRevealTopBars(reveal: revealTopBars) }
|
|
if let topBarStyle { w.setTopBarStyle(style: topBarStyle) }
|
|
if let v = Portico.mountSlotChild(content, ctx, onUpdate: { v in w.setContent(content: v) }) { w.setContent(content: v) }
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
extension ToolbarView: WidgetView {
|
|
public typealias Target = Adw.ToolbarView
|
|
|
|
@_spi(Portico) public func appending(
|
|
_ step: @escaping (Adw.ToolbarView, MountContext) -> Void
|
|
) -> Self {
|
|
var c = self
|
|
c.configure.append(step)
|
|
return c
|
|
}
|
|
}
|
|
|
|
@_spi(Portico) extension ToolbarView: 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.ToolbarView
|
|
/// Modifiers for `Adw.ToolbarView`, available on every Portico view whose
|
|
/// backing widget is `Adw.ToolbarView` or one of its subclasses.
|
|
extension WidgetView where Target: Adw.ToolbarView {
|
|
// PorticoGen: generateModifierExtension -> generateChildAdderModifiers(static) | source: Adw.ToolbarView.addBottomBar(widget:)
|
|
/// Adds a bottom bar 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 addBottomBar(_ child: Gtk.Widget) -> Self {
|
|
appending { w, _ in
|
|
w.addBottomBar(widget: child)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateChildAdderModifiers(viewBuilder) | source: Adw.ToolbarView.addBottomBar(widget:)
|
|
/// Adds a bottom bar 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 addBottomBar(@ViewBuilder _ child: () -> [AnyView]) -> Self {
|
|
let childViews = child()
|
|
return appending { w, ctx in
|
|
for v in childViews { w.addBottomBar(widget: v.makeWidget(ctx)) }
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateChildAdderModifiers(static) | source: Adw.ToolbarView.addTopBar(widget:)
|
|
/// Adds a top bar 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 addTopBar(_ child: Gtk.Widget) -> Self {
|
|
appending { w, _ in
|
|
w.addTopBar(widget: child)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateChildAdderModifiers(viewBuilder) | source: Adw.ToolbarView.addTopBar(widget:)
|
|
/// Adds a top bar 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 addTopBar(@ViewBuilder _ child: () -> [AnyView]) -> Self {
|
|
let childViews = child()
|
|
return appending { w, ctx in
|
|
for v in childViews { w.addTopBar(widget: v.makeWidget(ctx)) }
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ToolbarView.setBottomBarStyle(style:)
|
|
/// Sets appearance of the bottom bars for `self`.
|
|
///
|
|
/// If set to [enum`Adw`.ToolbarStyle.flat], bottom bars are flat and scrolling
|
|
/// content has a subtle undershoot shadow when touching them, same as the
|
|
/// [`.undershoot-bottom`](style-classes.html`undershoot`-indicators)
|
|
/// style class. This works well for simple content, e.g. [class`StatusPage`] or
|
|
/// [class`PreferencesPage`], where the background at the bottom of the page is
|
|
/// uniform. Additionally, windows with sidebars should always use this style.
|
|
///
|
|
/// Undershoot shadow is only present if a bottom bar is actually present and
|
|
/// visible. It is also never present if
|
|
/// [property`ToolbarView`:extend-content-to-bottom-edge] is set to `TRUE`.
|
|
///
|
|
/// If set to [enum`Adw`.ToolbarStyle.raised], bottom bars have an opaque
|
|
/// background and a persistent shadow, this is suitable for content such as
|
|
/// [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
|
|
/// where some elements are directly adjacent to the bottom bars, or
|
|
/// [class`TabView`], where each page can have a different background.
|
|
///
|
|
/// [enum`Adw`.ToolbarStyle.raised-border] is similar to
|
|
/// [enum`Adw`.ToolbarStyle.raised], but the shadow is replaced with a more subtle
|
|
/// border. This can be useful for applications like image viewers.
|
|
///
|
|
/// See also [method`ToolbarView`.set_top_bar_style].
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter bottomBarStyle: Appearance of the bottom bars.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func bottomBarStyle(_ bottomBarStyle: Adw.ToolbarStyle) -> Self {
|
|
appending { w, _ in
|
|
w.setBottomBarStyle(style: bottomBarStyle)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ToolbarView.setBottomBarStyle(style:), GObject.Object.connectNotify(detail:_:), Adw.ToolbarView.getBottomBarStyle()
|
|
/// Sets appearance of the bottom bars for `self`.
|
|
///
|
|
/// If set to [enum`Adw`.ToolbarStyle.flat], bottom bars are flat and scrolling
|
|
/// content has a subtle undershoot shadow when touching them, same as the
|
|
/// [`.undershoot-bottom`](style-classes.html`undershoot`-indicators)
|
|
/// style class. This works well for simple content, e.g. [class`StatusPage`] or
|
|
/// [class`PreferencesPage`], where the background at the bottom of the page is
|
|
/// uniform. Additionally, windows with sidebars should always use this style.
|
|
///
|
|
/// Undershoot shadow is only present if a bottom bar is actually present and
|
|
/// visible. It is also never present if
|
|
/// [property`ToolbarView`:extend-content-to-bottom-edge] is set to `TRUE`.
|
|
///
|
|
/// If set to [enum`Adw`.ToolbarStyle.raised], bottom bars have an opaque
|
|
/// background and a persistent shadow, this is suitable for content such as
|
|
/// [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
|
|
/// where some elements are directly adjacent to the bottom bars, or
|
|
/// [class`TabView`], where each page can have a different background.
|
|
///
|
|
/// [enum`Adw`.ToolbarStyle.raised-border] is similar to
|
|
/// [enum`Adw`.ToolbarStyle.raised], but the shadow is replaced with a more subtle
|
|
/// border. This can be useful for applications like image viewers.
|
|
///
|
|
/// See also [method`ToolbarView`.set_top_bar_style].
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Adw.ToolbarStyle` 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 bottomBarStyle(_ bottomBarStyle: Portico.Binding<Adw.ToolbarStyle>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, bottomBarStyle, registry: ctx.registry, notifyDetail: "bottom-bar-style",
|
|
read: { [w] in w.getBottomBarStyle() },
|
|
write: { [w] v in w.setBottomBarStyle(style: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ToolbarView.setBottomBarStyle(style:)
|
|
/// Sets appearance of the bottom bars for `self`.
|
|
///
|
|
/// If set to [enum`Adw`.ToolbarStyle.flat], bottom bars are flat and scrolling
|
|
/// content has a subtle undershoot shadow when touching them, same as the
|
|
/// [`.undershoot-bottom`](style-classes.html`undershoot`-indicators)
|
|
/// style class. This works well for simple content, e.g. [class`StatusPage`] or
|
|
/// [class`PreferencesPage`], where the background at the bottom of the page is
|
|
/// uniform. Additionally, windows with sidebars should always use this style.
|
|
///
|
|
/// Undershoot shadow is only present if a bottom bar is actually present and
|
|
/// visible. It is also never present if
|
|
/// [property`ToolbarView`:extend-content-to-bottom-edge] is set to `TRUE`.
|
|
///
|
|
/// If set to [enum`Adw`.ToolbarStyle.raised], bottom bars have an opaque
|
|
/// background and a persistent shadow, this is suitable for content such as
|
|
/// [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
|
|
/// where some elements are directly adjacent to the bottom bars, or
|
|
/// [class`TabView`], where each page can have a different background.
|
|
///
|
|
/// [enum`Adw`.ToolbarStyle.raised-border] is similar to
|
|
/// [enum`Adw`.ToolbarStyle.raised], but the shadow is replaced with a more subtle
|
|
/// border. This can be useful for applications like image viewers.
|
|
///
|
|
/// See also [method`ToolbarView`.set_top_bar_style].
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ToolbarView.setBottomBarStyle(style:)`.
|
|
///
|
|
/// - Parameter bottomBarStyle: Appearance of the bottom bars.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func bottomBarStyle(_ bottomBarStyle: @escaping () -> Adw.ToolbarStyle) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setBottomBarStyle(style: bottomBarStyle()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ToolbarView.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.ToolbarView.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.ToolbarView.setContent(content:), GObject.Object.connectNotify(detail:_:), Adw.ToolbarView.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.ToolbarView.setContent(content:), GObject.Object.connectNotify(detail:_:), Adw.ToolbarView.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.ToolbarView.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.ToolbarView.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.ToolbarView.setExtendContentToBottomEdge(extend:)
|
|
/// Sets whether the content widget can extend behind bottom bars.
|
|
///
|
|
/// This can be used in combination with [property`ToolbarView`:reveal-bottom-bars]
|
|
/// to show and hide toolbars in fullscreen.
|
|
///
|
|
/// See [method`ToolbarView`.set_extend_content_to_top_edge].
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter extendContentToBottomEdge: Whether the content widget can extend behind bottom bars.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func extendContentToBottomEdge(_ extendContentToBottomEdge: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setExtendContentToBottomEdge(extend: extendContentToBottomEdge)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ToolbarView.setExtendContentToBottomEdge(extend:), GObject.Object.connectNotify(detail:_:), Adw.ToolbarView.getExtendContentToBottomEdge()
|
|
/// Sets whether the content widget can extend behind bottom bars.
|
|
///
|
|
/// This can be used in combination with [property`ToolbarView`:reveal-bottom-bars]
|
|
/// to show and hide toolbars in fullscreen.
|
|
///
|
|
/// See [method`ToolbarView`.set_extend_content_to_top_edge].
|
|
///
|
|
/// 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 extendContentToBottomEdge(_ extendContentToBottomEdge: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, extendContentToBottomEdge, registry: ctx.registry, notifyDetail: "extend-content-to-bottom-edge",
|
|
read: { [w] in w.getExtendContentToBottomEdge() },
|
|
write: { [w] v in w.setExtendContentToBottomEdge(extend: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ToolbarView.setExtendContentToBottomEdge(extend:)
|
|
/// Sets whether the content widget can extend behind bottom bars.
|
|
///
|
|
/// This can be used in combination with [property`ToolbarView`:reveal-bottom-bars]
|
|
/// to show and hide toolbars in fullscreen.
|
|
///
|
|
/// See [method`ToolbarView`.set_extend_content_to_top_edge].
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ToolbarView.setExtendContentToBottomEdge(extend:)`.
|
|
///
|
|
/// - Parameter extendContentToBottomEdge: Whether the content widget can extend behind bottom bars.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func extendContentToBottomEdge(_ extendContentToBottomEdge: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setExtendContentToBottomEdge(extend: extendContentToBottomEdge()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ToolbarView.setExtendContentToTopEdge(extend:)
|
|
/// Sets whether the content widget can extend behind top bars.
|
|
///
|
|
/// This can be used in combination with [property`ToolbarView`:reveal-top-bars]
|
|
/// to show and hide toolbars in fullscreen.
|
|
///
|
|
/// See [method`ToolbarView`.set_extend_content_to_bottom_edge].
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter extendContentToTopEdge: Whether the content widget can extend behind top bars.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func extendContentToTopEdge(_ extendContentToTopEdge: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setExtendContentToTopEdge(extend: extendContentToTopEdge)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ToolbarView.setExtendContentToTopEdge(extend:), GObject.Object.connectNotify(detail:_:), Adw.ToolbarView.getExtendContentToTopEdge()
|
|
/// Sets whether the content widget can extend behind top bars.
|
|
///
|
|
/// This can be used in combination with [property`ToolbarView`:reveal-top-bars]
|
|
/// to show and hide toolbars in fullscreen.
|
|
///
|
|
/// See [method`ToolbarView`.set_extend_content_to_bottom_edge].
|
|
///
|
|
/// 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 extendContentToTopEdge(_ extendContentToTopEdge: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, extendContentToTopEdge, registry: ctx.registry, notifyDetail: "extend-content-to-top-edge",
|
|
read: { [w] in w.getExtendContentToTopEdge() },
|
|
write: { [w] v in w.setExtendContentToTopEdge(extend: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ToolbarView.setExtendContentToTopEdge(extend:)
|
|
/// Sets whether the content widget can extend behind top bars.
|
|
///
|
|
/// This can be used in combination with [property`ToolbarView`:reveal-top-bars]
|
|
/// to show and hide toolbars in fullscreen.
|
|
///
|
|
/// See [method`ToolbarView`.set_extend_content_to_bottom_edge].
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ToolbarView.setExtendContentToTopEdge(extend:)`.
|
|
///
|
|
/// - Parameter extendContentToTopEdge: Whether the content widget can extend behind top bars.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func extendContentToTopEdge(_ extendContentToTopEdge: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setExtendContentToTopEdge(extend: extendContentToTopEdge()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ToolbarView.setRevealBottomBars(reveal:)
|
|
/// Sets whether bottom bars are revealed for `self`.
|
|
///
|
|
/// The transition will be animated.
|
|
///
|
|
/// This can be used in combination with
|
|
/// [property`ToolbarView`:extend-content-to-bottom-edge] to show and hide
|
|
/// toolbars in fullscreen.
|
|
///
|
|
/// See [method`ToolbarView`.set_reveal_top_bars].
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter revealBottomBars: Whether bottom bars are visible.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func revealBottomBars(_ revealBottomBars: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setRevealBottomBars(reveal: revealBottomBars)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ToolbarView.setRevealBottomBars(reveal:), GObject.Object.connectNotify(detail:_:), Adw.ToolbarView.getRevealBottomBars()
|
|
/// Sets whether bottom bars are revealed for `self`.
|
|
///
|
|
/// The transition will be animated.
|
|
///
|
|
/// This can be used in combination with
|
|
/// [property`ToolbarView`:extend-content-to-bottom-edge] to show and hide
|
|
/// toolbars in fullscreen.
|
|
///
|
|
/// See [method`ToolbarView`.set_reveal_top_bars].
|
|
///
|
|
/// 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 revealBottomBars(_ revealBottomBars: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, revealBottomBars, registry: ctx.registry, notifyDetail: "reveal-bottom-bars",
|
|
read: { [w] in w.getRevealBottomBars() },
|
|
write: { [w] v in w.setRevealBottomBars(reveal: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ToolbarView.setRevealBottomBars(reveal:)
|
|
/// Sets whether bottom bars are revealed for `self`.
|
|
///
|
|
/// The transition will be animated.
|
|
///
|
|
/// This can be used in combination with
|
|
/// [property`ToolbarView`:extend-content-to-bottom-edge] to show and hide
|
|
/// toolbars in fullscreen.
|
|
///
|
|
/// See [method`ToolbarView`.set_reveal_top_bars].
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ToolbarView.setRevealBottomBars(reveal:)`.
|
|
///
|
|
/// - Parameter revealBottomBars: Whether bottom bars are visible.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func revealBottomBars(_ revealBottomBars: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setRevealBottomBars(reveal: revealBottomBars()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ToolbarView.setRevealTopBars(reveal:)
|
|
/// Sets whether top bars are revealed for `self`.
|
|
///
|
|
/// The transition will be animated.
|
|
///
|
|
/// This can be used in combination with
|
|
/// [property`ToolbarView`:extend-content-to-top-edge] to show and hide toolbars
|
|
/// in fullscreen.
|
|
///
|
|
/// See [method`ToolbarView`.set_reveal_bottom_bars].
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter revealTopBars: Whether top bars are revealed.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func revealTopBars(_ revealTopBars: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setRevealTopBars(reveal: revealTopBars)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ToolbarView.setRevealTopBars(reveal:), GObject.Object.connectNotify(detail:_:), Adw.ToolbarView.getRevealTopBars()
|
|
/// Sets whether top bars are revealed for `self`.
|
|
///
|
|
/// The transition will be animated.
|
|
///
|
|
/// This can be used in combination with
|
|
/// [property`ToolbarView`:extend-content-to-top-edge] to show and hide toolbars
|
|
/// in fullscreen.
|
|
///
|
|
/// See [method`ToolbarView`.set_reveal_bottom_bars].
|
|
///
|
|
/// 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 revealTopBars(_ revealTopBars: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, revealTopBars, registry: ctx.registry, notifyDetail: "reveal-top-bars",
|
|
read: { [w] in w.getRevealTopBars() },
|
|
write: { [w] v in w.setRevealTopBars(reveal: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ToolbarView.setRevealTopBars(reveal:)
|
|
/// Sets whether top bars are revealed for `self`.
|
|
///
|
|
/// The transition will be animated.
|
|
///
|
|
/// This can be used in combination with
|
|
/// [property`ToolbarView`:extend-content-to-top-edge] to show and hide toolbars
|
|
/// in fullscreen.
|
|
///
|
|
/// See [method`ToolbarView`.set_reveal_bottom_bars].
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ToolbarView.setRevealTopBars(reveal:)`.
|
|
///
|
|
/// - Parameter revealTopBars: Whether top bars are revealed.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func revealTopBars(_ revealTopBars: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setRevealTopBars(reveal: revealTopBars()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ToolbarView.setTopBarStyle(style:)
|
|
/// Sets appearance of the top bars for `self`.
|
|
///
|
|
/// If set to [enum`Adw`.ToolbarStyle.flat], top bars are flat and scrolling
|
|
/// content has a subtle undershoot shadow when touching them, same as the
|
|
/// [`.undershoot-top`](style-classes.html`undershoot`-indicators)
|
|
/// style class. This works well for simple content, e.g. [class`StatusPage`] or
|
|
/// [class`PreferencesPage`], where the background at the top of the page is
|
|
/// uniform. Additionally, windows with sidebars should always use this style.
|
|
///
|
|
/// Undershoot shadow is only present if a top bar is actually present and
|
|
/// visible. It is also never present if
|
|
/// [property`ToolbarView`:extend-content-to-top-edge] is set to `TRUE`.
|
|
///
|
|
/// If set to [enum`Adw`.ToolbarStyle.raised], top bars have an opaque background
|
|
/// and a persistent shadow, this is suitable for content such as
|
|
/// [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
|
|
/// where some elements are directly adjacent to the top bars, or
|
|
/// [class`TabView`], where each page can have a different background.
|
|
///
|
|
/// [enum`Adw`.ToolbarStyle.raised-border] is similar to
|
|
/// [enum`Adw`.ToolbarStyle.raised], but the shadow is replaced with a more subtle
|
|
/// border. This can be useful for applications like image viewers.
|
|
///
|
|
/// See also [method`ToolbarView`.set_bottom_bar_style].
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter topBarStyle: Appearance of the top bars.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func topBarStyle(_ topBarStyle: Adw.ToolbarStyle) -> Self {
|
|
appending { w, _ in
|
|
w.setTopBarStyle(style: topBarStyle)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ToolbarView.setTopBarStyle(style:), GObject.Object.connectNotify(detail:_:), Adw.ToolbarView.getTopBarStyle()
|
|
/// Sets appearance of the top bars for `self`.
|
|
///
|
|
/// If set to [enum`Adw`.ToolbarStyle.flat], top bars are flat and scrolling
|
|
/// content has a subtle undershoot shadow when touching them, same as the
|
|
/// [`.undershoot-top`](style-classes.html`undershoot`-indicators)
|
|
/// style class. This works well for simple content, e.g. [class`StatusPage`] or
|
|
/// [class`PreferencesPage`], where the background at the top of the page is
|
|
/// uniform. Additionally, windows with sidebars should always use this style.
|
|
///
|
|
/// Undershoot shadow is only present if a top bar is actually present and
|
|
/// visible. It is also never present if
|
|
/// [property`ToolbarView`:extend-content-to-top-edge] is set to `TRUE`.
|
|
///
|
|
/// If set to [enum`Adw`.ToolbarStyle.raised], top bars have an opaque background
|
|
/// and a persistent shadow, this is suitable for content such as
|
|
/// [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
|
|
/// where some elements are directly adjacent to the top bars, or
|
|
/// [class`TabView`], where each page can have a different background.
|
|
///
|
|
/// [enum`Adw`.ToolbarStyle.raised-border] is similar to
|
|
/// [enum`Adw`.ToolbarStyle.raised], but the shadow is replaced with a more subtle
|
|
/// border. This can be useful for applications like image viewers.
|
|
///
|
|
/// See also [method`ToolbarView`.set_bottom_bar_style].
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Adw.ToolbarStyle` 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 topBarStyle(_ topBarStyle: Portico.Binding<Adw.ToolbarStyle>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, topBarStyle, registry: ctx.registry, notifyDetail: "top-bar-style",
|
|
read: { [w] in w.getTopBarStyle() },
|
|
write: { [w] v in w.setTopBarStyle(style: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ToolbarView.setTopBarStyle(style:)
|
|
/// Sets appearance of the top bars for `self`.
|
|
///
|
|
/// If set to [enum`Adw`.ToolbarStyle.flat], top bars are flat and scrolling
|
|
/// content has a subtle undershoot shadow when touching them, same as the
|
|
/// [`.undershoot-top`](style-classes.html`undershoot`-indicators)
|
|
/// style class. This works well for simple content, e.g. [class`StatusPage`] or
|
|
/// [class`PreferencesPage`], where the background at the top of the page is
|
|
/// uniform. Additionally, windows with sidebars should always use this style.
|
|
///
|
|
/// Undershoot shadow is only present if a top bar is actually present and
|
|
/// visible. It is also never present if
|
|
/// [property`ToolbarView`:extend-content-to-top-edge] is set to `TRUE`.
|
|
///
|
|
/// If set to [enum`Adw`.ToolbarStyle.raised], top bars have an opaque background
|
|
/// and a persistent shadow, this is suitable for content such as
|
|
/// [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
|
|
/// where some elements are directly adjacent to the top bars, or
|
|
/// [class`TabView`], where each page can have a different background.
|
|
///
|
|
/// [enum`Adw`.ToolbarStyle.raised-border] is similar to
|
|
/// [enum`Adw`.ToolbarStyle.raised], but the shadow is replaced with a more subtle
|
|
/// border. This can be useful for applications like image viewers.
|
|
///
|
|
/// See also [method`ToolbarView`.set_bottom_bar_style].
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ToolbarView.setTopBarStyle(style:)`.
|
|
///
|
|
/// - Parameter topBarStyle: Appearance of the top bars.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func topBarStyle(_ topBarStyle: @escaping () -> Adw.ToolbarStyle) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setTopBarStyle(style: topBarStyle()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
}
|