portico/Sources/Portico/Generated/ColumnView.swift

783 lines
46 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.ColumnView
/// Presents a large dynamic list of items using multiple columns with headers.
///
/// `GtkColumnView` uses the factories of its columns to generate a cell widget for
/// each column, for each visible item and displays them together as the row for
/// this item.
///
/// The [property`Gtk`.ColumnView:show-row-separators] and
/// [property`Gtk`.ColumnView:show-column-separators] properties offer a simple way
/// to display separators between the rows or columns.
///
/// `GtkColumnView` allows the user to select items according to the selection
/// characteristics of the model. For models that allow multiple selected items,
/// it is possible to turn on *rubberband selection*, using
/// [property`Gtk`.ColumnView:enable-rubberband].
///
/// The column view supports sorting that can be customized by the user by
/// clicking on column headers. To set this up, the `GtkSorter` returned by
/// [method`Gtk`.ColumnView.get_sorter] must be attached to a sort model for the
/// data that the view is showing, and the columns must have sorters attached to
/// them by calling [method`Gtk`.ColumnViewColumn.set_sorter]. The initial sort
/// order can be set with [method`Gtk`.ColumnView.sort_by_column].
///
/// The column view also supports interactive resizing and reordering of
/// columns, via Drag-and-Drop of the column headers. This can be enabled or
/// disabled with the [property`Gtk`.ColumnView:reorderable] and
/// [property`Gtk`.ColumnViewColumn:resizable] properties.
///
/// To learn more about the list widget framework, see the
/// [overview](section-list-widget.html).
///
/// # CSS nodes
///
/// ```
/// columnview[.column-separators][.rich-list][.navigation-sidebar][.data-table]
/// header
/// <column header>
///
/// <column header>
///
/// listview
///
///
/// [rubberband]
/// ```
///
/// `GtkColumnView` uses a single CSS node named columnview. It may carry the
/// .column-separators style class, when [property`Gtk`.ColumnView:show-column-separators]
/// property is set. Header widgets appear below a node with name header.
/// The rows are contained in a `GtkListView` widget, so there is a listview
/// node with the same structure as for a standalone `GtkListView` widget.
/// If [property`Gtk`.ColumnView:show-row-separators] is set, it will be passed
/// on to the list view, causing its CSS node to carry the .separators style class.
/// For rubberband selection, a node with name rubberband is used.
///
/// The main columnview 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
///
/// `GtkColumnView` uses the [enum`Gtk`.AccessibleRole.tree_grid] role, header title
/// widgets are using the [enum`Gtk`.AccessibleRole.column_header] role. The row widgets
/// are using the [enum`Gtk`.AccessibleRole.row] role, and individual cells are using
/// the [enum`Gtk`.AccessibleRole.grid_cell] role
///
/// A Portico view that mounts a `Gtk.ColumnView`.
@MainActor public struct ColumnView: View {
private let make: (MountContext) -> Gtk.ColumnView
private var configure: [(Gtk.ColumnView, MountContext) -> Void] = []
public var body: Never { fatalError() }
// PorticoGen: generateInits(static) | source: Gtk.ColumnView.init(model:)
/// Creates a new `GtkColumnView`.
///
/// You most likely want to call [method`Gtk`.ColumnView.append_column]
/// to add columns next.
///
/// Applied once at mount; use the `Binding` or closure overload for values that change.
/// 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 model: Model for the items displayed.
/// - Parameter enableRubberband: Allow rubberband selection.
/// - Parameter headerFactory: Factory for creating header widgets.
/// - Parameter reorderable: Whether columns are reorderable.
/// - Parameter rowFactory: The factory used for configuring rows.
/// - Parameter showColumnSeparators: Show separators between columns.
/// - Parameter showRowSeparators: Show separators between rows.
/// - Parameter singleClickActivate: Activate rows on single click and select them on hover.
/// - Parameter tabBehavior: Behavior of the <kbd>Tab</kbd> key
/// - Parameter onActivate: Invoked when the widget emits the `activate` signal. The closure receives the signal's arguments in order.
public init(model: Gtk.SelectionModel?, enableRubberband: Bool? = nil, headerFactory: Gtk.ListItemFactory? = nil, reorderable: Bool? = nil, rowFactory: Gtk.ListItemFactory? = nil, showColumnSeparators: Bool? = nil, showRowSeparators: Bool? = nil, singleClickActivate: Bool? = nil, tabBehavior: Gtk.ListTabBehavior? = nil, onActivate: ((UInt32) -> Void)? = nil) {
make = { _ in Gtk.ColumnView(model: model) }
configure.append { w, ctx in
if let enableRubberband { w.setEnableRubberband(enableRubberband: enableRubberband) }
if let headerFactory { w.setHeaderFactory(factory: headerFactory) }
if let reorderable { w.setReorderable(reorderable: reorderable) }
if let rowFactory { w.setRowFactory(factory: rowFactory) }
if let showColumnSeparators { w.setShowColumnSeparators(showColumnSeparators: showColumnSeparators) }
if let showRowSeparators { w.setShowRowSeparators(showRowSeparators: showRowSeparators) }
if let singleClickActivate { w.setSingleClickActivate(singleClickActivate: singleClickActivate) }
if let tabBehavior { w.setTabBehavior(tabBehavior: tabBehavior) }
if let onActivate { ctx.registry.add(w.connectActivate { _, a0 in onActivate(a0) }) }
}
}
// PorticoGen: generateInits(binding) | source: Gtk.ColumnView.init(model:), Gtk.ColumnView.setModel(model:)
/// Creates a new `GtkColumnView`.
///
/// You most likely want to call [method`Gtk`.ColumnView.append_column]
/// to add columns next.
///
/// The initial value is the binding's current value; every later change is pushed into the widget through `Gtk.ColumnView.setModel(model:)` without rebuilding the view.
/// 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.
/// Optional `Binding` parameters bind through `Portico.bindProperty`, so they are two-way wherever the wrapper exposes a safe getter.
///
/// - Parameter model: Model for the items displayed.
/// - Parameter enableRubberband: Allow rubberband selection.
/// - Parameter headerFactory: Factory for creating header widgets.
/// - Parameter reorderable: Whether columns are reorderable.
/// - Parameter rowFactory: The factory used for configuring rows.
/// - Parameter showColumnSeparators: Show separators between columns.
/// - Parameter showRowSeparators: Show separators between rows.
/// - Parameter singleClickActivate: Activate rows on single click and select them on hover.
/// - Parameter tabBehavior: Behavior of the <kbd>Tab</kbd> key
/// - Parameter onActivate: Invoked when the widget emits the `activate` signal. The closure receives the signal's arguments in order.
public init(model: Portico.Binding<Gtk.SelectionModel?>, enableRubberband: Portico.Binding<Bool>? = nil, headerFactory: Portico.Binding<Gtk.ListItemFactory?>? = nil, reorderable: Portico.Binding<Bool>? = nil, rowFactory: Portico.Binding<Gtk.ListItemFactory?>? = nil, showColumnSeparators: Portico.Binding<Bool>? = nil, showRowSeparators: Portico.Binding<Bool>? = nil, singleClickActivate: Portico.Binding<Bool>? = nil, tabBehavior: Portico.Binding<Gtk.ListTabBehavior>? = nil, onActivate: ((UInt32) -> Void)? = nil) {
make = { _ in Gtk.ColumnView(model: model.wrappedValue) }
configure.append { w, ctx in
ctx.registry.add(model.subscribe { [w] v in w.setModel(model: v) })
if let enableRubberband {
Portico.bindProperty(w, enableRubberband, registry: ctx.registry, notifyDetail: "enable-rubberband", read: { [w] in w.getEnableRubberband() }, write: { [w] v in w.setEnableRubberband(enableRubberband: v) })
}
if let headerFactory {
Portico.bindProperty(w, headerFactory, registry: ctx.registry, notifyDetail: "header-factory", read: { [w] in w.getHeaderFactory() }, write: { [w] v in w.setHeaderFactory(factory: v) })
}
if let reorderable {
Portico.bindProperty(w, reorderable, registry: ctx.registry, notifyDetail: "reorderable", read: { [w] in w.getReorderable() }, write: { [w] v in w.setReorderable(reorderable: v) })
}
if let rowFactory {
Portico.bindProperty(w, rowFactory, registry: ctx.registry, notifyDetail: "row-factory", read: { [w] in w.getRowFactory() }, write: { [w] v in w.setRowFactory(factory: v) })
}
if let showColumnSeparators {
Portico.bindProperty(w, showColumnSeparators, registry: ctx.registry, notifyDetail: "show-column-separators", read: { [w] in w.getShowColumnSeparators() }, write: { [w] v in w.setShowColumnSeparators(showColumnSeparators: v) })
}
if let showRowSeparators {
Portico.bindProperty(w, showRowSeparators, registry: ctx.registry, notifyDetail: "show-row-separators", read: { [w] in w.getShowRowSeparators() }, write: { [w] v in w.setShowRowSeparators(showRowSeparators: v) })
}
if let singleClickActivate {
Portico.bindProperty(w, singleClickActivate, registry: ctx.registry, notifyDetail: "single-click-activate", read: { [w] in w.getSingleClickActivate() }, write: { [w] v in w.setSingleClickActivate(singleClickActivate: v) })
}
if let tabBehavior {
Portico.bindProperty(w, tabBehavior, registry: ctx.registry, notifyDetail: "tab-behavior", read: { [w] in w.getTabBehavior() }, write: { [w] v in w.setTabBehavior(tabBehavior: v) })
}
if let onActivate { ctx.registry.add(w.connectActivate { _, a0 in onActivate(a0) }) }
}
}
// PorticoGen: generateInits(closure) | source: Gtk.ColumnView.init(model:), Gtk.ColumnView.setModel(model:)
/// Creates a new `GtkColumnView`.
///
/// You most likely want to call [method`Gtk`.ColumnView.append_column]
/// to add columns next.
///
/// Each closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.ColumnView.setModel(model:)`.
/// 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 model: Model for the items displayed.
/// - Parameter enableRubberband: Allow rubberband selection.
/// - Parameter headerFactory: Factory for creating header widgets.
/// - Parameter reorderable: Whether columns are reorderable.
/// - Parameter rowFactory: The factory used for configuring rows.
/// - Parameter showColumnSeparators: Show separators between columns.
/// - Parameter showRowSeparators: Show separators between rows.
/// - Parameter singleClickActivate: Activate rows on single click and select them on hover.
/// - Parameter tabBehavior: Behavior of the <kbd>Tab</kbd> key
/// - Parameter onActivate: Invoked when the widget emits the `activate` signal. The closure receives the signal's arguments in order.
public init(model: @escaping () -> Gtk.SelectionModel?, enableRubberband: Bool? = nil, headerFactory: Gtk.ListItemFactory? = nil, reorderable: Bool? = nil, rowFactory: Gtk.ListItemFactory? = nil, showColumnSeparators: Bool? = nil, showRowSeparators: Bool? = nil, singleClickActivate: Bool? = nil, tabBehavior: Gtk.ListTabBehavior? = nil, onActivate: ((UInt32) -> Void)? = nil) {
make = { _ in Gtk.ColumnView(model: model()) }
configure.append { w, ctx in
let t0 = DependencyTracker { [w] in w.setModel(model: model()) }
t0.run()
ctx.registry.add(t0)
if let enableRubberband { w.setEnableRubberband(enableRubberband: enableRubberband) }
if let headerFactory { w.setHeaderFactory(factory: headerFactory) }
if let reorderable { w.setReorderable(reorderable: reorderable) }
if let rowFactory { w.setRowFactory(factory: rowFactory) }
if let showColumnSeparators { w.setShowColumnSeparators(showColumnSeparators: showColumnSeparators) }
if let showRowSeparators { w.setShowRowSeparators(showRowSeparators: showRowSeparators) }
if let singleClickActivate { w.setSingleClickActivate(singleClickActivate: singleClickActivate) }
if let tabBehavior { w.setTabBehavior(tabBehavior: tabBehavior) }
if let onActivate { ctx.registry.add(w.connectActivate { _, a0 in onActivate(a0) }) }
}
}
}
extension ColumnView: WidgetView {
public typealias Target = Gtk.ColumnView
@_spi(Portico) public func appending(
_ step: @escaping (Gtk.ColumnView, MountContext) -> Void
) -> Self {
var c = self
c.configure.append(step)
return c
}
}
@_spi(Portico) extension ColumnView: 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.ColumnView
/// Modifiers for `Gtk.ColumnView`, available on every Portico view whose
/// backing widget is `Gtk.ColumnView` or one of its subclasses.
extension WidgetView where Target: Gtk.ColumnView {
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.ColumnView.setEnableRubberband(enableRubberband:)
/// Sets whether selections can be changed by dragging with the mouse.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter enableRubberband: Allow rubberband selection.
/// - Returns: A copy of this view with the modifier applied.
public func enableRubberband(_ enableRubberband: Bool) -> Self {
appending { w, _ in
w.setEnableRubberband(enableRubberband: enableRubberband)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.ColumnView.setEnableRubberband(enableRubberband:), GObject.Object.connectNotify(detail:_:), Gtk.ColumnView.getEnableRubberband()
/// Sets whether selections can be changed by dragging with the mouse.
///
/// 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 enableRubberband(_ enableRubberband: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, enableRubberband, registry: ctx.registry, notifyDetail: "enable-rubberband",
read: { [w] in w.getEnableRubberband() },
write: { [w] v in w.setEnableRubberband(enableRubberband: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.ColumnView.setEnableRubberband(enableRubberband:)
/// Sets whether selections can be changed by dragging with the mouse.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.ColumnView.setEnableRubberband(enableRubberband:)`.
///
/// - Parameter enableRubberband: Allow rubberband selection.
/// - Returns: A copy of this view with the modifier applied.
public func enableRubberband(_ enableRubberband: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setEnableRubberband(enableRubberband: enableRubberband()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.ColumnView.setHeaderFactory(factory:)
/// Sets the factory to use for populating the
/// [class`Gtk`.ListHeader] objects used in section headers.
///
/// If this factory is set to `NULL`, the list will not show
/// section headers.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter headerFactory: Factory for creating header widgets.
/// - Returns: A copy of this view with the modifier applied.
public func headerFactory(_ headerFactory: Gtk.ListItemFactory?) -> Self {
appending { w, _ in
w.setHeaderFactory(factory: headerFactory)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.ColumnView.setHeaderFactory(factory:), GObject.Object.connectNotify(detail:_:), Gtk.ColumnView.getHeaderFactory()
/// Sets the factory to use for populating the
/// [class`Gtk`.ListHeader] objects used in section headers.
///
/// If this factory is set to `NULL`, the list will not show
/// section headers.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.ListItemFactory?` 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 headerFactory(_ headerFactory: Portico.Binding<Gtk.ListItemFactory?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, headerFactory, registry: ctx.registry, notifyDetail: "header-factory",
read: { [w] in w.getHeaderFactory() },
write: { [w] v in w.setHeaderFactory(factory: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.ColumnView.setHeaderFactory(factory:), GObject.Object.connectNotify(detail:_:), Gtk.ColumnView.getHeaderFactory()
/// Sets the factory to use for populating the
/// [class`Gtk`.ListHeader] objects used in section headers.
///
/// If this factory is set to `NULL`, the list will not show
/// section headers.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Gtk.ListItemFactory>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.ListItemFactory?>` to be able to clear the property.
/// When `Gtk.ListItemFactory` 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 headerFactory(_ headerFactory: Portico.Binding<Gtk.ListItemFactory>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, headerFactory, registry: ctx.registry, notifyDetail: "header-factory",
read: { [w] in w.getHeaderFactory() },
write: { [w] v in w.setHeaderFactory(factory: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.ColumnView.setHeaderFactory(factory:)
/// Sets the factory to use for populating the
/// [class`Gtk`.ListHeader] objects used in section headers.
///
/// If this factory is set to `NULL`, the list will not show
/// section headers.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.ColumnView.setHeaderFactory(factory:)`.
///
/// - Parameter headerFactory: Factory for creating header widgets.
/// - Returns: A copy of this view with the modifier applied.
public func headerFactory(_ headerFactory: @escaping () -> Gtk.ListItemFactory?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setHeaderFactory(factory: headerFactory()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.ColumnView.setModel(model:)
/// Sets the model to use.
///
/// This must be a [iface`Gtk`.SelectionModel].
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter model: Model for the items displayed.
/// - Returns: A copy of this view with the modifier applied.
public func model(_ model: Gtk.SelectionModel?) -> Self {
appending { w, _ in
w.setModel(model: model)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.ColumnView.setModel(model:), GObject.Object.connectNotify(detail:_:), Gtk.ColumnView.getModel()
/// Sets the model to use.
///
/// This must be a [iface`Gtk`.SelectionModel].
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.SelectionModel?` 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 model(_ model: Portico.Binding<Gtk.SelectionModel?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, model, registry: ctx.registry, notifyDetail: "model",
read: { [w] in w.getModel() },
write: { [w] v in w.setModel(model: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.ColumnView.setModel(model:), GObject.Object.connectNotify(detail:_:), Gtk.ColumnView.getModel()
/// Sets the model to use.
///
/// This must be a [iface`Gtk`.SelectionModel].
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Gtk.SelectionModel>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.SelectionModel?>` to be able to clear the property.
/// When `Gtk.SelectionModel` 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 model(_ model: Portico.Binding<Gtk.SelectionModel>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, model, registry: ctx.registry, notifyDetail: "model",
read: { [w] in w.getModel() },
write: { [w] v in w.setModel(model: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.ColumnView.setModel(model:)
/// Sets the model to use.
///
/// This must be a [iface`Gtk`.SelectionModel].
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.ColumnView.setModel(model:)`.
///
/// - Parameter model: Model for the items displayed.
/// - Returns: A copy of this view with the modifier applied.
public func model(_ model: @escaping () -> Gtk.SelectionModel?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setModel(model: model()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.ColumnView.setReorderable(reorderable:)
/// Sets whether columns should be reorderable by dragging.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter reorderable: Whether columns are reorderable.
/// - Returns: A copy of this view with the modifier applied.
public func reorderable(_ reorderable: Bool) -> Self {
appending { w, _ in
w.setReorderable(reorderable: reorderable)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.ColumnView.setReorderable(reorderable:), GObject.Object.connectNotify(detail:_:), Gtk.ColumnView.getReorderable()
/// Sets whether columns should be reorderable by dragging.
///
/// 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 reorderable(_ reorderable: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, reorderable, registry: ctx.registry, notifyDetail: "reorderable",
read: { [w] in w.getReorderable() },
write: { [w] v in w.setReorderable(reorderable: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.ColumnView.setReorderable(reorderable:)
/// Sets whether columns should be reorderable by dragging.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.ColumnView.setReorderable(reorderable:)`.
///
/// - Parameter reorderable: Whether columns are reorderable.
/// - Returns: A copy of this view with the modifier applied.
public func reorderable(_ reorderable: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setReorderable(reorderable: reorderable()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.ColumnView.setRowFactory(factory:)
/// Sets the factory used for configuring rows.
///
/// The factory must be for configuring [class`Gtk`.ColumnViewRow] objects.
///
/// If this factory is not set - which is the default - then the defaults
/// will be used.
///
/// This factory is not used to set the widgets displayed in the individual
/// cells. For that see [method`GtkColumnViewColumn`.set_factory] and
/// [class`GtkColumnViewCell`].
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter rowFactory: The factory used for configuring rows.
/// - Returns: A copy of this view with the modifier applied.
public func rowFactory(_ rowFactory: Gtk.ListItemFactory?) -> Self {
appending { w, _ in
w.setRowFactory(factory: rowFactory)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.ColumnView.setRowFactory(factory:), GObject.Object.connectNotify(detail:_:), Gtk.ColumnView.getRowFactory()
/// Sets the factory used for configuring rows.
///
/// The factory must be for configuring [class`Gtk`.ColumnViewRow] objects.
///
/// If this factory is not set - which is the default - then the defaults
/// will be used.
///
/// This factory is not used to set the widgets displayed in the individual
/// cells. For that see [method`GtkColumnViewColumn`.set_factory] and
/// [class`GtkColumnViewCell`].
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.ListItemFactory?` 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 rowFactory(_ rowFactory: Portico.Binding<Gtk.ListItemFactory?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, rowFactory, registry: ctx.registry, notifyDetail: "row-factory",
read: { [w] in w.getRowFactory() },
write: { [w] v in w.setRowFactory(factory: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.ColumnView.setRowFactory(factory:), GObject.Object.connectNotify(detail:_:), Gtk.ColumnView.getRowFactory()
/// Sets the factory used for configuring rows.
///
/// The factory must be for configuring [class`Gtk`.ColumnViewRow] objects.
///
/// If this factory is not set - which is the default - then the defaults
/// will be used.
///
/// This factory is not used to set the widgets displayed in the individual
/// cells. For that see [method`GtkColumnViewColumn`.set_factory] and
/// [class`GtkColumnViewCell`].
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Gtk.ListItemFactory>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.ListItemFactory?>` to be able to clear the property.
/// When `Gtk.ListItemFactory` 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 rowFactory(_ rowFactory: Portico.Binding<Gtk.ListItemFactory>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, rowFactory, registry: ctx.registry, notifyDetail: "row-factory",
read: { [w] in w.getRowFactory() },
write: { [w] v in w.setRowFactory(factory: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.ColumnView.setRowFactory(factory:)
/// Sets the factory used for configuring rows.
///
/// The factory must be for configuring [class`Gtk`.ColumnViewRow] objects.
///
/// If this factory is not set - which is the default - then the defaults
/// will be used.
///
/// This factory is not used to set the widgets displayed in the individual
/// cells. For that see [method`GtkColumnViewColumn`.set_factory] and
/// [class`GtkColumnViewCell`].
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.ColumnView.setRowFactory(factory:)`.
///
/// - Parameter rowFactory: The factory used for configuring rows.
/// - Returns: A copy of this view with the modifier applied.
public func rowFactory(_ rowFactory: @escaping () -> Gtk.ListItemFactory?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setRowFactory(factory: rowFactory()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.ColumnView.setShowColumnSeparators(showColumnSeparators:)
/// Sets whether the list should show separators between columns.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter showColumnSeparators: Show separators between columns.
/// - Returns: A copy of this view with the modifier applied.
public func showColumnSeparators(_ showColumnSeparators: Bool) -> Self {
appending { w, _ in
w.setShowColumnSeparators(showColumnSeparators: showColumnSeparators)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.ColumnView.setShowColumnSeparators(showColumnSeparators:), GObject.Object.connectNotify(detail:_:), Gtk.ColumnView.getShowColumnSeparators()
/// Sets whether the list should show separators between columns.
///
/// 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 showColumnSeparators(_ showColumnSeparators: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, showColumnSeparators, registry: ctx.registry, notifyDetail: "show-column-separators",
read: { [w] in w.getShowColumnSeparators() },
write: { [w] v in w.setShowColumnSeparators(showColumnSeparators: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.ColumnView.setShowColumnSeparators(showColumnSeparators:)
/// Sets whether the list should show separators between columns.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.ColumnView.setShowColumnSeparators(showColumnSeparators:)`.
///
/// - Parameter showColumnSeparators: Show separators between columns.
/// - Returns: A copy of this view with the modifier applied.
public func showColumnSeparators(_ showColumnSeparators: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setShowColumnSeparators(showColumnSeparators: showColumnSeparators()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.ColumnView.setShowRowSeparators(showRowSeparators:)
/// Sets whether the list should show separators between rows.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter showRowSeparators: Show separators between rows.
/// - Returns: A copy of this view with the modifier applied.
public func showRowSeparators(_ showRowSeparators: Bool) -> Self {
appending { w, _ in
w.setShowRowSeparators(showRowSeparators: showRowSeparators)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.ColumnView.setShowRowSeparators(showRowSeparators:), GObject.Object.connectNotify(detail:_:), Gtk.ColumnView.getShowRowSeparators()
/// Sets whether the list 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 showRowSeparators(_ showRowSeparators: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, showRowSeparators, registry: ctx.registry, notifyDetail: "show-row-separators",
read: { [w] in w.getShowRowSeparators() },
write: { [w] v in w.setShowRowSeparators(showRowSeparators: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.ColumnView.setShowRowSeparators(showRowSeparators:)
/// Sets whether the list 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.ColumnView.setShowRowSeparators(showRowSeparators:)`.
///
/// - Parameter showRowSeparators: Show separators between rows.
/// - Returns: A copy of this view with the modifier applied.
public func showRowSeparators(_ showRowSeparators: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setShowRowSeparators(showRowSeparators: showRowSeparators()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.ColumnView.setSingleClickActivate(singleClickActivate:)
/// Sets whether rows should be activated on single click and
/// selected on hover.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter singleClickActivate: Activate rows on single click and select them on hover.
/// - Returns: A copy of this view with the modifier applied.
public func singleClickActivate(_ singleClickActivate: Bool) -> Self {
appending { w, _ in
w.setSingleClickActivate(singleClickActivate: singleClickActivate)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.ColumnView.setSingleClickActivate(singleClickActivate:), GObject.Object.connectNotify(detail:_:), Gtk.ColumnView.getSingleClickActivate()
/// Sets whether rows should be activated on single click and
/// selected on hover.
///
/// 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 singleClickActivate(_ singleClickActivate: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, singleClickActivate, registry: ctx.registry, notifyDetail: "single-click-activate",
read: { [w] in w.getSingleClickActivate() },
write: { [w] v in w.setSingleClickActivate(singleClickActivate: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.ColumnView.setSingleClickActivate(singleClickActivate:)
/// Sets whether rows should be activated on single click and
/// selected on hover.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.ColumnView.setSingleClickActivate(singleClickActivate:)`.
///
/// - Parameter singleClickActivate: Activate rows on single click and select them on hover.
/// - Returns: A copy of this view with the modifier applied.
public func singleClickActivate(_ singleClickActivate: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setSingleClickActivate(singleClickActivate: singleClickActivate()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.ColumnView.setTabBehavior(tabBehavior:)
/// Sets the <kbd>Tab</kbd> key behavior.
///
/// This influences how the <kbd>Tab</kbd> and
/// <kbd>Shift</kbd>+<kbd>Tab</kbd> keys move the
/// focus in the columnview.
///
/// 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(tabBehavior: tabBehavior)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.ColumnView.setTabBehavior(tabBehavior:), GObject.Object.connectNotify(detail:_:), Gtk.ColumnView.getTabBehavior()
/// Sets the <kbd>Tab</kbd> key behavior.
///
/// This influences how the <kbd>Tab</kbd> and
/// <kbd>Shift</kbd>+<kbd>Tab</kbd> keys move the
/// focus in the columnview.
///
/// 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(tabBehavior: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.ColumnView.setTabBehavior(tabBehavior:)
/// Sets the <kbd>Tab</kbd> key behavior.
///
/// This influences how the <kbd>Tab</kbd> and
/// <kbd>Shift</kbd>+<kbd>Tab</kbd> keys move the
/// focus in the columnview.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.ColumnView.setTabBehavior(tabBehavior:)`.
///
/// - 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(tabBehavior: tabBehavior()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.ColumnView.connectActivate(_:)
/// Emitted when a row has been activated by the user, usually via activating
/// the GtkListBase|list.activate-item action.
///
/// This allows for a convenient way to handle activation in a columnview.
/// See [method`Gtk`.ListItem.set_activatable] for details on how to use this
/// signal.
///
/// - Parameter handler: Invoked when the widget emits the `activate` signal. The closure receives the signal's arguments in order.
/// - Returns: A copy of this view with the modifier applied.
public func onActivate(_ handler: @escaping (UInt32) -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectActivate { _, a0 in handler(a0) })
}
}
}