portico/Sources/Portico/Generated/FontChooserWidget.swift

63 lines
2.1 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.FontChooserWidget
/// The `GtkFontChooserWidget` widget lets the user select a font.
///
/// It is used in the `GtkFontChooserDialog` widget to provide a
/// dialog for selecting fonts.
///
/// To set the font which is initially selected, use
/// [method`Gtk`.FontChooser.set_font] or [method`Gtk`.FontChooser.set_font_desc].
///
/// To get the selected font use [method`Gtk`.FontChooser.get_font] or
/// [method`Gtk`.FontChooser.get_font_desc].
///
/// To change the text which is shown in the preview area, use
/// [method`Gtk`.FontChooser.set_preview_text].
///
/// # CSS nodes
///
/// `GtkFontChooserWidget` has a single CSS node with name fontchooser.
///
/// A Portico view that mounts a `Gtk.FontChooserWidget`.
@MainActor public struct FontChooserWidget: View {
private let make: (MountContext) -> Gtk.FontChooserWidget
private var configure: [(Gtk.FontChooserWidget, MountContext) -> Void] = []
public var body: Never { fatalError() }
// PorticoGen: generateInits(static) | source: Gtk.FontChooserWidget.init()
/// Creates a new `GtkFontChooserWidget`.
///
/// 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.
public init() {
make = { _ in Gtk.FontChooserWidget() }
}
}
extension FontChooserWidget: WidgetView {
public typealias Target = Gtk.FontChooserWidget
@_spi(Portico) public func appending(
_ step: @escaping (Gtk.FontChooserWidget, MountContext) -> Void
) -> Self {
var c = self
c.configure.append(step)
return c
}
}
@_spi(Portico) extension FontChooserWidget: Mountable {
@_spi(Portico) public func mount(_ ctx: MountContext) -> Gtk.Widget {
let w = make(ctx)
for step in configure { step(w, ctx) }
return w
}
}