486 lines
26 KiB
Swift
486 lines
26 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: Gtk.ListBox
|
|
/// Shows a vertical list.
|
|
///
|
|
/// <picture>
|
|
/// <source srcset="list-box-dark.png" media="(prefers-color-scheme: dark)">
|
|
/// <img alt="An example GtkListBox" src="list-box.png">
|
|
/// </picture>
|
|
///
|
|
/// A `GtkListBox` only contains `GtkListBoxRow` children. These rows can
|
|
/// by dynamically sorted and filtered, and headers can be added dynamically
|
|
/// depending on the row content. It also allows keyboard and mouse navigation
|
|
/// and selection like a typical list.
|
|
///
|
|
/// Using `GtkListBox` is often an alternative to `GtkTreeView`, especially
|
|
/// when the list contents has a more complicated layout than what is allowed
|
|
/// by a `GtkCellRenderer`, or when the contents is interactive (i.e. has a
|
|
/// button in it).
|
|
///
|
|
/// Although a `GtkListBox` must have only `GtkListBoxRow` children, you can
|
|
/// add any kind of widget to it via [method`Gtk`.ListBox.prepend],
|
|
/// [method`Gtk`.ListBox.append] and [method`Gtk`.ListBox.insert] and a
|
|
/// `GtkListBoxRow` widget will automatically be inserted between the list
|
|
/// and the widget.
|
|
///
|
|
/// `GtkListBoxRows` can be marked as activatable or selectable. If a row is
|
|
/// activatable, [signal`Gtk`.ListBox::row-activated] will be emitted for it when
|
|
/// the user tries to activate it. If it is selectable, the row will be marked
|
|
/// as selected when the user tries to select it.
|
|
///
|
|
/// # GtkListBox as GtkBuildable
|
|
///
|
|
/// The `GtkListBox` implementation of the `GtkBuildable` interface supports
|
|
/// setting a child as the placeholder by specifying “placeholder” as the “type”
|
|
/// attribute of a `<child>` element. See [method`Gtk`.ListBox.set_placeholder]
|
|
/// for info.
|
|
///
|
|
/// # Shortcuts and Gestures
|
|
///
|
|
/// The following signals have default keybindings:
|
|
///
|
|
/// - [signal`Gtk`.ListBox::move-cursor]
|
|
/// - [signal`Gtk`.ListBox::select-all]
|
|
/// - [signal`Gtk`.ListBox::toggle-cursor-row]
|
|
/// - [signal`Gtk`.ListBox::unselect-all]
|
|
///
|
|
/// # CSS nodes
|
|
///
|
|
/// ```
|
|
/// list[.separators][.rich-list][.navigation-sidebar][.boxed-list]
|
|
/// ╰── row[.activatable]
|
|
/// ```
|
|
///
|
|
/// `GtkListBox` uses a single CSS node named list. It may carry the .separators
|
|
/// style class, when the [property`Gtk`.ListBox:show-separators] property is set.
|
|
/// Each `GtkListBoxRow` uses a single CSS node named row. The row nodes get the
|
|
/// .activatable style class added when appropriate.
|
|
///
|
|
/// It may also carry the .boxed-list style class. In this case, the list will be
|
|
/// automatically surrounded by a frame and have separators.
|
|
///
|
|
/// The main list node may also carry style classes to select
|
|
/// the style of [list presentation](section-list-widget.html`list`-styles):
|
|
/// .rich-list, .navigation-sidebar or .data-table.
|
|
///
|
|
/// # Accessibility
|
|
///
|
|
/// `GtkListBox` uses the [enum`Gtk`.AccessibleRole.list] role and `GtkListBoxRow` uses
|
|
/// the [enum`Gtk`.AccessibleRole.list_item] role.
|
|
///
|
|
/// A Portico view that mounts a `Gtk.ListBox`.
|
|
@MainActor public struct ListBox: View {
|
|
private let make: (MountContext) -> Gtk.ListBox
|
|
private var configure: [(Gtk.ListBox, MountContext) -> Void] = []
|
|
|
|
public var body: Never { fatalError() }
|
|
|
|
// PorticoGen: generateInits(static) | source: Gtk.ListBox.init()
|
|
/// Creates a new `GtkListBox` container.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for values that change.
|
|
/// Each closure is evaluated once; children are added in order and slot closures mount their first view.
|
|
/// An empty closure adds no children and leaves slots unset.
|
|
/// A `ForEach` in the `children:` closure spreads its rows directly into this widget, with no wrapper, when the widget supports ordered insertion.
|
|
/// Optional value parameters are applied only when non-`nil`; a `nil` argument leaves the widget's own default in place and cannot clear a nullable property - use the matching modifier for that.
|
|
///
|
|
/// - Parameter activateOnSingleClick: Determines whether children can be activated with a single click, or require a double-click.
|
|
/// - Parameter selectionMode: The selection mode used by the list box.
|
|
/// - Parameter showSeparators: Whether to show separators between rows.
|
|
/// - Parameter tabBehavior: Behavior of the <kbd>Tab</kbd> key
|
|
/// - Parameter children: A `ViewBuilder` closure whose views are added in order.
|
|
/// - Parameter onActivateCursorRow: Invoked when the widget emits the `activate-cursor-row` signal.
|
|
/// - Parameter onMoveCursor: Invoked when the widget emits the `move-cursor` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onRowActivated: Invoked when the widget emits the `row-activated` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onRowSelected: Invoked when the widget emits the `row-selected` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onSelectAll: Invoked when the widget emits the `select-all` signal.
|
|
/// - Parameter onSelectedRowsChanged: Invoked when the widget emits the `selected-rows-changed` signal.
|
|
/// - Parameter onToggleCursorRow: Invoked when the widget emits the `toggle-cursor-row` signal.
|
|
/// - Parameter onUnselectAll: Invoked when the widget emits the `unselect-all` signal.
|
|
public init(activateOnSingleClick: Bool? = nil, selectionMode: Gtk.SelectionMode? = nil, showSeparators: Bool? = nil, tabBehavior: Gtk.ListTabBehavior? = nil, @ViewBuilder children: @escaping () -> [AnyView] = { [] }, onActivateCursorRow: (() -> Void)? = nil, onMoveCursor: ((Gtk.MovementStep, Int32, Bool, Bool) -> Void)? = nil, onRowActivated: ((Gtk.ListBoxRow) -> Void)? = nil, onRowSelected: ((Gtk.ListBoxRow?) -> Void)? = nil, onSelectAll: (() -> Void)? = nil, onSelectedRowsChanged: (() -> Void)? = nil, onToggleCursorRow: (() -> Void)? = nil, onUnselectAll: (() -> Void)? = nil) {
|
|
make = { _ in Gtk.ListBox() }
|
|
configure.append { w, ctx in
|
|
if let activateOnSingleClick { w.setActivateOnSingleClick(single: activateOnSingleClick) }
|
|
if let selectionMode { w.setSelectionMode(mode: selectionMode) }
|
|
if let showSeparators { w.setShowSeparators(showSeparators: showSeparators) }
|
|
if let tabBehavior { w.setTabBehavior(behavior: tabBehavior) }
|
|
Portico.mountChildren(children, into: w, ctx) { c in w.append(child: c) }
|
|
if let onActivateCursorRow { ctx.registry.add(w.connectActivateCursorRow { _ in onActivateCursorRow() }) }
|
|
if let onMoveCursor { ctx.registry.add(w.connectMoveCursor { _, a0, a1, a2, a3 in onMoveCursor(a0, a1, a2, a3) }) }
|
|
if let onRowActivated { ctx.registry.add(w.connectRowActivated { _, a0 in onRowActivated(a0) }) }
|
|
if let onRowSelected { ctx.registry.add(w.connectRowSelected { _, a0 in onRowSelected(a0) }) }
|
|
if let onSelectAll { ctx.registry.add(w.connectSelectAll { _ in onSelectAll() }) }
|
|
if let onSelectedRowsChanged { ctx.registry.add(w.connectSelectedRowsChanged { _ in onSelectedRowsChanged() }) }
|
|
if let onToggleCursorRow { ctx.registry.add(w.connectToggleCursorRow { _ in onToggleCursorRow() }) }
|
|
if let onUnselectAll { ctx.registry.add(w.connectUnselectAll { _ in onUnselectAll() }) }
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
extension ListBox: WidgetView {
|
|
public typealias Target = Gtk.ListBox
|
|
|
|
@_spi(Portico) public func appending(
|
|
_ step: @escaping (Gtk.ListBox, MountContext) -> Void
|
|
) -> Self {
|
|
var c = self
|
|
c.configure.append(step)
|
|
return c
|
|
}
|
|
}
|
|
|
|
@_spi(Portico) extension ListBox: Mountable {
|
|
@_spi(Portico) public func mount(_ ctx: MountContext) -> Gtk.Widget {
|
|
let w = make(ctx)
|
|
for step in configure { step(w, ctx) }
|
|
return w
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension | source: Gtk.ListBox
|
|
/// Modifiers for `Gtk.ListBox`, available on every Portico view whose
|
|
/// backing widget is `Gtk.ListBox` or one of its subclasses.
|
|
extension WidgetView where Target: Gtk.ListBox {
|
|
// PorticoGen: generateModifierExtension -> generateChildAdderModifiers(static) | source: Gtk.ListBox.append(child:)
|
|
/// Append a widget to the list.
|
|
///
|
|
/// If a sort function is set, the widget will
|
|
/// actually be inserted at the calculated position.
|
|
///
|
|
/// Applied once at mount; use the `@ViewBuilder` overload for multiple children.
|
|
///
|
|
/// - Parameter child: A child widget to add.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func append(_ child: Gtk.Widget) -> Self {
|
|
appending { w, _ in
|
|
w.append(child: child)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateChildAdderModifiers(viewBuilder) | source: Gtk.ListBox.append(child:)
|
|
/// Append a widget to the list.
|
|
///
|
|
/// If a sort function is set, the widget will
|
|
/// actually be inserted at the calculated position.
|
|
///
|
|
/// Every view the closure produces is added at mount, in order.
|
|
///
|
|
/// - Parameter child: A closure producing child views.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func append(@ViewBuilder _ child: () -> [AnyView]) -> Self {
|
|
let childViews = child()
|
|
return appending { w, ctx in
|
|
for v in childViews { w.append(child: v.makeWidget(ctx)) }
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.ListBox.setActivateOnSingleClick(single:)
|
|
/// If `single` is `true`, rows will be activated when you click on them,
|
|
/// otherwise you need to double-click.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter activateOnSingleClick: Determines whether children can be activated with a single click, or require a double-click.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func activateOnSingleClick(_ activateOnSingleClick: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setActivateOnSingleClick(single: activateOnSingleClick)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.ListBox.setActivateOnSingleClick(single:), GObject.Object.connectNotify(detail:_:), Gtk.ListBox.getActivateOnSingleClick()
|
|
/// If `single` is `true`, rows will be activated when you click on them,
|
|
/// otherwise you need to double-click.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Bool` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
|
///
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func activateOnSingleClick(_ activateOnSingleClick: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, activateOnSingleClick, registry: ctx.registry, notifyDetail: "activate-on-single-click",
|
|
read: { [w] in w.getActivateOnSingleClick() },
|
|
write: { [w] v in w.setActivateOnSingleClick(single: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.ListBox.setActivateOnSingleClick(single:)
|
|
/// If `single` is `true`, rows will be activated when you click on them,
|
|
/// otherwise you need to double-click.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.ListBox.setActivateOnSingleClick(single:)`.
|
|
///
|
|
/// - Parameter activateOnSingleClick: Determines whether children can be activated with a single click, or require a double-click.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func activateOnSingleClick(_ activateOnSingleClick: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setActivateOnSingleClick(single: activateOnSingleClick()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.ListBox.setSelectionMode(mode:)
|
|
/// Sets how selection works in the listbox.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter selectionMode: The selection mode used by the list box.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func selectionMode(_ selectionMode: Gtk.SelectionMode) -> Self {
|
|
appending { w, _ in
|
|
w.setSelectionMode(mode: selectionMode)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.ListBox.setSelectionMode(mode:), GObject.Object.connectNotify(detail:_:), Gtk.ListBox.getSelectionMode()
|
|
/// Sets how selection works in the listbox.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Gtk.SelectionMode` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
|
|
///
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func selectionMode(_ selectionMode: Portico.Binding<Gtk.SelectionMode>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, selectionMode, registry: ctx.registry, notifyDetail: "selection-mode",
|
|
read: { [w] in w.getSelectionMode() },
|
|
write: { [w] v in w.setSelectionMode(mode: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.ListBox.setSelectionMode(mode:)
|
|
/// Sets how selection works in the listbox.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.ListBox.setSelectionMode(mode:)`.
|
|
///
|
|
/// - Parameter selectionMode: The selection mode used by the list box.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func selectionMode(_ selectionMode: @escaping () -> Gtk.SelectionMode) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setSelectionMode(mode: selectionMode()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.ListBox.setShowSeparators(showSeparators:)
|
|
/// Sets whether the list box should show separators
|
|
/// between rows.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter showSeparators: Whether to show separators between rows.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func showSeparators(_ showSeparators: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setShowSeparators(showSeparators: showSeparators)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.ListBox.setShowSeparators(showSeparators:), GObject.Object.connectNotify(detail:_:), Gtk.ListBox.getShowSeparators()
|
|
/// Sets whether the list box should show separators
|
|
/// between rows.
|
|
///
|
|
/// 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 showSeparators(_ showSeparators: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, showSeparators, registry: ctx.registry, notifyDetail: "show-separators",
|
|
read: { [w] in w.getShowSeparators() },
|
|
write: { [w] v in w.setShowSeparators(showSeparators: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.ListBox.setShowSeparators(showSeparators:)
|
|
/// Sets whether the list box should show separators
|
|
/// between rows.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.ListBox.setShowSeparators(showSeparators:)`.
|
|
///
|
|
/// - Parameter showSeparators: Whether to show separators between rows.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func showSeparators(_ showSeparators: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setShowSeparators(showSeparators: showSeparators()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.ListBox.setTabBehavior(behavior:)
|
|
/// Sets the behavior of the <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter tabBehavior: Behavior of the <kbd>Tab</kbd> key
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func tabBehavior(_ tabBehavior: Gtk.ListTabBehavior) -> Self {
|
|
appending { w, _ in
|
|
w.setTabBehavior(behavior: tabBehavior)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.ListBox.setTabBehavior(behavior:), GObject.Object.connectNotify(detail:_:), Gtk.ListBox.getTabBehavior()
|
|
/// Sets the behavior of the <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Gtk.ListTabBehavior` 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 tabBehavior(_ tabBehavior: Portico.Binding<Gtk.ListTabBehavior>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, tabBehavior, registry: ctx.registry, notifyDetail: "tab-behavior",
|
|
read: { [w] in w.getTabBehavior() },
|
|
write: { [w] v in w.setTabBehavior(behavior: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.ListBox.setTabBehavior(behavior:)
|
|
/// Sets the behavior of the <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.ListBox.setTabBehavior(behavior:)`.
|
|
///
|
|
/// - Parameter tabBehavior: Behavior of the <kbd>Tab</kbd> key
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func tabBehavior(_ tabBehavior: @escaping () -> Gtk.ListTabBehavior) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setTabBehavior(behavior: tabBehavior()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.ListBox.connectActivateCursorRow(_:)
|
|
/// Emitted when the cursor row is activated.
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `activate-cursor-row` signal.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onActivateCursorRow(_ handler: @escaping () -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectActivateCursorRow { _ in handler() })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.ListBox.connectMoveCursor(_:)
|
|
/// Emitted when the user initiates a cursor movement.
|
|
///
|
|
/// The default bindings for this signal come in two variants, the variant with
|
|
/// the Shift modifier extends the selection, the variant without the Shift
|
|
/// modifier does not. There are too many key combinations to list them all
|
|
/// here.
|
|
///
|
|
/// - <kbd>←</kbd>, <kbd>→</kbd>, <kbd>↑</kbd>, <kbd>↓</kbd>
|
|
/// move by individual children
|
|
/// - <kbd>Home</kbd>, <kbd>End</kbd> move to the ends of the box
|
|
/// - <kbd>PgUp</kbd>, <kbd>PgDn</kbd> move vertically by pages
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `move-cursor` signal. The closure receives the signal's arguments in order.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onMoveCursor(_ handler: @escaping (Gtk.MovementStep, Int32, Bool, Bool) -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectMoveCursor { _, a0, a1, a2, a3 in handler(a0, a1, a2, a3) })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.ListBox.connectRowActivated(_:)
|
|
/// Emitted when a row has been activated by the user.
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `row-activated` signal. The closure receives the signal's arguments in order.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onRowActivated(_ handler: @escaping (Gtk.ListBoxRow) -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectRowActivated { _, a0 in handler(a0) })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.ListBox.connectRowSelected(_:)
|
|
/// Emitted when a new row is selected, or (with a `nil` `row`)
|
|
/// when the selection is cleared.
|
|
///
|
|
/// When the `box` is using `GTK_SELECTION_MULTIPLE`, this signal will not
|
|
/// give you the full picture of selection changes, and you should use
|
|
/// the [signal`Gtk`.ListBox::selected-rows-changed] signal instead.
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `row-selected` signal. The closure receives the signal's arguments in order.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onRowSelected(_ handler: @escaping (Gtk.ListBoxRow?) -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectRowSelected { _, a0 in handler(a0) })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.ListBox.connectSelectAll(_:)
|
|
/// Emitted to select all children of the box, if the selection
|
|
/// mode permits it.
|
|
///
|
|
/// This is a [keybinding signal](class.SignalAction.html).
|
|
///
|
|
/// The default binding for this signal is <kbd>Ctrl</kbd>-<kbd>a</kbd>.
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `select-all` signal.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onSelectAll(_ handler: @escaping () -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectSelectAll { _ in handler() })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.ListBox.connectSelectedRowsChanged(_:)
|
|
/// Emitted when the set of selected rows changes.
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `selected-rows-changed` signal.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onSelectedRowsChanged(_ handler: @escaping () -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectSelectedRowsChanged { _ in handler() })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.ListBox.connectToggleCursorRow(_:)
|
|
/// Emitted when the cursor row is toggled.
|
|
///
|
|
/// The default bindings for this signal is <kbd>Ctrl</kbd>+<kbd>␣</kbd>.
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `toggle-cursor-row` signal.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onToggleCursorRow(_ handler: @escaping () -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectToggleCursorRow { _ in handler() })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.ListBox.connectUnselectAll(_:)
|
|
/// Emitted to unselect all children of the box, if the selection
|
|
/// mode permits it.
|
|
///
|
|
/// This is a [keybinding signal](class.SignalAction.html).
|
|
///
|
|
/// The default binding for this signal is
|
|
/// <kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>a</kbd>.
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `unselect-all` signal.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onUnselectAll(_ handler: @escaping () -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectUnselectAll { _ in handler() })
|
|
}
|
|
}
|
|
|
|
}
|