portico/Sources/Portico/Generated/ComboRow.swift

735 lines
42 KiB
Swift

// Generated by PorticoGen. DO NOT EDIT. See Sources/PorticoGen to make changes.
import Adw
import Gtk
import Gio
import Gdk
// PorticoGen: generateStruct | source: Adw.ComboRow
/// A [class`Gtk`.ListBoxRow] used to choose from a list of items.
///
/// <picture>
/// <source srcset="combo-row-dark.png" media="(prefers-color-scheme: dark)">
/// <img src="combo-row.png" alt="combo-row">
/// </picture>
///
/// The `AdwComboRow` widget allows the user to choose from a list of valid
/// choices. The row displays the selected choice. When activated, the row
/// displays a popover which allows the user to make a new choice.
///
/// Example of an `AdwComboRow` UI definition:
/// ```xml
/// <object class="AdwComboRow">
/// <property name="title" translatable="yes">Combo Row</property>
/// <property name="model">
/// <object class="GtkStringList">
/// <items>
/// <item translatable="yes">Foo</item>
/// <item translatable="yes">Bar</item>
/// <item translatable="yes">Baz</item>
/// </items>
/// </object>
/// </property>
/// </object>
/// ```
///
/// The [property`ComboRow`:selected] and [property`ComboRow`:selected-item]
/// properties can be used to keep track of the selected item and react to their
/// changes.
///
/// `AdwComboRow` mirrors [class`Gtk`.DropDown], see that widget for details.
///
/// `AdwComboRow` is [property`Gtk`.ListBoxRow:activatable] if a model is set.
///
/// ## CSS nodes
///
/// `AdwComboRow` has a main CSS node with name `row` and the `.combo` style
/// class.
///
/// Its popover has the node named `popover` with the `.menu` style class, it
/// contains a [class`Gtk`.ScrolledWindow], which in turn contains a
/// [class`Gtk`.ListView], both are accessible via their regular nodes.
///
/// ## Accessibility
///
/// `AdwComboRow` uses the [enum`Gtk`.AccessibleRole.combo-box] role.
///
/// A Portico view that mounts a `Adw.ComboRow`.
@MainActor public struct ComboRow: View {
private let make: (MountContext) -> Adw.ComboRow
private var configure: [(Adw.ComboRow, MountContext) -> Void] = []
public var body: Never { fatalError() }
// PorticoGen: generateInits(static) | source: Adw.ComboRow.init()
/// Creates a new `AdwComboRow`.
///
/// 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 enableSearch: Whether to show a search entry in the popup.
/// - Parameter expression: An expression used to obtain strings from items.
/// - Parameter factory: Factory for populating list items.
/// - Parameter headerFactory: The factory for creating header widgets for the popup.
/// - Parameter listFactory: The factory for populating list items in the popup.
/// - Parameter model: The model that provides the displayed items.
/// - Parameter searchMatchMode: The match mode for the search filter.
/// - Parameter selected: The position of the selected item.
/// - Parameter useSubtitle: Whether to use the current value as the subtitle.
/// - Parameter iconName: The icon name for this row.
/// - Parameter subtitle: The subtitle for this row.
/// - Parameter subtitleLines: The number of lines at the end of which the subtitle label will be ellipsized.
/// - Parameter subtitleSelectable: Whether the user can copy the subtitle from the label.
/// - Parameter titleLines: The number of lines at the end of which the title label will be ellipsized.
/// - Parameter title: The title of the preference represented by this row.
/// - Parameter titleSelectable: Whether the user can copy the title from the label.
/// - Parameter useMarkup: Whether to use Pango markup for the title label.
/// - Parameter useUnderline: Whether an embedded underline in the title indicates a mnemonic.
/// - Parameter activatable: Determines whether the ::row-activated signal will be emitted for this row.
/// - Parameter selectable: Determines whether this row can be selected.
/// - Parameter child: A `ViewBuilder` closure whose first view is mounted into the `child` slot.
/// - Parameter activatableWidget: A `ViewBuilder` closure whose first view is mounted into the `activatableWidget` slot.
/// - Parameter onActivated: Invoked when the widget emits the `activated` signal.
/// - Parameter onActivate: Invoked when the widget emits the `activate` signal.
public init(enableSearch: Bool? = nil, expression: Adw.Expression? = nil, factory: Adw.ListItemFactory? = nil, headerFactory: Adw.ListItemFactory? = nil, listFactory: Adw.ListItemFactory? = nil, model: Adw.ListModel? = nil, searchMatchMode: Adw.StringFilterMatchMode? = nil, selected: UInt32? = nil, useSubtitle: Bool? = nil, iconName: String? = nil, subtitle: String? = nil, subtitleLines: Int32? = nil, subtitleSelectable: Bool? = nil, titleLines: Int32? = nil, title: String? = nil, titleSelectable: Bool? = nil, useMarkup: Bool? = nil, useUnderline: Bool? = nil, activatable: Bool? = nil, selectable: Bool? = nil, @ViewBuilder child: @escaping () -> [AnyView] = { [] }, @ViewBuilder activatableWidget: @escaping () -> [AnyView] = { [] }, onActivated: (() -> Void)? = nil, onActivate: (() -> Void)? = nil) {
make = { _ in Adw.ComboRow() }
configure.append { w, ctx in
if let enableSearch { w.setEnableSearch(enableSearch: enableSearch) }
if let expression { w.setExpression(expression: expression) }
if let factory { w.setFactory(factory: factory) }
if let headerFactory { w.setHeaderFactory(factory: headerFactory) }
if let listFactory { w.setListFactory(factory: listFactory) }
if let model { w.setModel(model: model) }
if let searchMatchMode { w.setSearchMatchMode(searchMatchMode: searchMatchMode) }
if let selected { w.setSelected(position: selected) }
if let useSubtitle { w.setUseSubtitle(useSubtitle: useSubtitle) }
if let iconName { w.setIconName(iconName: iconName) }
if let subtitle { w.setSubtitle(subtitle: subtitle) }
if let subtitleLines { w.setSubtitleLines(subtitleLines: subtitleLines) }
if let subtitleSelectable { w.setSubtitleSelectable(subtitleSelectable: subtitleSelectable) }
if let titleLines { w.setTitleLines(titleLines: titleLines) }
if let title { w.setTitle(title: title) }
if let titleSelectable { w.setTitleSelectable(titleSelectable: titleSelectable) }
if let useMarkup { w.setUseMarkup(useMarkup: useMarkup) }
if let useUnderline { w.setUseUnderline(useUnderline: useUnderline) }
if let activatable { w.setActivatable(activatable: activatable) }
if let selectable { w.setSelectable(selectable: selectable) }
if let v = Portico.mountSlotChild(child, ctx, onUpdate: { v in w.setChild(child: v) }) { w.setChild(child: v) }
if let v = Portico.mountSlotChild(activatableWidget, ctx, onUpdate: { v in w.setActivatableWidget(widget: v) }) { w.setActivatableWidget(widget: v) }
if let onActivated { ctx.registry.add(w.connectActivated { _ in onActivated() }) }
if let onActivate { ctx.registry.add(w.connectActivate { _ in onActivate() }) }
}
}
}
extension ComboRow: WidgetView {
public typealias Target = Adw.ComboRow
@_spi(Portico) public func appending(
_ step: @escaping (Adw.ComboRow, MountContext) -> Void
) -> Self {
var c = self
c.configure.append(step)
return c
}
}
@_spi(Portico) extension ComboRow: 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.ComboRow
/// Modifiers for `Adw.ComboRow`, available on every Portico view whose
/// backing widget is `Adw.ComboRow` or one of its subclasses.
extension WidgetView where Target: Adw.ComboRow {
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ComboRow.setEnableSearch(enableSearch:)
/// Sets whether to enable search.
///
/// If set to `TRUE`, a search entry will be shown in the popup that
/// allows to search for items in the list.
///
/// Search requires [property`ComboRow`:expression] to be set.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter enableSearch: Whether to show a search entry in the popup.
/// - 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.ComboRow.setEnableSearch(enableSearch:), GObject.Object.connectNotify(detail:_:), Adw.ComboRow.getEnableSearch()
/// Sets whether to enable search.
///
/// If set to `TRUE`, a search entry will be shown in the popup that
/// allows to search for items in the list.
///
/// Search requires [property`ComboRow`:expression] to be set.
///
/// 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.ComboRow.setEnableSearch(enableSearch:)
/// Sets whether to enable search.
///
/// If set to `TRUE`, a search entry will be shown in the popup that
/// allows to search for items in the list.
///
/// Search requires [property`ComboRow`:expression] to be set.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ComboRow.setEnableSearch(enableSearch:)`.
///
/// - Parameter enableSearch: Whether to show a search entry in the popup.
/// - 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.ComboRow.setExpression(expression:)
/// Sets the expression used to obtain strings from items.
///
/// The expression must have a value type of `G_TYPE_STRING`.
///
/// It's used to bind strings to labels produced by the default factory if
/// [property`ComboRow`:factory] is not set, or when
/// [property`ComboRow`:use-subtitle] is set to `TRUE`.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter expression: An expression used to obtain strings from items.
/// - Returns: A copy of this view with the modifier applied.
public func expression(_ expression: Adw.Expression?) -> Self {
appending { w, _ in
w.setExpression(expression: expression)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ComboRow.setExpression(expression:), GObject.Object.connectNotify(detail:_:), Adw.ComboRow.getExpression()
/// Sets the expression used to obtain strings from items.
///
/// The expression must have a value type of `G_TYPE_STRING`.
///
/// It's used to bind strings to labels produced by the default factory if
/// [property`ComboRow`:factory] is not set, or when
/// [property`ComboRow`:use-subtitle] is set to `TRUE`.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Adw.Expression?` 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 expression(_ expression: Portico.Binding<Adw.Expression?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, expression, registry: ctx.registry, notifyDetail: "expression",
read: { [w] in w.getExpression() },
write: { [w] v in w.setExpression(expression: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Adw.ComboRow.setExpression(expression:), GObject.Object.connectNotify(detail:_:), Adw.ComboRow.getExpression()
/// Sets the expression used to obtain strings from items.
///
/// The expression must have a value type of `G_TYPE_STRING`.
///
/// It's used to bind strings to labels produced by the default factory if
/// [property`ComboRow`:factory] is not set, or when
/// [property`ComboRow`:use-subtitle] is set to `TRUE`.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Adw.Expression>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Adw.Expression?>` to be able to clear the property.
/// When `Adw.Expression` 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 expression(_ expression: Portico.Binding<Adw.Expression>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, expression, registry: ctx.registry, notifyDetail: "expression",
read: { [w] in w.getExpression() },
write: { [w] v in w.setExpression(expression: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ComboRow.setExpression(expression:)
/// Sets the expression used to obtain strings from items.
///
/// The expression must have a value type of `G_TYPE_STRING`.
///
/// It's used to bind strings to labels produced by the default factory if
/// [property`ComboRow`:factory] is not set, or when
/// [property`ComboRow`:use-subtitle] is set to `TRUE`.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ComboRow.setExpression(expression:)`.
///
/// - Parameter expression: An expression used to obtain strings from items.
/// - Returns: A copy of this view with the modifier applied.
public func expression(_ expression: @escaping () -> Adw.Expression?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setExpression(expression: expression()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ComboRow.setFactory(factory:)
/// Sets the factory for populating list items.
///
/// This factory is always used for the item in the row. It is also used for
/// items in the popup unless [property`ComboRow`:list-factory] is set.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter factory: Factory for populating list items.
/// - Returns: A copy of this view with the modifier applied.
public func factory(_ factory: Adw.ListItemFactory?) -> Self {
appending { w, _ in
w.setFactory(factory: factory)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ComboRow.setFactory(factory:), GObject.Object.connectNotify(detail:_:), Adw.ComboRow.getFactory()
/// Sets the factory for populating list items.
///
/// This factory is always used for the item in the row. It is also used for
/// items in the popup unless [property`ComboRow`:list-factory] is set.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Adw.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 factory(_ factory: Portico.Binding<Adw.ListItemFactory?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, factory, registry: ctx.registry, notifyDetail: "factory",
read: { [w] in w.getFactory() },
write: { [w] v in w.setFactory(factory: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Adw.ComboRow.setFactory(factory:), GObject.Object.connectNotify(detail:_:), Adw.ComboRow.getFactory()
/// Sets the factory for populating list items.
///
/// This factory is always used for the item in the row. It is also used for
/// items in the popup unless [property`ComboRow`:list-factory] is set.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Adw.ListItemFactory>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Adw.ListItemFactory?>` to be able to clear the property.
/// When `Adw.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 factory(_ factory: Portico.Binding<Adw.ListItemFactory>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, factory, registry: ctx.registry, notifyDetail: "factory",
read: { [w] in w.getFactory() },
write: { [w] v in w.setFactory(factory: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ComboRow.setFactory(factory:)
/// Sets the factory for populating list items.
///
/// This factory is always used for the item in the row. It is also used for
/// items in the popup unless [property`ComboRow`:list-factory] is set.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ComboRow.setFactory(factory:)`.
///
/// - Parameter factory: Factory for populating list items.
/// - Returns: A copy of this view with the modifier applied.
public func factory(_ factory: @escaping () -> Adw.ListItemFactory?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setFactory(factory: factory()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ComboRow.setHeaderFactory(factory:)
/// Sets the factory to use for creating header widgets for the popup.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter headerFactory: The factory for creating header widgets for the popup.
/// - Returns: A copy of this view with the modifier applied.
public func headerFactory(_ headerFactory: Adw.ListItemFactory?) -> Self {
appending { w, _ in
w.setHeaderFactory(factory: headerFactory)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ComboRow.setHeaderFactory(factory:), GObject.Object.connectNotify(detail:_:), Adw.ComboRow.getHeaderFactory()
/// Sets the factory to use for creating header widgets for the popup.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Adw.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<Adw.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: Adw.ComboRow.setHeaderFactory(factory:), GObject.Object.connectNotify(detail:_:), Adw.ComboRow.getHeaderFactory()
/// Sets the factory to use for creating header widgets for the popup.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Adw.ListItemFactory>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Adw.ListItemFactory?>` to be able to clear the property.
/// When `Adw.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<Adw.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: Adw.ComboRow.setHeaderFactory(factory:)
/// Sets the factory to use for creating header widgets for the popup.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ComboRow.setHeaderFactory(factory:)`.
///
/// - Parameter headerFactory: The factory for creating header widgets for the popup.
/// - Returns: A copy of this view with the modifier applied.
public func headerFactory(_ headerFactory: @escaping () -> Adw.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: Adw.ComboRow.setListFactory(factory:)
/// Sets the factory for populating list items in the popup.
///
/// If this is not set, [property`ComboRow`:factory] is used.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter listFactory: The factory for populating list items in the popup.
/// - Returns: A copy of this view with the modifier applied.
public func listFactory(_ listFactory: Adw.ListItemFactory?) -> Self {
appending { w, _ in
w.setListFactory(factory: listFactory)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ComboRow.setListFactory(factory:), GObject.Object.connectNotify(detail:_:), Adw.ComboRow.getListFactory()
/// Sets the factory for populating list items in the popup.
///
/// If this is not set, [property`ComboRow`:factory] is used.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Adw.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 listFactory(_ listFactory: Portico.Binding<Adw.ListItemFactory?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, listFactory, registry: ctx.registry, notifyDetail: "list-factory",
read: { [w] in w.getListFactory() },
write: { [w] v in w.setListFactory(factory: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Adw.ComboRow.setListFactory(factory:), GObject.Object.connectNotify(detail:_:), Adw.ComboRow.getListFactory()
/// Sets the factory for populating list items in the popup.
///
/// If this is not set, [property`ComboRow`:factory] is used.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Adw.ListItemFactory>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Adw.ListItemFactory?>` to be able to clear the property.
/// When `Adw.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 listFactory(_ listFactory: Portico.Binding<Adw.ListItemFactory>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, listFactory, registry: ctx.registry, notifyDetail: "list-factory",
read: { [w] in w.getListFactory() },
write: { [w] v in w.setListFactory(factory: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ComboRow.setListFactory(factory:)
/// Sets the factory for populating list items in the popup.
///
/// If this is not set, [property`ComboRow`:factory] is used.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ComboRow.setListFactory(factory:)`.
///
/// - Parameter listFactory: The factory for populating list items in the popup.
/// - Returns: A copy of this view with the modifier applied.
public func listFactory(_ listFactory: @escaping () -> Adw.ListItemFactory?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setListFactory(factory: listFactory()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ComboRow.setModel(model:)
/// Sets the model that provides the displayed items.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter model: The model that provides the displayed items.
/// - Returns: A copy of this view with the modifier applied.
public func model(_ model: Adw.ListModel?) -> Self {
appending { w, _ in
w.setModel(model: model)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ComboRow.setModel(model:), GObject.Object.connectNotify(detail:_:), Adw.ComboRow.getModel()
/// Sets the model that provides the displayed items.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Adw.ListModel?` 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<Adw.ListModel?>) -> 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: Adw.ComboRow.setModel(model:), GObject.Object.connectNotify(detail:_:), Adw.ComboRow.getModel()
/// Sets the model that provides the displayed items.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Adw.ListModel>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Adw.ListModel?>` to be able to clear the property.
/// When `Adw.ListModel` 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<Adw.ListModel>) -> 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: Adw.ComboRow.setModel(model:)
/// Sets the model that provides the displayed items.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ComboRow.setModel(model:)`.
///
/// - Parameter model: The model that provides the displayed items.
/// - Returns: A copy of this view with the modifier applied.
public func model(_ model: @escaping () -> Adw.ListModel?) -> 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: Adw.ComboRow.setSearchMatchMode(searchMatchMode:)
/// Sets the match mode for the search filter.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter searchMatchMode: The match mode for the search filter.
/// - Returns: A copy of this view with the modifier applied.
public func searchMatchMode(_ searchMatchMode: Adw.StringFilterMatchMode) -> Self {
appending { w, _ in
w.setSearchMatchMode(searchMatchMode: searchMatchMode)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ComboRow.setSearchMatchMode(searchMatchMode:), GObject.Object.connectNotify(detail:_:), Adw.ComboRow.getSearchMatchMode()
/// Sets the match mode for the search filter.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Adw.StringFilterMatchMode` 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 searchMatchMode(_ searchMatchMode: Portico.Binding<Adw.StringFilterMatchMode>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, searchMatchMode, registry: ctx.registry, notifyDetail: "search-match-mode",
read: { [w] in w.getSearchMatchMode() },
write: { [w] v in w.setSearchMatchMode(searchMatchMode: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ComboRow.setSearchMatchMode(searchMatchMode:)
/// Sets the match mode for the search filter.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ComboRow.setSearchMatchMode(searchMatchMode:)`.
///
/// - Parameter searchMatchMode: The match mode for the search filter.
/// - Returns: A copy of this view with the modifier applied.
public func searchMatchMode(_ searchMatchMode: @escaping () -> Adw.StringFilterMatchMode) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setSearchMatchMode(searchMatchMode: searchMatchMode()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ComboRow.setSelected(position:)
/// Selects the item at the given position.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter selected: The position of the selected item.
/// - Returns: A copy of this view with the modifier applied.
public func selected(_ selected: UInt32) -> Self {
appending { w, _ in
w.setSelected(position: selected)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ComboRow.setSelected(position:), GObject.Object.connectNotify(detail:_:), Adw.ComboRow.getSelected()
/// Selects the item at the given position.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `UInt32` 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 selected(_ selected: Portico.Binding<UInt32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, selected, registry: ctx.registry, notifyDetail: "selected",
read: { [w] in w.getSelected() },
write: { [w] v in w.setSelected(position: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ComboRow.setSelected(position:)
/// Selects the item at the given position.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ComboRow.setSelected(position:)`.
///
/// - Parameter selected: The position of the selected item.
/// - Returns: A copy of this view with the modifier applied.
public func selected(_ selected: @escaping () -> UInt32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setSelected(position: selected()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Adw.ComboRow.setUseSubtitle(useSubtitle:)
/// Sets whether to use the current value as the subtitle.
///
/// If you use a custom list item factory, you will need to give the row a
/// name conversion expression with [property`ComboRow`:expression].
///
/// If set to `TRUE`, you should not access [property`ActionRow`:subtitle].
///
/// The subtitle is interpreted as Pango markup if
/// [property`PreferencesRow`:use-markup] is set to `TRUE`.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter useSubtitle: Whether to use the current value as the subtitle.
/// - Returns: A copy of this view with the modifier applied.
public func useSubtitle(_ useSubtitle: Bool) -> Self {
appending { w, _ in
w.setUseSubtitle(useSubtitle: useSubtitle)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Adw.ComboRow.setUseSubtitle(useSubtitle:), GObject.Object.connectNotify(detail:_:), Adw.ComboRow.getUseSubtitle()
/// Sets whether to use the current value as the subtitle.
///
/// If you use a custom list item factory, you will need to give the row a
/// name conversion expression with [property`ComboRow`:expression].
///
/// If set to `TRUE`, you should not access [property`ActionRow`:subtitle].
///
/// The subtitle is interpreted as Pango markup if
/// [property`PreferencesRow`:use-markup] is set to `TRUE`.
///
/// 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 useSubtitle(_ useSubtitle: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, useSubtitle, registry: ctx.registry, notifyDetail: "use-subtitle",
read: { [w] in w.getUseSubtitle() },
write: { [w] v in w.setUseSubtitle(useSubtitle: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Adw.ComboRow.setUseSubtitle(useSubtitle:)
/// Sets whether to use the current value as the subtitle.
///
/// If you use a custom list item factory, you will need to give the row a
/// name conversion expression with [property`ComboRow`:expression].
///
/// If set to `TRUE`, you should not access [property`ActionRow`:subtitle].
///
/// The subtitle is interpreted as Pango markup if
/// [property`PreferencesRow`:use-markup] is set to `TRUE`.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Adw.ComboRow.setUseSubtitle(useSubtitle:)`.
///
/// - Parameter useSubtitle: Whether to use the current value as the subtitle.
/// - Returns: A copy of this view with the modifier applied.
public func useSubtitle(_ useSubtitle: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setUseSubtitle(useSubtitle: useSubtitle()) }
tracker.run()
ctx.registry.add(tracker)
}
}
}