TextBufferProtocol

public protocol TextBufferProtocol : ObjectProtocol

Stores text and attributes for display in a GtkTextView.

You may wish to begin by reading the text widget conceptual overview, which gives an overview of all the objects and data types related to the text widget and how they work together.

GtkTextBuffer can support undoing changes to the buffer content, see [methodGtk.TextBuffer.set_enable_undo].

The TextBufferProtocol protocol exposes the methods and properties of an underlying GtkTextBuffer instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see TextBuffer. Alternatively, use TextBufferRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying GtkTextBuffer instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • text_buffer_ptr Default implementation

    Typed pointer to the underlying GtkTextBuffer instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GtkTextBuffer instance.

    Declaration

    Swift

    var text_buffer_ptr: UnsafeMutablePointer<GtkTextBuffer>! { get }
  • Required Initialiser for types conforming to TextBufferProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

TextBuffer Class

  • Bind a TextBufferPropertyName source property to a given target object.

    Declaration

    Swift

    @discardableResult
    @inlinable
    func bind<Q, T>(property source_property: TextBufferPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocol

    Parameters

    source_property

    the source property to bind

    target

    the target object to bind to

    target_property

    the target property to bind to

    flags

    the flags to pass to the Binding

    transform_from

    ValueTransformer to use for forward transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return Value

    binding reference or nil in case of an error

  • get(property:) Extension method

    Get the value of a TextBuffer property

    Declaration

    Swift

    @inlinable
    func get(property: TextBufferPropertyName) -> GLibObject.Value

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

  • set(property:value:) Extension method

    Set the value of a TextBuffer property. Note that this will only have an effect on properties that are writable and not construct-only!

    Declaration

    Swift

    @inlinable
    func set(property: TextBufferPropertyName, value v: GLibObject.Value)

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

TextBuffer signals

  • Connect a Swift signal handler to the given, typed TextBufferSignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: TextBufferSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> Int

    Parameters

    signal

    The signal to connect

    flags

    The connection flags to use

    data

    A pointer to user data to provide to the callback

    destroyData

    A GClosureNotify C function to destroy the data pointed to by userData

    handler

    The Swift signal handler (function or callback) to invoke on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • Connect a C signal handler to the given, typed TextBufferSignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: TextBufferSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> Int

    Parameters

    signal

    The signal to connect

    flags

    The connection flags to use

    data

    A pointer to user data to provide to the callback

    destroyData

    A GClosureNotify C function to destroy the data pointed to by userData

    signalHandler

    The C function to be called on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • onApplyTag(flags:handler:) Extension method

    Emitted to apply a tag to a range of text in a GtkTextBuffer.

    Applying actually occurs in the default handler.

    Note that if your handler runs before the default handler it must not invalidate the start and end iters (or has to revalidate them).

    See also: [methodGtk.TextBuffer.apply_tag], [methodGtk.TextBuffer.insert_with_tags], [methodGtk.TextBuffer.insert_range].

    Note

    This represents the underlying apply-tag signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onApplyTag(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ tag: TextTagRef, _ start: TextIterRef, _ end: TextIterRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    tag

    the applied tag

    start

    the start of the range the tag is applied to

    end

    the end of the range the tag is applied to

    handler

    The signal handler to call Run the given callback whenever the applyTag signal is emitted

  • applyTagSignal Extension method

    Typed apply-tag signal for using the connect(signal:) methods

    Declaration

    Swift

    static var applyTagSignal: TextBufferSignalName { get }
  • Emitted at the beginning of a single user-visible operation on a GtkTextBuffer.

    See also: [methodGtk.TextBuffer.begin_user_action], [methodGtk.TextBuffer.insert_interactive], [methodGtk.TextBuffer.insert_range_interactive], [methodGtk.TextBuffer.delete_interactive], [methodGtk.TextBuffer.backspace], [methodGtk.TextBuffer.delete_selection].

    Note

    This represents the underlying begin-user-action signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onBeginUserAction(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    handler

    The signal handler to call Run the given callback whenever the beginUserAction signal is emitted

  • beginUserActionSignal Extension method

    Typed begin-user-action signal for using the connect(signal:) methods

    Declaration

    Swift

    static var beginUserActionSignal: TextBufferSignalName { get }
  • onChanged(flags:handler:) Extension method

    Emitted when the content of a GtkTextBuffer has changed.

    Note

    This represents the underlying changed signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    handler

    The signal handler to call Run the given callback whenever the changed signal is emitted

  • changedSignal Extension method

    Typed changed signal for using the connect(signal:) methods

    Declaration

    Swift

    static var changedSignal: TextBufferSignalName { get }
  • Emitted to delete a range from a GtkTextBuffer.

    Note that if your handler runs before the default handler it must not invalidate the start and end iters (or has to revalidate them). The default signal handler revalidates the start and end iters to both point to the location where text was deleted. Handlers which run after the default handler (see g_signal_connect_after()) do not have access to the deleted text.

    See also: [methodGtk.TextBuffer.delete].

    Note

    This represents the underlying delete-range signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onDeleteRange(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ start: TextIterRef, _ end: TextIterRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    start

    the start of the range to be deleted

    end

    the end of the range to be deleted

    handler

    The signal handler to call Run the given callback whenever the deleteRange signal is emitted

  • deleteRangeSignal Extension method

    Typed delete-range signal for using the connect(signal:) methods

    Declaration

    Swift

    static var deleteRangeSignal: TextBufferSignalName { get }
  • Emitted at the end of a single user-visible operation on the GtkTextBuffer.

    See also: [methodGtk.TextBuffer.end_user_action], [methodGtk.TextBuffer.insert_interactive], [methodGtk.TextBuffer.insert_range_interactive], [methodGtk.TextBuffer.delete_interactive], [methodGtk.TextBuffer.backspace], [methodGtk.TextBuffer.delete_selection], [methodGtk.TextBuffer.backspace].

    Note

    This represents the underlying end-user-action signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onEndUserAction(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    handler

    The signal handler to call Run the given callback whenever the endUserAction signal is emitted

  • endUserActionSignal Extension method

    Typed end-user-action signal for using the connect(signal:) methods

    Declaration

    Swift

    static var endUserActionSignal: TextBufferSignalName { get }
  • Emitted to insert a GtkTextChildAnchor in a GtkTextBuffer.

    Insertion actually occurs in the default handler.

    Note that if your handler runs before the default handler it must not invalidate the location iter (or has to revalidate it). The default signal handler revalidates it to be placed after the inserted anchor.

    See also: [methodGtk.TextBuffer.insert_child_anchor].

    Note

    This represents the underlying insert-child-anchor signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onInsertChildAnchor(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ location: TextIterRef, _ anchor: TextChildAnchorRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    location

    position to insert anchor in textbuffer

    anchor

    the GtkTextChildAnchor to be inserted

    handler

    The signal handler to call Run the given callback whenever the insertChildAnchor signal is emitted

  • insertChildAnchorSignal Extension method

    Typed insert-child-anchor signal for using the connect(signal:) methods

    Declaration

    Swift

    static var insertChildAnchorSignal: TextBufferSignalName { get }
  • Emitted to insert a GdkPaintable in a GtkTextBuffer.

    Insertion actually occurs in the default handler.

    Note that if your handler runs before the default handler it must not invalidate the location iter (or has to revalidate it). The default signal handler revalidates it to be placed after the inserted paintable.

    See also: [methodGtk.TextBuffer.insert_paintable].

    Note

    This represents the underlying insert-paintable signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onInsertPaintable(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ location: TextIterRef, _ paintable: Gdk.PaintableRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    location

    position to insert paintable in textbuffer

    paintable

    the GdkPaintable to be inserted

    handler

    The signal handler to call Run the given callback whenever the insertPaintable signal is emitted

  • insertPaintableSignal Extension method

    Typed insert-paintable signal for using the connect(signal:) methods

    Declaration

    Swift

    static var insertPaintableSignal: TextBufferSignalName { get }
  • onInsertText(flags:handler:) Extension method

    Emitted to insert text in a GtkTextBuffer.

    Insertion actually occurs in the default handler.

    Note that if your handler runs before the default handler it must not invalidate the location iter (or has to revalidate it). The default signal handler revalidates it to point to the end of the inserted text.

    See also: [methodGtk.TextBuffer.insert], [methodGtk.TextBuffer.insert_range].

    Note

    This represents the underlying insert-text signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onInsertText(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ location: TextIterRef, _ text: String, _ len: Int) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    location

    position to insert text in textbuffer

    text

    the UTF-8 text to be inserted

    len

    length of the inserted text in bytes

    handler

    The signal handler to call Run the given callback whenever the insertText signal is emitted

  • insertTextSignal Extension method

    Typed insert-text signal for using the connect(signal:) methods

    Declaration

    Swift

    static var insertTextSignal: TextBufferSignalName { get }
  • Emitted as notification after a GtkTextMark is deleted.

    See also: [methodGtk.TextBuffer.delete_mark].

    Note

    This represents the underlying mark-deleted signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onMarkDeleted(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ mark: TextMarkRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    mark

    The mark that was deleted

    handler

    The signal handler to call Run the given callback whenever the markDeleted signal is emitted

  • markDeletedSignal Extension method

    Typed mark-deleted signal for using the connect(signal:) methods

    Declaration

    Swift

    static var markDeletedSignal: TextBufferSignalName { get }
  • onMarkSet(flags:handler:) Extension method

    Emitted as notification after a GtkTextMark is set.

    See also: [methodGtk.TextBuffer.create_mark], [methodGtk.TextBuffer.move_mark].

    Note

    This represents the underlying mark-set signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onMarkSet(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ location: TextIterRef, _ mark: TextMarkRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    location

    The location of mark in textbuffer

    mark

    The mark that is set

    handler

    The signal handler to call Run the given callback whenever the markSet signal is emitted

  • markSetSignal Extension method

    Typed mark-set signal for using the connect(signal:) methods

    Declaration

    Swift

    static var markSetSignal: TextBufferSignalName { get }
  • Emitted when the modified bit of a GtkTextBuffer flips.

    See also: [methodGtk.TextBuffer.set_modified].

    Note

    This represents the underlying modified-changed signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onModifiedChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    handler

    The signal handler to call Run the given callback whenever the modifiedChanged signal is emitted

  • modifiedChangedSignal Extension method

    Typed modified-changed signal for using the connect(signal:) methods

    Declaration

    Swift

    static var modifiedChangedSignal: TextBufferSignalName { get }
  • onPasteDone(flags:handler:) Extension method

    Emitted after paste operation has been completed.

    This is useful to properly scroll the view to the end of the pasted text. See [methodGtk.TextBuffer.paste_clipboard] for more details.

    Note

    This represents the underlying paste-done signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onPasteDone(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ clipboard: Gdk.ClipboardRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    clipboard

    the GdkClipboard pasted from

    handler

    The signal handler to call Run the given callback whenever the pasteDone signal is emitted

  • pasteDoneSignal Extension method

    Typed paste-done signal for using the connect(signal:) methods

    Declaration

    Swift

    static var pasteDoneSignal: TextBufferSignalName { get }
  • onRedo(flags:handler:) Extension method

    Emitted when a request has been made to redo the previously undone operation.

    Note

    This represents the underlying redo signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onRedo(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    handler

    The signal handler to call Run the given callback whenever the redo signal is emitted

  • redoSignal Extension method

    Typed redo signal for using the connect(signal:) methods

    Declaration

    Swift

    static var redoSignal: TextBufferSignalName { get }
  • onRemoveTag(flags:handler:) Extension method

    Emitted to remove all occurrences of tag from a range of text in a GtkTextBuffer.

    Removal actually occurs in the default handler.

    Note that if your handler runs before the default handler it must not invalidate the start and end iters (or has to revalidate them).

    See also: [methodGtk.TextBuffer.remove_tag].

    Note

    This represents the underlying remove-tag signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onRemoveTag(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ tag: TextTagRef, _ start: TextIterRef, _ end: TextIterRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    tag

    the tag to be removed

    start

    the start of the range the tag is removed from

    end

    the end of the range the tag is removed from

    handler

    The signal handler to call Run the given callback whenever the removeTag signal is emitted

  • removeTagSignal Extension method

    Typed remove-tag signal for using the connect(signal:) methods

    Declaration

    Swift

    static var removeTagSignal: TextBufferSignalName { get }
  • onUndo(flags:handler:) Extension method

    Emitted when a request has been made to undo the previous operation or set of operations that have been grouped together.

    Note

    This represents the underlying undo signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onUndo(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    handler

    The signal handler to call Run the given callback whenever the undo signal is emitted

  • undoSignal Extension method

    Typed undo signal for using the connect(signal:) methods

    Declaration

    Swift

    static var undoSignal: TextBufferSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::can-redo signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyCanRedo(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyCanRedo signal is emitted

  • notifyCanRedoSignal Extension method

    Typed notify::can-redo signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyCanRedoSignal: TextBufferSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::can-undo signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyCanUndo(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyCanUndo signal is emitted

  • notifyCanUndoSignal Extension method

    Typed notify::can-undo signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyCanUndoSignal: TextBufferSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::cursor-position signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyCursorPosition(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyCursorPosition signal is emitted

  • notifyCursorPositionSignal Extension method

    Typed notify::cursor-position signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyCursorPositionSignal: TextBufferSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::enable-undo signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyEnableUndo(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyEnableUndo signal is emitted

  • notifyEnableUndoSignal Extension method

    Typed notify::enable-undo signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyEnableUndoSignal: TextBufferSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::has-selection signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyHasSelection(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyHasSelection signal is emitted

  • notifyHasSelectionSignal Extension method

    Typed notify::has-selection signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyHasSelectionSignal: TextBufferSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::tag-table signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyTagTable(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyTagTable signal is emitted

  • notifyTagTableSignal Extension method

    Typed notify::tag-table signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyTagTableSignal: TextBufferSignalName { get }
  • onNotifyText(flags:handler:) Extension method

    The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::text signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyText(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyText signal is emitted

  • notifyTextSignal Extension method

    Typed notify::text signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyTextSignal: TextBufferSignalName { get }

TextBuffer Class: TextBufferProtocol extension (methods and fields)

  • add(mark:where:) Extension method

    Adds the mark at position where.

    The mark must not be added to another buffer, and if its name is not nil then there must not be another mark in the buffer with the same name.

    Emits the [signalGtk.TextBuffer::mark-set] signal as notification of the mark’s initial placement.

    Declaration

    Swift

    @inlinable
    func add<TextIterT, TextMarkT>(mark: TextMarkT, where: TextIterT) where TextIterT : TextIterProtocol, TextMarkT : TextMarkProtocol
  • addSelection(clipboard:) Extension method

    Adds clipboard to the list of clipboards in which the selection contents of buffer are available.

    In most cases, clipboard will be the GdkClipboard returned by [methodGtk.Widget.get_primary_clipboard] for a view of buffer.

    Declaration

    Swift

    @inlinable
    func addSelection<ClipboardT>(clipboard: ClipboardT) where ClipboardT : ClipboardProtocol
  • apply(tag:start:end:) Extension method

    Emits the “apply-tag” signal on buffer.

    The default handler for the signal applies tag to the given range. start and end do not have to be in order.

    Declaration

    Swift

    @inlinable
    func apply<TextIterT, TextTagT>(tag: TextTagT, start: TextIterT, end: TextIterT) where TextIterT : TextIterProtocol, TextTagT : TextTagProtocol
  • applyTagBy(name:start:end:) Extension method

    Emits the “apply-tag” signal on buffer.

    Calls [methodGtk.TextTagTable.lookup] on the buffer’s tag table to get a GtkTextTag, then calls [methodGtk.TextBuffer.apply_tag].

    Declaration

    Swift

    @inlinable
    func applyTagBy<TextIterT>(name: UnsafePointer<CChar>!, start: TextIterT, end: TextIterT) where TextIterT : TextIterProtocol
  • Performs the appropriate action as if the user hit the delete key with the cursor at the position specified by iter.

    In the normal case a single character will be deleted, but when combining accents are involved, more than one character can be deleted, and when precomposed character and accent combinations are involved, less than one character will be deleted.

    Because the buffer is modified, all outstanding iterators become invalid after calling this function; however, the iter will be re-initialized to point to the location where text was deleted.

    Declaration

    Swift

    @inlinable
    func backspace<TextIterT>(iter: TextIterT, interactive: Bool, defaultEditable: Bool) -> Bool where TextIterT : TextIterProtocol
  • beginIrreversibleAction() Extension method

    Denotes the beginning of an action that may not be undone.

    This will cause any previous operations in the undo/redo queue to be cleared.

    This should be paired with a call to [methodGtk.TextBuffer.end_irreversible_action] after the irreversible action has completed.

    You may nest calls to gtk_text_buffer_begin_irreversible_action() and gtk_text_buffer_end_irreversible_action() pairs.

    Declaration

    Swift

    @inlinable
    func beginIrreversibleAction()
  • beginUserAction() Extension method

    Called to indicate that the buffer operations between here and a call to gtk_text_buffer_end_user_action() are part of a single user-visible operation.

    The operations between gtk_text_buffer_begin_user_action() and gtk_text_buffer_end_user_action() can then be grouped when creating an undo stack. GtkTextBuffer maintains a count of calls to gtk_text_buffer_begin_user_action() that have not been closed with a call to gtk_text_buffer_end_user_action(), and emits the “begin-user-action” and “end-user-action” signals only for the outermost pair of calls. This allows you to build user actions from other user actions.

    The “interactive” buffer mutation functions, such as [methodGtk.TextBuffer.insert_interactive], automatically call begin/end user action around the buffer operations they perform, so there’s no need to add extra calls if you user action consists solely of a single call to one of those functions.

    Declaration

    Swift

    @inlinable
    func beginUserAction()
  • copy(clipboard:) Extension method

    Copies the currently-selected text to a clipboard.

    Declaration

    Swift

    @inlinable
    func copy<ClipboardT>(clipboard: ClipboardT) where ClipboardT : ClipboardProtocol
  • createChildAnchor(iter:) Extension method

    Creates and inserts a child anchor.

    This is a convenience function which simply creates a child anchor with [ctorGtk.TextChildAnchor.new] and inserts it into the buffer with [methodGtk.TextBuffer.insert_child_anchor].

    The new anchor is owned by the buffer; no reference count is returned to the caller of this function.

    Declaration

    Swift

    @inlinable
    func createChildAnchor<TextIterT>(iter: TextIterT) -> TextChildAnchorRef! where TextIterT : TextIterProtocol
  • Creates a mark at position where.

    If mark_name is nil, the mark is anonymous; otherwise, the mark can be retrieved by name using [methodGtk.TextBuffer.get_mark]. If a mark has left gravity, and text is inserted at the mark’s current location, the mark will be moved to the left of the newly-inserted text. If the mark has right gravity (left_gravity = false), the mark will end up on the right of newly-inserted text. The standard left-to-right cursor is a mark with right gravity (when you type, the cursor stays on the right side of the text you’re typing).

    The caller of this function does not own a reference to the returned GtkTextMark, so you can ignore the return value if you like. Marks are owned by the buffer and go away when the buffer does.

    Emits the [signalGtk.TextBuffer::mark-set] signal as notification of the mark’s initial placement.

    Declaration

    Swift

    @inlinable
    func createMark<TextIterT>(markName: UnsafePointer<CChar>? = nil, where: TextIterT, leftGravity: Bool) -> TextMarkRef! where TextIterT : TextIterProtocol
  • Copies the currently-selected text to a clipboard, then deletes said text if it’s editable.

    Declaration

    Swift

    @inlinable
    func cut<ClipboardT>(clipboard: ClipboardT, defaultEditable: Bool) where ClipboardT : ClipboardProtocol
  • delete(start:end:) Extension method

    Deletes text between start and end.

    The order of start and end is not actually relevant; gtk_text_buffer_delete() will reorder them.

    This function actually emits the “delete-range” signal, and the default handler of that signal deletes the text. Because the buffer is modified, all outstanding iterators become invalid after calling this function; however, the start and end will be re-initialized to point to the location where text was deleted.

    Declaration

    Swift

    @inlinable
    func delete<TextIterT>(start: TextIterT, end: TextIterT) where TextIterT : TextIterProtocol
  • Deletes all editable text in the given range.

    Calls [methodGtk.TextBuffer.delete] for each editable sub-range of [start,end). start and end are revalidated to point to the location of the last deleted range, or left untouched if no text was deleted.

    Declaration

    Swift

    @inlinable
    func deleteInteractive<TextIterT>(startIter: TextIterT, endIter: TextIterT, defaultEditable: Bool) -> Bool where TextIterT : TextIterProtocol
  • delete(mark:) Extension method

    Deletes mark, so that it’s no longer located anywhere in the buffer.

    Removes the reference the buffer holds to the mark, so if you haven’t called g_object_ref() on the mark, it will be freed. Even if the mark isn’t freed, most operations on mark become invalid, until it gets added to a buffer again with [methodGtk.TextBuffer.add_mark]. Use [methodGtk.TextMark.get_deleted] to find out if a mark has been removed from its buffer.

    The [signalGtk.TextBuffer::mark-deleted] signal will be emitted as notification after the mark is deleted.

    Declaration

    Swift

    @inlinable
    func delete<TextMarkT>(mark: TextMarkT) where TextMarkT : TextMarkProtocol
  • deleteMarkBy(name:) Extension method

    Deletes the mark named name; the mark must exist.

    See [methodGtk.TextBuffer.delete_mark] for details.

    Declaration

    Swift

    @inlinable
    func deleteMarkBy(name: UnsafePointer<CChar>!)
  • Deletes the range between the “insert” and “selection_bound” marks, that is, the currently-selected text.

    If interactive is true, the editability of the selection will be considered (users can’t delete uneditable text).

    Declaration

    Swift

    @inlinable
    func deleteSelection(interactive: Bool, defaultEditable: Bool) -> Bool
  • endIrreversibleAction() Extension method

    Denotes the end of an action that may not be undone.

    This will cause any previous operations in the undo/redo queue to be cleared.

    This should be called after completing modifications to the text buffer after [methodGtk.TextBuffer.begin_irreversible_action] was called.

    You may nest calls to gtk_text_buffer_begin_irreversible_action() and gtk_text_buffer_end_irreversible_action() pairs.

    Declaration

    Swift

    @inlinable
    func endIrreversibleAction()
  • endUserAction() Extension method

    Ends a user-visible operation.

    Should be paired with a call to [methodGtk.TextBuffer.begin_user_action]. See that function for a full explanation.

    Declaration

    Swift

    @inlinable
    func endUserAction()
  • getBounds(start:end:) Extension method

    Retrieves the first and last iterators in the buffer, i.e. the entire buffer lies within the range [start,end).

    Declaration

    Swift

    @inlinable
    func getBounds<TextIterT>(start: TextIterT, end: TextIterT) where TextIterT : TextIterProtocol
  • getCanRedo() Extension method

    Gets whether there is a redoable action in the history.

    Declaration

    Swift

    @inlinable
    func getCanRedo() -> Bool
  • getCanUndo() Extension method

    Gets whether there is an undoable action in the history.

    Declaration

    Swift

    @inlinable
    func getCanUndo() -> Bool
  • getCharCount() Extension method

    Gets the number of characters in the buffer.

    Note that characters and bytes are not the same, you can’t e.g. expect the contents of the buffer in string form to be this many bytes long.

    The character count is cached, so this function is very fast.

    Declaration

    Swift

    @inlinable
    func getCharCount() -> Int
  • getEnableUndo() Extension method

    Gets whether the buffer is saving modifications to the buffer to allow for undo and redo actions.

    See [methodGtk.TextBuffer.begin_irreversible_action] and [methodGtk.TextBuffer.end_irreversible_action] to create changes to the buffer that cannot be undone.

    Declaration

    Swift

    @inlinable
    func getEnableUndo() -> Bool
  • getEnd(iter:) Extension method

    Initializes iter with the “end iterator,” one past the last valid character in the text buffer.

    If dereferenced with [methodGtk.TextIter.get_char], the end iterator has a character value of 0. The entire buffer lies in the range from the first position in the buffer (call [methodGtk.TextBuffer.get_start_iter] to get character position 0) to the end iterator.

    Declaration

    Swift

    @inlinable
    func getEnd<TextIterT>(iter: TextIterT) where TextIterT : TextIterProtocol
  • getHasSelection() Extension method

    Indicates whether the buffer has some text currently selected.

    Declaration

    Swift

    @inlinable
    func getHasSelection() -> Bool
  • getInsert() Extension method

    Returns the mark that represents the cursor (insertion point).

    Equivalent to calling [methodGtk.TextBuffer.get_mark] to get the mark named “insert”, but very slightly more efficient, and involves less typing.

    Declaration

    Swift

    @inlinable
    func getInsert() -> TextMarkRef!
  • Obtains the location of anchor within buffer.

    Declaration

    Swift

    @inlinable
    func getIterAtChildAnchor<TextChildAnchorT, TextIterT>(iter: TextIterT, anchor: TextChildAnchorT) where TextChildAnchorT : TextChildAnchorProtocol, TextIterT : TextIterProtocol
  • Initializes iter to the start of the given line.

    If line_number is greater than or equal to the number of lines in the buffer, the end iterator is returned.

    Declaration

    Swift

    @inlinable
    func getIterAtLine<TextIterT>(iter: TextIterT, lineNumber: Int) -> Bool where TextIterT : TextIterProtocol
  • Obtains an iterator pointing to byte_index within the given line.

    byte_index must be the start of a UTF-8 character. Note bytes, not characters; UTF-8 may encode one character as multiple bytes.

    If line_number is greater than or equal to the number of lines in the buffer, the end iterator is returned. And if byte_index is off the end of the line, the iterator at the end of the line is returned.

    Declaration

    Swift

    @inlinable
    func getIterAtLineIndex<TextIterT>(iter: TextIterT, lineNumber: Int, byteIndex: Int) -> Bool where TextIterT : TextIterProtocol
  • Obtains an iterator pointing to char_offset within the given line.

    Note characters, not bytes; UTF-8 may encode one character as multiple bytes.

    If line_number is greater than or equal to the number of lines in the buffer, the end iterator is returned. And if char_offset is off the end of the line, the iterator at the end of the line is returned.

    Declaration

    Swift

    @inlinable
    func getIterAtLineOffset<TextIterT>(iter: TextIterT, lineNumber: Int, charOffset: Int) -> Bool where TextIterT : TextIterProtocol
  • getIterAtMark(iter:mark:) Extension method

    Initializes iter with the current position of mark.

    Declaration

    Swift

    @inlinable
    func getIterAtMark<TextIterT, TextMarkT>(iter: TextIterT, mark: TextMarkT) where TextIterT : TextIterProtocol, TextMarkT : TextMarkProtocol
  • Initializes iter to a position char_offset chars from the start of the entire buffer.

    If char_offset is -1 or greater than the number of characters in the buffer, iter is initialized to the end iterator, the iterator one past the last valid character in the buffer.

    Declaration

    Swift

    @inlinable
    func getIterAtOffset<TextIterT>(iter: TextIterT, charOffset: Int) where TextIterT : TextIterProtocol
  • getLineCount() Extension method

    Obtains the number of lines in the buffer.

    This value is cached, so the function is very fast.

    Declaration

    Swift

    @inlinable
    func getLineCount() -> Int
  • getMark(name:) Extension method

    Returns the mark named name in buffer buffer, or nil if no such mark exists in the buffer.

    Declaration

    Swift

    @inlinable
    func getMark(name: UnsafePointer<CChar>!) -> TextMarkRef!
  • getMaxUndoLevels() Extension method

    Gets the maximum number of undo levels to perform.

    If 0, unlimited undo actions may be performed. Note that this may have a memory usage impact as it requires storing an additional copy of the inserted or removed text within the text buffer.

    Declaration

    Swift

    @inlinable
    func getMaxUndoLevels() -> Int
  • getModified() Extension method

    Indicates whether the buffer has been modified since the last call to [methodGtk.TextBuffer.set_modified] set the modification flag to false.

    Used for example to enable a “save” function in a text editor.

    Declaration

    Swift

    @inlinable
    func getModified() -> Bool
  • getSelectionBound() Extension method

    Returns the mark that represents the selection bound.

    Equivalent to calling [methodGtk.TextBuffer.get_mark] to get the mark named “selection_bound”, but very slightly more efficient, and involves less typing.

    The currently-selected text in buffer is the region between the “selection_bound” and “insert” marks. If “selection_bound” and “insert” are in the same place, then there is no current selection. [methodGtk.TextBuffer.get_selection_bounds] is another convenient function for handling the selection, if you just want to know whether there’s a selection and what its bounds are.

    Declaration

    Swift

    @inlinable
    func getSelectionBound() -> TextMarkRef!
  • Returns true if some text is selected; places the bounds of the selection in start and end.

    If the selection has length 0, then start and end are filled in with the same value. start and end will be in ascending order. If start and end are nil, then they are not filled in, but the return value still indicates whether text is selected.

    Declaration

    Swift

    @inlinable
    func getSelectionBounds<TextIterT>(start: TextIterT, end: TextIterT) -> Bool where TextIterT : TextIterProtocol
  • getSelectionContent() Extension method

    Get a content provider for this buffer.

    It can be used to make the content of buffer available in a GdkClipboard, see [methodGdk.Clipboard.set_content].

    Declaration

    Swift

    @inlinable
    func getSelectionContent() -> Gdk.ContentProviderRef!
  • Returns the text in the range [start,end).

    Excludes undisplayed text (text marked with tags that set the invisibility attribute) if include_hidden_chars is false. The returned string includes a 0xFFFC character whenever the buffer contains embedded images, so byte and character indexes into the returned string do correspond to byte and character indexes into the buffer. Contrast with [methodGtk.TextBuffer.get_text]. Note that 0xFFFC can occur in normal text as well, so it is not a reliable indicator that a paintable or widget is in the buffer.

    Declaration

    Swift

    @inlinable
    func getSlice<TextIterT>(start: TextIterT, end: TextIterT, includeHiddenChars: Bool) -> String! where TextIterT : TextIterProtocol
  • getStart(iter:) Extension method

    Initialized iter with the first position in the text buffer.

    This is the same as using [methodGtk.TextBuffer.get_iter_at_offset] to get the iter at character offset 0.

    Declaration

    Swift

    @inlinable
    func getStart<TextIterT>(iter: TextIterT) where TextIterT : TextIterProtocol
  • getTagTable() Extension method

    Get the GtkTextTagTable associated with this buffer.

    Declaration

    Swift

    @inlinable
    func getTagTable() -> TextTagTableRef!
  • Returns the text in the range [start,end).

    Excludes undisplayed text (text marked with tags that set the invisibility attribute) if include_hidden_chars is false. Does not include characters representing embedded images, so byte and character indexes into the returned string do not correspond to byte and character indexes into the buffer. Contrast with [methodGtk.TextBuffer.get_slice].

    Declaration

    Swift

    @inlinable
    func getText<TextIterT>(start: TextIterT, end: TextIterT, includeHiddenChars: Bool) -> String! where TextIterT : TextIterProtocol
  • getInsert(iter:text:len:) Extension method

    Inserts len bytes of text at position iter.

    If len is -1, text must be nul-terminated and will be inserted in its entirety. Emits the “insert-text” signal; insertion actually occurs in the default handler for the signal. iter is invalidated when insertion occurs (because the buffer contents change), but the default signal handler revalidates it to point to the end of the inserted text.

    Declaration

    Swift

    @inlinable
    func getInsert<TextIterT>(iter: TextIterT, text: UnsafePointer<CChar>!, len: Int) where TextIterT : TextIterProtocol
  • insertAtCursor(text:len:) Extension method

    Inserts text in buffer.

    Simply calls [methodGtk.TextBuffer.insert], using the current cursor position as the insertion point.

    Declaration

    Swift

    @inlinable
    func insertAtCursor(text: UnsafePointer<CChar>!, len: Int)
  • Inserts a child widget anchor into the text buffer at iter.

    The anchor will be counted as one character in character counts, and when obtaining the buffer contents as a string, will be represented by the Unicode “object replacement character” 0xFFFC. Note that the “slice” variants for obtaining portions of the buffer as a string include this character for child anchors, but the “text” variants do not. E.g. see [methodGtk.TextBuffer.get_slice] and [methodGtk.TextBuffer.get_text].

    Consider [methodGtk.TextBuffer.create_child_anchor] as a more convenient alternative to this function. The buffer will add a reference to the anchor, so you can unref it after insertion.

    Declaration

    Swift

    @inlinable
    func insertChildAnchor<TextChildAnchorT, TextIterT>(iter: TextIterT, anchor: TextChildAnchorT) where TextChildAnchorT : TextChildAnchorProtocol, TextIterT : TextIterProtocol
  • Inserts text in buffer.

    Like [methodGtk.TextBuffer.insert], but the insertion will not occur if iter is at a non-editable location in the buffer. Usually you want to prevent insertions at ineditable locations if the insertion results from a user action (is interactive).

    default_editable indicates the editability of text that doesn’t have a tag affecting editability applied to it. Typically the result of [methodGtk.TextView.get_editable] is appropriate here.

    Declaration

    Swift

    @inlinable
    func insertInteractive<TextIterT>(iter: TextIterT, text: UnsafePointer<CChar>!, len: Int, defaultEditable: Bool) -> Bool where TextIterT : TextIterProtocol
  • Inserts text in buffer.

    Calls [methodGtk.TextBuffer.insert_interactive] at the cursor position.

    default_editable indicates the editability of text that doesn’t have a tag affecting editability applied to it. Typically the result of [methodGtk.TextView.get_editable] is appropriate here.

    Declaration

    Swift

    @inlinable
    func insertInteractiveAtCursor(text: UnsafePointer<CChar>!, len: Int, defaultEditable: Bool) -> Bool
  • Inserts the text in markup at position iter.

    markup will be inserted in its entirety and must be nul-terminated and valid UTF-8. Emits the [signalGtk.TextBuffer::insert-text] signal, possibly multiple times; insertion actually occurs in the default handler for the signal. iter will point to the end of the inserted text on return.

    Declaration

    Swift

    @inlinable
    func insertMarkup<TextIterT>(iter: TextIterT, markup: UnsafePointer<CChar>!, len: Int) where TextIterT : TextIterProtocol
  • Inserts an image into the text buffer at iter.

    The image will be counted as one character in character counts, and when obtaining the buffer contents as a string, will be represented by the Unicode “object replacement character” 0xFFFC. Note that the “slice” variants for obtaining portions of the buffer as a string include this character for paintable, but the “text” variants do not. e.g. see [methodGtk.TextBuffer.get_slice] and [methodGtk.TextBuffer.get_text].

    Declaration

    Swift

    @inlinable
    func insertPaintable<PaintableT, TextIterT>(iter: TextIterT, paintable: PaintableT) where PaintableT : PaintableProtocol, TextIterT : TextIterProtocol
  • insertRange(iter:start:end:) Extension method

    Copies text, tags, and paintables between start and end and inserts the copy at iter.

    The order of start and end doesn’t matter.

    Used instead of simply getting/inserting text because it preserves images and tags. If start and end are in a different buffer from buffer, the two buffers must share the same tag table.

    Implemented via emissions of the insert-text and apply-tag signals, so expect those.

    Declaration

    Swift

    @inlinable
    func insertRange<TextIterT>(iter: TextIterT, start: TextIterT, end: TextIterT) where TextIterT : TextIterProtocol
  • Copies text, tags, and paintables between start and end and inserts the copy at iter.

    Same as [methodGtk.TextBuffer.insert_range], but does nothing if the insertion point isn’t editable. The default_editable parameter indicates whether the text is editable at iter if no tags enclosing iter affect editability. Typically the result of [methodGtk.TextView.get_editable] is appropriate here.

    Declaration

    Swift

    @inlinable
    func insertRangeInteractive<TextIterT>(iter: TextIterT, start: TextIterT, end: TextIterT, defaultEditable: Bool) -> Bool where TextIterT : TextIterProtocol
  • move(mark:where:) Extension method

    Moves mark to the new location where.

    Emits the [signalGtk.TextBuffer::mark-set] signal as notification of the move.

    Declaration

    Swift

    @inlinable
    func move<TextIterT, TextMarkT>(mark: TextMarkT, where: TextIterT) where TextIterT : TextIterProtocol, TextMarkT : TextMarkProtocol
  • moveMarkBy(name:where:) Extension method

    Moves the mark named name (which must exist) to location where.

    See [methodGtk.TextBuffer.move_mark] for details.

    Declaration

    Swift

    @inlinable
    func moveMarkBy<TextIterT>(name: UnsafePointer<CChar>!, where: TextIterT) where TextIterT : TextIterProtocol
  • Pastes the contents of a clipboard.

    If override_location is nil, the pasted text will be inserted at the cursor position, or the buffer selection will be replaced if the selection is non-empty.

    Note: pasting is asynchronous, that is, we’ll ask for the paste data and return, and at some point later after the main loop runs, the paste data will be inserted.

    Declaration

    Swift

    @inlinable
    func paste<ClipboardT>(clipboard: ClipboardT, overrideLocation: TextIterRef? = nil, defaultEditable: Bool) where ClipboardT : ClipboardProtocol
  • Pastes the contents of a clipboard.

    If override_location is nil, the pasted text will be inserted at the cursor position, or the buffer selection will be replaced if the selection is non-empty.

    Note: pasting is asynchronous, that is, we’ll ask for the paste data and return, and at some point later after the main loop runs, the paste data will be inserted.

    Declaration

    Swift

    @inlinable
    func paste<ClipboardT, TextIterT>(clipboard: ClipboardT, overrideLocation: TextIterT?, defaultEditable: Bool) where ClipboardT : ClipboardProtocol, TextIterT : TextIterProtocol
  • placeCursor(where:) Extension method

    This function moves the “insert” and “selection_bound” marks simultaneously.

    If you move them to the same place in two steps with [methodGtk.TextBuffer.move_mark], you will temporarily select a region in between their old and new locations, which can be pretty inefficient since the temporarily-selected region will force stuff to be recalculated. This function moves them as a unit, which can be optimized.

    Declaration

    Swift

    @inlinable
    func placeCursor<TextIterT>(where: TextIterT) where TextIterT : TextIterProtocol
  • redo() Extension method

    Redoes the next redoable action on the buffer, if there is one.

    Declaration

    Swift

    @inlinable
    func redo()
  • removeAllTags(start:end:) Extension method

    Removes all tags in the range between start and end.

    Be careful with this function; it could remove tags added in code unrelated to the code you’re currently writing. That is, using this function is probably a bad idea if you have two or more unrelated code sections that add tags.

    Declaration

    Swift

    @inlinable
    func removeAllTags<TextIterT>(start: TextIterT, end: TextIterT) where TextIterT : TextIterProtocol
  • removeSelection(clipboard:) Extension method

    Removes a GdkClipboard added with gtk_text_buffer_add_selection_clipboard().

    Declaration

    Swift

    @inlinable
    func removeSelection<ClipboardT>(clipboard: ClipboardT) where ClipboardT : ClipboardProtocol
  • remove(tag:start:end:) Extension method

    Emits the “remove-tag” signal.

    The default handler for the signal removes all occurrences of tag from the given range. start and end don’t have to be in order.

    Declaration

    Swift

    @inlinable
    func remove<TextIterT, TextTagT>(tag: TextTagT, start: TextIterT, end: TextIterT) where TextIterT : TextIterProtocol, TextTagT : TextTagProtocol
  • removeTagBy(name:start:end:) Extension method

    Emits the “remove-tag” signal.

    Calls [methodGtk.TextTagTable.lookup] on the buffer’s tag table to get a GtkTextTag, then calls [methodGtk.TextBuffer.remove_tag].

    Declaration

    Swift

    @inlinable
    func removeTagBy<TextIterT>(name: UnsafePointer<CChar>!, start: TextIterT, end: TextIterT) where TextIterT : TextIterProtocol
  • selectRange(ins:bound:) Extension method

    This function moves the “insert” and “selection_bound” marks simultaneously.

    If you move them in two steps with [methodGtk.TextBuffer.move_mark], you will temporarily select a region in between their old and new locations, which can be pretty inefficient since the temporarily-selected region will force stuff to be recalculated. This function moves them as a unit, which can be optimized.

    Declaration

    Swift

    @inlinable
    func selectRange<TextIterT>(ins: TextIterT, bound: TextIterT) where TextIterT : TextIterProtocol
  • set(enableUndo:) Extension method

    Sets whether or not to enable undoable actions in the text buffer.

    Undoable actions in this context are changes to the text content of the buffer. Changes to tags and marks are not tracked.

    If enabled, the user will be able to undo the last number of actions up to [methodGtk.TextBuffer.get_max_undo_levels].

    See [methodGtk.TextBuffer.begin_irreversible_action] and [methodGtk.TextBuffer.end_irreversible_action] to create changes to the buffer that cannot be undone.

    Declaration

    Swift

    @inlinable
    func set(enableUndo: Bool)
  • set(maxUndoLevels:) Extension method

    Sets the maximum number of undo levels to perform.

    If 0, unlimited undo actions may be performed. Note that this may have a memory usage impact as it requires storing an additional copy of the inserted or removed text within the text buffer.

    Declaration

    Swift

    @inlinable
    func set(maxUndoLevels: Int)
  • setModified(setting:) Extension method

    Used to keep track of whether the buffer has been modified since the last time it was saved.

    Whenever the buffer is saved to disk, call gtk_text_buffer_set_modified (buffer, FALSE). When the buffer is modified, it will automatically toggled on the modified bit again. When the modified bit flips, the buffer emits the [signalGtk.TextBuffer::modified-changed] signal.

    Declaration

    Swift

    @inlinable
    func setModified(setting: Bool)
  • set(text:len:) Extension method

    Deletes current contents of buffer, and inserts text instead.

    If len is -1, text must be nul-terminated. text must be valid UTF-8.

    Declaration

    Swift

    @inlinable
    func set(text: UnsafePointer<CChar>!, len: Int)
  • undo() Extension method

    Undoes the last undoable action on the buffer, if there is one.

    Declaration

    Swift

    @inlinable
    func undo()
  • canRedo Extension method

    Gets whether there is a redoable action in the history.

    Declaration

    Swift

    @inlinable
    var canRedo: Bool { get }
  • canUndo Extension method

    Gets whether there is an undoable action in the history.

    Declaration

    Swift

    @inlinable
    var canUndo: Bool { get }
  • charCount Extension method

    Gets the number of characters in the buffer.

    Note that characters and bytes are not the same, you can’t e.g. expect the contents of the buffer in string form to be this many bytes long.

    The character count is cached, so this function is very fast.

    Declaration

    Swift

    @inlinable
    var charCount: Int { get }
  • enableUndo Extension method

    Gets whether the buffer is saving modifications to the buffer to allow for undo and redo actions.

    See [methodGtk.TextBuffer.begin_irreversible_action] and [methodGtk.TextBuffer.end_irreversible_action] to create changes to the buffer that cannot be undone.

    Declaration

    Swift

    @inlinable
    var enableUndo: Bool { get nonmutating set }
  • hasSelection Extension method

    Indicates whether the buffer has some text currently selected.

    Declaration

    Swift

    @inlinable
    var hasSelection: Bool { get }
  • insert Extension method

    Returns the mark that represents the cursor (insertion point).

    Equivalent to calling [methodGtk.TextBuffer.get_mark] to get the mark named “insert”, but very slightly more efficient, and involves less typing.

    Declaration

    Swift

    @inlinable
    var insert: TextMarkRef! { get }
  • lineCount Extension method

    Obtains the number of lines in the buffer.

    This value is cached, so the function is very fast.

    Declaration

    Swift

    @inlinable
    var lineCount: Int { get }
  • maxUndoLevels Extension method

    Gets the maximum number of undo levels to perform.

    If 0, unlimited undo actions may be performed. Note that this may have a memory usage impact as it requires storing an additional copy of the inserted or removed text within the text buffer.

    Declaration

    Swift

    @inlinable
    var maxUndoLevels: Int { get nonmutating set }
  • modified Extension method

    Indicates whether the buffer has been modified since the last call to [methodGtk.TextBuffer.set_modified] set the modification flag to false.

    Used for example to enable a “save” function in a text editor.

    Declaration

    Swift

    @inlinable
    var modified: Bool { get nonmutating set }
  • selectionBound Extension method

    Returns the mark that represents the selection bound.

    Equivalent to calling [methodGtk.TextBuffer.get_mark] to get the mark named “selection_bound”, but very slightly more efficient, and involves less typing.

    The currently-selected text in buffer is the region between the “selection_bound” and “insert” marks. If “selection_bound” and “insert” are in the same place, then there is no current selection. [methodGtk.TextBuffer.get_selection_bounds] is another convenient function for handling the selection, if you just want to know whether there’s a selection and what its bounds are.

    Declaration

    Swift

    @inlinable
    var selectionBound: TextMarkRef! { get }
  • selectionContent Extension method

    Get a content provider for this buffer.

    It can be used to make the content of buffer available in a GdkClipboard, see [methodGdk.Clipboard.set_content].

    Declaration

    Swift

    @inlinable
    var selectionContent: Gdk.ContentProviderRef! { get }
  • tagTable Extension method

    Get the GtkTextTagTable associated with this buffer.

    Declaration

    Swift

    @inlinable
    var tagTable: TextTagTableRef! { get }
  • parentInstance Extension method

    Undocumented

    Declaration

    Swift

    @inlinable
    var parentInstance: GObject { get }
  • text Extension method

    A string containing the text stored inside the text buffer, including hidden characters

    Declaration

    Swift

    @inlinable
    var text: String { get nonmutating set }
  • bounds Extension method

    bounds for the start and end of the text buffer

    Declaration

    Swift

    @inlinable
    var bounds: (start: TextIter, end: TextIter) { get }