portico/Sources/Portico/Generated/PasswordEntryRow.swift

104 lines
5.9 KiB
Swift

// Generated by PorticoGen. DO NOT EDIT. See Sources/PorticoGen to make changes.
import Adw
import Gtk
import Gio
import Gdk
// PorticoGen: generateStruct | source: Adw.PasswordEntryRow
/// A [class`EntryRow`] tailored for entering secrets.
///
/// <picture>
/// <source srcset="password-entry-row-dark.png" media="(prefers-color-scheme: dark)">
/// <img src="password-entry-row.png" alt="password-entry-row">
/// </picture>
///
/// It does not show its contents in clear text, does not allow to copy it to the
/// clipboard, and shows a warning when Caps Lock is engaged. If the underlying
/// platform allows it, `AdwPasswordEntryRow` will also place the text in a
/// non-pageable memory area, to avoid it being written out to disk by the
/// operating system.
///
/// It offer a way to reveal the contents in clear text.
///
/// ## CSS Nodes
///
/// `AdwPasswordEntryRow` has a single CSS node with name `row` that carries
/// `.entry` and `.password` style classes.
///
/// A Portico view that mounts a `Adw.PasswordEntryRow`.
@MainActor public struct PasswordEntryRow: View {
private let make: (MountContext) -> Adw.PasswordEntryRow
private var configure: [(Adw.PasswordEntryRow, MountContext) -> Void] = []
public var body: Never { fatalError() }
// PorticoGen: generateInits(static) | source: Adw.PasswordEntryRow.init()
/// Creates a new `AdwPasswordEntryRow`.
///
/// Applied once at mount; use the `Binding` or closure overload for values that change.
/// Each closure is evaluated once; children are added in order and slot closures mount their first view.
/// An empty closure adds no children and leaves slots unset.
/// Optional value parameters are applied only when non-`nil`; a `nil` argument leaves the widget's own default in place and cannot clear a nullable property - use the matching modifier for that.
///
/// - Parameter activatesDefault: Whether activating the embedded entry can activate the default widget.
/// - Parameter attributes: A list of Pango attributes to apply to the text of the embedded entry.
/// - Parameter enableEmojiCompletion: Whether to suggest emoji replacements on the entry row.
/// - Parameter inputHints: Additional input hints for the entry row.
/// - Parameter inputPurpose: The input purpose of the entry row.
/// - Parameter maxLength: Maximum number of characters for the entry.
/// - Parameter showApplyButton: Whether to show the apply button.
/// - Parameter title: The title of the preference represented by this row.
/// - Parameter titleSelectable: Whether the user can copy the title from the label.
/// - Parameter useMarkup: Whether to use Pango markup for the title label.
/// - Parameter useUnderline: Whether an embedded underline in the title indicates a mnemonic.
/// - Parameter activatable: Determines whether the ::row-activated signal will be emitted for this row.
/// - Parameter selectable: Determines whether this row can be selected.
/// - Parameter child: A `ViewBuilder` closure whose first view is mounted into the `child` slot.
/// - Parameter onApply: Invoked when the widget emits the `apply` signal.
/// - Parameter onEntryActivated: Invoked when the widget emits the `entry-activated` signal.
/// - Parameter onActivate: Invoked when the widget emits the `activate` signal.
public init(activatesDefault: Bool? = nil, attributes: Adw.AttrList? = nil, enableEmojiCompletion: Bool? = nil, inputHints: Adw.InputHints? = nil, inputPurpose: Adw.InputPurpose? = nil, maxLength: Int32? = nil, showApplyButton: Bool? = nil, title: String? = nil, titleSelectable: Bool? = nil, useMarkup: Bool? = nil, useUnderline: Bool? = nil, activatable: Bool? = nil, selectable: Bool? = nil, @ViewBuilder child: @escaping () -> [AnyView] = { [] }, onApply: (() -> Void)? = nil, onEntryActivated: (() -> Void)? = nil, onActivate: (() -> Void)? = nil) {
make = { _ in Adw.PasswordEntryRow() }
configure.append { w, ctx in
if let activatesDefault { w.setActivatesDefault(activates: activatesDefault) }
if let attributes { w.setAttributes(attributes: attributes) }
if let enableEmojiCompletion { w.setEnableEmojiCompletion(enableEmojiCompletion: enableEmojiCompletion) }
if let inputHints { w.setInputHints(hints: inputHints) }
if let inputPurpose { w.setInputPurpose(purpose: inputPurpose) }
if let maxLength { w.setMaxLength(maxLength: maxLength) }
if let showApplyButton { w.setShowApplyButton(showApplyButton: showApplyButton) }
if let title { w.setTitle(title: title) }
if let titleSelectable { w.setTitleSelectable(titleSelectable: titleSelectable) }
if let useMarkup { w.setUseMarkup(useMarkup: useMarkup) }
if let useUnderline { w.setUseUnderline(useUnderline: useUnderline) }
if let activatable { w.setActivatable(activatable: activatable) }
if let selectable { w.setSelectable(selectable: selectable) }
if let v = Portico.mountSlotChild(child, ctx, onUpdate: { v in w.setChild(child: v) }) { w.setChild(child: v) }
if let onApply { ctx.registry.add(w.connectApply { _ in onApply() }) }
if let onEntryActivated { ctx.registry.add(w.connectEntryActivated { _ in onEntryActivated() }) }
if let onActivate { ctx.registry.add(w.connectActivate { _ in onActivate() }) }
}
}
}
extension PasswordEntryRow: WidgetView {
public typealias Target = Adw.PasswordEntryRow
@_spi(Portico) public func appending(
_ step: @escaping (Adw.PasswordEntryRow, MountContext) -> Void
) -> Self {
var c = self
c.configure.append(step)
return c
}
}
@_spi(Portico) extension PasswordEntryRow: Mountable {
@_spi(Portico) public func mount(_ ctx: MountContext) -> Gtk.Widget {
let w = make(ctx)
for step in configure { step(w, ctx) }
return w
}
}