portico/Sources/Portico/Generated/TabOverview.swift

809 lines
45 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.TabOverview
/// A tab overview for [class`TabView`].
///
/// <picture>
/// <source srcset="tab-overview-dark.png" media="(prefers-color-scheme: dark)">
/// <img src="tab-overview.png" alt="tab-overview">
/// </picture>
///
/// `AdwTabOverview` is a widget that can display tabs from an `AdwTabView` in a
/// grid.
///
/// `AdwTabOverview` shows a thumbnail for each tab. By default thumbnails are
/// static for all pages except the selected one. They can be made always live
/// by setting [property`TabPage`:live-thumbnail] to `TRUE`, or refreshed with
/// [method`TabPage`.invalidate_thumbnail] or
/// [method`TabView`.invalidate_thumbnails] otherwise.
///
/// If the pages are too tall or too wide, the thumbnails will be cropped; use
/// [property`TabPage`:thumbnail-xalign] and [property`TabPage`:thumbnail-yalign] to
/// control which part of the page should be visible in this case.
///
/// Pinned tabs are shown as smaller cards without thumbnails above the other
/// tabs. Unlike in [class`TabBar`], they still have titles, as well as an unpin
/// button.
///
/// `AdwTabOverview` provides search in open tabs. It searches in tab titles and
/// tooltips, as well as [property`TabPage`:keyword].
///
/// If [property`TabOverview`:enable-new-tab] is set to `TRUE`, a new tab button
/// will be shown. Connect to the [signal`TabOverview`::create-tab] signal to use
/// it.
///
/// [property`TabOverview`:secondary-menu] can be used to provide a secondary menu
/// for the overview. Use it to add extra actions, e.g. to open a new window or
/// undo closed tab.
///
/// `AdwTabOverview` is intended to be used as the direct child of the window,
/// with the rest of the window contents set as the [property`TabOverview`:child].
/// The child is expected to contain an [class`TabView`].
///
/// `AdwTabOverview` shows window buttons by default. They can be disabled by
/// setting [property`TabOverview`:show-start-title-buttons] and/or
/// [property`TabOverview`:show-start-title-buttons] and/or
/// [property`TabOverview`:show-end-title-buttons] to `FALSE`.
///
/// If search and window buttons are disabled, and secondary menu is not set, the
/// header bar will be hidden.
///
/// ## Drag-and-Drop
///
/// `AdwTabOverview` thumbnails can have an additional drop target for arbitrary
/// content.
///
/// Use [method`TabOverview`.setup_extra_drop_target] to set it up, specifying the
/// supported content types and drag actions, then connect to
/// [signal`TabOverview`::extra-drag-drop] to handle a drop.
///
/// In some cases, it may be necessary to determine the used action based on the
/// content. In that case, set [property`TabOverview`:extra-drag-preload] to
/// `TRUE` and connect to [signal`TabOverview`::extra-drag-value] signal, then
/// return the action from its handler. To access this action from the
/// [signal`TabOverview`::extra-drag-drop] handler, use the
/// [property`TabOverview`:extra-drag-preferred-action] property.
///
/// [signal`TabOverview`::extra-drag-value] is also always emitted when starting to
/// hover an item, with a `NULL` value. This happens even when
/// [property`TabOverview`:extra-drag-preload] is `FALSE`.
///
/// ## Actions
///
/// `AdwTabOverview` defines the `overview.open` and `overview.close` actions for
/// opening and closing itself. They can be convenient when used together with
/// [class`TabButton`].
///
/// ## CSS nodes
///
/// `AdwTabOverview` has a single CSS node with name `taboverview`.
///
/// A Portico view that mounts a `Adw.TabOverview`.
@MainActor public struct TabOverview: View {
private let make: (MountContext) -> Adw.TabOverview
private var configure: [(Adw.TabOverview, MountContext) -> Void] = []
public var body: Never { fatalError() }
// PorticoGen: generateInits(static) | source: Adw.TabOverview.init()
/// Creates a new `AdwTabOverview`.
///
/// 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 enableNewTab: Whether to enable new tab button.
/// - Parameter enableSearch: Whether to enable search in tabs.
/// - Parameter extraDragPreload: Whether the drop data should be preloaded on hover.
/// - Parameter inverted: Whether thumbnails use inverted layout.
/// - Parameter `open`: Whether the overview is open.
/// - Parameter secondaryMenu: The secondary menu model.
/// - Parameter showEndTitleButtons: Whether to show end title buttons in the overview's header bar.
/// - Parameter showStartTitleButtons: Whether to show start title buttons in the overview's header bar.
/// - Parameter view: The tab view the overview controls.
/// - Parameter child: A `ViewBuilder` closure whose first view is mounted into the `child` slot.
/// - Parameter onCreateTab: Invoked when the widget emits the `create-tab` signal. Its return value is forwarded to GTK as the signal's result.
/// - Parameter onExtraDragDrop: Invoked when the widget emits the `extra-drag-drop` signal. The closure receives the signal's arguments in order. Its return value is forwarded to GTK as the signal's result.
/// - Parameter onExtraDragValue: Invoked when the widget emits the `extra-drag-value` signal. The closure receives the signal's arguments in order. Its return value is forwarded to GTK as the signal's result.
public init(enableNewTab: Bool? = nil, enableSearch: Bool? = nil, extraDragPreload: Bool? = nil, inverted: Bool? = nil, `open`: Bool? = nil, secondaryMenu: Adw.MenuModel? = nil, showEndTitleButtons: Bool? = nil, showStartTitleButtons: Bool? = nil, view: Adw.TabView? = nil, @ViewBuilder child: @escaping () -> [AnyView] = { [] }, onCreateTab: (() -> Adw.TabPage)? = nil, onExtraDragDrop: ((Adw.TabPage, Adw.Value) -> Bool)? = nil, onExtraDragValue: ((Adw.TabPage, Adw.Value?) -> Adw.DragAction)? = nil) {
make = { _ in Adw.TabOverview() }
configure.append { w, ctx in
if let enableNewTab { w.setEnableNewTab(enableNewTab: enableNewTab) }
if let enableSearch { w.setEnableSearch(enableSearch: enableSearch) }
if let extraDragPreload { w.setExtraDragPreload(preload: extraDragPreload) }
if let inverted { w.setInverted(inverted: inverted) }
if let `open` { w.setOpen(`open`: `open`) }
if let secondaryMenu { w.setSecondaryMenu(secondaryMenu: secondaryMenu) }
if let showEndTitleButtons { w.setShowEndTitleButtons(showEndTitleButtons: showEndTitleButtons) }
if let showStartTitleButtons { w.setShowStartTitleButtons(showStartTitleButtons: showStartTitleButtons) }
if let view { w.setView(view: view) }
if let v = Portico.mountSlotChild(child, ctx, onUpdate: { v in w.setChild(child: v) }) { w.setChild(child: v) }
if let onCreateTab { ctx.registry.add(w.connectCreateTab { _ in onCreateTab() }) }
if let onExtraDragDrop { ctx.registry.add(w.connectExtraDragDrop { _, a0, a1 in onExtraDragDrop(a0, a1) }) }
if let onExtraDragValue { ctx.registry.add(w.connectExtraDragValue { _, a0, a1 in onExtraDragValue(a0, a1) }) }
}
}
}
extension TabOverview: WidgetView {
public typealias Target = Adw.TabOverview
@_spi(Portico) public func appending(
_ step: @escaping (Adw.TabOverview, MountContext) -> Void
) -> Self {
var c = self
c.configure.append(step)
return c
}
}
@_spi(Portico) extension TabOverview: 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.TabOverview
/// Modifiers for `Adw.TabOverview`, available on every Portico view whose
/// backing widget is `Adw.TabOverview` or one of its subclasses.
extension WidgetView where Target: Adw.TabOverview {
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.TabOverview.setChild(child:)
/// Sets the child widget of `self`.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter child: The child widget.
/// - Returns: A copy of this view with the modifier applied.
public func child(_ child: Adw.Widget?) -> Self {
appending { w, _ in
w.setChild(child: child)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(viewBuilder) | source: Adw.TabOverview.setChild(child:)
/// Sets the child widget of `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 child: The child widget.
/// - Returns: A copy of this view with the modifier applied.
public func child(@ViewBuilder _ child: () -> [AnyView]) -> Self {
let childViews = child()
return appending { w, ctx in
guard let v = childViews.first else { return }
w.setChild(child: v.makeWidget(ctx))
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.TabOverview.setChild(child:), GObject.Object.connectNotify(detail:_:), Adw.TabOverview.getChild()
/// Sets the child widget of `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 child<W: Gtk.Widget>(_ child: Portico.Binding<W?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, child, registry: ctx.registry, notifyDetail: "child",
read: { [w] in w.getChild() as? W },
write: { [w] v in w.setChild(child: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Adw.TabOverview.setChild(child:), GObject.Object.connectNotify(detail:_:), Adw.TabOverview.getChild()
/// Sets the child widget of `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 child<W: Gtk.Widget>(_ child: Portico.Binding<W>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, child, registry: ctx.registry, notifyDetail: "child",
read: { [w] in w.getChild() as? W },
write: { [w] v in w.setChild(child: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.TabOverview.setChild(child:)
/// Sets the child widget of `self`.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.TabOverview.setChild(child:)`.
///
/// - Parameter child: The child widget.
/// - Returns: A copy of this view with the modifier applied.
public func child(_ child: @escaping () -> Adw.Widget?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setChild(child: child()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.TabOverview.setEnableNewTab(enableNewTab:)
/// Sets whether to enable new tab button for `self`.
///
/// Connect to the [signal`TabOverview`::create-tab] signal to use it.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter enableNewTab: Whether to enable new tab button.
/// - Returns: A copy of this view with the modifier applied.
public func enableNewTab(_ enableNewTab: Bool) -> Self {
appending { w, _ in
w.setEnableNewTab(enableNewTab: enableNewTab)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.TabOverview.setEnableNewTab(enableNewTab:), GObject.Object.connectNotify(detail:_:), Adw.TabOverview.getEnableNewTab()
/// Sets whether to enable new tab button for `self`.
///
/// Connect to the [signal`TabOverview`::create-tab] signal to use it.
///
/// 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 enableNewTab(_ enableNewTab: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, enableNewTab, registry: ctx.registry, notifyDetail: "enable-new-tab",
read: { [w] in w.getEnableNewTab() },
write: { [w] v in w.setEnableNewTab(enableNewTab: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.TabOverview.setEnableNewTab(enableNewTab:)
/// Sets whether to enable new tab button for `self`.
///
/// Connect to the [signal`TabOverview`::create-tab] signal to use it.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.TabOverview.setEnableNewTab(enableNewTab:)`.
///
/// - Parameter enableNewTab: Whether to enable new tab button.
/// - Returns: A copy of this view with the modifier applied.
public func enableNewTab(_ enableNewTab: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setEnableNewTab(enableNewTab: enableNewTab()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.TabOverview.setEnableSearch(enableSearch:)
/// Sets whether to enable search in tabs for `self`.
///
/// Search matches tab titles and tooltips, as well as keywords, set via
/// [property`TabPage`:keyword]. Use keywords to search in e.g. page URLs in a web
/// browser.
///
/// During search, tab reordering and drag-n-drop are disabled.
///
/// Use [property`TabOverview`:search-active] to check out if search is currently
/// active.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter enableSearch: Whether to enable search in tabs.
/// - Returns: A copy of this view with the modifier applied.
public func enableSearch(_ enableSearch: Bool) -> Self {
appending { w, _ in
w.setEnableSearch(enableSearch: enableSearch)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.TabOverview.setEnableSearch(enableSearch:), GObject.Object.connectNotify(detail:_:), Adw.TabOverview.getEnableSearch()
/// Sets whether to enable search in tabs for `self`.
///
/// Search matches tab titles and tooltips, as well as keywords, set via
/// [property`TabPage`:keyword]. Use keywords to search in e.g. page URLs in a web
/// browser.
///
/// During search, tab reordering and drag-n-drop are disabled.
///
/// Use [property`TabOverview`:search-active] to check out if search is currently
/// active.
///
/// 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 enableSearch(_ enableSearch: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, enableSearch, registry: ctx.registry, notifyDetail: "enable-search",
read: { [w] in w.getEnableSearch() },
write: { [w] v in w.setEnableSearch(enableSearch: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.TabOverview.setEnableSearch(enableSearch:)
/// Sets whether to enable search in tabs for `self`.
///
/// Search matches tab titles and tooltips, as well as keywords, set via
/// [property`TabPage`:keyword]. Use keywords to search in e.g. page URLs in a web
/// browser.
///
/// During search, tab reordering and drag-n-drop are disabled.
///
/// Use [property`TabOverview`:search-active] to check out if search is currently
/// active.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.TabOverview.setEnableSearch(enableSearch:)`.
///
/// - Parameter enableSearch: Whether to enable search in tabs.
/// - Returns: A copy of this view with the modifier applied.
public func enableSearch(_ enableSearch: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setEnableSearch(enableSearch: enableSearch()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.TabOverview.setExtraDragPreload(preload:)
/// Sets whether drop data should be preloaded on hover.
///
/// See [property`Gtk`.DropTarget:preload].
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter extraDragPreload: Whether the drop data should be preloaded on hover.
/// - Returns: A copy of this view with the modifier applied.
public func extraDragPreload(_ extraDragPreload: Bool) -> Self {
appending { w, _ in
w.setExtraDragPreload(preload: extraDragPreload)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.TabOverview.setExtraDragPreload(preload:), GObject.Object.connectNotify(detail:_:), Adw.TabOverview.getExtraDragPreload()
/// Sets whether drop data should be preloaded on hover.
///
/// See [property`Gtk`.DropTarget:preload].
///
/// 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 extraDragPreload(_ extraDragPreload: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, extraDragPreload, registry: ctx.registry, notifyDetail: "extra-drag-preload",
read: { [w] in w.getExtraDragPreload() },
write: { [w] v in w.setExtraDragPreload(preload: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.TabOverview.setExtraDragPreload(preload:)
/// Sets whether drop data should be preloaded on hover.
///
/// See [property`Gtk`.DropTarget:preload].
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.TabOverview.setExtraDragPreload(preload:)`.
///
/// - Parameter extraDragPreload: Whether the drop data should be preloaded on hover.
/// - Returns: A copy of this view with the modifier applied.
public func extraDragPreload(_ extraDragPreload: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setExtraDragPreload(preload: extraDragPreload()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.TabOverview.setInverted(inverted:)
/// Sets whether thumbnails use inverted layout.
///
/// If set to `TRUE`, thumbnails will have the close or unpin button at the
/// beginning and the indicator at the end rather than the other way around.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter inverted: Whether thumbnails use inverted layout.
/// - Returns: A copy of this view with the modifier applied.
public func inverted(_ inverted: Bool) -> Self {
appending { w, _ in
w.setInverted(inverted: inverted)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.TabOverview.setInverted(inverted:), GObject.Object.connectNotify(detail:_:), Adw.TabOverview.getInverted()
/// Sets whether thumbnails use inverted layout.
///
/// If set to `TRUE`, thumbnails will have the close or unpin button at the
/// beginning and the indicator at the end rather than the other way around.
///
/// 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 inverted(_ inverted: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, inverted, registry: ctx.registry, notifyDetail: "inverted",
read: { [w] in w.getInverted() },
write: { [w] v in w.setInverted(inverted: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.TabOverview.setInverted(inverted:)
/// Sets whether thumbnails use inverted layout.
///
/// If set to `TRUE`, thumbnails will have the close or unpin button at the
/// beginning and the indicator at the end rather than the other way around.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.TabOverview.setInverted(inverted:)`.
///
/// - Parameter inverted: Whether thumbnails use inverted layout.
/// - Returns: A copy of this view with the modifier applied.
public func inverted(_ inverted: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setInverted(inverted: inverted()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.TabOverview.setOpen(`open`:)
/// Sets whether the to open `self`.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter `open`: Whether the overview is open.
/// - Returns: A copy of this view with the modifier applied.
public func `open`(_ `open`: Bool) -> Self {
appending { w, _ in
w.setOpen(`open`: `open`)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.TabOverview.setOpen(`open`:), GObject.Object.connectNotify(detail:_:)
/// Sets whether the to open `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 `open`(_ `open`: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, `open`, registry: ctx.registry, notifyDetail: "open",
read: { [w] in w.`open` },
write: { [w] v in w.setOpen(`open`: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.TabOverview.setOpen(`open`:)
/// Sets whether the to open `self`.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.TabOverview.setOpen(`open`:)`.
///
/// - Parameter `open`: Whether the overview is open.
/// - Returns: A copy of this view with the modifier applied.
public func `open`(_ `open`: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setOpen(`open`: `open`()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.TabOverview.setSecondaryMenu(secondaryMenu:)
/// Sets the secondary menu model for `self`.
///
/// Use it to add extra actions, e.g. to open a new window or undo closed tab.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter secondaryMenu: The secondary menu model.
/// - Returns: A copy of this view with the modifier applied.
public func secondaryMenu(_ secondaryMenu: Adw.MenuModel?) -> Self {
appending { w, _ in
w.setSecondaryMenu(secondaryMenu: secondaryMenu)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.TabOverview.setSecondaryMenu(secondaryMenu:), GObject.Object.connectNotify(detail:_:), Adw.TabOverview.getSecondaryMenu()
/// Sets the secondary menu model for `self`.
///
/// Use it to add extra actions, e.g. to open a new window or undo closed tab.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Adw.MenuModel?` 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 secondaryMenu(_ secondaryMenu: Portico.Binding<Adw.MenuModel?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, secondaryMenu, registry: ctx.registry, notifyDetail: "secondary-menu",
read: { [w] in w.getSecondaryMenu() },
write: { [w] v in w.setSecondaryMenu(secondaryMenu: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Adw.TabOverview.setSecondaryMenu(secondaryMenu:), GObject.Object.connectNotify(detail:_:), Adw.TabOverview.getSecondaryMenu()
/// Sets the secondary menu model for `self`.
///
/// Use it to add extra actions, e.g. to open a new window or undo closed tab.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Adw.MenuModel>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Adw.MenuModel?>` to be able to clear the property.
/// When `Adw.MenuModel` 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 secondaryMenu(_ secondaryMenu: Portico.Binding<Adw.MenuModel>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, secondaryMenu, registry: ctx.registry, notifyDetail: "secondary-menu",
read: { [w] in w.getSecondaryMenu() },
write: { [w] v in w.setSecondaryMenu(secondaryMenu: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.TabOverview.setSecondaryMenu(secondaryMenu:)
/// Sets the secondary menu model for `self`.
///
/// Use it to add extra actions, e.g. to open a new window or undo closed tab.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.TabOverview.setSecondaryMenu(secondaryMenu:)`.
///
/// - Parameter secondaryMenu: The secondary menu model.
/// - Returns: A copy of this view with the modifier applied.
public func secondaryMenu(_ secondaryMenu: @escaping () -> Adw.MenuModel?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setSecondaryMenu(secondaryMenu: secondaryMenu()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.TabOverview.setShowEndTitleButtons(showEndTitleButtons:)
/// Sets whether to show end title buttons in `self`'s header bar.
///
/// See [property`HeaderBar`:show-start-title-buttons] for the other side.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter showEndTitleButtons: Whether to show end title buttons in the overview's header bar.
/// - Returns: A copy of this view with the modifier applied.
public func showEndTitleButtons(_ showEndTitleButtons: Bool) -> Self {
appending { w, _ in
w.setShowEndTitleButtons(showEndTitleButtons: showEndTitleButtons)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.TabOverview.setShowEndTitleButtons(showEndTitleButtons:), GObject.Object.connectNotify(detail:_:), Adw.TabOverview.getShowEndTitleButtons()
/// Sets whether to show end title buttons in `self`'s header bar.
///
/// See [property`HeaderBar`:show-start-title-buttons] for the other 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 showEndTitleButtons(_ showEndTitleButtons: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, showEndTitleButtons, registry: ctx.registry, notifyDetail: "show-end-title-buttons",
read: { [w] in w.getShowEndTitleButtons() },
write: { [w] v in w.setShowEndTitleButtons(showEndTitleButtons: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.TabOverview.setShowEndTitleButtons(showEndTitleButtons:)
/// Sets whether to show end title buttons in `self`'s header bar.
///
/// See [property`HeaderBar`:show-start-title-buttons] for the other side.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.TabOverview.setShowEndTitleButtons(showEndTitleButtons:)`.
///
/// - Parameter showEndTitleButtons: Whether to show end title buttons in the overview's header bar.
/// - Returns: A copy of this view with the modifier applied.
public func showEndTitleButtons(_ showEndTitleButtons: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setShowEndTitleButtons(showEndTitleButtons: showEndTitleButtons()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.TabOverview.setShowStartTitleButtons(showStartTitleButtons:)
/// Sets whether to show start title buttons in `self`'s header bar.
///
/// See [property`HeaderBar`:show-end-title-buttons] for the other side.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter showStartTitleButtons: Whether to show start title buttons in the overview's header bar.
/// - Returns: A copy of this view with the modifier applied.
public func showStartTitleButtons(_ showStartTitleButtons: Bool) -> Self {
appending { w, _ in
w.setShowStartTitleButtons(showStartTitleButtons: showStartTitleButtons)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.TabOverview.setShowStartTitleButtons(showStartTitleButtons:), GObject.Object.connectNotify(detail:_:), Adw.TabOverview.getShowStartTitleButtons()
/// Sets whether to show start title buttons in `self`'s header bar.
///
/// See [property`HeaderBar`:show-end-title-buttons] for the other 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 showStartTitleButtons(_ showStartTitleButtons: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, showStartTitleButtons, registry: ctx.registry, notifyDetail: "show-start-title-buttons",
read: { [w] in w.getShowStartTitleButtons() },
write: { [w] v in w.setShowStartTitleButtons(showStartTitleButtons: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.TabOverview.setShowStartTitleButtons(showStartTitleButtons:)
/// Sets whether to show start title buttons in `self`'s header bar.
///
/// See [property`HeaderBar`:show-end-title-buttons] for the other side.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.TabOverview.setShowStartTitleButtons(showStartTitleButtons:)`.
///
/// - Parameter showStartTitleButtons: Whether to show start title buttons in the overview's header bar.
/// - Returns: A copy of this view with the modifier applied.
public func showStartTitleButtons(_ showStartTitleButtons: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setShowStartTitleButtons(showStartTitleButtons: showStartTitleButtons()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.TabOverview.setView(view:)
/// Sets the tab view to control.
///
/// The view must be inside `self`, see [property`TabOverview`:child].
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter view: The tab view the overview controls.
/// - Returns: A copy of this view with the modifier applied.
public func view(_ view: Adw.TabView?) -> Self {
appending { w, _ in
w.setView(view: view)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.TabOverview.setView(view:), GObject.Object.connectNotify(detail:_:), Adw.TabOverview.getView()
/// Sets the tab view to control.
///
/// The view must be inside `self`, see [property`TabOverview`:child].
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Adw.TabView?` 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 view<W: Adw.TabView>(_ view: Portico.Binding<W?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, view, registry: ctx.registry, notifyDetail: "view",
read: { [w] in w.getView() as? W },
write: { [w] v in w.setView(view: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Adw.TabOverview.setView(view:), GObject.Object.connectNotify(detail:_:), Adw.TabOverview.getView()
/// Sets the tab view to control.
///
/// The view must be inside `self`, see [property`TabOverview`:child].
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Adw.TabView>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Adw.TabView?>` to be able to clear the property.
/// When `Adw.TabView` 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 view<W: Adw.TabView>(_ view: Portico.Binding<W>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, view, registry: ctx.registry, notifyDetail: "view",
read: { [w] in w.getView() as? W },
write: { [w] v in w.setView(view: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.TabOverview.setView(view:)
/// Sets the tab view to control.
///
/// The view must be inside `self`, see [property`TabOverview`:child].
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.TabOverview.setView(view:)`.
///
/// - Parameter view: The tab view the overview controls.
/// - Returns: A copy of this view with the modifier applied.
public func view(_ view: @escaping () -> Adw.TabView?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setView(view: view()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Adw.TabOverview.connectCreateTab(_:)
/// Emitted when a tab needs to be created.
///
/// This can happen after the new tab button has been pressed, see
/// [property`TabOverview`:enable-new-tab].
///
/// The signal handler is expected to create a new page in the corresponding
/// [class`TabView`] and return it.
///
/// - Parameter handler: Invoked when the widget emits the `create-tab` signal. Its return value is forwarded to GTK as the signal's result.
/// - Returns: A copy of this view with the modifier applied.
public func onCreateTab(_ handler: @escaping () -> Adw.TabPage) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectCreateTab { _ in handler() })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Adw.TabOverview.connectExtraDragDrop(_:)
/// Emitted when content is dropped onto a tab.
///
/// The content must be of one of the types set up via
/// [method`TabOverview`.setup_extra_drop_target].
///
/// See [signal`Gtk`.DropTarget::drop].
///
/// - Parameter handler: Invoked when the widget emits the `extra-drag-drop` signal. The closure receives the signal's arguments in order. Its return value is forwarded to GTK as the signal's result.
/// - Returns: A copy of this view with the modifier applied.
public func onExtraDragDrop(_ handler: @escaping (Adw.TabPage, Adw.Value) -> Bool) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectExtraDragDrop { _, a0, a1 in handler(a0, a1) })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Adw.TabOverview.connectExtraDragValue(_:)
/// Emitted when the dropped content is preloaded.
///
/// In order for data to be preloaded, [property`TabOverview`:extra-drag-preload]
/// must be set to `TRUE`.
///
/// The content must be of one of the types set up via
/// [method`TabOverview`.setup_extra_drop_target].
///
/// See [property`Gtk`.DropTarget:value].
///
/// - Parameter handler: Invoked when the widget emits the `extra-drag-value` signal. The closure receives the signal's arguments in order. Its return value is forwarded to GTK as the signal's result.
/// - Returns: A copy of this view with the modifier applied.
public func onExtraDragValue(_ handler: @escaping (Adw.TabPage, Adw.Value?) -> Adw.DragAction) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectExtraDragValue { _, a0, a1 in handler(a0, a1) })
}
}
}