portico/Sources/Portico/Generated/Picture.swift

937 lines
56 KiB
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Generated by PorticoGen. DO NOT EDIT. See Sources/PorticoGen to make changes.
import Adw
import Gtk
import Gio
import Gdk
// PorticoGen: generateStruct | source: Gtk.Picture
/// Displays a `GdkPaintable`.
///
/// <picture>
/// <source srcset="picture-dark.png" media="(prefers-color-scheme: dark)">
/// <img alt="An example GtkPicture" src="picture.png">
/// </picture>
///
/// Many convenience functions are provided to make pictures simple to use.
/// For example, if you want to load an image from a file, and then display
/// it, theres a convenience function to do this:
///
/// ```c
/// GtkWidget *widget = gtk_picture_new_for_filename ("myfile.png");
/// ```
///
/// If the file isnt loaded successfully, the picture will contain a
/// broken image icon similar to that used in many web browsers.
/// If you want to handle errors in loading the file yourself,
/// for example by displaying an error message, then load the image with
/// and image loading framework such as libglycin, then create the `GtkPicture`
/// with [ctor`Gtk`.Picture.new_for_paintable].
///
/// Sometimes an application will want to avoid depending on external data
/// files, such as image files. See the documentation of `GResource` for details.
/// In this case, [ctor`Gtk`.Picture.new_for_resource] and
/// [method`Gtk`.Picture.set_resource] should be used.
///
/// `GtkPicture` displays an image at its natural size. See [class`Gtk`.Image]
/// if you want to display a fixed-size image, such as an icon.
///
/// ## Sizing the paintable
///
/// You can influence how the paintable is displayed inside the `GtkPicture`
/// by changing [property`Gtk`.Picture:content-fit]. See [enum`Gtk`.ContentFit]
/// for details. [property`Gtk`.Picture:can-shrink] can be unset to make sure
/// that paintables are never made smaller than their ideal size - but
/// be careful if you do not know the size of the paintable in use (like
/// when displaying user-loaded images). This can easily cause the picture to
/// grow larger than the screen. And [property`Gtk`.Widget:halign] and
/// [property`Gtk`.Widget:valign] can be used to make sure the paintable doesn't
/// fill all available space but is instead displayed at its original size.
///
/// ## CSS nodes
///
/// `GtkPicture` has a single CSS node with the name `picture`.
///
/// ## Accessibility
///
/// `GtkPicture` uses the [enum`Gtk`.AccessibleRole.img] role.
///
/// A Portico view that mounts a `Gtk.Picture`.
@MainActor public struct Picture: View {
private let make: (MountContext) -> Gtk.Picture
private var configure: [(Gtk.Picture, MountContext) -> Void] = []
public var body: Never { fatalError() }
// PorticoGen: generateInits(static) | source: Gtk.Picture.init()
/// Creates a new empty `GtkPicture` widget.
///
/// 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 alternativeText: The alternative textual description for the picture.
/// - Parameter canShrink: If the `GtkPicture` can be made smaller than the natural size of its contents.
/// - Parameter contentFit: How the content should be resized to fit inside the `GtkPicture`.
/// - Parameter isolateContents: If the rendering of the contents is isolated from the rest of the widget tree.
/// - Parameter keepAspectRatio: Whether the GtkPicture will render its contents trying to preserve the aspect ratio.
public init(alternativeText: String? = nil, canShrink: Bool? = nil, contentFit: Gtk.ContentFit? = nil, isolateContents: Bool? = nil, keepAspectRatio: Bool? = nil) {
make = { _ in Gtk.Picture() }
configure.append { w, _ in
if let alternativeText { w.setAlternativeText(alternativeText: alternativeText) }
if let canShrink { w.setCanShrink(canShrink: canShrink) }
if let contentFit { w.setContentFit(contentFit: contentFit) }
if let isolateContents { w.setIsolateContents(isolateContents: isolateContents) }
if let keepAspectRatio { w.setKeepAspectRatio(keepAspectRatio: keepAspectRatio) }
}
}
// PorticoGen: generateInits(static) | source: Gtk.Picture.init(file:)
/// Creates a new `GtkPicture` displaying the given `file`.
///
/// If the file isnt found or cant be loaded, the resulting
/// `GtkPicture` is empty.
///
/// If you need to detect failures to load the file, use an
/// image loading framework such as libglycin to load the file
/// yourself, then create the `GtkPicture` from the texture.
///
/// 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 file: The `GFile` that is displayed or `nil` if none.
/// - Parameter alternativeText: The alternative textual description for the picture.
/// - Parameter canShrink: If the `GtkPicture` can be made smaller than the natural size of its contents.
/// - Parameter contentFit: How the content should be resized to fit inside the `GtkPicture`.
/// - Parameter isolateContents: If the rendering of the contents is isolated from the rest of the widget tree.
/// - Parameter keepAspectRatio: Whether the GtkPicture will render its contents trying to preserve the aspect ratio.
public init(file: Gtk.File?, alternativeText: String? = nil, canShrink: Bool? = nil, contentFit: Gtk.ContentFit? = nil, isolateContents: Bool? = nil, keepAspectRatio: Bool? = nil) {
make = { _ in Gtk.Picture(file: file) }
configure.append { w, _ in
if let alternativeText { w.setAlternativeText(alternativeText: alternativeText) }
if let canShrink { w.setCanShrink(canShrink: canShrink) }
if let contentFit { w.setContentFit(contentFit: contentFit) }
if let isolateContents { w.setIsolateContents(isolateContents: isolateContents) }
if let keepAspectRatio { w.setKeepAspectRatio(keepAspectRatio: keepAspectRatio) }
}
}
// PorticoGen: generateInits(binding) | source: Gtk.Picture.init(file:), Gtk.Picture.setFile(file:)
/// Creates a new `GtkPicture` displaying the given `file`.
///
/// If the file isnt found or cant be loaded, the resulting
/// `GtkPicture` is empty.
///
/// If you need to detect failures to load the file, use an
/// image loading framework such as libglycin to load the file
/// yourself, then create the `GtkPicture` from the texture.
///
/// The initial value is the binding's current value; every later change is pushed into the widget through `Gtk.Picture.setFile(file:)` 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 file: The `GFile` that is displayed or `nil` if none.
/// - Parameter alternativeText: The alternative textual description for the picture.
/// - Parameter canShrink: If the `GtkPicture` can be made smaller than the natural size of its contents.
/// - Parameter contentFit: How the content should be resized to fit inside the `GtkPicture`.
/// - Parameter isolateContents: If the rendering of the contents is isolated from the rest of the widget tree.
/// - Parameter keepAspectRatio: Whether the GtkPicture will render its contents trying to preserve the aspect ratio.
public init(file: Portico.Binding<Gtk.File?>, alternativeText: Portico.Binding<String?>? = nil, canShrink: Portico.Binding<Bool>? = nil, contentFit: Portico.Binding<Gtk.ContentFit>? = nil, isolateContents: Portico.Binding<Bool>? = nil, keepAspectRatio: Portico.Binding<Bool>? = nil) {
make = { _ in Gtk.Picture(file: file.wrappedValue) }
configure.append { w, ctx in
ctx.registry.add(file.subscribe { [w] v in w.setFile(file: v) })
if let alternativeText {
Portico.bindProperty(w, alternativeText, registry: ctx.registry, notifyDetail: "alternative-text", read: { [w] in w.getAlternativeText() }, write: { [w] v in w.setAlternativeText(alternativeText: v) })
}
if let canShrink {
Portico.bindProperty(w, canShrink, registry: ctx.registry, notifyDetail: "can-shrink", read: { [w] in w.getCanShrink() }, write: { [w] v in w.setCanShrink(canShrink: v) })
}
if let contentFit {
Portico.bindProperty(w, contentFit, registry: ctx.registry, notifyDetail: "content-fit", read: { [w] in w.getContentFit() }, write: { [w] v in w.setContentFit(contentFit: v) })
}
if let isolateContents {
Portico.bindProperty(w, isolateContents, registry: ctx.registry, notifyDetail: "isolate-contents", read: { [w] in w.getIsolateContents() }, write: { [w] v in w.setIsolateContents(isolateContents: v) })
}
if let keepAspectRatio {
Portico.bindProperty(w, keepAspectRatio, registry: ctx.registry, notifyDetail: "keep-aspect-ratio", read: { [w] in w.getKeepAspectRatio() }, write: { [w] v in w.setKeepAspectRatio(keepAspectRatio: v) })
}
}
}
// PorticoGen: generateInits(closure) | source: Gtk.Picture.init(file:), Gtk.Picture.setFile(file:)
/// Creates a new `GtkPicture` displaying the given `file`.
///
/// If the file isnt found or cant be loaded, the resulting
/// `GtkPicture` is empty.
///
/// If you need to detect failures to load the file, use an
/// image loading framework such as libglycin to load the file
/// yourself, then create the `GtkPicture` from the texture.
///
/// Each closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Picture.setFile(file:)`.
/// 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 file: The `GFile` that is displayed or `nil` if none.
/// - Parameter alternativeText: The alternative textual description for the picture.
/// - Parameter canShrink: If the `GtkPicture` can be made smaller than the natural size of its contents.
/// - Parameter contentFit: How the content should be resized to fit inside the `GtkPicture`.
/// - Parameter isolateContents: If the rendering of the contents is isolated from the rest of the widget tree.
/// - Parameter keepAspectRatio: Whether the GtkPicture will render its contents trying to preserve the aspect ratio.
public init(file: @escaping () -> Gtk.File?, alternativeText: String? = nil, canShrink: Bool? = nil, contentFit: Gtk.ContentFit? = nil, isolateContents: Bool? = nil, keepAspectRatio: Bool? = nil) {
make = { _ in Gtk.Picture(file: file()) }
configure.append { w, ctx in
let t0 = DependencyTracker { [w] in w.setFile(file: file()) }
t0.run()
ctx.registry.add(t0)
if let alternativeText { w.setAlternativeText(alternativeText: alternativeText) }
if let canShrink { w.setCanShrink(canShrink: canShrink) }
if let contentFit { w.setContentFit(contentFit: contentFit) }
if let isolateContents { w.setIsolateContents(isolateContents: isolateContents) }
if let keepAspectRatio { w.setKeepAspectRatio(keepAspectRatio: keepAspectRatio) }
}
}
// PorticoGen: generateInits(static) | source: Gtk.Picture.init(filename:)
/// Creates a new `GtkPicture` displaying the file `filename`.
///
/// This is a utility function that calls [ctor`Gtk`.Picture.new_for_file].
/// See that function for details.
///
/// 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 filename: Makes `self` load and display the given `filename`.
/// - Parameter alternativeText: The alternative textual description for the picture.
/// - Parameter canShrink: If the `GtkPicture` can be made smaller than the natural size of its contents.
/// - Parameter contentFit: How the content should be resized to fit inside the `GtkPicture`.
/// - Parameter isolateContents: If the rendering of the contents is isolated from the rest of the widget tree.
/// - Parameter keepAspectRatio: Whether the GtkPicture will render its contents trying to preserve the aspect ratio.
public init(filename: String?, alternativeText: String? = nil, canShrink: Bool? = nil, contentFit: Gtk.ContentFit? = nil, isolateContents: Bool? = nil, keepAspectRatio: Bool? = nil) {
make = { _ in Gtk.Picture(filename: filename) }
configure.append { w, _ in
if let alternativeText { w.setAlternativeText(alternativeText: alternativeText) }
if let canShrink { w.setCanShrink(canShrink: canShrink) }
if let contentFit { w.setContentFit(contentFit: contentFit) }
if let isolateContents { w.setIsolateContents(isolateContents: isolateContents) }
if let keepAspectRatio { w.setKeepAspectRatio(keepAspectRatio: keepAspectRatio) }
}
}
// PorticoGen: generateInits(static) | source: Gtk.Picture.init(paintable:)
/// Creates a new `GtkPicture` displaying `paintable`.
///
/// The `GtkPicture` will track changes to the `paintable` and update
/// its size and contents in response to it.
///
/// 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 paintable: The `GdkPaintable` to be displayed by this `GtkPicture`.
/// - Parameter alternativeText: The alternative textual description for the picture.
/// - Parameter canShrink: If the `GtkPicture` can be made smaller than the natural size of its contents.
/// - Parameter contentFit: How the content should be resized to fit inside the `GtkPicture`.
/// - Parameter isolateContents: If the rendering of the contents is isolated from the rest of the widget tree.
/// - Parameter keepAspectRatio: Whether the GtkPicture will render its contents trying to preserve the aspect ratio.
public init(paintable: Gtk.Paintable?, alternativeText: String? = nil, canShrink: Bool? = nil, contentFit: Gtk.ContentFit? = nil, isolateContents: Bool? = nil, keepAspectRatio: Bool? = nil) {
make = { _ in Gtk.Picture(paintable: paintable) }
configure.append { w, _ in
if let alternativeText { w.setAlternativeText(alternativeText: alternativeText) }
if let canShrink { w.setCanShrink(canShrink: canShrink) }
if let contentFit { w.setContentFit(contentFit: contentFit) }
if let isolateContents { w.setIsolateContents(isolateContents: isolateContents) }
if let keepAspectRatio { w.setKeepAspectRatio(keepAspectRatio: keepAspectRatio) }
}
}
// PorticoGen: generateInits(binding) | source: Gtk.Picture.init(paintable:), Gtk.Picture.setPaintable(paintable:)
/// Creates a new `GtkPicture` displaying `paintable`.
///
/// The `GtkPicture` will track changes to the `paintable` and update
/// its size and contents in response to it.
///
/// The initial value is the binding's current value; every later change is pushed into the widget through `Gtk.Picture.setPaintable(paintable:)` 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 paintable: The `GdkPaintable` to be displayed by this `GtkPicture`.
/// - Parameter alternativeText: The alternative textual description for the picture.
/// - Parameter canShrink: If the `GtkPicture` can be made smaller than the natural size of its contents.
/// - Parameter contentFit: How the content should be resized to fit inside the `GtkPicture`.
/// - Parameter isolateContents: If the rendering of the contents is isolated from the rest of the widget tree.
/// - Parameter keepAspectRatio: Whether the GtkPicture will render its contents trying to preserve the aspect ratio.
public init(paintable: Portico.Binding<Gtk.Paintable?>, alternativeText: Portico.Binding<String?>? = nil, canShrink: Portico.Binding<Bool>? = nil, contentFit: Portico.Binding<Gtk.ContentFit>? = nil, isolateContents: Portico.Binding<Bool>? = nil, keepAspectRatio: Portico.Binding<Bool>? = nil) {
make = { _ in Gtk.Picture(paintable: paintable.wrappedValue) }
configure.append { w, ctx in
ctx.registry.add(paintable.subscribe { [w] v in w.setPaintable(paintable: v) })
if let alternativeText {
Portico.bindProperty(w, alternativeText, registry: ctx.registry, notifyDetail: "alternative-text", read: { [w] in w.getAlternativeText() }, write: { [w] v in w.setAlternativeText(alternativeText: v) })
}
if let canShrink {
Portico.bindProperty(w, canShrink, registry: ctx.registry, notifyDetail: "can-shrink", read: { [w] in w.getCanShrink() }, write: { [w] v in w.setCanShrink(canShrink: v) })
}
if let contentFit {
Portico.bindProperty(w, contentFit, registry: ctx.registry, notifyDetail: "content-fit", read: { [w] in w.getContentFit() }, write: { [w] v in w.setContentFit(contentFit: v) })
}
if let isolateContents {
Portico.bindProperty(w, isolateContents, registry: ctx.registry, notifyDetail: "isolate-contents", read: { [w] in w.getIsolateContents() }, write: { [w] v in w.setIsolateContents(isolateContents: v) })
}
if let keepAspectRatio {
Portico.bindProperty(w, keepAspectRatio, registry: ctx.registry, notifyDetail: "keep-aspect-ratio", read: { [w] in w.getKeepAspectRatio() }, write: { [w] v in w.setKeepAspectRatio(keepAspectRatio: v) })
}
}
}
// PorticoGen: generateInits(closure) | source: Gtk.Picture.init(paintable:), Gtk.Picture.setPaintable(paintable:)
/// Creates a new `GtkPicture` displaying `paintable`.
///
/// The `GtkPicture` will track changes to the `paintable` and update
/// its size and contents in response to it.
///
/// Each closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Picture.setPaintable(paintable:)`.
/// 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 paintable: The `GdkPaintable` to be displayed by this `GtkPicture`.
/// - Parameter alternativeText: The alternative textual description for the picture.
/// - Parameter canShrink: If the `GtkPicture` can be made smaller than the natural size of its contents.
/// - Parameter contentFit: How the content should be resized to fit inside the `GtkPicture`.
/// - Parameter isolateContents: If the rendering of the contents is isolated from the rest of the widget tree.
/// - Parameter keepAspectRatio: Whether the GtkPicture will render its contents trying to preserve the aspect ratio.
public init(paintable: @escaping () -> Gtk.Paintable?, alternativeText: String? = nil, canShrink: Bool? = nil, contentFit: Gtk.ContentFit? = nil, isolateContents: Bool? = nil, keepAspectRatio: Bool? = nil) {
make = { _ in Gtk.Picture(paintable: paintable()) }
configure.append { w, ctx in
let t0 = DependencyTracker { [w] in w.setPaintable(paintable: paintable()) }
t0.run()
ctx.registry.add(t0)
if let alternativeText { w.setAlternativeText(alternativeText: alternativeText) }
if let canShrink { w.setCanShrink(canShrink: canShrink) }
if let contentFit { w.setContentFit(contentFit: contentFit) }
if let isolateContents { w.setIsolateContents(isolateContents: isolateContents) }
if let keepAspectRatio { w.setKeepAspectRatio(keepAspectRatio: keepAspectRatio) }
}
}
// PorticoGen: generateInits(static) | source: Gtk.Picture.init(pixbuf:)
/// Creates a new `GtkPicture` displaying `pixbuf`.
///
/// This is a utility function that calls [ctor`Gtk`.Picture.new_for_paintable],
/// See that function for details.
///
/// The pixbuf must not be modified after passing it to this function.
///
/// 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 pixbuf: Sets a `GtkPicture` to show a `GdkPixbuf`.
/// - Parameter alternativeText: The alternative textual description for the picture.
/// - Parameter canShrink: If the `GtkPicture` can be made smaller than the natural size of its contents.
/// - Parameter contentFit: How the content should be resized to fit inside the `GtkPicture`.
/// - Parameter isolateContents: If the rendering of the contents is isolated from the rest of the widget tree.
/// - Parameter keepAspectRatio: Whether the GtkPicture will render its contents trying to preserve the aspect ratio.
public init(pixbuf: Gtk.Pixbuf?, alternativeText: String? = nil, canShrink: Bool? = nil, contentFit: Gtk.ContentFit? = nil, isolateContents: Bool? = nil, keepAspectRatio: Bool? = nil) {
make = { _ in Gtk.Picture(pixbuf: pixbuf) }
configure.append { w, _ in
if let alternativeText { w.setAlternativeText(alternativeText: alternativeText) }
if let canShrink { w.setCanShrink(canShrink: canShrink) }
if let contentFit { w.setContentFit(contentFit: contentFit) }
if let isolateContents { w.setIsolateContents(isolateContents: isolateContents) }
if let keepAspectRatio { w.setKeepAspectRatio(keepAspectRatio: keepAspectRatio) }
}
}
// PorticoGen: generateInits(static) | source: Gtk.Picture.init(resourcePath:)
/// Creates a new `GtkPicture` displaying the resource at `resource_path`.
///
/// This is a utility function that calls [ctor`Gtk`.Picture.new_for_file].
/// See that function for details.
///
/// 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 resourcePath: The `resourcePath` value forwarded to `Gtk.Picture`.
/// - Parameter alternativeText: The alternative textual description for the picture.
/// - Parameter canShrink: If the `GtkPicture` can be made smaller than the natural size of its contents.
/// - Parameter contentFit: How the content should be resized to fit inside the `GtkPicture`.
/// - Parameter isolateContents: If the rendering of the contents is isolated from the rest of the widget tree.
/// - Parameter keepAspectRatio: Whether the GtkPicture will render its contents trying to preserve the aspect ratio.
public init(resourcePath: String?, alternativeText: String? = nil, canShrink: Bool? = nil, contentFit: Gtk.ContentFit? = nil, isolateContents: Bool? = nil, keepAspectRatio: Bool? = nil) {
make = { _ in Gtk.Picture(resourcePath: resourcePath) }
configure.append { w, _ in
if let alternativeText { w.setAlternativeText(alternativeText: alternativeText) }
if let canShrink { w.setCanShrink(canShrink: canShrink) }
if let contentFit { w.setContentFit(contentFit: contentFit) }
if let isolateContents { w.setIsolateContents(isolateContents: isolateContents) }
if let keepAspectRatio { w.setKeepAspectRatio(keepAspectRatio: keepAspectRatio) }
}
}
}
extension Picture: WidgetView {
public typealias Target = Gtk.Picture
@_spi(Portico) public func appending(
_ step: @escaping (Gtk.Picture, MountContext) -> Void
) -> Self {
var c = self
c.configure.append(step)
return c
}
}
@_spi(Portico) extension Picture: 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.Picture
/// Modifiers for `Gtk.Picture`, available on every Portico view whose
/// backing widget is `Gtk.Picture` or one of its subclasses.
extension WidgetView where Target: Gtk.Picture {
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Picture.setAlternativeText(alternativeText:)
/// Sets an alternative textual description for the picture contents.
///
/// It is equivalent to the "alt" attribute for images on websites.
///
/// This text will be made available to accessibility tools.
///
/// If the picture cannot be described textually, set this property to `nil`.
///
/// 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 alternativeText: The alternative textual description for the picture.
/// - Returns: A copy of this view with the modifier applied.
@_disfavoredOverload
public func alternativeText<S: StringProtocol>(_ alternativeText: S?) -> Self {
appending { w, _ in
w.setAlternativeText(alternativeText: alternativeText.map { String($0) })
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Picture.setAlternativeText(alternativeText:), GObject.Object.connectNotify(detail:_:), Gtk.Picture.getAlternativeText()
/// Sets an alternative textual description for the picture contents.
///
/// It is equivalent to the "alt" attribute for images on websites.
///
/// This text will be made available to accessibility tools.
///
/// If the picture cannot be described textually, set this property to `nil`.
///
/// 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 alternativeText(_ alternativeText: Portico.Binding<String?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, alternativeText, registry: ctx.registry, notifyDetail: "alternative-text",
read: { [w] in w.getAlternativeText() },
write: { [w] v in w.setAlternativeText(alternativeText: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Picture.setAlternativeText(alternativeText:), GObject.Object.connectNotify(detail:_:), Gtk.Picture.getAlternativeText()
/// Sets an alternative textual description for the picture contents.
///
/// It is equivalent to the "alt" attribute for images on websites.
///
/// This text will be made available to accessibility tools.
///
/// If the picture cannot be described textually, set this property to `nil`.
///
/// 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 alternativeText(_ alternativeText: Portico.Binding<String>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, alternativeText, registry: ctx.registry, notifyDetail: "alternative-text",
read: { [w] in w.getAlternativeText() },
write: { [w] v in w.setAlternativeText(alternativeText: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Picture.setAlternativeText(alternativeText:)
/// Sets an alternative textual description for the picture contents.
///
/// It is equivalent to the "alt" attribute for images on websites.
///
/// This text will be made available to accessibility tools.
///
/// If the picture cannot be described textually, set this property to `nil`.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Picture.setAlternativeText(alternativeText:)`.
///
/// - Parameter alternativeText: The alternative textual description for the picture.
/// - Returns: A copy of this view with the modifier applied.
public func alternativeText(_ alternativeText: @escaping () -> String?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setAlternativeText(alternativeText: alternativeText()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(interpolation) | source: Gtk.Picture.setAlternativeText(alternativeText:)
/// Sets an alternative textual description for the picture contents.
///
/// It is equivalent to the "alt" attribute for images on websites.
///
/// This text will be made available to accessibility tools.
///
/// If the picture cannot be described textually, set this property to `nil`.
///
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Gtk.Picture.setAlternativeText(alternativeText:)`. A literal with no interpolation is applied once, with no subscription.
///
/// - Parameter alternativeText: The alternative textual description for the picture.
/// - Returns: A copy of this view with the modifier applied.
public func alternativeText(_ alternativeText: Portico.InterpolatedText?) -> Self {
appending { w, ctx in
Portico.bindOptionalInterpolation(alternativeText, registry: ctx.registry) { [w] v in w.setAlternativeText(alternativeText: v) }
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Picture.setCanShrink(canShrink:)
/// If set to `true`, then `self` can be made smaller than its contents.
///
/// The contents will then be scaled down when rendering.
///
/// If you want to still force a minimum size manually, consider using
/// [method`Gtk`.Widget.set_size_request].
///
/// Also of note is that a similar function for growing does not exist
/// because the grow behavior can be controlled via
/// [method`Gtk`.Widget.set_halign] and [method`Gtk`.Widget.set_valign].
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter canShrink: If the `GtkPicture` can be made smaller than the natural size of its contents.
/// - Returns: A copy of this view with the modifier applied.
public func canShrink(_ canShrink: Bool) -> Self {
appending { w, _ in
w.setCanShrink(canShrink: canShrink)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Picture.setCanShrink(canShrink:), GObject.Object.connectNotify(detail:_:), Gtk.Picture.getCanShrink()
/// If set to `true`, then `self` can be made smaller than its contents.
///
/// The contents will then be scaled down when rendering.
///
/// If you want to still force a minimum size manually, consider using
/// [method`Gtk`.Widget.set_size_request].
///
/// Also of note is that a similar function for growing does not exist
/// because the grow behavior can be controlled via
/// [method`Gtk`.Widget.set_halign] and [method`Gtk`.Widget.set_valign].
///
/// 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 canShrink(_ canShrink: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, canShrink, registry: ctx.registry, notifyDetail: "can-shrink",
read: { [w] in w.getCanShrink() },
write: { [w] v in w.setCanShrink(canShrink: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Picture.setCanShrink(canShrink:)
/// If set to `true`, then `self` can be made smaller than its contents.
///
/// The contents will then be scaled down when rendering.
///
/// If you want to still force a minimum size manually, consider using
/// [method`Gtk`.Widget.set_size_request].
///
/// Also of note is that a similar function for growing does not exist
/// because the grow behavior can be controlled via
/// [method`Gtk`.Widget.set_halign] and [method`Gtk`.Widget.set_valign].
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Picture.setCanShrink(canShrink:)`.
///
/// - Parameter canShrink: If the `GtkPicture` can be made smaller than the natural size of its contents.
/// - Returns: A copy of this view with the modifier applied.
public func canShrink(_ canShrink: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setCanShrink(canShrink: canShrink()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Picture.setContentFit(contentFit:)
/// Sets how the content should be resized to fit the `GtkPicture`.
///
/// See [enum`Gtk`.ContentFit] for details.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter contentFit: How the content should be resized to fit inside the `GtkPicture`.
/// - Returns: A copy of this view with the modifier applied.
public func contentFit(_ contentFit: Gtk.ContentFit) -> Self {
appending { w, _ in
w.setContentFit(contentFit: contentFit)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Picture.setContentFit(contentFit:), GObject.Object.connectNotify(detail:_:), Gtk.Picture.getContentFit()
/// Sets how the content should be resized to fit the `GtkPicture`.
///
/// See [enum`Gtk`.ContentFit] for details.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.ContentFit` 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 contentFit(_ contentFit: Portico.Binding<Gtk.ContentFit>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, contentFit, registry: ctx.registry, notifyDetail: "content-fit",
read: { [w] in w.getContentFit() },
write: { [w] v in w.setContentFit(contentFit: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Picture.setContentFit(contentFit:)
/// Sets how the content should be resized to fit the `GtkPicture`.
///
/// See [enum`Gtk`.ContentFit] for details.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Picture.setContentFit(contentFit:)`.
///
/// - Parameter contentFit: How the content should be resized to fit inside the `GtkPicture`.
/// - Returns: A copy of this view with the modifier applied.
public func contentFit(_ contentFit: @escaping () -> Gtk.ContentFit) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setContentFit(contentFit: contentFit()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Picture.setFile(file:)
/// Makes `self` load and display `file`.
///
/// See [ctor`Gtk`.Picture.new_for_file] for details.
///
/// ::: warning
/// Note that this function should not be used with untrusted data.
/// Use a proper image loading framework such as libglycin, which can
/// load many image formats into a `GdkTexture`, and then use
/// [method`Gtk`.Image.set_from_paintable].
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter file: The `GFile` that is displayed or `nil` if none.
/// - Returns: A copy of this view with the modifier applied.
public func file(_ file: Gtk.File?) -> Self {
appending { w, _ in
w.setFile(file: file)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Picture.setFile(file:), GObject.Object.connectNotify(detail:_:), Gtk.Picture.getFile()
/// Makes `self` load and display `file`.
///
/// See [ctor`Gtk`.Picture.new_for_file] for details.
///
/// ::: warning
/// Note that this function should not be used with untrusted data.
/// Use a proper image loading framework such as libglycin, which can
/// load many image formats into a `GdkTexture`, and then use
/// [method`Gtk`.Image.set_from_paintable].
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.File?` 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 file(_ file: Portico.Binding<Gtk.File?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, file, registry: ctx.registry, notifyDetail: "file",
read: { [w] in w.getFile() },
write: { [w] v in w.setFile(file: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Picture.setFile(file:), GObject.Object.connectNotify(detail:_:), Gtk.Picture.getFile()
/// Makes `self` load and display `file`.
///
/// See [ctor`Gtk`.Picture.new_for_file] for details.
///
/// ::: warning
/// Note that this function should not be used with untrusted data.
/// Use a proper image loading framework such as libglycin, which can
/// load many image formats into a `GdkTexture`, and then use
/// [method`Gtk`.Image.set_from_paintable].
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Gtk.File>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.File?>` to be able to clear the property.
/// When `Gtk.File` 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 file(_ file: Portico.Binding<Gtk.File>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, file, registry: ctx.registry, notifyDetail: "file",
read: { [w] in w.getFile() },
write: { [w] v in w.setFile(file: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Picture.setFile(file:)
/// Makes `self` load and display `file`.
///
/// See [ctor`Gtk`.Picture.new_for_file] for details.
///
/// ::: warning
/// Note that this function should not be used with untrusted data.
/// Use a proper image loading framework such as libglycin, which can
/// load many image formats into a `GdkTexture`, and then use
/// [method`Gtk`.Image.set_from_paintable].
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Picture.setFile(file:)`.
///
/// - Parameter file: The `GFile` that is displayed or `nil` if none.
/// - Returns: A copy of this view with the modifier applied.
public func file(_ file: @escaping () -> Gtk.File?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setFile(file: file()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Picture.setIsolateContents(isolateContents:)
/// If set to true, then the contents will be rendered individually.
///
/// If set to false they will be able to erase or otherwise mix with
/// the background.
///
/// GTK supports finer grained isolation, in rare cases where you need
/// this, you can use [method`Gtk`.Snapshot.push_isolation] yourself to
/// achieve this.
///
/// By default contents are isolated.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter isolateContents: If the rendering of the contents is isolated from the rest of the widget tree.
/// - Returns: A copy of this view with the modifier applied.
public func isolateContents(_ isolateContents: Bool) -> Self {
appending { w, _ in
w.setIsolateContents(isolateContents: isolateContents)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Picture.setIsolateContents(isolateContents:), GObject.Object.connectNotify(detail:_:), Gtk.Picture.getIsolateContents()
/// If set to true, then the contents will be rendered individually.
///
/// If set to false they will be able to erase or otherwise mix with
/// the background.
///
/// GTK supports finer grained isolation, in rare cases where you need
/// this, you can use [method`Gtk`.Snapshot.push_isolation] yourself to
/// achieve this.
///
/// By default contents are isolated.
///
/// 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 isolateContents(_ isolateContents: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, isolateContents, registry: ctx.registry, notifyDetail: "isolate-contents",
read: { [w] in w.getIsolateContents() },
write: { [w] v in w.setIsolateContents(isolateContents: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Picture.setIsolateContents(isolateContents:)
/// If set to true, then the contents will be rendered individually.
///
/// If set to false they will be able to erase or otherwise mix with
/// the background.
///
/// GTK supports finer grained isolation, in rare cases where you need
/// this, you can use [method`Gtk`.Snapshot.push_isolation] yourself to
/// achieve this.
///
/// By default contents are isolated.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Picture.setIsolateContents(isolateContents:)`.
///
/// - Parameter isolateContents: If the rendering of the contents is isolated from the rest of the widget tree.
/// - Returns: A copy of this view with the modifier applied.
public func isolateContents(_ isolateContents: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setIsolateContents(isolateContents: isolateContents()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Picture.setKeepAspectRatio(keepAspectRatio:)
/// If set to `true`, the `self` will render its contents according to
/// their aspect ratio.
///
/// That means that empty space may show up at the top/bottom or
/// left/right of `self`.
///
/// If set to `false` or if the contents provide no aspect ratio,
/// the contents will be stretched over the picture's whole area.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter keepAspectRatio: Whether the GtkPicture will render its contents trying to preserve the aspect ratio.
/// - Returns: A copy of this view with the modifier applied.
public func keepAspectRatio(_ keepAspectRatio: Bool) -> Self {
appending { w, _ in
w.setKeepAspectRatio(keepAspectRatio: keepAspectRatio)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Picture.setKeepAspectRatio(keepAspectRatio:), GObject.Object.connectNotify(detail:_:), Gtk.Picture.getKeepAspectRatio()
/// If set to `true`, the `self` will render its contents according to
/// their aspect ratio.
///
/// That means that empty space may show up at the top/bottom or
/// left/right of `self`.
///
/// If set to `false` or if the contents provide no aspect ratio,
/// the contents will be stretched over the picture's whole area.
///
/// 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 keepAspectRatio(_ keepAspectRatio: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, keepAspectRatio, registry: ctx.registry, notifyDetail: "keep-aspect-ratio",
read: { [w] in w.getKeepAspectRatio() },
write: { [w] v in w.setKeepAspectRatio(keepAspectRatio: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Picture.setKeepAspectRatio(keepAspectRatio:)
/// If set to `true`, the `self` will render its contents according to
/// their aspect ratio.
///
/// That means that empty space may show up at the top/bottom or
/// left/right of `self`.
///
/// If set to `false` or if the contents provide no aspect ratio,
/// the contents will be stretched over the picture's whole area.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Picture.setKeepAspectRatio(keepAspectRatio:)`.
///
/// - Parameter keepAspectRatio: Whether the GtkPicture will render its contents trying to preserve the aspect ratio.
/// - Returns: A copy of this view with the modifier applied.
public func keepAspectRatio(_ keepAspectRatio: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setKeepAspectRatio(keepAspectRatio: keepAspectRatio()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Picture.setPaintable(paintable:)
/// Makes `self` display the given `paintable`.
///
/// If `paintable` is `NULL`, nothing will be displayed.
///
/// See [ctor`Gtk`.Picture.new_for_paintable] for details.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter paintable: The `GdkPaintable` to be displayed by this `GtkPicture`.
/// - Returns: A copy of this view with the modifier applied.
public func paintable(_ paintable: Gtk.Paintable?) -> Self {
appending { w, _ in
w.setPaintable(paintable: paintable)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Picture.setPaintable(paintable:), GObject.Object.connectNotify(detail:_:), Gtk.Picture.getPaintable()
/// Makes `self` display the given `paintable`.
///
/// If `paintable` is `NULL`, nothing will be displayed.
///
/// See [ctor`Gtk`.Picture.new_for_paintable] for details.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.Paintable?` 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 paintable(_ paintable: Portico.Binding<Gtk.Paintable?>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, paintable, registry: ctx.registry, notifyDetail: "paintable",
read: { [w] in w.getPaintable() },
write: { [w] v in w.setPaintable(paintable: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Picture.setPaintable(paintable:), GObject.Object.connectNotify(detail:_:), Gtk.Picture.getPaintable()
/// Makes `self` display the given `paintable`.
///
/// If `paintable` is `NULL`, nothing will be displayed.
///
/// See [ctor`Gtk`.Picture.new_for_paintable] for details.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant, so a `Binding<Gtk.Paintable>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.Paintable?>` to be able to clear the property.
/// When `Gtk.Paintable` 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 paintable(_ paintable: Portico.Binding<Gtk.Paintable>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, paintable, registry: ctx.registry, notifyDetail: "paintable",
read: { [w] in w.getPaintable() },
write: { [w] v in w.setPaintable(paintable: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Picture.setPaintable(paintable:)
/// Makes `self` display the given `paintable`.
///
/// If `paintable` is `NULL`, nothing will be displayed.
///
/// See [ctor`Gtk`.Picture.new_for_paintable] for details.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Picture.setPaintable(paintable:)`.
///
/// - Parameter paintable: The `GdkPaintable` to be displayed by this `GtkPicture`.
/// - Returns: A copy of this view with the modifier applied.
public func paintable(_ paintable: @escaping () -> Gtk.Paintable?) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setPaintable(paintable: paintable()) }
tracker.run()
ctx.registry.add(tracker)
}
}
}