TextBufferProtocol
public protocol TextBufferProtocol : ObjectProtocol
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.
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.
-
Untyped pointer to the underlying
GtkTextBufferinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
text_buffer_ptrDefault implementationTyped pointer to the underlying
GtkTextBufferinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkTextBufferinstance.Declaration
Swift
var text_buffer_ptr: UnsafeMutablePointer<GtkTextBuffer>! { get } -
Required Initialiser for types conforming to
TextBufferProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
TextBufferPropertyNamesource 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 : ObjectProtocolParameters
source_propertythe source property to bind
targetthe target object to bind to
target_propertythe target property to bind to
flagsthe flags to pass to the
Bindingtransform_fromValueTransformerto use for forward transformationtransform_toValueTransformerto use for backwards transformationReturn Value
binding reference or
nilin case of an error -
get(property:Extension method) Get the value of a TextBuffer property
Declaration
Swift
@inlinable func get(property: TextBufferPropertyName) -> GLibObject.ValueParameters
propertythe property to get the value for
Return Value
the value of the named property
-
set(property:Extension methodvalue: ) 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
propertythe property to get the value for
Return Value
the value of the named property
-
connect(signal:Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
TextBufferSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: TextBufferSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatahandlerThe 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(signal:Extension methodflags: data: destroyData: signalHandler: ) Connect a C signal handler to the given, typed
TextBufferSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: TextBufferSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatasignalHandlerThe C function to be called on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
onApplyTag(flags:Extension methodhandler: ) The
apply-tagsignal is emitted to apply a tag to a range of text in aGtkTextBuffer. Applying actually occurs in the default handler.Note that if your handler runs before the default handler it must not invalidate the
startandenditers (or has to revalidate them).See also:
gtk_text_buffer_apply_tag(),gtk_text_buffer_insert_with_tags(),gtk_text_buffer_insert_range().Note
This represents the underlyingapply-tagsignalDeclaration
Swift
@discardableResult @inlinable func onApplyTag(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ tag: TextTagRef, _ start: TextIterRef, _ end: TextIterRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
tagthe applied tag
startthe start of the range the tag is applied to
endthe end of the range the tag is applied to
handlerThe signal handler to call Run the given callback whenever the
applyTagsignal is emitted -
applyTagSignalExtension methodTyped
apply-tagsignal for using theconnect(signal:)methodsDeclaration
Swift
static var applyTagSignal: TextBufferSignalName { get } -
onBeginUserAction(flags:Extension methodhandler: ) The
begin-user-actionsignal is emitted at the beginning of a single user-visible operation on aGtkTextBuffer.See also:
gtk_text_buffer_begin_user_action(),gtk_text_buffer_insert_interactive(),gtk_text_buffer_insert_range_interactive(),gtk_text_buffer_delete_interactive(),gtk_text_buffer_backspace(),gtk_text_buffer_delete_selection().Note
This represents the underlyingbegin-user-actionsignalDeclaration
Swift
@discardableResult @inlinable func onBeginUserAction(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
beginUserActionsignal is emitted -
beginUserActionSignalExtension methodTyped
begin-user-actionsignal for using theconnect(signal:)methodsDeclaration
Swift
static var beginUserActionSignal: TextBufferSignalName { get } -
onChanged(flags:Extension methodhandler: ) The
changedsignal is emitted when the content of aGtkTextBufferhas changed.Note
This represents the underlyingchangedsignalDeclaration
Swift
@discardableResult @inlinable func onChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
changedsignal is emitted -
changedSignalExtension methodTyped
changedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var changedSignal: TextBufferSignalName { get } -
onDeleteRange(flags:Extension methodhandler: ) The
delete-rangesignal is emitted to delete a range from aGtkTextBuffer.Note that if your handler runs before the default handler it must not invalidate the
startandenditers (or has to revalidate them). The default signal handler revalidates thestartandenditers to both point to the location where text was deleted. Handlers which run after the default handler (seeg_signal_connect_after()) do not have access to the deleted text.See also:
gtk_text_buffer_delete().Note
This represents the underlyingdelete-rangesignalDeclaration
Swift
@discardableResult @inlinable func onDeleteRange(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ start: TextIterRef, _ end: TextIterRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
startthe start of the range to be deleted
endthe end of the range to be deleted
handlerThe signal handler to call Run the given callback whenever the
deleteRangesignal is emitted -
deleteRangeSignalExtension methodTyped
delete-rangesignal for using theconnect(signal:)methodsDeclaration
Swift
static var deleteRangeSignal: TextBufferSignalName { get } -
onEndUserAction(flags:Extension methodhandler: ) The
end-user-actionsignal is emitted at the end of a single user-visible operation on theGtkTextBuffer.See also:
gtk_text_buffer_end_user_action(),gtk_text_buffer_insert_interactive(),gtk_text_buffer_insert_range_interactive(),gtk_text_buffer_delete_interactive(),gtk_text_buffer_backspace(),gtk_text_buffer_delete_selection(),gtk_text_buffer_backspace().Note
This represents the underlyingend-user-actionsignalDeclaration
Swift
@discardableResult @inlinable func onEndUserAction(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
endUserActionsignal is emitted -
endUserActionSignalExtension methodTyped
end-user-actionsignal for using theconnect(signal:)methodsDeclaration
Swift
static var endUserActionSignal: TextBufferSignalName { get } -
onInsertChildAnchor(flags:Extension methodhandler: ) The
insert-child-anchorsignal is emitted to insert aGtkTextChildAnchorin aGtkTextBuffer. Insertion actually occurs in the default handler.Note that if your handler runs before the default handler it must not invalidate the
locationiter (or has to revalidate it). The default signal handler revalidates it to be placed after the insertedanchor.See also:
gtk_text_buffer_insert_child_anchor().Note
This represents the underlyinginsert-child-anchorsignalDeclaration
Swift
@discardableResult @inlinable func onInsertChildAnchor(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ location: TextIterRef, _ anchor: TextChildAnchorRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
locationposition to insert
anchorintextbufferanchorthe
GtkTextChildAnchorto be insertedhandlerThe signal handler to call Run the given callback whenever the
insertChildAnchorsignal is emitted -
insertChildAnchorSignalExtension methodTyped
insert-child-anchorsignal for using theconnect(signal:)methodsDeclaration
Swift
static var insertChildAnchorSignal: TextBufferSignalName { get } -
onInsertPixbuf(flags:Extension methodhandler: ) The
insert-pixbufsignal is emitted to insert aGdkPixbufin aGtkTextBuffer. Insertion actually occurs in the default handler.Note that if your handler runs before the default handler it must not invalidate the
locationiter (or has to revalidate it). The default signal handler revalidates it to be placed after the insertedpixbuf.See also:
gtk_text_buffer_insert_pixbuf().Note
This represents the underlyinginsert-pixbufsignalDeclaration
Swift
@discardableResult @inlinable func onInsertPixbuf(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ location: TextIterRef, _ pixbuf: PixbufRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
locationposition to insert
pixbufintextbufferpixbufthe
GdkPixbufto be insertedhandlerThe signal handler to call Run the given callback whenever the
insertPixbufsignal is emitted -
insertPixbufSignalExtension methodTyped
insert-pixbufsignal for using theconnect(signal:)methodsDeclaration
Swift
static var insertPixbufSignal: TextBufferSignalName { get } -
onInsertText(flags:Extension methodhandler: ) The
insert-textsignal is emitted to insert text in aGtkTextBuffer. Insertion actually occurs in the default handler.Note that if your handler runs before the default handler it must not invalidate the
locationiter (or has to revalidate it). The default signal handler revalidates it to point to the end of the inserted text.See also:
gtk_text_buffer_insert(),gtk_text_buffer_insert_range().Note
This represents the underlyinginsert-textsignalDeclaration
Swift
@discardableResult @inlinable func onInsertText(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ location: TextIterRef, _ text: String, _ len: Int) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
locationposition to insert
textintextbuffertextthe UTF-8 text to be inserted
lenlength of the inserted text in bytes
handlerThe signal handler to call Run the given callback whenever the
insertTextsignal is emitted -
insertTextSignalExtension methodTyped
insert-textsignal for using theconnect(signal:)methodsDeclaration
Swift
static var insertTextSignal: TextBufferSignalName { get } -
onMarkDeleted(flags:Extension methodhandler: ) The
mark-deletedsignal is emitted as notification after aGtkTextMarkis deleted.See also:
gtk_text_buffer_delete_mark().Note
This represents the underlyingmark-deletedsignalDeclaration
Swift
@discardableResult @inlinable func onMarkDeleted(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ mark: TextMarkRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
markThe mark that was deleted
handlerThe signal handler to call Run the given callback whenever the
markDeletedsignal is emitted -
markDeletedSignalExtension methodTyped
mark-deletedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var markDeletedSignal: TextBufferSignalName { get } -
onMarkSet(flags:Extension methodhandler: ) The
mark-setsignal is emitted as notification after aGtkTextMarkis set.See also:
gtk_text_buffer_create_mark(),gtk_text_buffer_move_mark().Note
This represents the underlyingmark-setsignalDeclaration
Swift
@discardableResult @inlinable func onMarkSet(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ location: TextIterRef, _ mark: TextMarkRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
locationThe location of
markintextbuffermarkThe mark that is set
handlerThe signal handler to call Run the given callback whenever the
markSetsignal is emitted -
markSetSignalExtension methodTyped
mark-setsignal for using theconnect(signal:)methodsDeclaration
Swift
static var markSetSignal: TextBufferSignalName { get } -
onModifiedChanged(flags:Extension methodhandler: ) The
modified-changedsignal is emitted when the modified bit of aGtkTextBufferflips.See also:
gtk_text_buffer_set_modified().Note
This represents the underlyingmodified-changedsignalDeclaration
Swift
@discardableResult @inlinable func onModifiedChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
modifiedChangedsignal is emitted -
modifiedChangedSignalExtension methodTyped
modified-changedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var modifiedChangedSignal: TextBufferSignalName { get } -
onPasteDone(flags:Extension methodhandler: ) The paste-done signal is emitted after paste operation has been completed. This is useful to properly scroll the view to the end of the pasted text. See
gtk_text_buffer_paste_clipboard()for more details.Note
This represents the underlyingpaste-donesignalDeclaration
Swift
@discardableResult @inlinable func onPasteDone(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ clipboard: ClipboardRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
clipboardthe
GtkClipboardpasted fromhandlerThe signal handler to call Run the given callback whenever the
pasteDonesignal is emitted -
pasteDoneSignalExtension methodTyped
paste-donesignal for using theconnect(signal:)methodsDeclaration
Swift
static var pasteDoneSignal: TextBufferSignalName { get } -
onRemoveTag(flags:Extension methodhandler: ) The
remove-tagsignal is emitted to remove all occurrences oftagfrom a range of text in aGtkTextBuffer. Removal actually occurs in the default handler.Note that if your handler runs before the default handler it must not invalidate the
startandenditers (or has to revalidate them).See also:
gtk_text_buffer_remove_tag().Note
This represents the underlyingremove-tagsignalDeclaration
Swift
@discardableResult @inlinable func onRemoveTag(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ tag: TextTagRef, _ start: TextIterRef, _ end: TextIterRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
tagthe tag to be removed
startthe start of the range the tag is removed from
endthe end of the range the tag is removed from
handlerThe signal handler to call Run the given callback whenever the
removeTagsignal is emitted -
removeTagSignalExtension methodTyped
remove-tagsignal for using theconnect(signal:)methodsDeclaration
Swift
static var removeTagSignal: TextBufferSignalName { get } -
onNotifyCopyTargetList(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::copy-target-listsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyCopyTargetList(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyCopyTargetListsignal is emitted -
notifyCopyTargetListSignalExtension methodTyped
notify::copy-target-listsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyCopyTargetListSignal: TextBufferSignalName { get } -
onNotifyCursorPosition(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::cursor-positionsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyCursorPosition(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyCursorPositionsignal is emitted -
notifyCursorPositionSignalExtension methodTyped
notify::cursor-positionsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyCursorPositionSignal: TextBufferSignalName { get } -
onNotifyHasSelection(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::has-selectionsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyHasSelection(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyHasSelectionsignal is emitted -
notifyHasSelectionSignalExtension methodTyped
notify::has-selectionsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyHasSelectionSignal: TextBufferSignalName { get } -
onNotifyPasteTargetList(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::paste-target-listsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyPasteTargetList(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyPasteTargetListsignal is emitted -
notifyPasteTargetListSignalExtension methodTyped
notify::paste-target-listsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyPasteTargetListSignal: TextBufferSignalName { get } -
onNotifyTagTable(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::tag-tablesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyTagTable(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyTagTablesignal is emitted -
notifyTagTableSignalExtension methodTyped
notify::tag-tablesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyTagTableSignal: TextBufferSignalName { get } -
onNotifyText(flags:Extension methodhandler: ) 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 tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_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 underlyingnotify::textsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyText(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextBufferRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyTextsignal is emitted -
notifyTextSignalExtension methodTyped
notify::textsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyTextSignal: TextBufferSignalName { get }
-
add(mark:Extension methodwhere: ) Adds the mark at position
where. The mark must not be added to another buffer, and if its name is notnilthen there must not be another mark in the buffer with the same name.Emits the
GtkTextBuffer::mark-setsignal 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
clipboardto the list of clipboards in which the selection contents ofbufferare available. In most cases,clipboardwill be theGtkClipboardof typeGDK_SELECTION_PRIMARYfor a view ofbuffer.Declaration
Swift
@inlinable func addSelection<ClipboardT>(clipboard: ClipboardT) where ClipboardT : ClipboardProtocol -
apply(tag:Extension methodstart: end: ) Emits the “apply-tag” signal on
buffer. The default handler for the signal appliestagto the given range.startandenddo 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:Extension methodstart: end: ) Calls
gtk_text_tag_table_lookup()on the buffer’s tag table to get aGtkTextTag, then callsgtk_text_buffer_apply_tag().Declaration
Swift
@inlinable func applyTagBy<TextIterT>(name: UnsafePointer<gchar>!, start: TextIterT, end: TextIterT) where TextIterT : TextIterProtocol -
backspace(iter:Extension methodinteractive: defaultEditable: ) 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
iterwill 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 -
beginUserAction()Extension methodCalled 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 betweengtk_text_buffer_begin_user_action()andgtk_text_buffer_end_user_action()can then be grouped when creating an undo stack.GtkTextBuffermaintains a count of calls togtk_text_buffer_begin_user_action()that have not been closed with a call togtk_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
gtk_text_buffer_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) This is a convenience function which simply creates a child anchor with
gtk_text_child_anchor_new()and inserts it into the buffer withgtk_text_buffer_insert_child_anchor(). The new anchor is owned by the buffer; no reference count is returned to the caller ofgtk_text_buffer_create_child_anchor().Declaration
Swift
@inlinable func createChildAnchor<TextIterT>(iter: TextIterT) -> TextChildAnchorRef! where TextIterT : TextIterProtocol -
createMark(markName:Extension methodwhere: leftGravity: ) Creates a mark at position
where. Ifmark_nameisnil, the mark is anonymous; otherwise, the mark can be retrieved by name usinggtk_text_buffer_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
GtkTextBuffer::mark-setsignal as notification of the mark’s initial placement.Declaration
Swift
@inlinable func createMark<TextIterT>(markName: UnsafePointer<gchar>? = nil, where: TextIterT, leftGravity: Bool) -> TextMarkRef! where TextIterT : TextIterProtocol -
cut(clipboard:Extension methoddefaultEditable: ) 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:Extension methodend: ) Deletes text between
startandend. The order ofstartandendis 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, thestartandendwill 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 -
deleteInteractive(startIter:Extension methodendIter: defaultEditable: ) Deletes all editable text in the given range. Calls
gtk_text_buffer_delete()for each editable sub-range of [start,end).startandendare 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 calledg_object_ref()on the mark, it will be freed. Even if the mark isn’t freed, most operations onmarkbecome invalid, until it gets added to a buffer again withgtk_text_buffer_add_mark(). Usegtk_text_mark_get_deleted()to find out if a mark has been removed from its buffer. TheGtkTextBuffer::mark-deletedsignal 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. Seegtk_text_buffer_delete_mark()for details.Declaration
Swift
@inlinable func deleteMarkBy(name: UnsafePointer<gchar>!) -
deleteSelection(interactive:Extension methoddefaultEditable: ) Deletes the range between the “insert” and “selection_bound” marks, that is, the currently-selected text. If
interactiveistrue, the editability of the selection will be considered (users can’t delete uneditable text).Declaration
Swift
@inlinable func deleteSelection(interactive: Bool, defaultEditable: Bool) -> Bool -
deserialize(contentBuffer:Extension methodformat: iter: data: length: ) This function deserializes rich text in format
formatand inserts it atiter.formatsto be used must be registered usinggtk_text_buffer_register_deserialize_format()orgtk_text_buffer_register_deserialize_tagset()beforehand.Declaration
Swift
@inlinable func deserialize<TextBufferT, TextIterT>(contentBuffer: TextBufferT, format: GdkAtom, iter: TextIterT, data: UnsafePointer<guint8>!, length: Int) throws -> Bool where TextBufferT : TextBufferProtocol, TextIterT : TextIterProtocol -
deserializeGetCanCreateTags(format:Extension method) This functions returns the value set with
gtk_text_buffer_deserialize_set_can_create_tags()Declaration
Swift
@inlinable func deserializeGetCanCreateTags(format: GdkAtom) -> Bool -
deserializeSetCanCreateTags(format:Extension methodcanCreateTags: ) Use this function to allow a rich text deserialization function to create new tags in the receiving buffer. Note that using this function is almost always a bad idea, because the rich text functions you register should know how to map the rich text format they handler to your text buffers set of tags.
The ability of creating new (arbitrary!) tags in the receiving buffer is meant for special rich text formats like the internal one that is registered using
gtk_text_buffer_register_deserialize_tagset(), because that format is essentially a dump of the internal structure of the source buffer, including its tag names.You should allow creation of tags only if you know what you are doing, e.g. if you defined a tagset name for your application suite’s text buffers and you know that it’s fine to receive new tags from these buffers, because you know that your application can handle the newly created tags.
Declaration
Swift
@inlinable func deserializeSetCanCreateTags(format: GdkAtom, canCreateTags: Bool) -
endUserAction()Extension methodShould be paired with a call to
gtk_text_buffer_begin_user_action(). See that function for a full explanation.Declaration
Swift
@inlinable func endUserAction() -
getBounds(start:Extension methodend: ) 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 -
getCharCount()Extension methodGets 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 -
getCopyTargetList()Extension methodThis function returns the list of targets this text buffer can provide for copying and as DND source. The targets in the list are added with
infovalues from theGtkTextBufferTargetInfoenum, usinggtk_target_list_add_rich_text_targets()andgtk_target_list_add_text_targets().Declaration
Swift
@inlinable func getCopyTargetList() -> TargetListRef! -
getDeserializeFormats(nFormats:Extension method) This function returns the rich text deserialize formats registered with
bufferusinggtk_text_buffer_register_deserialize_format()orgtk_text_buffer_register_deserialize_tagset()Declaration
Swift
@inlinable func getDeserializeFormats(nFormats: UnsafeMutablePointer<gint>!) -> UnsafeMutablePointer<GdkAtom?>! -
getEnd(iter:Extension method) Initializes
iterwith the “end iterator,” one past the last valid character in the text buffer. If dereferenced withgtk_text_iter_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 (callgtk_text_buffer_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 methodIndicates whether the buffer has some text currently selected.
Declaration
Swift
@inlinable func getHasSelection() -> Bool -
getInsert()Extension methodReturns the mark that represents the cursor (insertion point). Equivalent to calling
gtk_text_buffer_get_mark()to get the mark named “insert”, but very slightly more efficient, and involves less typing.Declaration
Swift
@inlinable func getInsert() -> TextMarkRef! -
getIterAtChildAnchor(iter:Extension methodanchor: ) Obtains the location of
anchorwithinbuffer.Declaration
Swift
@inlinable func getIterAtChildAnchor<TextChildAnchorT, TextIterT>(iter: TextIterT, anchor: TextChildAnchorT) where TextChildAnchorT : TextChildAnchorProtocol, TextIterT : TextIterProtocol -
getIterAtLine(iter:Extension methodlineNumber: ) Initializes
iterto the start of the given line. Ifline_numberis greater than the number of lines in thebuffer, the end iterator is returned.Declaration
Swift
@inlinable func getIterAtLine<TextIterT>(iter: TextIterT, lineNumber: Int) where TextIterT : TextIterProtocol -
getIterAtLineIndex(iter:Extension methodlineNumber: byteIndex: ) Obtains an iterator pointing to
byte_indexwithin the given line.byte_indexmust be the start of a UTF-8 character. Note bytes, not characters; UTF-8 may encode one character as multiple bytes.Before the 3.20 version, it was not allowed to pass an invalid location.
Since the 3.20 version, if
line_numberis greater than the number of lines in thebuffer, the end iterator is returned. And ifbyte_indexis 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) where TextIterT : TextIterProtocol -
getIterAtLineOffset(iter:Extension methodlineNumber: charOffset: ) Obtains an iterator pointing to
char_offsetwithin the given line. Note characters, not bytes; UTF-8 may encode one character as multiple bytes.Before the 3.20 version, it was not allowed to pass an invalid location.
Since the 3.20 version, if
line_numberis greater than the number of lines in thebuffer, the end iterator is returned. And ifchar_offsetis 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) where TextIterT : TextIterProtocol -
getIterAtMark(iter:Extension methodmark: ) Initializes
iterwith the current position ofmark.Declaration
Swift
@inlinable func getIterAtMark<TextIterT, TextMarkT>(iter: TextIterT, mark: TextMarkT) where TextIterT : TextIterProtocol, TextMarkT : TextMarkProtocol -
getIterAtOffset(iter:Extension methodcharOffset: ) Initializes
iterto a positionchar_offsetchars from the start of the entire buffer. Ifchar_offsetis -1 or greater than the number of characters in the buffer,iteris 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 methodObtains 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
namein bufferbuffer, ornilif no such mark exists in the buffer.Declaration
Swift
@inlinable func getMark(name: UnsafePointer<gchar>!) -> TextMarkRef! -
getModified()Extension methodIndicates whether the buffer has been modified since the last call to
gtk_text_buffer_set_modified()set the modification flag tofalse. Used for example to enable a “save” function in a text editor.Declaration
Swift
@inlinable func getModified() -> Bool -
getPasteTargetList()Extension methodThis function returns the list of targets this text buffer supports for pasting and as DND destination. The targets in the list are added with
infovalues from theGtkTextBufferTargetInfoenum, usinggtk_target_list_add_rich_text_targets()andgtk_target_list_add_text_targets().Declaration
Swift
@inlinable func getPasteTargetList() -> TargetListRef! -
getSelectionBound()Extension methodReturns the mark that represents the selection bound. Equivalent to calling
gtk_text_buffer_get_mark()to get the mark named “selection_bound”, but very slightly more efficient, and involves less typing.The currently-selected text in
bufferis 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.gtk_text_buffer_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! -
getSelectionBounds(start:Extension methodend: ) Returns
trueif some text is selected; places the bounds of the selection instartandend(if the selection has length 0, thenstartandendare filled in with the same value).startandendwill be in ascending order. Ifstartandendare NULL, 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 -
getSerializeFormats(nFormats:Extension method) This function returns the rich text serialize formats registered with
bufferusinggtk_text_buffer_register_serialize_format()orgtk_text_buffer_register_serialize_tagset()Declaration
Swift
@inlinable func getSerializeFormats(nFormats: UnsafeMutablePointer<gint>!) -> UnsafeMutablePointer<GdkAtom?>! -
getSlice(start:Extension methodend: includeHiddenChars: ) Returns the text in the range [
start,end). Excludes undisplayed text (text marked with tags that set the invisibility attribute) ifinclude_hidden_charsisfalse. 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 withgtk_text_buffer_get_text(). Note that 0xFFFC can occur in normal text as well, so it is not a reliable indicator that a pixbuf 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
iterwith the first position in the text buffer. This is the same as usinggtk_text_buffer_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 methodGet the
GtkTextTagTableassociated with this buffer.Declaration
Swift
@inlinable func getTagTable() -> TextTagTableRef! -
getText(start:Extension methodend: includeHiddenChars: ) Returns the text in the range [
start,end). Excludes undisplayed text (text marked with tags that set the invisibility attribute) ifinclude_hidden_charsisfalse. 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 withgtk_text_buffer_get_slice().Declaration
Swift
@inlinable func getText<TextIterT>(start: TextIterT, end: TextIterT, includeHiddenChars: Bool) -> String! where TextIterT : TextIterProtocol -
getInsert(iter:Extension methodtext: len: ) Inserts
lenbytes oftextat positioniter. Iflenis -1,textmust 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.iteris 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<gchar>!, len: Int) where TextIterT : TextIterProtocol -
insertAtCursor(text:Extension methodlen: ) Simply calls
gtk_text_buffer_insert(), using the current cursor position as the insertion point.Declaration
Swift
@inlinable func insertAtCursor(text: UnsafePointer<gchar>!, len: Int) -
insertChildAnchor(iter:Extension methodanchor: ) 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. seegtk_text_buffer_get_slice()andgtk_text_buffer_get_text(). Considergtk_text_buffer_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 -
insertInteractive(iter:Extension methodtext: len: defaultEditable: ) Like
gtk_text_buffer_insert(), but the insertion will not occur ifiteris 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_editableindicates the editability of text that doesn’t have a tag affecting editability applied to it. Typically the result ofgtk_text_view_get_editable()is appropriate here.Declaration
Swift
@inlinable func insertInteractive<TextIterT>(iter: TextIterT, text: UnsafePointer<gchar>!, len: Int, defaultEditable: Bool) -> Bool where TextIterT : TextIterProtocol -
insertInteractiveAtCursor(text:Extension methodlen: defaultEditable: ) Calls
gtk_text_buffer_insert_interactive()at the cursor position.default_editableindicates the editability of text that doesn’t have a tag affecting editability applied to it. Typically the result ofgtk_text_view_get_editable()is appropriate here.Declaration
Swift
@inlinable func insertInteractiveAtCursor(text: UnsafePointer<gchar>!, len: Int, defaultEditable: Bool) -> Bool -
insertMarkup(iter:Extension methodmarkup: len: ) Inserts the text in
markupat positioniter.markupwill be inserted in its entirety and must be nul-terminated and valid UTF-8. Emits theGtkTextBuffer::insert-textsignal, possibly multiple times; insertion actually occurs in the default handler for the signal.iterwill point to the end of the inserted text on return.Declaration
Swift
@inlinable func insertMarkup<TextIterT>(iter: TextIterT, markup: UnsafePointer<gchar>!, len: Int) where TextIterT : TextIterProtocol -
insertPixbuf(iter:Extension methodpixbuf: ) 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 pixbufs, but the “text” variants do not. e.g. seegtk_text_buffer_get_slice()andgtk_text_buffer_get_text().Declaration
Swift
@inlinable func insertPixbuf<PixbufT, TextIterT>(iter: TextIterT, pixbuf: PixbufT) where PixbufT : PixbufProtocol, TextIterT : TextIterProtocol -
insertRange(iter:Extension methodstart: end: ) Copies text, tags, and pixbufs between
startandend(the order ofstartandenddoesn’t matter) and inserts the copy atiter. Used instead of simply getting/inserting text because it preserves images and tags. Ifstartandendare in a different buffer frombuffer, 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 -
insertRangeInteractive(iter:Extension methodstart: end: defaultEditable: ) Same as
gtk_text_buffer_insert_range(), but does nothing if the insertion point isn’t editable. Thedefault_editableparameter indicates whether the text is editable atiterif no tags enclosingiteraffect editability. Typically the result ofgtk_text_view_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:Extension methodwhere: ) Moves
markto the new locationwhere. Emits theGtkTextBuffer::mark-setsignal as notification of the move.Declaration
Swift
@inlinable func move<TextIterT, TextMarkT>(mark: TextMarkT, where: TextIterT) where TextIterT : TextIterProtocol, TextMarkT : TextMarkProtocol -
moveMarkBy(name:Extension methodwhere: ) Moves the mark named
name(which must exist) to locationwhere. Seegtk_text_buffer_move_mark()for details.Declaration
Swift
@inlinable func moveMarkBy<TextIterT>(name: UnsafePointer<gchar>!, where: TextIterT) where TextIterT : TextIterProtocol -
paste(clipboard:Extension methodoverrideLocation: defaultEditable: ) Pastes the contents of a clipboard. If
override_locationisnil, 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 -
paste(clipboard:Extension methodoverrideLocation: defaultEditable: ) Pastes the contents of a clipboard. If
override_locationisnil, 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
gtk_text_buffer_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 -
This function registers a rich text deserialization
functionalong with itsmime_typewith the passedbuffer.Declaration
Swift
@inlinable func registerDeserializeFormat(mimeType: UnsafePointer<gchar>!, function: GtkTextBufferDeserializeFunc?, userData: gpointer! = nil, userDataDestroy: GDestroyNotify?) -> GdkAtom! -
registerDeserializeTagset(tagsetName:Extension method) This function registers GTK+’s internal rich text serialization format with the passed
buffer. Seegtk_text_buffer_register_serialize_tagset()for details.Declaration
Swift
@inlinable func registerDeserializeTagset(tagsetName: UnsafePointer<gchar>? = nil) -> GdkAtom! -
registerSerializeFormat(mimeType:Extension methodfunction: userData: userDataDestroy: ) This function registers a rich text serialization
functionalong with itsmime_typewith the passedbuffer.Declaration
Swift
@inlinable func registerSerializeFormat(mimeType: UnsafePointer<gchar>!, function: GtkTextBufferSerializeFunc?, userData: gpointer! = nil, userDataDestroy: GDestroyNotify?) -> GdkAtom! -
registerSerializeTagset(tagsetName:Extension method) This function registers GTK+’s internal rich text serialization format with the passed
buffer. The internal format does not comply to any standard rich text format and only works betweenGtkTextBufferinstances. It is capable of serializing all of a text buffer’s tags and embedded pixbufs.This function is just a wrapper around
gtk_text_buffer_register_serialize_format(). The mime type used for registering is “application/x-gtk-text-buffer-rich-text”, or “application/x-gtk-text-buffer-rich-text;format=tagset_name” if atagset_namewas passed.The
tagset_namecan be used to restrict the transfer of rich text to buffers with compatible sets of tags, in order to avoid unknown tags from being pasted. It is probably the common case to pass an identifier !=nilhere, since theniltagset requires the receiving buffer to deal with with pasting of arbitrary tags.Declaration
Swift
@inlinable func registerSerializeTagset(tagsetName: UnsafePointer<gchar>? = nil) -> GdkAtom! -
removeAllTags(start:Extension methodend: ) Removes all tags in the range between
startandend. 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
GtkClipboardadded withgtk_text_buffer_add_selection_clipboard().Declaration
Swift
@inlinable func removeSelection<ClipboardT>(clipboard: ClipboardT) where ClipboardT : ClipboardProtocol -
remove(tag:Extension methodstart: end: ) Emits the “remove-tag” signal. The default handler for the signal removes all occurrences of
tagfrom the given range.startandenddon’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:Extension methodstart: end: ) Calls
gtk_text_tag_table_lookup()on the buffer’s tag table to get aGtkTextTag, then callsgtk_text_buffer_remove_tag().Declaration
Swift
@inlinable func removeTagBy<TextIterT>(name: UnsafePointer<gchar>!, start: TextIterT, end: TextIterT) where TextIterT : TextIterProtocol -
selectRange(ins:Extension methodbound: ) This function moves the “insert” and “selection_bound” marks simultaneously. If you move them in two steps with
gtk_text_buffer_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 -
serialize(contentBuffer:Extension methodformat: start: end: length: ) This function serializes the portion of text between
startandendin the rich text format represented byformat.formatsto be used must be registered usinggtk_text_buffer_register_serialize_format()orgtk_text_buffer_register_serialize_tagset()beforehand.Declaration
Swift
@inlinable func serialize<TextBufferT, TextIterT>(contentBuffer: TextBufferT, format: GdkAtom, start: TextIterT, end: TextIterT, length: UnsafeMutablePointer<gsize>!) -> UnsafeMutablePointer<guint8>! where TextBufferT : TextBufferProtocol, TextIterT : TextIterProtocol -
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 theGtkTextBuffer::modified-changedsignal.Declaration
Swift
@inlinable func setModified(setting: Bool) -
set(text:Extension methodlen: ) -
unregisterDeserialize(format:Extension method) This function unregisters a rich text format that was previously registered using
gtk_text_buffer_register_deserialize_format()orgtk_text_buffer_register_deserialize_tagset().Declaration
Swift
@inlinable func unregisterDeserialize(format: GdkAtom) -
unregisterSerialize(format:Extension method) This function unregisters a rich text format that was previously registered using
gtk_text_buffer_register_serialize_format()orgtk_text_buffer_register_serialize_tagset()Declaration
Swift
@inlinable func unregisterSerialize(format: GdkAtom) -
targetsIncludeRichText(targets:Extension methodnTargets: ) Determines if any of the targets in
targetscan be used to provide rich text.Declaration
Swift
@inlinable func targetsIncludeRichText(targets: UnsafeMutablePointer<GdkAtom?>!, nTargets: Int) -> Bool -
charCountExtension methodGets 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 } -
copyTargetListExtension methodThis function returns the list of targets this text buffer can provide for copying and as DND source. The targets in the list are added with
infovalues from theGtkTextBufferTargetInfoenum, usinggtk_target_list_add_rich_text_targets()andgtk_target_list_add_text_targets().Declaration
Swift
@inlinable var copyTargetList: TargetListRef! { get } -
hasSelectionExtension methodIndicates whether the buffer has some text currently selected.
Declaration
Swift
@inlinable var hasSelection: Bool { get } -
insertExtension methodReturns the mark that represents the cursor (insertion point). Equivalent to calling
gtk_text_buffer_get_mark()to get the mark named “insert”, but very slightly more efficient, and involves less typing.Declaration
Swift
@inlinable var insert: TextMarkRef! { get } -
lineCountExtension methodObtains the number of lines in the buffer. This value is cached, so the function is very fast.
Declaration
Swift
@inlinable var lineCount: Int { get } -
modifiedExtension methodIndicates whether the buffer has been modified since the last call to
gtk_text_buffer_set_modified()set the modification flag tofalse. Used for example to enable a “save” function in a text editor.Declaration
Swift
@inlinable var modified: Bool { get nonmutating set } -
pasteTargetListExtension methodThis function returns the list of targets this text buffer supports for pasting and as DND destination. The targets in the list are added with
infovalues from theGtkTextBufferTargetInfoenum, usinggtk_target_list_add_rich_text_targets()andgtk_target_list_add_text_targets().Declaration
Swift
@inlinable var pasteTargetList: TargetListRef! { get } -
selectionBoundExtension methodReturns the mark that represents the selection bound. Equivalent to calling
gtk_text_buffer_get_mark()to get the mark named “selection_bound”, but very slightly more efficient, and involves less typing.The currently-selected text in
bufferis 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.gtk_text_buffer_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 } -
tagTableExtension methodGet the
GtkTextTagTableassociated with this buffer.Declaration
Swift
@inlinable var tagTable: TextTagTableRef! { get } -
parentInstanceExtension methodUndocumented
Declaration
Swift
@inlinable var parentInstance: GObject { get } -
textExtension methodA string containing the text stored inside the text buffer, including hidden characters
Declaration
Swift
@inlinable var text: String { get nonmutating set } -
boundsExtension methodbounds for the start and end of the text buffer
View on GitHub
Install in Dash
TextBufferProtocol Protocol Reference