portico/Sources/Portico/Generated/Separator.swift

67 lines
2.2 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.Separator
/// Draws a horizontal or vertical line to separate other widgets.
///
/// <picture>
/// <source srcset="separator-dark.png" media="(prefers-color-scheme: dark)">
/// <img alt="An example GtkSeparator" src="separator.png">
/// </picture>
///
/// A `GtkSeparator` can be used to group the widgets within a window.
/// It displays a line with a shadow to make it appear sunken into the
/// interface.
///
/// # CSS nodes
///
/// `GtkSeparator` has a single CSS node with name separator. The node
/// gets one of the .horizontal or .vertical style classes.
///
/// # Accessibility
///
/// `GtkSeparator` uses the [enum`Gtk`.AccessibleRole.separator] role.
///
/// A Portico view that mounts a `Gtk.Separator`.
@MainActor public struct Separator: View {
private let make: (MountContext) -> Gtk.Separator
private var configure: [(Gtk.Separator, MountContext) -> Void] = []
public var body: Never { fatalError() }
// PorticoGen: generateInits(static) | source: Gtk.Separator.init(orientation:)
/// Creates a new `GtkSeparator` with the given orientation.
///
/// 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 orientation: The `orientation` value forwarded to `Gtk.Separator`.
public init(orientation: Gtk.Orientation) {
make = { _ in Gtk.Separator(orientation: orientation) }
}
}
extension Separator: WidgetView {
public typealias Target = Gtk.Separator
@_spi(Portico) public func appending(
_ step: @escaping (Gtk.Separator, MountContext) -> Void
) -> Self {
var c = self
c.configure.append(step)
return c
}
}
@_spi(Portico) extension Separator: Mountable {
@_spi(Portico) public func mount(_ ctx: MountContext) -> Gtk.Widget {
let w = make(ctx)
for step in configure { step(w, ctx) }
return w
}
}