portico/Sources/Portico/Generated/TextView.swift

1619 lines
92 KiB
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters

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

// Generated by PorticoGen. DO NOT EDIT. See Sources/PorticoGen to make changes.
import Adw
import Gtk
import Gio
import Gdk
// PorticoGen: generateStruct | source: Gtk.TextView
/// Displays the contents of a [class`Gtk`.TextBuffer].
///
/// <picture>
/// <source srcset="multiline-text-dark.png" media="(prefers-color-scheme: dark)">
/// <img alt="An example GtkTextView" src="multiline-text.png">
/// </picture>
///
/// You may wish to begin by reading the [conceptual overview](section-text-widget.html),
/// which gives an overview of all the objects and data types related to the
/// text widget and how they work together.
///
/// ## Shortcuts and Gestures
///
/// `GtkTextView` supports the following keyboard shortcuts:
///
/// - <kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Menu</kbd> opens the context menu.
/// - <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>Clear</kbd> clears the content.
///
/// Additionally, the following signals have default keybindings:
///
/// - [signal`Gtk`.TextView::backspace]
/// - [signal`Gtk`.TextView::copy-clipboard]
/// - [signal`Gtk`.TextView::cut-clipboard]
/// - [signal`Gtk`.TextView::delete-from-cursor]
/// - [signal`Gtk`.TextView::insert-emoji]
/// - [signal`Gtk`.TextView::move-cursor]
/// - [signal`Gtk`.TextView::paste-clipboard]
/// - [signal`Gtk`.TextView::select-all]
/// - [signal`Gtk`.TextView::toggle-cursor-visible]
/// - [signal`Gtk`.TextView::toggle-overwrite]
///
/// ## Actions
///
/// `GtkTextView` 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.
/// - `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` clears the content.
///
/// ## CSS nodes
///
/// ```
/// textview.view
/// border.top
/// border.left
/// text
/// [selection]
/// border.right
/// border.bottom
/// [window.popup]
/// ```
///
/// `GtkTextView` has a main css node with name textview and style class .view,
/// and subnodes for each of the border windows, and the main text area,
/// with names border and text, respectively. The border nodes each get
/// one of the style classes .left, .right, .top or .bottom.
///
/// A node representing the selection will appear below the text node.
///
/// If a context menu is opened, the window node will appear as a subnode
/// of the main node.
///
/// ## Accessibility
///
/// `GtkTextView` uses the [enum`Gtk`.AccessibleRole.text_box] role.
///
/// A Portico view that mounts a `Gtk.TextView`.
@MainActor public struct TextView: View {
private let make: (MountContext) -> Gtk.TextView
private var configure: [(Gtk.TextView, MountContext) -> Void] = []
public var body: Never { fatalError() }
// PorticoGen: generateInits(static) | source: Gtk.TextView.init()
/// Creates a new `GtkTextView`.
///
/// If you dont call [method`Gtk`.TextView.set_buffer] before using the
/// text view, an empty default buffer will be created for you. Get the
/// buffer with [method`Gtk`.TextView.get_buffer]. If you want to specify
/// your own buffer, consider [ctor`Gtk`.TextView.new_with_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 acceptsTab: Whether Tab will result in a tab character being entered.
/// - Parameter bottomMargin: The bottom margin for text in the text view.
/// - Parameter cursorVisible: If the insertion cursor is shown.
/// - Parameter editable: Whether the text can be modified by the user.
/// - Parameter extraMenu: A menu model whose contents will be appended to the context menu.
/// - Parameter indent: Amount to indent the paragraph, in pixels.
/// - Parameter inputHints: Additional hints (beyond [property`Gtk`.TextView:input-purpose]) that allow input methods to fine-tune their behaviour.
/// - Parameter inputPurpose: The purpose of this text field.
/// - Parameter justification: Left, right, or center justification.
/// - Parameter leftMargin: The default left margin for text in the text view.
/// - Parameter monospace: Whether text should be displayed in a monospace font.
/// - Parameter overwrite: Whether entered text overwrites existing contents.
/// - Parameter pixelsAboveLines: Pixels of blank space above paragraphs.
/// - Parameter pixelsBelowLines: Pixels of blank space below paragraphs.
/// - Parameter pixelsInsideWrap: Pixels of blank space between wrapped lines in a paragraph.
/// - Parameter rightMargin: The default right margin for text in the text view.
/// - Parameter tabs: Custom tabs for this text.
/// - Parameter topMargin: The top margin for text in the text view.
/// - Parameter wrapMode: Whether to wrap lines never, at word boundaries, or at character boundaries.
/// - 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 onExtendSelection: Invoked when the widget emits the `extend-selection` signal. The closure receives the signal's arguments in order. Its return value is forwarded to GTK as the signal's result.
/// - 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 onMoveViewport: Invoked when the widget emits the `move-viewport` 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 onSelectAll: Invoked when the widget emits the `select-all` signal. The closure receives the signal's arguments in order.
/// - Parameter onSetAnchor: Invoked when the widget emits the `set-anchor` signal.
/// - Parameter onToggleCursorVisible: Invoked when the widget emits the `toggle-cursor-visible` signal.
/// - Parameter onToggleOverwrite: Invoked when the widget emits the `toggle-overwrite` signal.
public init(acceptsTab: Bool? = nil, bottomMargin: Int32? = nil, cursorVisible: Bool? = nil, editable: Bool? = nil, extraMenu: Gtk.MenuModel? = nil, indent: Int32? = nil, inputHints: Gtk.InputHints? = nil, inputPurpose: Gtk.InputPurpose? = nil, justification: Gtk.Justification? = nil, leftMargin: Int32? = nil, monospace: Bool? = nil, overwrite: Bool? = nil, pixelsAboveLines: Int32? = nil, pixelsBelowLines: Int32? = nil, pixelsInsideWrap: Int32? = nil, rightMargin: Int32? = nil, tabs: Gtk.TabArray? = nil, topMargin: Int32? = nil, wrapMode: Gtk.WrapMode? = nil, onBackspace: (() -> Void)? = nil, onCopyClipboard: (() -> Void)? = nil, onCutClipboard: (() -> Void)? = nil, onDeleteFromCursor: ((Gtk.DeleteType, Int32) -> Void)? = nil, onExtendSelection: ((Gtk.TextExtendSelection, Gtk.TextIter, Gtk.TextIter, Gtk.TextIter) -> Bool)? = nil, onInsertAtCursor: ((String) -> Void)? = nil, onInsertEmoji: (() -> Void)? = nil, onMoveCursor: ((Gtk.MovementStep, Int32, Bool) -> Void)? = nil, onMoveViewport: ((Gtk.ScrollStep, Int32) -> Void)? = nil, onPasteClipboard: (() -> Void)? = nil, onPreeditChanged: ((String) -> Void)? = nil, onSelectAll: ((Bool) -> Void)? = nil, onSetAnchor: (() -> Void)? = nil, onToggleCursorVisible: (() -> Void)? = nil, onToggleOverwrite: (() -> Void)? = nil) {
make = { _ in Gtk.TextView() }
configure.append { w, ctx in
if let acceptsTab { w.setAcceptsTab(acceptsTab: acceptsTab) }
if let bottomMargin { w.setBottomMargin(bottomMargin: bottomMargin) }
if let cursorVisible { w.setCursorVisible(setting: cursorVisible) }
if let editable { w.setEditable(setting: editable) }
if let extraMenu { w.setExtraMenu(model: extraMenu) }
if let indent { w.setIndent(indent: indent) }
if let inputHints { w.setInputHints(hints: inputHints) }
if let inputPurpose { w.setInputPurpose(purpose: inputPurpose) }
if let justification { w.setJustification(justification: justification) }
if let leftMargin { w.setLeftMargin(leftMargin: leftMargin) }
if let monospace { w.setMonospace(monospace: monospace) }
if let overwrite { w.setOverwrite(overwrite: overwrite) }
if let pixelsAboveLines { w.setPixelsAboveLines(pixelsAboveLines: pixelsAboveLines) }
if let pixelsBelowLines { w.setPixelsBelowLines(pixelsBelowLines: pixelsBelowLines) }
if let pixelsInsideWrap { w.setPixelsInsideWrap(pixelsInsideWrap: pixelsInsideWrap) }
if let rightMargin { w.setRightMargin(rightMargin: rightMargin) }
if let tabs { w.setTabs(tabs: tabs) }
if let topMargin { w.setTopMargin(topMargin: topMargin) }
if let wrapMode { w.setWrapMode(wrapMode: wrapMode) }
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 onExtendSelection { ctx.registry.add(w.connectExtendSelection { _, a0, a1, a2, a3 in onExtendSelection(a0, a1, a2, a3) }) }
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 onMoveViewport { ctx.registry.add(w.connectMoveViewport { _, a0, a1 in onMoveViewport(a0, a1) }) }
if let onPasteClipboard { ctx.registry.add(w.connectPasteClipboard { _ in onPasteClipboard() }) }
if let onPreeditChanged { ctx.registry.add(w.connectPreeditChanged { _, a0 in onPreeditChanged(a0) }) }
if let onSelectAll { ctx.registry.add(w.connectSelectAll { _, a0 in onSelectAll(a0) }) }
if let onSetAnchor { ctx.registry.add(w.connectSetAnchor { _ in onSetAnchor() }) }
if let onToggleCursorVisible { ctx.registry.add(w.connectToggleCursorVisible { _ in onToggleCursorVisible() }) }
if let onToggleOverwrite { ctx.registry.add(w.connectToggleOverwrite { _ in onToggleOverwrite() }) }
}
}
// PorticoGen: generateInits(static) | source: Gtk.TextView.init(buffer:)
/// Creates a new `GtkTextView` widget displaying the buffer `buffer`.
///
/// One buffer can be shared among many widgets. `buffer` may be `nil`
/// to create a default buffer, in which case this function is equivalent
/// to [ctor`Gtk`.TextView.new]. The text view adds its own reference count
/// to the buffer; it does not take over an existing reference.
///
/// 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 buffer which is displayed.
/// - Parameter acceptsTab: Whether Tab will result in a tab character being entered.
/// - Parameter bottomMargin: The bottom margin for text in the text view.
/// - Parameter cursorVisible: If the insertion cursor is shown.
/// - Parameter editable: Whether the text can be modified by the user.
/// - Parameter extraMenu: A menu model whose contents will be appended to the context menu.
/// - Parameter indent: Amount to indent the paragraph, in pixels.
/// - Parameter inputHints: Additional hints (beyond [property`Gtk`.TextView:input-purpose]) that allow input methods to fine-tune their behaviour.
/// - Parameter inputPurpose: The purpose of this text field.
/// - Parameter justification: Left, right, or center justification.
/// - Parameter leftMargin: The default left margin for text in the text view.
/// - Parameter monospace: Whether text should be displayed in a monospace font.
/// - Parameter overwrite: Whether entered text overwrites existing contents.
/// - Parameter pixelsAboveLines: Pixels of blank space above paragraphs.
/// - Parameter pixelsBelowLines: Pixels of blank space below paragraphs.
/// - Parameter pixelsInsideWrap: Pixels of blank space between wrapped lines in a paragraph.
/// - Parameter rightMargin: The default right margin for text in the text view.
/// - Parameter tabs: Custom tabs for this text.
/// - Parameter topMargin: The top margin for text in the text view.
/// - Parameter wrapMode: Whether to wrap lines never, at word boundaries, or at character boundaries.
/// - 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 onExtendSelection: Invoked when the widget emits the `extend-selection` signal. The closure receives the signal's arguments in order. Its return value is forwarded to GTK as the signal's result.
/// - 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 onMoveViewport: Invoked when the widget emits the `move-viewport` 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 onSelectAll: Invoked when the widget emits the `select-all` signal. The closure receives the signal's arguments in order.
/// - Parameter onSetAnchor: Invoked when the widget emits the `set-anchor` signal.
/// - Parameter onToggleCursorVisible: Invoked when the widget emits the `toggle-cursor-visible` signal.
/// - Parameter onToggleOverwrite: Invoked when the widget emits the `toggle-overwrite` signal.
public init(buffer: Gtk.TextBuffer, acceptsTab: Bool? = nil, bottomMargin: Int32? = nil, cursorVisible: Bool? = nil, editable: Bool? = nil, extraMenu: Gtk.MenuModel? = nil, indent: Int32? = nil, inputHints: Gtk.InputHints? = nil, inputPurpose: Gtk.InputPurpose? = nil, justification: Gtk.Justification? = nil, leftMargin: Int32? = nil, monospace: Bool? = nil, overwrite: Bool? = nil, pixelsAboveLines: Int32? = nil, pixelsBelowLines: Int32? = nil, pixelsInsideWrap: Int32? = nil, rightMargin: Int32? = nil, tabs: Gtk.TabArray? = nil, topMargin: Int32? = nil, wrapMode: Gtk.WrapMode? = nil, onBackspace: (() -> Void)? = nil, onCopyClipboard: (() -> Void)? = nil, onCutClipboard: (() -> Void)? = nil, onDeleteFromCursor: ((Gtk.DeleteType, Int32) -> Void)? = nil, onExtendSelection: ((Gtk.TextExtendSelection, Gtk.TextIter, Gtk.TextIter, Gtk.TextIter) -> Bool)? = nil, onInsertAtCursor: ((String) -> Void)? = nil, onInsertEmoji: (() -> Void)? = nil, onMoveCursor: ((Gtk.MovementStep, Int32, Bool) -> Void)? = nil, onMoveViewport: ((Gtk.ScrollStep, Int32) -> Void)? = nil, onPasteClipboard: (() -> Void)? = nil, onPreeditChanged: ((String) -> Void)? = nil, onSelectAll: ((Bool) -> Void)? = nil, onSetAnchor: (() -> Void)? = nil, onToggleCursorVisible: (() -> Void)? = nil, onToggleOverwrite: (() -> Void)? = nil) {
make = { _ in Gtk.TextView(buffer: buffer) }
configure.append { w, ctx in
if let acceptsTab { w.setAcceptsTab(acceptsTab: acceptsTab) }
if let bottomMargin { w.setBottomMargin(bottomMargin: bottomMargin) }
if let cursorVisible { w.setCursorVisible(setting: cursorVisible) }
if let editable { w.setEditable(setting: editable) }
if let extraMenu { w.setExtraMenu(model: extraMenu) }
if let indent { w.setIndent(indent: indent) }
if let inputHints { w.setInputHints(hints: inputHints) }
if let inputPurpose { w.setInputPurpose(purpose: inputPurpose) }
if let justification { w.setJustification(justification: justification) }
if let leftMargin { w.setLeftMargin(leftMargin: leftMargin) }
if let monospace { w.setMonospace(monospace: monospace) }
if let overwrite { w.setOverwrite(overwrite: overwrite) }
if let pixelsAboveLines { w.setPixelsAboveLines(pixelsAboveLines: pixelsAboveLines) }
if let pixelsBelowLines { w.setPixelsBelowLines(pixelsBelowLines: pixelsBelowLines) }
if let pixelsInsideWrap { w.setPixelsInsideWrap(pixelsInsideWrap: pixelsInsideWrap) }
if let rightMargin { w.setRightMargin(rightMargin: rightMargin) }
if let tabs { w.setTabs(tabs: tabs) }
if let topMargin { w.setTopMargin(topMargin: topMargin) }
if let wrapMode { w.setWrapMode(wrapMode: wrapMode) }
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 onExtendSelection { ctx.registry.add(w.connectExtendSelection { _, a0, a1, a2, a3 in onExtendSelection(a0, a1, a2, a3) }) }
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 onMoveViewport { ctx.registry.add(w.connectMoveViewport { _, a0, a1 in onMoveViewport(a0, a1) }) }
if let onPasteClipboard { ctx.registry.add(w.connectPasteClipboard { _ in onPasteClipboard() }) }
if let onPreeditChanged { ctx.registry.add(w.connectPreeditChanged { _, a0 in onPreeditChanged(a0) }) }
if let onSelectAll { ctx.registry.add(w.connectSelectAll { _, a0 in onSelectAll(a0) }) }
if let onSetAnchor { ctx.registry.add(w.connectSetAnchor { _ in onSetAnchor() }) }
if let onToggleCursorVisible { ctx.registry.add(w.connectToggleCursorVisible { _ in onToggleCursorVisible() }) }
if let onToggleOverwrite { ctx.registry.add(w.connectToggleOverwrite { _ in onToggleOverwrite() }) }
}
}
}
extension TextView: WidgetView {
public typealias Target = Gtk.TextView
@_spi(Portico) public func appending(
_ step: @escaping (Gtk.TextView, MountContext) -> Void
) -> Self {
var c = self
c.configure.append(step)
return c
}
}
@_spi(Portico) extension TextView: 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.TextView
/// Modifiers for `Gtk.TextView`, available on every Portico view whose
/// backing widget is `Gtk.TextView` or one of its subclasses.
extension WidgetView where Target: Gtk.TextView {
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.TextView.setAcceptsTab(acceptsTab:)
/// Sets the behavior of the text widget when the <kbd>Tab</kbd> key is pressed.
///
/// If `accepts_tab` is `true`, a tab character is inserted. If `accepts_tab`
/// is `false` the keyboard focus is moved to the next widget in the focus
/// chain.
///
/// Focus can always be moved using <kbd>Ctrl</kbd>+<kbd>Tab</kbd>.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter acceptsTab: Whether Tab will result in a tab character being entered.
/// - Returns: A copy of this view with the modifier applied.
public func acceptsTab(_ acceptsTab: Bool) -> Self {
appending { w, _ in
w.setAcceptsTab(acceptsTab: acceptsTab)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.TextView.setAcceptsTab(acceptsTab:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getAcceptsTab()
/// Sets the behavior of the text widget when the <kbd>Tab</kbd> key is pressed.
///
/// If `accepts_tab` is `true`, a tab character is inserted. If `accepts_tab`
/// is `false` the keyboard focus is moved to the next widget in the focus
/// chain.
///
/// Focus can always be moved using <kbd>Ctrl</kbd>+<kbd>Tab</kbd>.
///
/// 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 acceptsTab(_ acceptsTab: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, acceptsTab, registry: ctx.registry, notifyDetail: "accepts-tab",
read: { [w] in w.getAcceptsTab() },
write: { [w] v in w.setAcceptsTab(acceptsTab: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.TextView.setAcceptsTab(acceptsTab:)
/// Sets the behavior of the text widget when the <kbd>Tab</kbd> key is pressed.
///
/// If `accepts_tab` is `true`, a tab character is inserted. If `accepts_tab`
/// is `false` the keyboard focus is moved to the next widget in the focus
/// chain.
///
/// Focus can always be moved using <kbd>Ctrl</kbd>+<kbd>Tab</kbd>.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.TextView.setAcceptsTab(acceptsTab:)`.
///
/// - Parameter acceptsTab: Whether Tab will result in a tab character being entered.
/// - Returns: A copy of this view with the modifier applied.
public func acceptsTab(_ acceptsTab: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setAcceptsTab(acceptsTab: acceptsTab()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.TextView.setBottomMargin(bottomMargin:)
/// Sets the bottom margin for text in `text_view`.
///
/// Note that this function is confusingly named.
/// In CSS terms, the value set here is padding.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter bottomMargin: The bottom margin for text in the text view.
/// - Returns: A copy of this view with the modifier applied.
public func bottomMargin(_ bottomMargin: Int32) -> Self {
appending { w, _ in
w.setBottomMargin(bottomMargin: bottomMargin)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.TextView.setBottomMargin(bottomMargin:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getBottomMargin()
/// Sets the bottom margin for text in `text_view`.
///
/// Note that this function is confusingly named.
/// In CSS terms, the value set here is padding.
///
/// 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 bottomMargin(_ bottomMargin: Portico.Binding<Int32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, bottomMargin, registry: ctx.registry, notifyDetail: "bottom-margin",
read: { [w] in w.getBottomMargin() },
write: { [w] v in w.setBottomMargin(bottomMargin: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.TextView.setBottomMargin(bottomMargin:)
/// Sets the bottom margin for text in `text_view`.
///
/// Note that this function is confusingly named.
/// In CSS terms, the value set here is padding.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.TextView.setBottomMargin(bottomMargin:)`.
///
/// - Parameter bottomMargin: The bottom margin for text in the text view.
/// - Returns: A copy of this view with the modifier applied.
public func bottomMargin(_ bottomMargin: @escaping () -> Int32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setBottomMargin(bottomMargin: bottomMargin()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.TextView.setCursorVisible(setting:)
/// Toggles whether the insertion point should be displayed.
///
/// A buffer with no editable text probably shouldnt have a visible
/// cursor, so you may want to turn the cursor off.
///
/// Note that this property may be overridden by the
/// [property`Gtk`.Settings:gtk-keynav-use-caret] setting.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter cursorVisible: If the insertion cursor is shown.
/// - Returns: A copy of this view with the modifier applied.
public func cursorVisible(_ cursorVisible: Bool) -> Self {
appending { w, _ in
w.setCursorVisible(setting: cursorVisible)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.TextView.setCursorVisible(setting:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getCursorVisible()
/// Toggles whether the insertion point should be displayed.
///
/// A buffer with no editable text probably shouldnt have a visible
/// cursor, so you may want to turn the cursor off.
///
/// Note that this property may be overridden by the
/// [property`Gtk`.Settings:gtk-keynav-use-caret] setting.
///
/// 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 cursorVisible(_ cursorVisible: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, cursorVisible, registry: ctx.registry, notifyDetail: "cursor-visible",
read: { [w] in w.getCursorVisible() },
write: { [w] v in w.setCursorVisible(setting: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.TextView.setCursorVisible(setting:)
/// Toggles whether the insertion point should be displayed.
///
/// A buffer with no editable text probably shouldnt have a visible
/// cursor, so you may want to turn the cursor off.
///
/// Note that this property may be overridden by the
/// [property`Gtk`.Settings:gtk-keynav-use-caret] setting.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.TextView.setCursorVisible(setting:)`.
///
/// - Parameter cursorVisible: If the insertion cursor is shown.
/// - Returns: A copy of this view with the modifier applied.
public func cursorVisible(_ cursorVisible: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setCursorVisible(setting: cursorVisible()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.TextView.setEditable(setting:)
/// Sets the default editability of the `GtkTextView`.
///
/// You can override this default setting with tags in the buffer,
/// using the editable attribute of tags.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter editable: Whether the text can be modified by the user.
/// - Returns: A copy of this view with the modifier applied.
public func editable(_ editable: Bool) -> Self {
appending { w, _ in
w.setEditable(setting: editable)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.TextView.setEditable(setting:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getEditable()
/// Sets the default editability of the `GtkTextView`.
///
/// You can override this default setting with tags in the buffer,
/// using the editable attribute of tags.
///
/// 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 editable(_ editable: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, editable, registry: ctx.registry, notifyDetail: "editable",
read: { [w] in w.getEditable() },
write: { [w] v in w.setEditable(setting: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.TextView.setEditable(setting:)
/// Sets the default editability of the `GtkTextView`.
///
/// You can override this default setting with tags in the buffer,
/// using the editable attribute of tags.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.TextView.setEditable(setting:)`.
///
/// - Parameter editable: Whether the text can be modified by the user.
/// - Returns: A copy of this view with the modifier applied.
public func editable(_ editable: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setEditable(setting: editable()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.TextView.setExtraMenu(model:)
/// Sets a menu model to add when constructing the context
/// menu for `text_view`.
///
/// You can pass `nil` to remove a previously set extra menu.
///
/// 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.TextView.setExtraMenu(model:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getExtraMenu()
/// Sets a menu model to add when constructing the context
/// menu for `text_view`.
///
/// You can pass `nil` to remove a previously set extra menu.
///
/// 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.TextView.setExtraMenu(model:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getExtraMenu()
/// Sets a menu model to add when constructing the context
/// menu for `text_view`.
///
/// You can pass `nil` to remove a previously set extra menu.
///
/// 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.TextView.setExtraMenu(model:)
/// Sets a menu model to add when constructing the context
/// menu for `text_view`.
///
/// You can pass `nil` to remove a previously set extra menu.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.TextView.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.TextView.setIndent(indent:)
/// Sets the default indentation for paragraphs in `text_view`.
///
/// Tags in the buffer may override the default.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter indent: Amount to indent the paragraph, in pixels.
/// - Returns: A copy of this view with the modifier applied.
public func indent(_ indent: Int32) -> Self {
appending { w, _ in
w.setIndent(indent: indent)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.TextView.setIndent(indent:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getIndent()
/// Sets the default indentation for paragraphs in `text_view`.
///
/// Tags in the buffer may override the default.
///
/// 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 indent(_ indent: Portico.Binding<Int32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, indent, registry: ctx.registry, notifyDetail: "indent",
read: { [w] in w.getIndent() },
write: { [w] v in w.setIndent(indent: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.TextView.setIndent(indent:)
/// Sets the default indentation for paragraphs in `text_view`.
///
/// Tags in the buffer may override the default.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.TextView.setIndent(indent:)`.
///
/// - Parameter indent: Amount to indent the paragraph, in pixels.
/// - Returns: A copy of this view with the modifier applied.
public func indent(_ indent: @escaping () -> Int32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setIndent(indent: indent()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.TextView.setInputHints(hints:)
/// Sets the `input-hints` of the `GtkTextView`.
///
/// The `input-hints` 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 (beyond [property`Gtk`.TextView:input-purpose]) 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.TextView.setInputHints(hints:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getInputHints()
/// Sets the `input-hints` of the `GtkTextView`.
///
/// The `input-hints` 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.TextView.setInputHints(hints:)
/// Sets the `input-hints` of the `GtkTextView`.
///
/// The `input-hints` 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.TextView.setInputHints(hints:)`.
///
/// - Parameter inputHints: Additional hints (beyond [property`Gtk`.TextView:input-purpose]) 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.TextView.setInputPurpose(purpose:)
/// Sets the `input-purpose` of the `GtkTextView`.
///
/// 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.TextView.setInputPurpose(purpose:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getInputPurpose()
/// Sets the `input-purpose` of the `GtkTextView`.
///
/// 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.TextView.setInputPurpose(purpose:)
/// Sets the `input-purpose` of the `GtkTextView`.
///
/// 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.TextView.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.TextView.setJustification(justification:)
/// Sets the default justification of text in `text_view`.
///
/// Tags in the views buffer may override the default.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter justification: Left, right, or center justification.
/// - Returns: A copy of this view with the modifier applied.
public func justification(_ justification: Gtk.Justification) -> Self {
appending { w, _ in
w.setJustification(justification: justification)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.TextView.setJustification(justification:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getJustification()
/// Sets the default justification of text in `text_view`.
///
/// Tags in the views buffer may override the default.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.Justification` 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 justification(_ justification: Portico.Binding<Gtk.Justification>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, justification, registry: ctx.registry, notifyDetail: "justification",
read: { [w] in w.getJustification() },
write: { [w] v in w.setJustification(justification: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.TextView.setJustification(justification:)
/// Sets the default justification of text in `text_view`.
///
/// Tags in the views buffer may override the default.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.TextView.setJustification(justification:)`.
///
/// - Parameter justification: Left, right, or center justification.
/// - Returns: A copy of this view with the modifier applied.
public func justification(_ justification: @escaping () -> Gtk.Justification) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setJustification(justification: justification()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.TextView.setLeftMargin(leftMargin:)
/// Sets the default left margin for text in `text_view`.
///
/// Tags in the buffer may override the default.
///
/// Note that this function is confusingly named.
/// In CSS terms, the value set here is padding.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter leftMargin: The default left margin for text in the text view.
/// - Returns: A copy of this view with the modifier applied.
public func leftMargin(_ leftMargin: Int32) -> Self {
appending { w, _ in
w.setLeftMargin(leftMargin: leftMargin)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.TextView.setLeftMargin(leftMargin:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getLeftMargin()
/// Sets the default left margin for text in `text_view`.
///
/// Tags in the buffer may override the default.
///
/// Note that this function is confusingly named.
/// In CSS terms, the value set here is padding.
///
/// 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 leftMargin(_ leftMargin: Portico.Binding<Int32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, leftMargin, registry: ctx.registry, notifyDetail: "left-margin",
read: { [w] in w.getLeftMargin() },
write: { [w] v in w.setLeftMargin(leftMargin: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.TextView.setLeftMargin(leftMargin:)
/// Sets the default left margin for text in `text_view`.
///
/// Tags in the buffer may override the default.
///
/// Note that this function is confusingly named.
/// In CSS terms, the value set here is padding.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.TextView.setLeftMargin(leftMargin:)`.
///
/// - Parameter leftMargin: The default left margin for text in the text view.
/// - Returns: A copy of this view with the modifier applied.
public func leftMargin(_ leftMargin: @escaping () -> Int32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setLeftMargin(leftMargin: leftMargin()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.TextView.setMonospace(monospace:)
/// Sets whether the `GtkTextView` should display text in
/// monospace styling.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter monospace: Whether text should be displayed in a monospace font.
/// - Returns: A copy of this view with the modifier applied.
public func monospace(_ monospace: Bool) -> Self {
appending { w, _ in
w.setMonospace(monospace: monospace)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.TextView.setMonospace(monospace:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getMonospace()
/// Sets whether the `GtkTextView` should display text in
/// monospace styling.
///
/// 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 monospace(_ monospace: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, monospace, registry: ctx.registry, notifyDetail: "monospace",
read: { [w] in w.getMonospace() },
write: { [w] v in w.setMonospace(monospace: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.TextView.setMonospace(monospace:)
/// Sets whether the `GtkTextView` should display text in
/// monospace styling.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.TextView.setMonospace(monospace:)`.
///
/// - Parameter monospace: Whether text should be displayed in a monospace font.
/// - Returns: A copy of this view with the modifier applied.
public func monospace(_ monospace: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setMonospace(monospace: monospace()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.TextView.setOverwrite(overwrite:)
/// Changes the `GtkTextView` overwrite mode.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter overwrite: Whether entered text overwrites existing contents.
/// - Returns: A copy of this view with the modifier applied.
public func overwrite(_ overwrite: Bool) -> Self {
appending { w, _ in
w.setOverwrite(overwrite: overwrite)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.TextView.setOverwrite(overwrite:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getOverwrite()
/// Changes the `GtkTextView` overwrite mode.
///
/// 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 overwrite(_ overwrite: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, overwrite, registry: ctx.registry, notifyDetail: "overwrite",
read: { [w] in w.getOverwrite() },
write: { [w] v in w.setOverwrite(overwrite: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.TextView.setOverwrite(overwrite:)
/// Changes the `GtkTextView` overwrite mode.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.TextView.setOverwrite(overwrite:)`.
///
/// - Parameter overwrite: Whether entered text overwrites existing contents.
/// - Returns: A copy of this view with the modifier applied.
public func overwrite(_ overwrite: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setOverwrite(overwrite: overwrite()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.TextView.setPixelsAboveLines(pixelsAboveLines:)
/// Sets the default number of blank pixels above paragraphs in `text_view`.
///
/// Tags in the buffer for `text_view` may override the defaults.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter pixelsAboveLines: Pixels of blank space above paragraphs.
/// - Returns: A copy of this view with the modifier applied.
public func pixelsAboveLines(_ pixelsAboveLines: Int32) -> Self {
appending { w, _ in
w.setPixelsAboveLines(pixelsAboveLines: pixelsAboveLines)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.TextView.setPixelsAboveLines(pixelsAboveLines:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getPixelsAboveLines()
/// Sets the default number of blank pixels above paragraphs in `text_view`.
///
/// Tags in the buffer for `text_view` may override the defaults.
///
/// 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 pixelsAboveLines(_ pixelsAboveLines: Portico.Binding<Int32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, pixelsAboveLines, registry: ctx.registry, notifyDetail: "pixels-above-lines",
read: { [w] in w.getPixelsAboveLines() },
write: { [w] v in w.setPixelsAboveLines(pixelsAboveLines: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.TextView.setPixelsAboveLines(pixelsAboveLines:)
/// Sets the default number of blank pixels above paragraphs in `text_view`.
///
/// Tags in the buffer for `text_view` may override the defaults.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.TextView.setPixelsAboveLines(pixelsAboveLines:)`.
///
/// - Parameter pixelsAboveLines: Pixels of blank space above paragraphs.
/// - Returns: A copy of this view with the modifier applied.
public func pixelsAboveLines(_ pixelsAboveLines: @escaping () -> Int32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setPixelsAboveLines(pixelsAboveLines: pixelsAboveLines()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.TextView.setPixelsBelowLines(pixelsBelowLines:)
/// Sets the default number of pixels of blank space
/// to put below paragraphs in `text_view`.
///
/// May be overridden by tags applied to `text_view`s buffer.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter pixelsBelowLines: Pixels of blank space below paragraphs.
/// - Returns: A copy of this view with the modifier applied.
public func pixelsBelowLines(_ pixelsBelowLines: Int32) -> Self {
appending { w, _ in
w.setPixelsBelowLines(pixelsBelowLines: pixelsBelowLines)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.TextView.setPixelsBelowLines(pixelsBelowLines:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getPixelsBelowLines()
/// Sets the default number of pixels of blank space
/// to put below paragraphs in `text_view`.
///
/// May be overridden by tags applied to `text_view`s buffer.
///
/// 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 pixelsBelowLines(_ pixelsBelowLines: Portico.Binding<Int32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, pixelsBelowLines, registry: ctx.registry, notifyDetail: "pixels-below-lines",
read: { [w] in w.getPixelsBelowLines() },
write: { [w] v in w.setPixelsBelowLines(pixelsBelowLines: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.TextView.setPixelsBelowLines(pixelsBelowLines:)
/// Sets the default number of pixels of blank space
/// to put below paragraphs in `text_view`.
///
/// May be overridden by tags applied to `text_view`s buffer.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.TextView.setPixelsBelowLines(pixelsBelowLines:)`.
///
/// - Parameter pixelsBelowLines: Pixels of blank space below paragraphs.
/// - Returns: A copy of this view with the modifier applied.
public func pixelsBelowLines(_ pixelsBelowLines: @escaping () -> Int32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setPixelsBelowLines(pixelsBelowLines: pixelsBelowLines()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.TextView.setPixelsInsideWrap(pixelsInsideWrap:)
/// Sets the default number of pixels of blank space to leave between
/// display/wrapped lines within a paragraph.
///
/// May be overridden by tags in `text_view`s buffer.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter pixelsInsideWrap: Pixels of blank space between wrapped lines in a paragraph.
/// - Returns: A copy of this view with the modifier applied.
public func pixelsInsideWrap(_ pixelsInsideWrap: Int32) -> Self {
appending { w, _ in
w.setPixelsInsideWrap(pixelsInsideWrap: pixelsInsideWrap)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.TextView.setPixelsInsideWrap(pixelsInsideWrap:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getPixelsInsideWrap()
/// Sets the default number of pixels of blank space to leave between
/// display/wrapped lines within a paragraph.
///
/// May be overridden by tags in `text_view`s buffer.
///
/// 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 pixelsInsideWrap(_ pixelsInsideWrap: Portico.Binding<Int32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, pixelsInsideWrap, registry: ctx.registry, notifyDetail: "pixels-inside-wrap",
read: { [w] in w.getPixelsInsideWrap() },
write: { [w] v in w.setPixelsInsideWrap(pixelsInsideWrap: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.TextView.setPixelsInsideWrap(pixelsInsideWrap:)
/// Sets the default number of pixels of blank space to leave between
/// display/wrapped lines within a paragraph.
///
/// May be overridden by tags in `text_view`s buffer.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.TextView.setPixelsInsideWrap(pixelsInsideWrap:)`.
///
/// - Parameter pixelsInsideWrap: Pixels of blank space between wrapped lines in a paragraph.
/// - Returns: A copy of this view with the modifier applied.
public func pixelsInsideWrap(_ pixelsInsideWrap: @escaping () -> Int32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setPixelsInsideWrap(pixelsInsideWrap: pixelsInsideWrap()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.TextView.setRightMargin(rightMargin:)
/// Sets the default right margin for text in the text view.
///
/// Tags in the buffer may override the default.
///
/// Note that this function is confusingly named.
/// In CSS terms, the value set here is padding.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter rightMargin: The default right margin for text in the text view.
/// - Returns: A copy of this view with the modifier applied.
public func rightMargin(_ rightMargin: Int32) -> Self {
appending { w, _ in
w.setRightMargin(rightMargin: rightMargin)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.TextView.setRightMargin(rightMargin:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getRightMargin()
/// Sets the default right margin for text in the text view.
///
/// Tags in the buffer may override the default.
///
/// Note that this function is confusingly named.
/// In CSS terms, the value set here is padding.
///
/// 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 rightMargin(_ rightMargin: Portico.Binding<Int32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, rightMargin, registry: ctx.registry, notifyDetail: "right-margin",
read: { [w] in w.getRightMargin() },
write: { [w] v in w.setRightMargin(rightMargin: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.TextView.setRightMargin(rightMargin:)
/// Sets the default right margin for text in the text view.
///
/// Tags in the buffer may override the default.
///
/// Note that this function is confusingly named.
/// In CSS terms, the value set here is padding.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.TextView.setRightMargin(rightMargin:)`.
///
/// - Parameter rightMargin: The default right margin for text in the text view.
/// - Returns: A copy of this view with the modifier applied.
public func rightMargin(_ rightMargin: @escaping () -> Int32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setRightMargin(rightMargin: rightMargin()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.TextView.setTabs(tabs:)
/// Sets the default tab stops for paragraphs in `text_view`.
///
/// Tags in the buffer may override the default.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter tabs: Custom tabs for this text.
/// - 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.TextView.setTabs(tabs:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getTabs()
/// Sets the default tab stops for paragraphs in `text_view`.
///
/// Tags in the buffer may override the default.
///
/// 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(lowered) | source: Gtk.TextView.setTabs(tabs:)
/// Sets the default tab stops for paragraphs in `text_view`.
///
/// Tags in the buffer may override the default.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// `Binding` is invariant and this property has no unset state; this overload accepts a nullable binding and ignores `nil` values. Binds one way only.
///
/// - Returns: A copy of this view with the modifier applied.
public func tabs(_ tabs: Portico.Binding<Gtk.TabArray?>) -> Self {
appending { w, ctx in
if let v = tabs.untrackedValue { w.setTabs(tabs: v) }
ctx.registry.add(tabs.subscribe { [w] v in if let v { w.setTabs(tabs: v) } })
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.TextView.setTabs(tabs:)
/// Sets the default tab stops for paragraphs in `text_view`.
///
/// Tags in the buffer may override the default.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.TextView.setTabs(tabs:)`.
///
/// - Parameter tabs: Custom tabs for this text.
/// - 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.TextView.setTopMargin(topMargin:)
/// Sets the top margin for text in `text_view`.
///
/// Note that this function is confusingly named.
/// In CSS terms, the value set here is padding.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter topMargin: The top margin for text in the text view.
/// - Returns: A copy of this view with the modifier applied.
public func topMargin(_ topMargin: Int32) -> Self {
appending { w, _ in
w.setTopMargin(topMargin: topMargin)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.TextView.setTopMargin(topMargin:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getTopMargin()
/// Sets the top margin for text in `text_view`.
///
/// Note that this function is confusingly named.
/// In CSS terms, the value set here is padding.
///
/// 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 topMargin(_ topMargin: Portico.Binding<Int32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, topMargin, registry: ctx.registry, notifyDetail: "top-margin",
read: { [w] in w.getTopMargin() },
write: { [w] v in w.setTopMargin(topMargin: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.TextView.setTopMargin(topMargin:)
/// Sets the top margin for text in `text_view`.
///
/// Note that this function is confusingly named.
/// In CSS terms, the value set here is padding.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.TextView.setTopMargin(topMargin:)`.
///
/// - Parameter topMargin: The top margin for text in the text view.
/// - Returns: A copy of this view with the modifier applied.
public func topMargin(_ topMargin: @escaping () -> Int32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setTopMargin(topMargin: topMargin()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.TextView.setWrapMode(wrapMode:)
/// Sets the line wrapping for the view.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter wrapMode: Whether to wrap lines never, at word boundaries, or at character boundaries.
/// - Returns: A copy of this view with the modifier applied.
public func wrapMode(_ wrapMode: Gtk.WrapMode) -> Self {
appending { w, _ in
w.setWrapMode(wrapMode: wrapMode)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.TextView.setWrapMode(wrapMode:), GObject.Object.connectNotify(detail:_:), Gtk.TextView.getWrapMode()
/// Sets the line wrapping for the view.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.WrapMode` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
///
/// - Returns: A copy of this view with the modifier applied.
public func wrapMode(_ wrapMode: Portico.Binding<Gtk.WrapMode>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, wrapMode, registry: ctx.registry, notifyDetail: "wrap-mode",
read: { [w] in w.getWrapMode() },
write: { [w] v in w.setWrapMode(wrapMode: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.TextView.setWrapMode(wrapMode:)
/// Sets the line wrapping for the view.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.TextView.setWrapMode(wrapMode:)`.
///
/// - Parameter wrapMode: Whether to wrap lines never, at word boundaries, or at character boundaries.
/// - Returns: A copy of this view with the modifier applied.
public func wrapMode(_ wrapMode: @escaping () -> Gtk.WrapMode) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setWrapMode(wrapMode: wrapMode()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.TextView.connectBackspace(_:)
/// Gets emitted when the user asks for it.
///
/// The ::backspace signal 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.TextView.connectCopyClipboard(_:)
/// Gets emitted to copy the selection to the clipboard.
///
/// The ::copy-clipboard signal 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.TextView.connectCutClipboard(_:)
/// Gets emitted to cut the selection to the clipboard.
///
/// The ::cut-clipboard signal 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.TextView.connectDeleteFromCursor(_:)
/// Gets emitted when the user initiates a text deletion.
///
/// The ::delete-from-cursor signal is a [keybinding signal](class.SignalAction.html).
///
/// If the `type` is `GTK_DELETE_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, <kbd>Ctrl</kbd>+<kbd>Delete</kbd> for
/// deleting a word and <kbd>Ctrl</kbd>+<kbd>Backspace</kbd> for
/// deleting a word backwards.
///
/// - 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.TextView.connectExtendSelection(_:)
/// Emitted when the selection needs to be extended at `location`.
///
/// - Parameter handler: Invoked when the widget emits the `extend-selection` signal. The closure receives the signal's arguments in order. Its return value is forwarded to GTK as the signal's result.
/// - Returns: A copy of this view with the modifier applied.
public func onExtendSelection(_ handler: @escaping (Gtk.TextExtendSelection, Gtk.TextIter, Gtk.TextIter, Gtk.TextIter) -> Bool) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectExtendSelection { _, a0, a1, a2, a3 in handler(a0, a1, a2, a3) })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.TextView.connectInsertAtCursor(_:)
/// Gets emitted when the user initiates the insertion of a
/// fixed string at the cursor.
///
/// The ::insert-at-cursor signal 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.TextView.connectInsertEmoji(_:)
/// Gets emitted to present the Emoji chooser for the `text_view`.
///
/// The ::insert-emoji signal 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.TextView.connectMoveCursor(_:)
/// Gets emitted when the user initiates a cursor movement.
///
/// The ::move-cursor signal is a [keybinding signal](class.SignalAction.html).
/// If the cursor is not visible in `text_view`, this signal causes
/// the viewport to be moved instead.
///
/// Applications should not connect to it, but may emit it with
/// g_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
/// - <kbd>PgUp</kbd> and <kbd>PgDn</kbd> move vertically by pages
/// - <kbd>Ctrl</kbd>+<kbd>PgUp</kbd> and <kbd>Ctrl</kbd>+<kbd>PgDn</kbd>
/// move horizontally by pages
///
/// - 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.TextView.connectMoveViewport(_:)
/// Gets emitted to move the viewport.
///
/// The ::move-viewport signal is a [keybinding signal](class.SignalAction.html),
/// which can be bound to key combinations to allow the user to move the viewport,
/// i.e. change what part of the text view is visible in a containing scrolled
/// window.
///
/// There are no default bindings for this signal.
///
/// - Parameter handler: Invoked when the widget emits the `move-viewport` signal. The closure receives the signal's arguments in order.
/// - Returns: A copy of this view with the modifier applied.
public func onMoveViewport(_ handler: @escaping (Gtk.ScrollStep, Int32) -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectMoveViewport { _, a0, a1 in handler(a0, a1) })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.TextView.connectPasteClipboard(_:)
/// Gets emitted to paste the contents of the clipboard
/// into the text view.
///
/// The ::paste-clipboard signal 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.TextView.connectPreeditChanged(_:)
/// Emitted when preedit text of the active IM 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.
///
/// This signal is only emitted if the text at the given position
/// is actually editable.
///
/// - 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.TextView.connectSelectAll(_:)
/// Gets emitted to select or unselect the complete contents of the text view.
///
/// The ::select-all signal is a [keybinding signal](class.SignalAction.html).
///
/// The default bindings for this signal are
/// <kbd>Ctrl</kbd>+<kbd>a</kbd> and
/// <kbd>Ctrl</kbd>+<kbd>/</kbd> for selecting and
/// <kbd>Shift</kbd>+<kbd>Ctrl</kbd>+<kbd>a</kbd> and
/// <kbd>Ctrl</kbd>+<kbd>\</kbd> for unselecting.
///
/// - Parameter handler: Invoked when the widget emits the `select-all` signal. The closure receives the signal's arguments in order.
/// - Returns: A copy of this view with the modifier applied.
public func onSelectAll(_ handler: @escaping (Bool) -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectSelectAll { _, a0 in handler(a0) })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.TextView.connectSetAnchor(_:)
/// Gets emitted when the user initiates settings the "anchor" mark.
///
/// The ::set-anchor signal is a [keybinding signal](class.SignalAction.html)
/// which gets emitted when the user initiates setting the "anchor"
/// mark. The "anchor" mark gets placed at the same position as the
/// "insert" mark.
///
/// This signal has no default bindings.
///
/// - Parameter handler: Invoked when the widget emits the `set-anchor` signal.
/// - Returns: A copy of this view with the modifier applied.
public func onSetAnchor(_ handler: @escaping () -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectSetAnchor { _ in handler() })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.TextView.connectToggleCursorVisible(_:)
/// Gets emitted to toggle the `cursor-visible` property.
///
/// The ::toggle-cursor-visible signal is a
/// [keybinding signal](class.SignalAction.html).
///
/// The default binding for this signal is <kbd>F7</kbd>.
///
/// - Parameter handler: Invoked when the widget emits the `toggle-cursor-visible` signal.
/// - Returns: A copy of this view with the modifier applied.
public func onToggleCursorVisible(_ handler: @escaping () -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectToggleCursorVisible { _ in handler() })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.TextView.connectToggleOverwrite(_:)
/// Gets emitted to toggle the overwrite mode of the text view.
///
/// The ::toggle-overwrite signal is a [keybinding signal](class.SignalAction.html).
///
/// The default binding 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() })
}
}
}