1527 lines
94 KiB
Swift
1527 lines
94 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.Text
|
|
/// A single-line text entry.
|
|
///
|
|
/// `GtkText` is the common implementation of single-line text editing
|
|
/// that is shared between [class`Gtk`.Entry], [class`Gtk`.PasswordEntry],
|
|
/// [class`Gtk`.SpinButton], and other widgets. In all of these, a `GtkText`
|
|
/// instance is used as the delegate for the [iface`Gtk`.Editable] implementation.
|
|
///
|
|
/// A large number of key bindings s supported by default. If the entered
|
|
/// text is longer than the allocation of the widget, the widget will scroll
|
|
/// so that the cursor position is visible.
|
|
///
|
|
/// When using an entry for passwords and other sensitive information,
|
|
/// it can be put into “password mode” using [method`Gtk`.Text.set_visibility].
|
|
/// In this mode, entered text is displayed using an “invisible” character.
|
|
/// By default, GTK picks the best invisible character that is available
|
|
/// in the current font, but it can be changed with
|
|
/// [method`Gtk`.Text.set_invisible_char].
|
|
///
|
|
/// If you want to add icons or progress display in an entry, look at
|
|
/// [class`Gtk`.Entry]. There are other alternatives for more specialized
|
|
/// use cases, such as [class`Gtk`.SearchEntry].
|
|
///
|
|
/// If you need multi-line editable text, use [class`Gtk`.TextView].
|
|
///
|
|
/// # Shortcuts and Gestures
|
|
///
|
|
/// `GtkText` supports the following keyboard shortcuts:
|
|
///
|
|
/// - <kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Menu</kbd> opens the context menu.
|
|
/// - <kbd>Ctrl</kbd>+<kbd>A</kbd> or <kbd>Ctrl</kbd>+<kbd>/</kbd>
|
|
/// selects all the text.
|
|
/// - <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>A</kbd> or
|
|
/// <kbd>Ctrl</kbd>+<kbd>\</kbd> unselects all.
|
|
/// - <kbd>Ctrl</kbd>+<kbd>Z</kbd> undoes the last modification.
|
|
/// - <kbd>Ctrl</kbd>+<kbd>Y</kbd> or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Z</kbd>
|
|
/// redoes the last undone modification.
|
|
/// - <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>T</kbd> toggles the text direction.
|
|
/// - <kbd>Clear</kbd> clears the content.
|
|
///
|
|
/// Additionally, the following signals have default keybindings:
|
|
///
|
|
/// - [signal`Gtk`.Text::activate]
|
|
/// - [signal`Gtk`.Text::backspace]
|
|
/// - [signal`Gtk`.Text::copy-clipboard]
|
|
/// - [signal`Gtk`.Text::cut-clipboard]
|
|
/// - [signal`Gtk`.Text::delete-from-cursor]
|
|
/// - [signal`Gtk`.Text::insert-emoji]
|
|
/// - [signal`Gtk`.Text::move-cursor]
|
|
/// - [signal`Gtk`.Text::paste-clipboard]
|
|
/// - [signal`Gtk`.Text::toggle-overwrite]
|
|
///
|
|
/// # Actions
|
|
///
|
|
/// `GtkText` defines a set of built-in actions:
|
|
///
|
|
/// - `clipboard.copy` copies the contents to the clipboard.
|
|
/// - `clipboard.cut` copies the contents to the clipboard and deletes it from
|
|
/// the widget.
|
|
/// - `clipboard.paste` inserts the contents of the clipboard into the widget.
|
|
/// - `menu.popup` opens the context menu.
|
|
/// - `misc.insert-emoji` opens the Emoji chooser.
|
|
/// - `misc.toggle-visibility` toggles the `GtkText`:visibility property.
|
|
/// - `misc.toggle-direction` toggles the text direction.
|
|
/// - `selection.delete` deletes the current selection.
|
|
/// - `selection.select-all` selects all of the widgets content.
|
|
/// - `text.redo` redoes the last change to the contents.
|
|
/// - `text.undo` undoes the last change to the contents.
|
|
/// - `text.clear` removes all content.
|
|
///
|
|
/// # CSS nodes
|
|
///
|
|
/// ```
|
|
/// text[.read-only]
|
|
/// ├── placeholder
|
|
/// ├── undershoot.left
|
|
/// ├── undershoot.right
|
|
/// ├── [selection]
|
|
/// ├── [cursor-handle[.top]
|
|
/// ├── [cursor-handle.bottom]
|
|
/// ├── [block-cursor]
|
|
/// ├── [cursor-handle[.top/.bottom][.insertion-cursor]]
|
|
/// ╰── [window.popup]
|
|
/// ```
|
|
///
|
|
/// `GtkText` has a main node with the name `text`. Depending on the properties
|
|
/// of the widget, the `.read-only` style class may appear.
|
|
///
|
|
/// When the entry has a selection, it adds a subnode with the name `selection`.
|
|
///
|
|
/// When the entry is in overwrite mode, it adds a subnode with the name
|
|
/// `block-cursor` that determines how the block cursor is drawn.
|
|
///
|
|
/// The CSS node for a context menu is added as a subnode with the name `popup`.
|
|
///
|
|
/// The `undershoot` nodes are used to draw the underflow indication when content
|
|
/// is scrolled out of view. These nodes get the `.left` or `.right` style class
|
|
/// added depending on where the indication is drawn.
|
|
///
|
|
/// When touch is used and touch selection handles are shown, they are using
|
|
/// CSS nodes with name `cursor-handle`. They get the `.top` or `.bottom` style
|
|
/// class depending on where they are shown in relation to the selection. If
|
|
/// there is just a single handle for the text cursor, it gets the style class
|
|
/// `.insertion-cursor`.
|
|
///
|
|
/// # Accessibility
|
|
///
|
|
/// `GtkText` uses the [enum`Gtk`.AccessibleRole.none] role, which causes it to be
|
|
/// skipped for accessibility. This is because `GtkText` is expected to be used
|
|
/// as a delegate for a `GtkEditable` implementation that will be represented
|
|
/// to accessibility.
|
|
///
|
|
/// A Portico view that mounts a `Gtk.Text`.
|
|
@MainActor public struct Text: View {
|
|
private let make: (MountContext) -> Gtk.Text
|
|
private var configure: [(Gtk.Text, MountContext) -> Void] = []
|
|
|
|
public var body: Never { fatalError() }
|
|
|
|
// PorticoGen: generateInits(static) | source: Gtk.Text.init()
|
|
/// Creates a new `GtkText`.
|
|
///
|
|
/// 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 activatesDefault: Whether to activate the default widget when <kbd>Enter</kbd> is pressed.
|
|
/// - Parameter attributes: A list of Pango attributes to apply to the text.
|
|
/// - Parameter enableEmojiCompletion: Whether to suggest Emoji replacements.
|
|
/// - Parameter extraMenu: A menu model whose contents will be appended to the context menu.
|
|
/// - Parameter inputHints: Additional hints that allow input methods to fine-tune their behaviour.
|
|
/// - Parameter inputPurpose: The purpose of this text field.
|
|
/// - Parameter invisibleChar: The character to used when masking contents (in “password mode”).
|
|
/// - Parameter maxLength: Maximum number of characters that are allowed.
|
|
/// - Parameter overwriteMode: If text is overwritten when typing.
|
|
/// - Parameter placeholderText: The text that will be displayed in the `GtkText` when it is empty and unfocused.
|
|
/// - Parameter propagateTextWidth: Whether the widget should grow and shrink with the content.
|
|
/// - Parameter tabs: Custom tabs for this text widget.
|
|
/// - Parameter truncateMultiline: When true, pasted multi-line text is truncated to the first line.
|
|
/// - Parameter visibility: If false, the text is masked with the “invisible char”.
|
|
/// - Parameter onActivate: Invoked when the widget emits the `activate` signal.
|
|
/// - Parameter onBackspace: Invoked when the widget emits the `backspace` signal.
|
|
/// - Parameter onCopyClipboard: Invoked when the widget emits the `copy-clipboard` signal.
|
|
/// - Parameter onCutClipboard: Invoked when the widget emits the `cut-clipboard` signal.
|
|
/// - Parameter onDeleteFromCursor: Invoked when the widget emits the `delete-from-cursor` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onInsertAtCursor: Invoked when the widget emits the `insert-at-cursor` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onInsertEmoji: Invoked when the widget emits the `insert-emoji` signal.
|
|
/// - Parameter onMoveCursor: Invoked when the widget emits the `move-cursor` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onPasteClipboard: Invoked when the widget emits the `paste-clipboard` signal.
|
|
/// - Parameter onPreeditChanged: Invoked when the widget emits the `preedit-changed` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onToggleOverwrite: Invoked when the widget emits the `toggle-overwrite` signal.
|
|
public init(activatesDefault: Bool? = nil, attributes: Gtk.AttrList? = nil, enableEmojiCompletion: Bool? = nil, extraMenu: Gtk.MenuModel? = nil, inputHints: Gtk.InputHints? = nil, inputPurpose: Gtk.InputPurpose? = nil, invisibleChar: UInt32? = nil, maxLength: Int32? = nil, overwriteMode: Bool? = nil, placeholderText: String? = nil, propagateTextWidth: Bool? = nil, tabs: Gtk.TabArray? = nil, truncateMultiline: Bool? = nil, visibility: Bool? = nil, onActivate: (() -> Void)? = nil, onBackspace: (() -> Void)? = nil, onCopyClipboard: (() -> Void)? = nil, onCutClipboard: (() -> Void)? = nil, onDeleteFromCursor: ((Gtk.DeleteType, Int32) -> Void)? = nil, onInsertAtCursor: ((String) -> Void)? = nil, onInsertEmoji: (() -> Void)? = nil, onMoveCursor: ((Gtk.MovementStep, Int32, Bool) -> Void)? = nil, onPasteClipboard: (() -> Void)? = nil, onPreeditChanged: ((String) -> Void)? = nil, onToggleOverwrite: (() -> Void)? = nil) {
|
|
make = { _ in Gtk.Text() }
|
|
configure.append { w, ctx in
|
|
if let activatesDefault { w.setActivatesDefault(activates: activatesDefault) }
|
|
if let attributes { w.setAttributes(attrs: attributes) }
|
|
if let enableEmojiCompletion { w.setEnableEmojiCompletion(enableEmojiCompletion: enableEmojiCompletion) }
|
|
if let extraMenu { w.setExtraMenu(model: extraMenu) }
|
|
if let inputHints { w.setInputHints(hints: inputHints) }
|
|
if let inputPurpose { w.setInputPurpose(purpose: inputPurpose) }
|
|
if let invisibleChar { w.setInvisibleChar(ch: invisibleChar) }
|
|
if let maxLength { w.setMaxLength(length: maxLength) }
|
|
if let overwriteMode { w.setOverwriteMode(overwrite: overwriteMode) }
|
|
if let placeholderText { w.setPlaceholderText(text: placeholderText) }
|
|
if let propagateTextWidth { w.setPropagateTextWidth(propagateTextWidth: propagateTextWidth) }
|
|
if let tabs { w.setTabs(tabs: tabs) }
|
|
if let truncateMultiline { w.setTruncateMultiline(truncateMultiline: truncateMultiline) }
|
|
if let visibility { w.setVisibility(visible: visibility) }
|
|
if let onActivate { ctx.registry.add(w.connectActivate { _ in onActivate() }) }
|
|
if let onBackspace { ctx.registry.add(w.connectBackspace { _ in onBackspace() }) }
|
|
if let onCopyClipboard { ctx.registry.add(w.connectCopyClipboard { _ in onCopyClipboard() }) }
|
|
if let onCutClipboard { ctx.registry.add(w.connectCutClipboard { _ in onCutClipboard() }) }
|
|
if let onDeleteFromCursor { ctx.registry.add(w.connectDeleteFromCursor { _, a0, a1 in onDeleteFromCursor(a0, a1) }) }
|
|
if let onInsertAtCursor { ctx.registry.add(w.connectInsertAtCursor { _, a0 in onInsertAtCursor(a0) }) }
|
|
if let onInsertEmoji { ctx.registry.add(w.connectInsertEmoji { _ in onInsertEmoji() }) }
|
|
if let onMoveCursor { ctx.registry.add(w.connectMoveCursor { _, a0, a1, a2 in onMoveCursor(a0, a1, a2) }) }
|
|
if let onPasteClipboard { ctx.registry.add(w.connectPasteClipboard { _ in onPasteClipboard() }) }
|
|
if let onPreeditChanged { ctx.registry.add(w.connectPreeditChanged { _, a0 in onPreeditChanged(a0) }) }
|
|
if let onToggleOverwrite { ctx.registry.add(w.connectToggleOverwrite { _ in onToggleOverwrite() }) }
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateInits(static) | source: Gtk.Text.init(buffer:)
|
|
/// Creates a new `GtkText` with the specified buffer.
|
|
///
|
|
/// 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 buffer: The `GtkEntryBuffer` object which stores the text.
|
|
/// - Parameter activatesDefault: Whether to activate the default widget when <kbd>Enter</kbd> is pressed.
|
|
/// - Parameter attributes: A list of Pango attributes to apply to the text.
|
|
/// - Parameter enableEmojiCompletion: Whether to suggest Emoji replacements.
|
|
/// - Parameter extraMenu: A menu model whose contents will be appended to the context menu.
|
|
/// - Parameter inputHints: Additional hints that allow input methods to fine-tune their behaviour.
|
|
/// - Parameter inputPurpose: The purpose of this text field.
|
|
/// - Parameter invisibleChar: The character to used when masking contents (in “password mode”).
|
|
/// - Parameter maxLength: Maximum number of characters that are allowed.
|
|
/// - Parameter overwriteMode: If text is overwritten when typing.
|
|
/// - Parameter placeholderText: The text that will be displayed in the `GtkText` when it is empty and unfocused.
|
|
/// - Parameter propagateTextWidth: Whether the widget should grow and shrink with the content.
|
|
/// - Parameter tabs: Custom tabs for this text widget.
|
|
/// - Parameter truncateMultiline: When true, pasted multi-line text is truncated to the first line.
|
|
/// - Parameter visibility: If false, the text is masked with the “invisible char”.
|
|
/// - Parameter onActivate: Invoked when the widget emits the `activate` signal.
|
|
/// - Parameter onBackspace: Invoked when the widget emits the `backspace` signal.
|
|
/// - Parameter onCopyClipboard: Invoked when the widget emits the `copy-clipboard` signal.
|
|
/// - Parameter onCutClipboard: Invoked when the widget emits the `cut-clipboard` signal.
|
|
/// - Parameter onDeleteFromCursor: Invoked when the widget emits the `delete-from-cursor` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onInsertAtCursor: Invoked when the widget emits the `insert-at-cursor` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onInsertEmoji: Invoked when the widget emits the `insert-emoji` signal.
|
|
/// - Parameter onMoveCursor: Invoked when the widget emits the `move-cursor` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onPasteClipboard: Invoked when the widget emits the `paste-clipboard` signal.
|
|
/// - Parameter onPreeditChanged: Invoked when the widget emits the `preedit-changed` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onToggleOverwrite: Invoked when the widget emits the `toggle-overwrite` signal.
|
|
public init(buffer: Gtk.EntryBuffer, activatesDefault: Bool? = nil, attributes: Gtk.AttrList? = nil, enableEmojiCompletion: Bool? = nil, extraMenu: Gtk.MenuModel? = nil, inputHints: Gtk.InputHints? = nil, inputPurpose: Gtk.InputPurpose? = nil, invisibleChar: UInt32? = nil, maxLength: Int32? = nil, overwriteMode: Bool? = nil, placeholderText: String? = nil, propagateTextWidth: Bool? = nil, tabs: Gtk.TabArray? = nil, truncateMultiline: Bool? = nil, visibility: Bool? = nil, onActivate: (() -> Void)? = nil, onBackspace: (() -> Void)? = nil, onCopyClipboard: (() -> Void)? = nil, onCutClipboard: (() -> Void)? = nil, onDeleteFromCursor: ((Gtk.DeleteType, Int32) -> Void)? = nil, onInsertAtCursor: ((String) -> Void)? = nil, onInsertEmoji: (() -> Void)? = nil, onMoveCursor: ((Gtk.MovementStep, Int32, Bool) -> Void)? = nil, onPasteClipboard: (() -> Void)? = nil, onPreeditChanged: ((String) -> Void)? = nil, onToggleOverwrite: (() -> Void)? = nil) {
|
|
make = { _ in Gtk.Text(buffer: buffer) }
|
|
configure.append { w, ctx in
|
|
if let activatesDefault { w.setActivatesDefault(activates: activatesDefault) }
|
|
if let attributes { w.setAttributes(attrs: attributes) }
|
|
if let enableEmojiCompletion { w.setEnableEmojiCompletion(enableEmojiCompletion: enableEmojiCompletion) }
|
|
if let extraMenu { w.setExtraMenu(model: extraMenu) }
|
|
if let inputHints { w.setInputHints(hints: inputHints) }
|
|
if let inputPurpose { w.setInputPurpose(purpose: inputPurpose) }
|
|
if let invisibleChar { w.setInvisibleChar(ch: invisibleChar) }
|
|
if let maxLength { w.setMaxLength(length: maxLength) }
|
|
if let overwriteMode { w.setOverwriteMode(overwrite: overwriteMode) }
|
|
if let placeholderText { w.setPlaceholderText(text: placeholderText) }
|
|
if let propagateTextWidth { w.setPropagateTextWidth(propagateTextWidth: propagateTextWidth) }
|
|
if let tabs { w.setTabs(tabs: tabs) }
|
|
if let truncateMultiline { w.setTruncateMultiline(truncateMultiline: truncateMultiline) }
|
|
if let visibility { w.setVisibility(visible: visibility) }
|
|
if let onActivate { ctx.registry.add(w.connectActivate { _ in onActivate() }) }
|
|
if let onBackspace { ctx.registry.add(w.connectBackspace { _ in onBackspace() }) }
|
|
if let onCopyClipboard { ctx.registry.add(w.connectCopyClipboard { _ in onCopyClipboard() }) }
|
|
if let onCutClipboard { ctx.registry.add(w.connectCutClipboard { _ in onCutClipboard() }) }
|
|
if let onDeleteFromCursor { ctx.registry.add(w.connectDeleteFromCursor { _, a0, a1 in onDeleteFromCursor(a0, a1) }) }
|
|
if let onInsertAtCursor { ctx.registry.add(w.connectInsertAtCursor { _, a0 in onInsertAtCursor(a0) }) }
|
|
if let onInsertEmoji { ctx.registry.add(w.connectInsertEmoji { _ in onInsertEmoji() }) }
|
|
if let onMoveCursor { ctx.registry.add(w.connectMoveCursor { _, a0, a1, a2 in onMoveCursor(a0, a1, a2) }) }
|
|
if let onPasteClipboard { ctx.registry.add(w.connectPasteClipboard { _ in onPasteClipboard() }) }
|
|
if let onPreeditChanged { ctx.registry.add(w.connectPreeditChanged { _, a0 in onPreeditChanged(a0) }) }
|
|
if let onToggleOverwrite { ctx.registry.add(w.connectToggleOverwrite { _ in onToggleOverwrite() }) }
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateInits(binding) | source: Gtk.Text.init(buffer:), Gtk.Text.setBuffer(buffer:)
|
|
/// Creates a new `GtkText` with the specified buffer.
|
|
///
|
|
/// The initial value is the binding's current value; every later change is pushed into the widget through `Gtk.Text.setBuffer(buffer:)` 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 buffer: The `GtkEntryBuffer` object which stores the text.
|
|
/// - Parameter activatesDefault: Whether to activate the default widget when <kbd>Enter</kbd> is pressed.
|
|
/// - Parameter attributes: A list of Pango attributes to apply to the text.
|
|
/// - Parameter enableEmojiCompletion: Whether to suggest Emoji replacements.
|
|
/// - Parameter extraMenu: A menu model whose contents will be appended to the context menu.
|
|
/// - Parameter inputHints: Additional hints that allow input methods to fine-tune their behaviour.
|
|
/// - Parameter inputPurpose: The purpose of this text field.
|
|
/// - Parameter invisibleChar: The character to used when masking contents (in “password mode”).
|
|
/// - Parameter maxLength: Maximum number of characters that are allowed.
|
|
/// - Parameter overwriteMode: If text is overwritten when typing.
|
|
/// - Parameter placeholderText: The text that will be displayed in the `GtkText` when it is empty and unfocused.
|
|
/// - Parameter propagateTextWidth: Whether the widget should grow and shrink with the content.
|
|
/// - Parameter tabs: Custom tabs for this text widget.
|
|
/// - Parameter truncateMultiline: When true, pasted multi-line text is truncated to the first line.
|
|
/// - Parameter visibility: If false, the text is masked with the “invisible char”.
|
|
/// - Parameter onActivate: Invoked when the widget emits the `activate` signal.
|
|
/// - Parameter onBackspace: Invoked when the widget emits the `backspace` signal.
|
|
/// - Parameter onCopyClipboard: Invoked when the widget emits the `copy-clipboard` signal.
|
|
/// - Parameter onCutClipboard: Invoked when the widget emits the `cut-clipboard` signal.
|
|
/// - Parameter onDeleteFromCursor: Invoked when the widget emits the `delete-from-cursor` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onInsertAtCursor: Invoked when the widget emits the `insert-at-cursor` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onInsertEmoji: Invoked when the widget emits the `insert-emoji` signal.
|
|
/// - Parameter onMoveCursor: Invoked when the widget emits the `move-cursor` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onPasteClipboard: Invoked when the widget emits the `paste-clipboard` signal.
|
|
/// - Parameter onPreeditChanged: Invoked when the widget emits the `preedit-changed` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onToggleOverwrite: Invoked when the widget emits the `toggle-overwrite` signal.
|
|
public init(buffer: Portico.Binding<Gtk.EntryBuffer>, activatesDefault: Portico.Binding<Bool>? = nil, attributes: Portico.Binding<Gtk.AttrList?>? = nil, enableEmojiCompletion: Portico.Binding<Bool>? = nil, extraMenu: Portico.Binding<Gtk.MenuModel?>? = nil, inputHints: Portico.Binding<Gtk.InputHints>? = nil, inputPurpose: Portico.Binding<Gtk.InputPurpose>? = nil, invisibleChar: Portico.Binding<UInt32>? = nil, maxLength: Portico.Binding<Int32>? = nil, overwriteMode: Portico.Binding<Bool>? = nil, placeholderText: Portico.Binding<String?>? = nil, propagateTextWidth: Portico.Binding<Bool>? = nil, tabs: Portico.Binding<Gtk.TabArray?>? = nil, truncateMultiline: Portico.Binding<Bool>? = nil, visibility: Portico.Binding<Bool>? = nil, onActivate: (() -> Void)? = nil, onBackspace: (() -> Void)? = nil, onCopyClipboard: (() -> Void)? = nil, onCutClipboard: (() -> Void)? = nil, onDeleteFromCursor: ((Gtk.DeleteType, Int32) -> Void)? = nil, onInsertAtCursor: ((String) -> Void)? = nil, onInsertEmoji: (() -> Void)? = nil, onMoveCursor: ((Gtk.MovementStep, Int32, Bool) -> Void)? = nil, onPasteClipboard: (() -> Void)? = nil, onPreeditChanged: ((String) -> Void)? = nil, onToggleOverwrite: (() -> Void)? = nil) {
|
|
make = { _ in Gtk.Text(buffer: buffer.wrappedValue) }
|
|
configure.append { w, ctx in
|
|
ctx.registry.add(buffer.subscribe { [w] v in w.setBuffer(buffer: v) })
|
|
if let activatesDefault {
|
|
Portico.bindProperty(w, activatesDefault, registry: ctx.registry, notifyDetail: "activates-default", read: { [w] in w.getActivatesDefault() }, write: { [w] v in w.setActivatesDefault(activates: 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 enableEmojiCompletion {
|
|
Portico.bindProperty(w, enableEmojiCompletion, registry: ctx.registry, notifyDetail: "enable-emoji-completion", read: { [w] in w.getEnableEmojiCompletion() }, write: { [w] v in w.setEnableEmojiCompletion(enableEmojiCompletion: v) })
|
|
}
|
|
if let extraMenu {
|
|
Portico.bindProperty(w, extraMenu, registry: ctx.registry, notifyDetail: "extra-menu", read: { [w] in w.getExtraMenu() }, write: { [w] v in w.setExtraMenu(model: v) })
|
|
}
|
|
if let inputHints {
|
|
Portico.bindProperty(w, inputHints, registry: ctx.registry, notifyDetail: "input-hints", read: { [w] in w.getInputHints() }, write: { [w] v in w.setInputHints(hints: v) })
|
|
}
|
|
if let inputPurpose {
|
|
Portico.bindProperty(w, inputPurpose, registry: ctx.registry, notifyDetail: "input-purpose", read: { [w] in w.getInputPurpose() }, write: { [w] v in w.setInputPurpose(purpose: v) })
|
|
}
|
|
if let invisibleChar {
|
|
Portico.bindProperty(w, invisibleChar, registry: ctx.registry, notifyDetail: "invisible-char", read: { [w] in w.getInvisibleChar() }, write: { [w] v in w.setInvisibleChar(ch: v) })
|
|
}
|
|
if let maxLength {
|
|
Portico.bindProperty(w, maxLength, registry: ctx.registry, notifyDetail: "max-length", read: { [w] in w.getMaxLength() }, write: { [w] v in w.setMaxLength(length: v) })
|
|
}
|
|
if let overwriteMode {
|
|
Portico.bindProperty(w, overwriteMode, registry: ctx.registry, notifyDetail: "overwrite-mode", read: { [w] in w.getOverwriteMode() }, write: { [w] v in w.setOverwriteMode(overwrite: v) })
|
|
}
|
|
if let placeholderText {
|
|
Portico.bindProperty(w, placeholderText, registry: ctx.registry, notifyDetail: "placeholder-text", read: { [w] in w.getPlaceholderText() }, write: { [w] v in w.setPlaceholderText(text: v) })
|
|
}
|
|
if let propagateTextWidth {
|
|
Portico.bindProperty(w, propagateTextWidth, registry: ctx.registry, notifyDetail: "propagate-text-width", read: { [w] in w.getPropagateTextWidth() }, write: { [w] v in w.setPropagateTextWidth(propagateTextWidth: v) })
|
|
}
|
|
if let tabs {
|
|
Portico.bindProperty(w, tabs, registry: ctx.registry, notifyDetail: "tabs", read: { [w] in w.getTabs() }, write: { [w] v in w.setTabs(tabs: v) })
|
|
}
|
|
if let truncateMultiline {
|
|
Portico.bindProperty(w, truncateMultiline, registry: ctx.registry, notifyDetail: "truncate-multiline", read: { [w] in w.getTruncateMultiline() }, write: { [w] v in w.setTruncateMultiline(truncateMultiline: v) })
|
|
}
|
|
if let visibility {
|
|
Portico.bindProperty(w, visibility, registry: ctx.registry, notifyDetail: "visibility", read: { [w] in w.getVisibility() }, write: { [w] v in w.setVisibility(visible: v) })
|
|
}
|
|
if let onActivate { ctx.registry.add(w.connectActivate { _ in onActivate() }) }
|
|
if let onBackspace { ctx.registry.add(w.connectBackspace { _ in onBackspace() }) }
|
|
if let onCopyClipboard { ctx.registry.add(w.connectCopyClipboard { _ in onCopyClipboard() }) }
|
|
if let onCutClipboard { ctx.registry.add(w.connectCutClipboard { _ in onCutClipboard() }) }
|
|
if let onDeleteFromCursor { ctx.registry.add(w.connectDeleteFromCursor { _, a0, a1 in onDeleteFromCursor(a0, a1) }) }
|
|
if let onInsertAtCursor { ctx.registry.add(w.connectInsertAtCursor { _, a0 in onInsertAtCursor(a0) }) }
|
|
if let onInsertEmoji { ctx.registry.add(w.connectInsertEmoji { _ in onInsertEmoji() }) }
|
|
if let onMoveCursor { ctx.registry.add(w.connectMoveCursor { _, a0, a1, a2 in onMoveCursor(a0, a1, a2) }) }
|
|
if let onPasteClipboard { ctx.registry.add(w.connectPasteClipboard { _ in onPasteClipboard() }) }
|
|
if let onPreeditChanged { ctx.registry.add(w.connectPreeditChanged { _, a0 in onPreeditChanged(a0) }) }
|
|
if let onToggleOverwrite { ctx.registry.add(w.connectToggleOverwrite { _ in onToggleOverwrite() }) }
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateInits(closure) | source: Gtk.Text.init(buffer:), Gtk.Text.setBuffer(buffer:)
|
|
/// Creates a new `GtkText` with the specified buffer.
|
|
///
|
|
/// Each closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Text.setBuffer(buffer:)`.
|
|
/// 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 buffer: The `GtkEntryBuffer` object which stores the text.
|
|
/// - Parameter activatesDefault: Whether to activate the default widget when <kbd>Enter</kbd> is pressed.
|
|
/// - Parameter attributes: A list of Pango attributes to apply to the text.
|
|
/// - Parameter enableEmojiCompletion: Whether to suggest Emoji replacements.
|
|
/// - Parameter extraMenu: A menu model whose contents will be appended to the context menu.
|
|
/// - Parameter inputHints: Additional hints that allow input methods to fine-tune their behaviour.
|
|
/// - Parameter inputPurpose: The purpose of this text field.
|
|
/// - Parameter invisibleChar: The character to used when masking contents (in “password mode”).
|
|
/// - Parameter maxLength: Maximum number of characters that are allowed.
|
|
/// - Parameter overwriteMode: If text is overwritten when typing.
|
|
/// - Parameter placeholderText: The text that will be displayed in the `GtkText` when it is empty and unfocused.
|
|
/// - Parameter propagateTextWidth: Whether the widget should grow and shrink with the content.
|
|
/// - Parameter tabs: Custom tabs for this text widget.
|
|
/// - Parameter truncateMultiline: When true, pasted multi-line text is truncated to the first line.
|
|
/// - Parameter visibility: If false, the text is masked with the “invisible char”.
|
|
/// - Parameter onActivate: Invoked when the widget emits the `activate` signal.
|
|
/// - Parameter onBackspace: Invoked when the widget emits the `backspace` signal.
|
|
/// - Parameter onCopyClipboard: Invoked when the widget emits the `copy-clipboard` signal.
|
|
/// - Parameter onCutClipboard: Invoked when the widget emits the `cut-clipboard` signal.
|
|
/// - Parameter onDeleteFromCursor: Invoked when the widget emits the `delete-from-cursor` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onInsertAtCursor: Invoked when the widget emits the `insert-at-cursor` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onInsertEmoji: Invoked when the widget emits the `insert-emoji` signal.
|
|
/// - Parameter onMoveCursor: Invoked when the widget emits the `move-cursor` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onPasteClipboard: Invoked when the widget emits the `paste-clipboard` signal.
|
|
/// - Parameter onPreeditChanged: Invoked when the widget emits the `preedit-changed` signal. The closure receives the signal's arguments in order.
|
|
/// - Parameter onToggleOverwrite: Invoked when the widget emits the `toggle-overwrite` signal.
|
|
public init(buffer: @escaping () -> Gtk.EntryBuffer, activatesDefault: Bool? = nil, attributes: Gtk.AttrList? = nil, enableEmojiCompletion: Bool? = nil, extraMenu: Gtk.MenuModel? = nil, inputHints: Gtk.InputHints? = nil, inputPurpose: Gtk.InputPurpose? = nil, invisibleChar: UInt32? = nil, maxLength: Int32? = nil, overwriteMode: Bool? = nil, placeholderText: String? = nil, propagateTextWidth: Bool? = nil, tabs: Gtk.TabArray? = nil, truncateMultiline: Bool? = nil, visibility: Bool? = nil, onActivate: (() -> Void)? = nil, onBackspace: (() -> Void)? = nil, onCopyClipboard: (() -> Void)? = nil, onCutClipboard: (() -> Void)? = nil, onDeleteFromCursor: ((Gtk.DeleteType, Int32) -> Void)? = nil, onInsertAtCursor: ((String) -> Void)? = nil, onInsertEmoji: (() -> Void)? = nil, onMoveCursor: ((Gtk.MovementStep, Int32, Bool) -> Void)? = nil, onPasteClipboard: (() -> Void)? = nil, onPreeditChanged: ((String) -> Void)? = nil, onToggleOverwrite: (() -> Void)? = nil) {
|
|
make = { _ in Gtk.Text(buffer: buffer()) }
|
|
configure.append { w, ctx in
|
|
let t0 = DependencyTracker { [w] in w.setBuffer(buffer: buffer()) }
|
|
t0.run()
|
|
ctx.registry.add(t0)
|
|
if let activatesDefault { w.setActivatesDefault(activates: activatesDefault) }
|
|
if let attributes { w.setAttributes(attrs: attributes) }
|
|
if let enableEmojiCompletion { w.setEnableEmojiCompletion(enableEmojiCompletion: enableEmojiCompletion) }
|
|
if let extraMenu { w.setExtraMenu(model: extraMenu) }
|
|
if let inputHints { w.setInputHints(hints: inputHints) }
|
|
if let inputPurpose { w.setInputPurpose(purpose: inputPurpose) }
|
|
if let invisibleChar { w.setInvisibleChar(ch: invisibleChar) }
|
|
if let maxLength { w.setMaxLength(length: maxLength) }
|
|
if let overwriteMode { w.setOverwriteMode(overwrite: overwriteMode) }
|
|
if let placeholderText { w.setPlaceholderText(text: placeholderText) }
|
|
if let propagateTextWidth { w.setPropagateTextWidth(propagateTextWidth: propagateTextWidth) }
|
|
if let tabs { w.setTabs(tabs: tabs) }
|
|
if let truncateMultiline { w.setTruncateMultiline(truncateMultiline: truncateMultiline) }
|
|
if let visibility { w.setVisibility(visible: visibility) }
|
|
if let onActivate { ctx.registry.add(w.connectActivate { _ in onActivate() }) }
|
|
if let onBackspace { ctx.registry.add(w.connectBackspace { _ in onBackspace() }) }
|
|
if let onCopyClipboard { ctx.registry.add(w.connectCopyClipboard { _ in onCopyClipboard() }) }
|
|
if let onCutClipboard { ctx.registry.add(w.connectCutClipboard { _ in onCutClipboard() }) }
|
|
if let onDeleteFromCursor { ctx.registry.add(w.connectDeleteFromCursor { _, a0, a1 in onDeleteFromCursor(a0, a1) }) }
|
|
if let onInsertAtCursor { ctx.registry.add(w.connectInsertAtCursor { _, a0 in onInsertAtCursor(a0) }) }
|
|
if let onInsertEmoji { ctx.registry.add(w.connectInsertEmoji { _ in onInsertEmoji() }) }
|
|
if let onMoveCursor { ctx.registry.add(w.connectMoveCursor { _, a0, a1, a2 in onMoveCursor(a0, a1, a2) }) }
|
|
if let onPasteClipboard { ctx.registry.add(w.connectPasteClipboard { _ in onPasteClipboard() }) }
|
|
if let onPreeditChanged { ctx.registry.add(w.connectPreeditChanged { _, a0 in onPreeditChanged(a0) }) }
|
|
if let onToggleOverwrite { ctx.registry.add(w.connectToggleOverwrite { _ in onToggleOverwrite() }) }
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
extension Text: WidgetView {
|
|
public typealias Target = Gtk.Text
|
|
|
|
@_spi(Portico) public func appending(
|
|
_ step: @escaping (Gtk.Text, MountContext) -> Void
|
|
) -> Self {
|
|
var c = self
|
|
c.configure.append(step)
|
|
return c
|
|
}
|
|
}
|
|
|
|
@_spi(Portico) extension Text: 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.Text
|
|
/// Modifiers for `Gtk.Text`, available on every Portico view whose
|
|
/// backing widget is `Gtk.Text` or one of its subclasses.
|
|
extension WidgetView where Target: Gtk.Text {
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Text.setActivatesDefault(activates:)
|
|
/// Sets whether pressing <kbd>Enter</kbd> will activate
|
|
/// the default widget.
|
|
///
|
|
/// This usually means that the dialog containing `self` will
|
|
/// be closed, since the default widget is usually one of
|
|
/// the dialog buttons.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter activatesDefault: Whether to activate the default widget when <kbd>Enter</kbd> is pressed.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func activatesDefault(_ activatesDefault: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setActivatesDefault(activates: activatesDefault)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Text.setActivatesDefault(activates:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getActivatesDefault()
|
|
/// Sets whether pressing <kbd>Enter</kbd> will activate
|
|
/// the default widget.
|
|
///
|
|
/// This usually means that the dialog containing `self` will
|
|
/// be closed, since the default widget is usually one of
|
|
/// the dialog buttons.
|
|
///
|
|
/// 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 activatesDefault(_ activatesDefault: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, activatesDefault, registry: ctx.registry, notifyDetail: "activates-default",
|
|
read: { [w] in w.getActivatesDefault() },
|
|
write: { [w] v in w.setActivatesDefault(activates: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Text.setActivatesDefault(activates:)
|
|
/// Sets whether pressing <kbd>Enter</kbd> will activate
|
|
/// the default widget.
|
|
///
|
|
/// This usually means that the dialog containing `self` will
|
|
/// be closed, since the default widget is usually one of
|
|
/// the dialog buttons.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Text.setActivatesDefault(activates:)`.
|
|
///
|
|
/// - Parameter activatesDefault: Whether to activate the default widget when <kbd>Enter</kbd> is pressed.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func activatesDefault(_ activatesDefault: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setActivatesDefault(activates: activatesDefault()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Text.setAttributes(attrs:)
|
|
/// Apply attributes to the contents of the text widget.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter attributes: A list of Pango attributes to apply to the text.
|
|
/// - 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.Text.setAttributes(attrs:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getAttributes()
|
|
/// Apply attributes to the contents of the text widget.
|
|
///
|
|
/// 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.Text.setAttributes(attrs:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getAttributes()
|
|
/// Apply attributes to the contents of the text widget.
|
|
///
|
|
/// 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.Text.setAttributes(attrs:)
|
|
/// Apply attributes to the contents of the text widget.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Text.setAttributes(attrs:)`.
|
|
///
|
|
/// - Parameter attributes: A list of Pango attributes to apply to the text.
|
|
/// - 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.Text.setBuffer(buffer:)
|
|
/// Set the entry buffer object which holds the text for
|
|
/// this widget.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter buffer: The `GtkEntryBuffer` object which stores the text.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func buffer(_ buffer: Gtk.EntryBuffer) -> Self {
|
|
appending { w, _ in
|
|
w.setBuffer(buffer: buffer)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Text.setBuffer(buffer:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getBuffer()
|
|
/// Set the entry buffer object which holds the text for
|
|
/// this widget.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Gtk.EntryBuffer` 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 buffer(_ buffer: Portico.Binding<Gtk.EntryBuffer>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, buffer, registry: ctx.registry, notifyDetail: "buffer",
|
|
read: { [w] in w.getBuffer() },
|
|
write: { [w] v in w.setBuffer(buffer: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Text.setBuffer(buffer:)
|
|
/// Set the entry buffer object which holds the text for
|
|
/// this widget.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Text.setBuffer(buffer:)`.
|
|
///
|
|
/// - Parameter buffer: The `GtkEntryBuffer` object which stores the text.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func buffer(_ buffer: @escaping () -> Gtk.EntryBuffer) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setBuffer(buffer: buffer()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Text.setEnableEmojiCompletion(enableEmojiCompletion:)
|
|
/// Sets whether Emoji completion is enabled.
|
|
///
|
|
/// If it is, typing ':', followed by a recognized keyword,
|
|
/// will pop up a window with suggested Emojis matching the
|
|
/// keyword.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter enableEmojiCompletion: Whether to suggest Emoji replacements.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func enableEmojiCompletion(_ enableEmojiCompletion: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setEnableEmojiCompletion(enableEmojiCompletion: enableEmojiCompletion)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Text.setEnableEmojiCompletion(enableEmojiCompletion:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getEnableEmojiCompletion()
|
|
/// Sets whether Emoji completion is enabled.
|
|
///
|
|
/// If it is, typing ':', followed by a recognized keyword,
|
|
/// will pop up a window with suggested Emojis matching the
|
|
/// keyword.
|
|
///
|
|
/// 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 enableEmojiCompletion(_ enableEmojiCompletion: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, enableEmojiCompletion, registry: ctx.registry, notifyDetail: "enable-emoji-completion",
|
|
read: { [w] in w.getEnableEmojiCompletion() },
|
|
write: { [w] v in w.setEnableEmojiCompletion(enableEmojiCompletion: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Text.setEnableEmojiCompletion(enableEmojiCompletion:)
|
|
/// Sets whether Emoji completion is enabled.
|
|
///
|
|
/// If it is, typing ':', followed by a recognized keyword,
|
|
/// will pop up a window with suggested Emojis matching the
|
|
/// keyword.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Text.setEnableEmojiCompletion(enableEmojiCompletion:)`.
|
|
///
|
|
/// - Parameter enableEmojiCompletion: Whether to suggest Emoji replacements.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func enableEmojiCompletion(_ enableEmojiCompletion: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setEnableEmojiCompletion(enableEmojiCompletion: enableEmojiCompletion()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Text.setExtraMenu(model:)
|
|
/// Sets a menu model to add to the context menu of the text widget.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter extraMenu: A menu model whose contents will be appended to the context menu.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func extraMenu(_ extraMenu: Gtk.MenuModel?) -> Self {
|
|
appending { w, _ in
|
|
w.setExtraMenu(model: extraMenu)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Text.setExtraMenu(model:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getExtraMenu()
|
|
/// Sets a menu model to add to the context menu of the text widget.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Gtk.MenuModel?` 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 extraMenu(_ extraMenu: Portico.Binding<Gtk.MenuModel?>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, extraMenu, registry: ctx.registry, notifyDetail: "extra-menu",
|
|
read: { [w] in w.getExtraMenu() },
|
|
write: { [w] v in w.setExtraMenu(model: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Text.setExtraMenu(model:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getExtraMenu()
|
|
/// Sets a menu model to add to the context menu of the text widget.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// `Binding` is invariant, so a `Binding<Gtk.MenuModel>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.MenuModel?>` to be able to clear the property.
|
|
/// When `Gtk.MenuModel` 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 extraMenu(_ extraMenu: Portico.Binding<Gtk.MenuModel>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, extraMenu, registry: ctx.registry, notifyDetail: "extra-menu",
|
|
read: { [w] in w.getExtraMenu() },
|
|
write: { [w] v in w.setExtraMenu(model: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Text.setExtraMenu(model:)
|
|
/// Sets a menu model to add to the context menu of the text widget.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Text.setExtraMenu(model:)`.
|
|
///
|
|
/// - Parameter extraMenu: A menu model whose contents will be appended to the context menu.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func extraMenu(_ extraMenu: @escaping () -> Gtk.MenuModel?) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setExtraMenu(model: extraMenu()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Text.setInputHints(hints:)
|
|
/// Sets hints that allow input methods to fine-tune their behaviour.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter inputHints: Additional hints that allow input methods to fine-tune their behaviour.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func inputHints(_ inputHints: Gtk.InputHints) -> Self {
|
|
appending { w, _ in
|
|
w.setInputHints(hints: inputHints)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Text.setInputHints(hints:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getInputHints()
|
|
/// Sets hints that allow input methods to fine-tune their behaviour.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Gtk.InputHints` 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 inputHints(_ inputHints: Portico.Binding<Gtk.InputHints>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, inputHints, registry: ctx.registry, notifyDetail: "input-hints",
|
|
read: { [w] in w.getInputHints() },
|
|
write: { [w] v in w.setInputHints(hints: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Text.setInputHints(hints:)
|
|
/// Sets hints that allow input methods to fine-tune their behaviour.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Text.setInputHints(hints:)`.
|
|
///
|
|
/// - Parameter inputHints: Additional hints that allow input methods to fine-tune their behaviour.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func inputHints(_ inputHints: @escaping () -> Gtk.InputHints) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setInputHints(hints: inputHints()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Text.setInputPurpose(purpose:)
|
|
/// Sets the input purpose of the text widget.
|
|
///
|
|
/// The input purpose can be used by on-screen keyboards
|
|
/// and other input methods to adjust their behaviour.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter inputPurpose: The purpose of this text field.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func inputPurpose(_ inputPurpose: Gtk.InputPurpose) -> Self {
|
|
appending { w, _ in
|
|
w.setInputPurpose(purpose: inputPurpose)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Text.setInputPurpose(purpose:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getInputPurpose()
|
|
/// Sets the input purpose of the text widget.
|
|
///
|
|
/// The input purpose can be used by on-screen keyboards
|
|
/// and other input methods to adjust their behaviour.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Gtk.InputPurpose` 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 inputPurpose(_ inputPurpose: Portico.Binding<Gtk.InputPurpose>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, inputPurpose, registry: ctx.registry, notifyDetail: "input-purpose",
|
|
read: { [w] in w.getInputPurpose() },
|
|
write: { [w] v in w.setInputPurpose(purpose: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Text.setInputPurpose(purpose:)
|
|
/// Sets the input purpose of the text widget.
|
|
///
|
|
/// The input purpose can be used by on-screen keyboards
|
|
/// and other input methods to adjust their behaviour.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Text.setInputPurpose(purpose:)`.
|
|
///
|
|
/// - Parameter inputPurpose: The purpose of this text field.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func inputPurpose(_ inputPurpose: @escaping () -> Gtk.InputPurpose) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setInputPurpose(purpose: inputPurpose()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Text.setInvisibleChar(ch:)
|
|
/// Sets the character to use when in “password mode”.
|
|
///
|
|
/// By default, GTK picks the best invisible char available in the
|
|
/// current font. If you set the invisible char to 0, then the user
|
|
/// will get no feedback at all; there will be no text on the screen
|
|
/// as they type.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter invisibleChar: The character to used when masking contents (in “password mode”).
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func invisibleChar(_ invisibleChar: UInt32) -> Self {
|
|
appending { w, _ in
|
|
w.setInvisibleChar(ch: invisibleChar)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Text.setInvisibleChar(ch:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getInvisibleChar()
|
|
/// Sets the character to use when in “password mode”.
|
|
///
|
|
/// By default, GTK picks the best invisible char available in the
|
|
/// current font. If you set the invisible char to 0, then the user
|
|
/// will get no feedback at all; there will be no text on the screen
|
|
/// as they type.
|
|
///
|
|
/// 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 invisibleChar(_ invisibleChar: Portico.Binding<UInt32>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, invisibleChar, registry: ctx.registry, notifyDetail: "invisible-char",
|
|
read: { [w] in w.getInvisibleChar() },
|
|
write: { [w] v in w.setInvisibleChar(ch: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Text.setInvisibleChar(ch:)
|
|
/// Sets the character to use when in “password mode”.
|
|
///
|
|
/// By default, GTK picks the best invisible char available in the
|
|
/// current font. If you set the invisible char to 0, then the user
|
|
/// will get no feedback at all; there will be no text on the screen
|
|
/// as they type.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Text.setInvisibleChar(ch:)`.
|
|
///
|
|
/// - Parameter invisibleChar: The character to used when masking contents (in “password mode”).
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func invisibleChar(_ invisibleChar: @escaping () -> UInt32) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setInvisibleChar(ch: invisibleChar()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Text.setMaxLength(length:)
|
|
/// Sets the maximum allowed length of the contents.
|
|
///
|
|
/// If the current contents are longer than the given length,
|
|
/// they will be truncated to fit.
|
|
///
|
|
/// This is equivalent to getting `self`'s `GtkEntryBuffer` and
|
|
/// calling [method`Gtk`.EntryBuffer.set_max_length] on it.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter maxLength: Maximum number of characters that are allowed.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func maxLength(_ maxLength: Int32) -> Self {
|
|
appending { w, _ in
|
|
w.setMaxLength(length: maxLength)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Text.setMaxLength(length:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getMaxLength()
|
|
/// Sets the maximum allowed length of the contents.
|
|
///
|
|
/// If the current contents are longer than the given length,
|
|
/// they will be truncated to fit.
|
|
///
|
|
/// This is equivalent to getting `self`'s `GtkEntryBuffer` and
|
|
/// calling [method`Gtk`.EntryBuffer.set_max_length] on it.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Int32` 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 maxLength(_ maxLength: Portico.Binding<Int32>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, maxLength, registry: ctx.registry, notifyDetail: "max-length",
|
|
read: { [w] in w.getMaxLength() },
|
|
write: { [w] v in w.setMaxLength(length: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Text.setMaxLength(length:)
|
|
/// Sets the maximum allowed length of the contents.
|
|
///
|
|
/// If the current contents are longer than the given length,
|
|
/// they will be truncated to fit.
|
|
///
|
|
/// This is equivalent to getting `self`'s `GtkEntryBuffer` and
|
|
/// calling [method`Gtk`.EntryBuffer.set_max_length] on it.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Text.setMaxLength(length:)`.
|
|
///
|
|
/// - Parameter maxLength: Maximum number of characters that are allowed.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func maxLength(_ maxLength: @escaping () -> Int32) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setMaxLength(length: maxLength()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Text.setOverwriteMode(overwrite:)
|
|
/// Sets whether the text is overwritten when typing.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter overwriteMode: If text is overwritten when typing.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func overwriteMode(_ overwriteMode: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setOverwriteMode(overwrite: overwriteMode)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Text.setOverwriteMode(overwrite:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getOverwriteMode()
|
|
/// Sets whether the text is overwritten when typing.
|
|
///
|
|
/// 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 overwriteMode(_ overwriteMode: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, overwriteMode, registry: ctx.registry, notifyDetail: "overwrite-mode",
|
|
read: { [w] in w.getOverwriteMode() },
|
|
write: { [w] v in w.setOverwriteMode(overwrite: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Text.setOverwriteMode(overwrite:)
|
|
/// Sets whether the text is overwritten when typing.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Text.setOverwriteMode(overwrite:)`.
|
|
///
|
|
/// - Parameter overwriteMode: If text is overwritten when typing.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func overwriteMode(_ overwriteMode: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setOverwriteMode(overwrite: overwriteMode()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Text.setPlaceholderText(text:)
|
|
/// Sets the text to be displayed when the text widget is
|
|
/// empty and unfocused.
|
|
///
|
|
/// This can be used to give a visual hint of the expected
|
|
/// contents of the text widget.
|
|
///
|
|
/// 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 placeholderText: The text that will be displayed in the `GtkText` when it is empty and unfocused.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
@_disfavoredOverload
|
|
public func placeholderText<S: StringProtocol>(_ placeholderText: S?) -> Self {
|
|
appending { w, _ in
|
|
w.setPlaceholderText(text: placeholderText.map { String($0) })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Text.setPlaceholderText(text:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getPlaceholderText()
|
|
/// Sets the text to be displayed when the text widget is
|
|
/// empty and unfocused.
|
|
///
|
|
/// This can be used to give a visual hint of the expected
|
|
/// contents of the text widget.
|
|
///
|
|
/// 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 placeholderText(_ placeholderText: Portico.Binding<String?>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, placeholderText, registry: ctx.registry, notifyDetail: "placeholder-text",
|
|
read: { [w] in w.getPlaceholderText() },
|
|
write: { [w] v in w.setPlaceholderText(text: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Text.setPlaceholderText(text:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getPlaceholderText()
|
|
/// Sets the text to be displayed when the text widget is
|
|
/// empty and unfocused.
|
|
///
|
|
/// This can be used to give a visual hint of the expected
|
|
/// contents of the text widget.
|
|
///
|
|
/// 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 placeholderText(_ placeholderText: Portico.Binding<String>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, placeholderText, registry: ctx.registry, notifyDetail: "placeholder-text",
|
|
read: { [w] in w.getPlaceholderText() },
|
|
write: { [w] v in w.setPlaceholderText(text: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Text.setPlaceholderText(text:)
|
|
/// Sets the text to be displayed when the text widget is
|
|
/// empty and unfocused.
|
|
///
|
|
/// This can be used to give a visual hint of the expected
|
|
/// contents of the text widget.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Text.setPlaceholderText(text:)`.
|
|
///
|
|
/// - Parameter placeholderText: The text that will be displayed in the `GtkText` when it is empty and unfocused.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func placeholderText(_ placeholderText: @escaping () -> String?) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setPlaceholderText(text: placeholderText()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(interpolation) | source: Gtk.Text.setPlaceholderText(text:)
|
|
/// Sets the text to be displayed when the text widget is
|
|
/// empty and unfocused.
|
|
///
|
|
/// This can be used to give a visual hint of the expected
|
|
/// contents of the text widget.
|
|
///
|
|
/// Interpolated segments are captured unevaluated and re-read inside a `DependencyTracker`, so any `@State` they read pushes a new value through `Gtk.Text.setPlaceholderText(text:)`. A literal with no interpolation is applied once, with no subscription.
|
|
///
|
|
/// - Parameter placeholderText: The text that will be displayed in the `GtkText` when it is empty and unfocused.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func placeholderText(_ placeholderText: Portico.InterpolatedText?) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindOptionalInterpolation(placeholderText, registry: ctx.registry) { [w] v in w.setPlaceholderText(text: v) }
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Text.setPropagateTextWidth(propagateTextWidth:)
|
|
/// Sets whether the text widget should grow and shrink with the content.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter propagateTextWidth: Whether the widget should grow and shrink with the content.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func propagateTextWidth(_ propagateTextWidth: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setPropagateTextWidth(propagateTextWidth: propagateTextWidth)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Text.setPropagateTextWidth(propagateTextWidth:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getPropagateTextWidth()
|
|
/// Sets whether the text widget should grow and shrink with the content.
|
|
///
|
|
/// 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 propagateTextWidth(_ propagateTextWidth: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, propagateTextWidth, registry: ctx.registry, notifyDetail: "propagate-text-width",
|
|
read: { [w] in w.getPropagateTextWidth() },
|
|
write: { [w] v in w.setPropagateTextWidth(propagateTextWidth: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Text.setPropagateTextWidth(propagateTextWidth:)
|
|
/// Sets whether the text widget should grow and shrink with the content.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Text.setPropagateTextWidth(propagateTextWidth:)`.
|
|
///
|
|
/// - Parameter propagateTextWidth: Whether the widget should grow and shrink with the content.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func propagateTextWidth(_ propagateTextWidth: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setPropagateTextWidth(propagateTextWidth: propagateTextWidth()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Text.setTabs(tabs:)
|
|
/// Sets tab stops for the text widget.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter tabs: Custom tabs for this text widget.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func tabs(_ tabs: Gtk.TabArray?) -> Self {
|
|
appending { w, _ in
|
|
w.setTabs(tabs: tabs)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Text.setTabs(tabs:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getTabs()
|
|
/// Sets tab stops for the text widget.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// When `Gtk.TabArray?` 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 tabs(_ tabs: Portico.Binding<Gtk.TabArray?>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, tabs, registry: ctx.registry, notifyDetail: "tabs",
|
|
read: { [w] in w.getTabs() },
|
|
write: { [w] v in w.setTabs(tabs: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(lifted,twoWay) | source: Gtk.Text.setTabs(tabs:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getTabs()
|
|
/// Sets tab stops for the text widget.
|
|
///
|
|
/// Applied at mount and re-applied on every change the binding publishes.
|
|
/// `Binding` is invariant, so a `Binding<Gtk.TabArray>` is not accepted by the nullable overload; this one takes it and promotes each value. Pass a `Binding<Gtk.TabArray?>` to be able to clear the property.
|
|
/// When `Gtk.TabArray` 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 tabs(_ tabs: Portico.Binding<Gtk.TabArray>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, tabs, registry: ctx.registry, notifyDetail: "tabs",
|
|
read: { [w] in w.getTabs() },
|
|
write: { [w] v in w.setTabs(tabs: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Text.setTabs(tabs:)
|
|
/// Sets tab stops for the text widget.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Text.setTabs(tabs:)`.
|
|
///
|
|
/// - Parameter tabs: Custom tabs for this text widget.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func tabs(_ tabs: @escaping () -> Gtk.TabArray?) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setTabs(tabs: tabs()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Text.setTruncateMultiline(truncateMultiline:)
|
|
/// Sets whether pasted text should be truncated to the first line.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter truncateMultiline: When true, pasted multi-line text is truncated to the first line.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func truncateMultiline(_ truncateMultiline: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setTruncateMultiline(truncateMultiline: truncateMultiline)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Text.setTruncateMultiline(truncateMultiline:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getTruncateMultiline()
|
|
/// Sets whether pasted text should be truncated to the first line.
|
|
///
|
|
/// 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 truncateMultiline(_ truncateMultiline: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, truncateMultiline, registry: ctx.registry, notifyDetail: "truncate-multiline",
|
|
read: { [w] in w.getTruncateMultiline() },
|
|
write: { [w] v in w.setTruncateMultiline(truncateMultiline: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Text.setTruncateMultiline(truncateMultiline:)
|
|
/// Sets whether pasted text should be truncated to the first line.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Text.setTruncateMultiline(truncateMultiline:)`.
|
|
///
|
|
/// - Parameter truncateMultiline: When true, pasted multi-line text is truncated to the first line.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func truncateMultiline(_ truncateMultiline: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setTruncateMultiline(truncateMultiline: truncateMultiline()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Text.setVisibility(visible:)
|
|
/// Sets whether the contents of the text widget are visible or not.
|
|
///
|
|
/// When visibility is set to false, characters are displayed
|
|
/// as the invisible char, and it will also appear that way when
|
|
/// the text in the widget is copied to the clipboard.
|
|
///
|
|
/// By default, GTK picks the best invisible character available
|
|
/// in the current font, but it can be changed with
|
|
/// [method`Gtk`.Text.set_invisible_char].
|
|
///
|
|
/// Note that you probably want to set [property`Gtk`.Text:input-purpose]
|
|
/// to [enum`Gtk`.InputPurpose.password] or [enum`Gtk`.InputPurpose.pin]
|
|
/// to inform input methods about the purpose of this widget, in addition
|
|
/// to setting visibility to false.
|
|
///
|
|
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
|
|
///
|
|
/// - Parameter visibility: If false, the text is masked with the “invisible char”.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func visibility(_ visibility: Bool) -> Self {
|
|
appending { w, _ in
|
|
w.setVisibility(visible: visibility)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Text.setVisibility(visible:), GObject.Object.connectNotify(detail:_:), Gtk.Text.getVisibility()
|
|
/// Sets whether the contents of the text widget are visible or not.
|
|
///
|
|
/// When visibility is set to false, characters are displayed
|
|
/// as the invisible char, and it will also appear that way when
|
|
/// the text in the widget is copied to the clipboard.
|
|
///
|
|
/// By default, GTK picks the best invisible character available
|
|
/// in the current font, but it can be changed with
|
|
/// [method`Gtk`.Text.set_invisible_char].
|
|
///
|
|
/// Note that you probably want to set [property`Gtk`.Text:input-purpose]
|
|
/// to [enum`Gtk`.InputPurpose.password] or [enum`Gtk`.InputPurpose.pin]
|
|
/// to inform input methods about the purpose of this widget, in addition
|
|
/// to setting visibility to false.
|
|
///
|
|
/// 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 visibility(_ visibility: Portico.Binding<Bool>) -> Self {
|
|
appending { w, ctx in
|
|
Portico.bindProperty(
|
|
w, visibility, registry: ctx.registry, notifyDetail: "visibility",
|
|
read: { [w] in w.getVisibility() },
|
|
write: { [w] v in w.setVisibility(visible: v) }
|
|
)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Text.setVisibility(visible:)
|
|
/// Sets whether the contents of the text widget are visible or not.
|
|
///
|
|
/// When visibility is set to false, characters are displayed
|
|
/// as the invisible char, and it will also appear that way when
|
|
/// the text in the widget is copied to the clipboard.
|
|
///
|
|
/// By default, GTK picks the best invisible character available
|
|
/// in the current font, but it can be changed with
|
|
/// [method`Gtk`.Text.set_invisible_char].
|
|
///
|
|
/// Note that you probably want to set [property`Gtk`.Text:input-purpose]
|
|
/// to [enum`Gtk`.InputPurpose.password] or [enum`Gtk`.InputPurpose.pin]
|
|
/// to inform input methods about the purpose of this widget, in addition
|
|
/// to setting visibility to false.
|
|
///
|
|
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Text.setVisibility(visible:)`.
|
|
///
|
|
/// - Parameter visibility: If false, the text is masked with the “invisible char”.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func visibility(_ visibility: @escaping () -> Bool) -> Self {
|
|
appending { w, ctx in
|
|
let tracker = DependencyTracker { [w] in w.setVisibility(visible: visibility()) }
|
|
tracker.run()
|
|
ctx.registry.add(tracker)
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Text.connectActivate(_:)
|
|
/// Emitted when the user hits the <kbd>Enter</kbd> key.
|
|
///
|
|
/// The default bindings for this signal are all forms
|
|
/// of the <kbd>Enter</kbd> key.
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `activate` signal.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onActivate(_ handler: @escaping () -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectActivate { _ in handler() })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Text.connectBackspace(_:)
|
|
/// Emitted when the user asks for it.
|
|
///
|
|
/// This is a [keybinding signal](class.SignalAction.html).
|
|
///
|
|
/// The default bindings for this signal are
|
|
/// <kbd>Backspace</kbd> and <kbd>Shift</kbd>+<kbd>Backspace</kbd>.
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `backspace` signal.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onBackspace(_ handler: @escaping () -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectBackspace { _ in handler() })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Text.connectCopyClipboard(_:)
|
|
/// Emitted to copy the selection to the clipboard.
|
|
///
|
|
/// This is a [keybinding signal](class.SignalAction.html).
|
|
///
|
|
/// The default bindings for this signal are
|
|
/// <kbd>Ctrl</kbd>+<kbd>c</kbd> and
|
|
/// <kbd>Ctrl</kbd>+<kbd>Insert</kbd>.
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `copy-clipboard` signal.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onCopyClipboard(_ handler: @escaping () -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectCopyClipboard { _ in handler() })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Text.connectCutClipboard(_:)
|
|
/// Emitted to cut the selection to the clipboard.
|
|
///
|
|
/// This is a [keybinding signal](class.SignalAction.html).
|
|
///
|
|
/// The default bindings for this signal are
|
|
/// <kbd>Ctrl</kbd>+<kbd>x</kbd> and
|
|
/// <kbd>Shift</kbd>+<kbd>Delete</kbd>.
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `cut-clipboard` signal.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onCutClipboard(_ handler: @escaping () -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectCutClipboard { _ in handler() })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Text.connectDeleteFromCursor(_:)
|
|
/// Emitted when the user initiates a text deletion.
|
|
///
|
|
/// This is a [keybinding signal](class.SignalAction.html).
|
|
///
|
|
/// If the `type` is [enum`Gtk`.DeleteType.chars], GTK deletes the
|
|
/// selection if there is one, otherwise it deletes the requested
|
|
/// number of characters.
|
|
///
|
|
/// The default bindings for this signal are <kbd>Delete</kbd>
|
|
/// for deleting a character and <kbd>Ctrl</kbd>+<kbd>Delete</kbd>
|
|
/// for deleting a word.
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `delete-from-cursor` signal. The closure receives the signal's arguments in order.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onDeleteFromCursor(_ handler: @escaping (Gtk.DeleteType, Int32) -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectDeleteFromCursor { _, a0, a1 in handler(a0, a1) })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Text.connectInsertAtCursor(_:)
|
|
/// Emitted when the user initiates the insertion of a
|
|
/// fixed string at the cursor.
|
|
///
|
|
/// This is a [keybinding signal](class.SignalAction.html).
|
|
///
|
|
/// This signal has no default bindings.
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `insert-at-cursor` signal. The closure receives the signal's arguments in order.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onInsertAtCursor(_ handler: @escaping (String) -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectInsertAtCursor { _, a0 in handler(a0) })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Text.connectInsertEmoji(_:)
|
|
/// Emitted to present the Emoji chooser.
|
|
///
|
|
/// This is a [keybinding signal](class.SignalAction.html).
|
|
///
|
|
/// The default bindings for this signal are
|
|
/// <kbd>Ctrl</kbd>+<kbd>.</kbd> and
|
|
/// <kbd>Ctrl</kbd>+<kbd>;</kbd>
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `insert-emoji` signal.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onInsertEmoji(_ handler: @escaping () -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectInsertEmoji { _ in handler() })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Text.connectMoveCursor(_:)
|
|
/// Emitted when the user initiates a cursor movement.
|
|
///
|
|
/// If the cursor is not visible in `self`, this signal causes
|
|
/// the viewport to be moved instead.
|
|
///
|
|
/// This is a [keybinding signal](class.SignalAction.html).
|
|
///
|
|
/// Applications should not connect to it, but may emit it with
|
|
/// [func`GObject`.signal_emit_by_name] if they need to control
|
|
/// the cursor programmatically.
|
|
///
|
|
/// The default bindings for this signal come in two variants,
|
|
/// the variant with the <kbd>Shift</kbd> modifier extends the
|
|
/// selection, the variant without it does not.
|
|
/// There are too many key combinations to list them all here.
|
|
///
|
|
/// - <kbd>←</kbd>, <kbd>→</kbd>, <kbd>↑</kbd>, <kbd>↓</kbd>
|
|
/// move by individual characters/lines
|
|
/// - <kbd>Ctrl</kbd>+<kbd>←</kbd>, etc. move by words/paragraphs
|
|
/// - <kbd>Home</kbd> and <kbd>End</kbd> move to the ends of the buffer
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `move-cursor` signal. The closure receives the signal's arguments in order.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onMoveCursor(_ handler: @escaping (Gtk.MovementStep, Int32, Bool) -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectMoveCursor { _, a0, a1, a2 in handler(a0, a1, a2) })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Text.connectPasteClipboard(_:)
|
|
/// Emitted to paste the contents of the clipboard.
|
|
///
|
|
/// This is a [keybinding signal](class.SignalAction.html).
|
|
///
|
|
/// The default bindings for this signal are
|
|
/// <kbd>Ctrl</kbd>+<kbd>v</kbd> and <kbd>Shift</kbd>+<kbd>Insert</kbd>.
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `paste-clipboard` signal.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onPasteClipboard(_ handler: @escaping () -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectPasteClipboard { _ in handler() })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Text.connectPreeditChanged(_:)
|
|
/// Emitted when the preedit text changes.
|
|
///
|
|
/// If an input method is used, the typed text will not immediately
|
|
/// be committed to the buffer. So if you are interested in the text,
|
|
/// connect to this signal.
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `preedit-changed` signal. The closure receives the signal's arguments in order.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onPreeditChanged(_ handler: @escaping (String) -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectPreeditChanged { _, a0 in handler(a0) })
|
|
}
|
|
}
|
|
|
|
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Text.connectToggleOverwrite(_:)
|
|
/// Emitted to toggle the overwrite mode.
|
|
///
|
|
/// This is a [keybinding signal](class.SignalAction.html).
|
|
///
|
|
/// The default bindings for this signal is <kbd>Insert</kbd>.
|
|
///
|
|
/// - Parameter handler: Invoked when the widget emits the `toggle-overwrite` signal.
|
|
/// - Returns: A copy of this view with the modifier applied.
|
|
public func onToggleOverwrite(_ handler: @escaping () -> Void) -> Self {
|
|
appending { w, ctx in
|
|
ctx.registry.add(w.connectToggleOverwrite { _ in handler() })
|
|
}
|
|
}
|
|
|
|
}
|