portico/Sources/Portico/Generated/Inscription.swift

755 lines
44 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.Inscription
/// Shows text in a predefined area.
///
/// You likely want to use `GtkLabel` instead as this widget is intended only
/// for a small subset of use cases. The main scenario envisaged is inside lists
/// such as `GtkColumnView`.
///
/// While a `GtkLabel` sizes itself depending on the text that is displayed,
/// `GtkInscription` is given a size and inscribes the given text into that
/// space as well as it can.
///
/// Users of this widget should take care to plan behaviour for the common case
/// where the text doesn't fit exactly in the allocated space.
///
/// ## CSS nodes
///
/// `GtkInscription` has a single CSS node with the name label.
///
/// A Portico view that mounts a `Gtk.Inscription`.
@MainActor public struct Inscription: View {
private let make: (MountContext) -> Gtk.Inscription
private var configure: [(Gtk.Inscription, MountContext) -> Void] = []
public var body: Never { fatalError() }
// PorticoGen: generateInits(static) | source: Gtk.Inscription.init(text:)
/// Creates a new `GtkInscription` with the given text.
///
/// Applied once at mount; use the `Binding`, closure, or `InterpolatedText` overload for values that change.
/// A string literal containing interpolation selects the `InterpolatedText` overload instead, which updates live.
/// 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 text: The displayed text.
/// - Parameter attributes: A list of style attributes to apply to the text of the inscription.
/// - Parameter minChars: The number of characters that should fit into the inscription at minimum.
/// - Parameter minLines: The number of lines that should fit into the inscription at minimum.
/// - Parameter natChars: The number of characters that should ideally fit into the inscription.
/// - Parameter natLines: The number of lines that should ideally fit into the inscription.
/// - Parameter textOverflow: The overflow method to use for the text.
/// - Parameter wrapMode: Controls how the line wrapping is done.
/// - Parameter xalign: The horizontal alignment of the text inside the allocated size.
/// - Parameter yalign: The vertical alignment of the text inside the allocated size.
@_disfavoredOverload
public init<S: StringProtocol>(text: S?, attributes: Gtk.AttrList? = nil, minChars: UInt32? = nil, minLines: UInt32? = nil, natChars: UInt32? = nil, natLines: UInt32? = nil, textOverflow: Gtk.InscriptionOverflow? = nil, wrapMode: Pango.WrapMode? = nil, xalign: Float? = nil, yalign: Float? = nil) {
make = { _ in Gtk.Inscription(text: text.map { String($0) }) }
configure.append { w, _ in
if let attributes { w.setAttributes(attrs: attributes) }
if let minChars { w.setMinChars(minChars: minChars) }
if let minLines { w.setMinLines(minLines: minLines) }
if let natChars { w.setNatChars(natChars: natChars) }
if let natLines { w.setNatLines(natLines: natLines) }
if let textOverflow { w.setTextOverflow(overflow: textOverflow) }
if let wrapMode { w.setWrapMode(wrapMode: wrapMode) }
if let xalign { w.setXalign(xalign: xalign) }
if let yalign { w.setYalign(yalign: yalign) }
}
}
// PorticoGen: generateInits(binding) | source: Gtk.Inscription.init(text:), Gtk.Inscription.setText(text:)
/// Creates a new `GtkInscription` with the given text.
///
/// The initial value is the binding's current value; every later change is pushed into the widget through `Gtk.Inscription.setText(text:)` 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 text: The displayed text.
/// - Parameter attributes: A list of style attributes to apply to the text of the inscription.
/// - Parameter minChars: The number of characters that should fit into the inscription at minimum.
/// - Parameter minLines: The number of lines that should fit into the inscription at minimum.
/// - Parameter natChars: The number of characters that should ideally fit into the inscription.
/// - Parameter natLines: The number of lines that should ideally fit into the inscription.
/// - Parameter textOverflow: The overflow method to use for the text.
/// - Parameter wrapMode: Controls how the line wrapping is done.
/// - Parameter xalign: The horizontal alignment of the text inside the allocated size.
/// - Parameter yalign: The vertical alignment of the text inside the allocated size.
public init(text: Portico.Binding<String?>, attributes: Portico.Binding<Gtk.AttrList?>? = nil, minChars: Portico.Binding<UInt32>? = nil, minLines: Portico.Binding<UInt32>? = nil, natChars: Portico.Binding<UInt32>? = nil, natLines: Portico.Binding<UInt32>? = nil, textOverflow: Portico.Binding<Gtk.InscriptionOverflow>? = nil, wrapMode: Portico.Binding<Pango.WrapMode>? = nil, xalign: Portico.Binding<Float>? = nil, yalign: Portico.Binding<Float>? = nil) {
make = { _ in Gtk.Inscription(text: text.wrappedValue) }
configure.append { w, ctx in
ctx.registry.add(text.subscribe { [w] v in w.setText(text: v) })
if let attributes {
Portico.bindProperty(w, attributes, registry: ctx.registry, notifyDetail: "attributes", read: { [w] in w.getAttributes() }, write: { [w] v in w.setAttributes(attrs: v) })
}
if let minChars {
Portico.bindProperty(w, minChars, registry: ctx.registry, notifyDetail: "min-chars", read: { [w] in w.getMinChars() }, write: { [w] v in w.setMinChars(minChars: v) })
}
if let minLines {
Portico.bindProperty(w, minLines, registry: ctx.registry, notifyDetail: "min-lines", read: { [w] in w.getMinLines() }, write: { [w] v in w.setMinLines(minLines: v) })
}
if let natChars {
Portico.bindProperty(w, natChars, registry: ctx.registry, notifyDetail: "nat-chars", read: { [w] in w.getNatChars() }, write: { [w] v in w.setNatChars(natChars: v) })
}
if let natLines {
Portico.bindProperty(w, natLines, registry: ctx.registry, notifyDetail: "nat-lines", read: { [w] in w.getNatLines() }, write: { [w] v in w.setNatLines(natLines: v) })
}
if let textOverflow {
Portico.bindProperty(w, textOverflow, registry: ctx.registry, notifyDetail: "text-overflow", read: { [w] in w.getTextOverflow() }, write: { [w] v in w.setTextOverflow(overflow: v) })
}
if let wrapMode {
Portico.bindProperty(w, wrapMode, registry: ctx.registry, notifyDetail: "wrap-mode", read: { [w] in w.getWrapMode() }, write: { [w] v in w.setWrapMode(wrapMode: v) })
}
if let xalign {
Portico.bindProperty(w, xalign, registry: ctx.registry, notifyDetail: "xalign", read: { [w] in w.getXalign() }, write: { [w] v in w.setXalign(xalign: v) })
}
if let yalign {
Portico.bindProperty(w, yalign, registry: ctx.registry, notifyDetail: "yalign", read: { [w] in w.getYalign() }, write: { [w] v in w.setYalign(yalign: v) })
}
}
}
// PorticoGen: generateInits(closure) | source: Gtk.Inscription.init(text:), Gtk.Inscription.setText(text:)
/// Creates a new `GtkInscription` with the given text.
///
/// Each closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Inscription.setText(text:)`.
/// 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 text: The displayed text.
/// - Parameter attributes: A list of style attributes to apply to the text of the inscription.
/// - Parameter minChars: The number of characters that should fit into the inscription at minimum.
/// - Parameter minLines: The number of lines that should fit into the inscription at minimum.
/// - Parameter natChars: The number of characters that should ideally fit into the inscription.
/// - Parameter natLines: The number of lines that should ideally fit into the inscription.
/// - Parameter textOverflow: The overflow method to use for the text.
/// - Parameter wrapMode: Controls how the line wrapping is done.
/// - Parameter xalign: The horizontal alignment of the text inside the allocated size.
/// - Parameter yalign: The vertical alignment of the text inside the allocated size.
public init(text: @escaping () -> String?, attributes: Gtk.AttrList? = nil, minChars: UInt32? = nil, minLines: UInt32? = nil, natChars: UInt32? = nil, natLines: UInt32? = nil, textOverflow: Gtk.InscriptionOverflow? = nil, wrapMode: Pango.WrapMode? = nil, xalign: Float? = nil, yalign: Float? = nil) {
make = { _ in Gtk.Inscription(text: text()) }
configure.append { w, ctx in
let t0 = DependencyTracker { [w] in w.setText(text: text()) }
t0.run()
ctx.registry.add(t0)
if let attributes { w.setAttributes(attrs: attributes) }
if let minChars { w.setMinChars(minChars: minChars) }
if let minLines { w.setMinLines(minLines: minLines) }
if let natChars { w.setNatChars(natChars: natChars) }
if let natLines { w.setNatLines(natLines: natLines) }
if let textOverflow { w.setTextOverflow(overflow: textOverflow) }
if let wrapMode { w.setWrapMode(wrapMode: wrapMode) }
if let xalign { w.setXalign(xalign: xalign) }
if let yalign { w.setYalign(yalign: yalign) }
}
}
// PorticoGen: generateInits(interpolation) | source: Gtk.Inscription.init(text:), Gtk.Inscription.setText(text:)
/// Creates a new `GtkInscription` with the given text.
///
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Gtk.Inscription.setText(text:)`. A literal with no interpolation is applied once, with no subscription.
/// 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 text: The displayed text.
/// - Parameter attributes: A list of style attributes to apply to the text of the inscription.
/// - Parameter minChars: The number of characters that should fit into the inscription at minimum.
/// - Parameter minLines: The number of lines that should fit into the inscription at minimum.
/// - Parameter natChars: The number of characters that should ideally fit into the inscription.
/// - Parameter natLines: The number of lines that should ideally fit into the inscription.
/// - Parameter textOverflow: The overflow method to use for the text.
/// - Parameter wrapMode: Controls how the line wrapping is done.
/// - Parameter xalign: The horizontal alignment of the text inside the allocated size.
/// - Parameter yalign: The vertical alignment of the text inside the allocated size.
public init(text: Portico.InterpolatedText?, attributes: Gtk.AttrList? = nil, minChars: UInt32? = nil, minLines: UInt32? = nil, natChars: UInt32? = nil, natLines: UInt32? = nil, textOverflow: Gtk.InscriptionOverflow? = nil, wrapMode: Pango.WrapMode? = nil, xalign: Float? = nil, yalign: Float? = nil) {
make = { _ in Gtk.Inscription(text: text?.untrackedText) }
configure.append { w, ctx in
Portico.bindOptionalInterpolation(text, registry: ctx.registry) { [w] v in w.setText(text: v) }
if let attributes { w.setAttributes(attrs: attributes) }
if let minChars { w.setMinChars(minChars: minChars) }
if let minLines { w.setMinLines(minLines: minLines) }
if let natChars { w.setNatChars(natChars: natChars) }
if let natLines { w.setNatLines(natLines: natLines) }
if let textOverflow { w.setTextOverflow(overflow: textOverflow) }
if let wrapMode { w.setWrapMode(wrapMode: wrapMode) }
if let xalign { w.setXalign(xalign: xalign) }
if let yalign { w.setYalign(yalign: yalign) }
}
}
}
extension Inscription: WidgetView {
public typealias Target = Gtk.Inscription
@_spi(Portico) public func appending(
_ step: @escaping (Gtk.Inscription, MountContext) -> Void
) -> Self {
var c = self
c.configure.append(step)
return c
}
}
@_spi(Portico) extension Inscription: 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.Inscription
/// Modifiers for `Gtk.Inscription`, available on every Portico view whose
/// backing widget is `Gtk.Inscription` or one of its subclasses.
extension WidgetView where Target: Gtk.Inscription {
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Inscription.setAttributes(attrs:)
/// Apply attributes to the inscription text.
///
/// These attributes will not be evaluated for sizing the inscription.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter attributes: A list of style attributes to apply to the text of the inscription.
/// - Returns: A copy of this view with the modifier applied.
public func attributes(_ attributes: Gtk.AttrList?) -> Self {
appending { w, _ in
w.setAttributes(attrs: attributes)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Inscription.setAttributes(attrs:), GObject.Object.connectNotify(detail:_:), Gtk.Inscription.getAttributes()
/// Apply attributes to the inscription text.
///
/// These attributes will not be evaluated for sizing the inscription.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.AttrList?` 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 attributes(_ attributes: Portico.Binding<Gtk.AttrList?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, attributes, registry: ctx.registry, notifyDetail: "attributes",
read: { [w] in w.getAttributes() },
write: { [w] v in w.setAttributes(attrs: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Inscription.setAttributes(attrs:), GObject.Object.connectNotify(detail:_:), Gtk.Inscription.getAttributes()
/// Apply attributes to the inscription text.
///
/// These attributes will not be evaluated for sizing the inscription.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Gtk.AttrList>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.AttrList?>` to be able to clear the property.
/// When `Gtk.AttrList` 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 attributes(_ attributes: Portico.Binding<Gtk.AttrList>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, attributes, registry: ctx.registry, notifyDetail: "attributes",
read: { [w] in w.getAttributes() },
write: { [w] v in w.setAttributes(attrs: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Inscription.setAttributes(attrs:)
/// Apply attributes to the inscription text.
///
/// These attributes will not be evaluated for sizing the inscription.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Inscription.setAttributes(attrs:)`.
///
/// - Parameter attributes: A list of style attributes to apply to the text of the inscription.
/// - Returns: A copy of this view with the modifier applied.
public func attributes(_ attributes: @escaping () -> Gtk.AttrList?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setAttributes(attrs: attributes()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Inscription.setMinChars(minChars:)
/// Sets the `min-chars` of the inscription.
///
/// See the [property`Gtk`.Inscription:min-chars] property.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter minChars: The number of characters that should fit into the inscription at minimum.
/// - Returns: A copy of this view with the modifier applied.
public func minChars(_ minChars: UInt32) -> Self {
appending { w, _ in
w.setMinChars(minChars: minChars)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Inscription.setMinChars(minChars:), GObject.Object.connectNotify(detail:_:), Gtk.Inscription.getMinChars()
/// Sets the `min-chars` of the inscription.
///
/// See the [property`Gtk`.Inscription:min-chars] property.
///
/// 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 minChars(_ minChars: Portico.Binding<UInt32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, minChars, registry: ctx.registry, notifyDetail: "min-chars",
read: { [w] in w.getMinChars() },
write: { [w] v in w.setMinChars(minChars: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Inscription.setMinChars(minChars:)
/// Sets the `min-chars` of the inscription.
///
/// See the [property`Gtk`.Inscription:min-chars] property.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Inscription.setMinChars(minChars:)`.
///
/// - Parameter minChars: The number of characters that should fit into the inscription at minimum.
/// - Returns: A copy of this view with the modifier applied.
public func minChars(_ minChars: @escaping () -> UInt32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setMinChars(minChars: minChars()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Inscription.setMinLines(minLines:)
/// Sets the `min-lines` of the inscription.
///
/// See the [property`Gtk`.Inscription:min-lines] property.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter minLines: The number of lines that should fit into the inscription at minimum.
/// - Returns: A copy of this view with the modifier applied.
public func minLines(_ minLines: UInt32) -> Self {
appending { w, _ in
w.setMinLines(minLines: minLines)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Inscription.setMinLines(minLines:), GObject.Object.connectNotify(detail:_:), Gtk.Inscription.getMinLines()
/// Sets the `min-lines` of the inscription.
///
/// See the [property`Gtk`.Inscription:min-lines] property.
///
/// 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 minLines(_ minLines: Portico.Binding<UInt32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, minLines, registry: ctx.registry, notifyDetail: "min-lines",
read: { [w] in w.getMinLines() },
write: { [w] v in w.setMinLines(minLines: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Inscription.setMinLines(minLines:)
/// Sets the `min-lines` of the inscription.
///
/// See the [property`Gtk`.Inscription:min-lines] property.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Inscription.setMinLines(minLines:)`.
///
/// - Parameter minLines: The number of lines that should fit into the inscription at minimum.
/// - Returns: A copy of this view with the modifier applied.
public func minLines(_ minLines: @escaping () -> UInt32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setMinLines(minLines: minLines()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Inscription.setNatChars(natChars:)
/// Sets the `nat-chars` of the inscription.
///
/// See the [property`Gtk`.Inscription:nat-chars] property.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter natChars: The number of characters that should ideally fit into the inscription.
/// - Returns: A copy of this view with the modifier applied.
public func natChars(_ natChars: UInt32) -> Self {
appending { w, _ in
w.setNatChars(natChars: natChars)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Inscription.setNatChars(natChars:), GObject.Object.connectNotify(detail:_:), Gtk.Inscription.getNatChars()
/// Sets the `nat-chars` of the inscription.
///
/// See the [property`Gtk`.Inscription:nat-chars] property.
///
/// 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 natChars(_ natChars: Portico.Binding<UInt32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, natChars, registry: ctx.registry, notifyDetail: "nat-chars",
read: { [w] in w.getNatChars() },
write: { [w] v in w.setNatChars(natChars: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Inscription.setNatChars(natChars:)
/// Sets the `nat-chars` of the inscription.
///
/// See the [property`Gtk`.Inscription:nat-chars] property.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Inscription.setNatChars(natChars:)`.
///
/// - Parameter natChars: The number of characters that should ideally fit into the inscription.
/// - Returns: A copy of this view with the modifier applied.
public func natChars(_ natChars: @escaping () -> UInt32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setNatChars(natChars: natChars()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Inscription.setNatLines(natLines:)
/// Sets the `nat-lines` of the inscription.
///
/// See the [property`Gtk`.Inscription:nat-lines] property.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter natLines: The number of lines that should ideally fit into the inscription.
/// - Returns: A copy of this view with the modifier applied.
public func natLines(_ natLines: UInt32) -> Self {
appending { w, _ in
w.setNatLines(natLines: natLines)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Inscription.setNatLines(natLines:), GObject.Object.connectNotify(detail:_:), Gtk.Inscription.getNatLines()
/// Sets the `nat-lines` of the inscription.
///
/// See the [property`Gtk`.Inscription:nat-lines] property.
///
/// 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 natLines(_ natLines: Portico.Binding<UInt32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, natLines, registry: ctx.registry, notifyDetail: "nat-lines",
read: { [w] in w.getNatLines() },
write: { [w] v in w.setNatLines(natLines: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Inscription.setNatLines(natLines:)
/// Sets the `nat-lines` of the inscription.
///
/// See the [property`Gtk`.Inscription:nat-lines] property.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Inscription.setNatLines(natLines:)`.
///
/// - Parameter natLines: The number of lines that should ideally fit into the inscription.
/// - Returns: A copy of this view with the modifier applied.
public func natLines(_ natLines: @escaping () -> UInt32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setNatLines(natLines: natLines()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Inscription.setText(text:)
/// Sets the text to be displayed.
///
/// Applied once at mount; use the `Binding`, closure, or `InterpolatedText` overload for a value that changes.
/// A string literal containing interpolation selects the `InterpolatedText` overload instead, which updates live.
///
/// - Parameter text: The displayed text.
/// - Returns: A copy of this view with the modifier applied.
@_disfavoredOverload
public func text<S: StringProtocol>(_ text: S?) -> Self {
appending { w, _ in
w.setText(text: text.map { String($0) })
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Inscription.setText(text:), GObject.Object.connectNotify(detail:_:), Gtk.Inscription.getText()
/// Sets the text to be displayed.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `String?` 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 text(_ text: Portico.Binding<String?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, text, registry: ctx.registry, notifyDetail: "text",
read: { [w] in w.getText() },
write: { [w] v in w.setText(text: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Inscription.setText(text:), GObject.Object.connectNotify(detail:_:), Gtk.Inscription.getText()
/// Sets the text to be displayed.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<String>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<String?>` to be able to clear the property.
/// When `String` 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 text(_ text: Portico.Binding<String>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, text, registry: ctx.registry, notifyDetail: "text",
read: { [w] in w.getText() },
write: { [w] v in w.setText(text: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Inscription.setText(text:)
/// Sets the text to be displayed.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Inscription.setText(text:)`.
///
/// - Parameter text: The displayed text.
/// - Returns: A copy of this view with the modifier applied.
public func text(_ text: @escaping () -> String?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setText(text: text()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(interpolation) | source: Gtk.Inscription.setText(text:)
/// Sets the text to be displayed.
///
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Gtk.Inscription.setText(text:)`. A literal with no interpolation is applied once, with no subscription.
///
/// - Parameter text: The displayed text.
/// - Returns: A copy of this view with the modifier applied.
public func text(_ text: Portico.InterpolatedText?) -> Self {
appending { w, ctx in
Portico.bindOptionalInterpolation(text, registry: ctx.registry) { [w] v in w.setText(text: v) }
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Inscription.setTextOverflow(overflow:)
/// Sets what to do when the text doesn't fit.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter textOverflow: The overflow method to use for the text.
/// - Returns: A copy of this view with the modifier applied.
public func textOverflow(_ textOverflow: Gtk.InscriptionOverflow) -> Self {
appending { w, _ in
w.setTextOverflow(overflow: textOverflow)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Inscription.setTextOverflow(overflow:), GObject.Object.connectNotify(detail:_:), Gtk.Inscription.getTextOverflow()
/// Sets what to do when the text doesn't fit.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.InscriptionOverflow` 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 textOverflow(_ textOverflow: Portico.Binding<Gtk.InscriptionOverflow>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, textOverflow, registry: ctx.registry, notifyDetail: "text-overflow",
read: { [w] in w.getTextOverflow() },
write: { [w] v in w.setTextOverflow(overflow: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Inscription.setTextOverflow(overflow:)
/// Sets what to do when the text doesn't fit.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Inscription.setTextOverflow(overflow:)`.
///
/// - Parameter textOverflow: The overflow method to use for the text.
/// - Returns: A copy of this view with the modifier applied.
public func textOverflow(_ textOverflow: @escaping () -> Gtk.InscriptionOverflow) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setTextOverflow(overflow: textOverflow()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Inscription.setWrapMode(wrapMode:)
/// Controls how line wrapping is done.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter wrapMode: Controls how the line wrapping is done.
/// - Returns: A copy of this view with the modifier applied.
public func wrapMode(_ wrapMode: Pango.WrapMode) -> Self {
appending { w, _ in
w.setWrapMode(wrapMode: wrapMode)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Inscription.setWrapMode(wrapMode:), GObject.Object.connectNotify(detail:_:), Gtk.Inscription.getWrapMode()
/// Controls how line wrapping is done.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Pango.WrapMode` 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 wrapMode(_ wrapMode: Portico.Binding<Pango.WrapMode>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, wrapMode, registry: ctx.registry, notifyDetail: "wrap-mode",
read: { [w] in w.getWrapMode() },
write: { [w] v in w.setWrapMode(wrapMode: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Inscription.setWrapMode(wrapMode:)
/// Controls how line wrapping is done.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Inscription.setWrapMode(wrapMode:)`.
///
/// - Parameter wrapMode: Controls how the line wrapping is done.
/// - Returns: A copy of this view with the modifier applied.
public func wrapMode(_ wrapMode: @escaping () -> Pango.WrapMode) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setWrapMode(wrapMode: wrapMode()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Inscription.setXalign(xalign:)
/// Sets the `xalign` of the inscription.
///
/// See the [property`Gtk`.Inscription:xalign] property.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter xalign: The horizontal alignment of the text inside the allocated size.
/// - Returns: A copy of this view with the modifier applied.
public func xalign(_ xalign: Float) -> Self {
appending { w, _ in
w.setXalign(xalign: xalign)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Inscription.setXalign(xalign:), GObject.Object.connectNotify(detail:_:), Gtk.Inscription.getXalign()
/// Sets the `xalign` of the inscription.
///
/// See the [property`Gtk`.Inscription:xalign] property.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Float` 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 xalign(_ xalign: Portico.Binding<Float>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, xalign, registry: ctx.registry, notifyDetail: "xalign",
read: { [w] in w.getXalign() },
write: { [w] v in w.setXalign(xalign: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Inscription.setXalign(xalign:)
/// Sets the `xalign` of the inscription.
///
/// See the [property`Gtk`.Inscription:xalign] property.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Inscription.setXalign(xalign:)`.
///
/// - Parameter xalign: The horizontal alignment of the text inside the allocated size.
/// - Returns: A copy of this view with the modifier applied.
public func xalign(_ xalign: @escaping () -> Float) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setXalign(xalign: xalign()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Inscription.setYalign(yalign:)
/// Sets the `yalign` of the inscription.
///
/// See the [property`Gtk`.Inscription:yalign] property.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter yalign: The vertical alignment of the text inside the allocated size.
/// - Returns: A copy of this view with the modifier applied.
public func yalign(_ yalign: Float) -> Self {
appending { w, _ in
w.setYalign(yalign: yalign)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Inscription.setYalign(yalign:), GObject.Object.connectNotify(detail:_:), Gtk.Inscription.getYalign()
/// Sets the `yalign` of the inscription.
///
/// See the [property`Gtk`.Inscription:yalign] property.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Float` 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 yalign(_ yalign: Portico.Binding<Float>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, yalign, registry: ctx.registry, notifyDetail: "yalign",
read: { [w] in w.getYalign() },
write: { [w] v in w.setYalign(yalign: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Inscription.setYalign(yalign:)
/// Sets the `yalign` of the inscription.
///
/// See the [property`Gtk`.Inscription:yalign] property.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Inscription.setYalign(yalign:)`.
///
/// - Parameter yalign: The vertical alignment of the text inside the allocated size.
/// - Returns: A copy of this view with the modifier applied.
public func yalign(_ yalign: @escaping () -> Float) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setYalign(yalign: yalign()) }
tracker.run()
ctx.registry.add(tracker)
}
}
}