EntryBufferProtocol
public protocol EntryBufferProtocol : ObjectProtocol
A GtkEntryBuffer hold the text displayed in a GtkText widget.
A single GtkEntryBuffer object can be shared by multiple widgets
which will then share the same text content, but not the cursor
position, visibility attributes, icon etc.
GtkEntryBuffer may be derived from. Such a derived class might allow
text to be stored in an alternate location, such as non-pageable memory,
useful in the case of important passwords. Or a derived class could
integrate with an application’s concept of undo/redo.
The EntryBufferProtocol protocol exposes the methods and properties of an underlying GtkEntryBuffer 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 EntryBuffer.
Alternatively, use EntryBufferRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkEntryBufferinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
entry_buffer_ptrDefault implementationTyped pointer to the underlying
GtkEntryBufferinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkEntryBufferinstance.Declaration
Swift
var entry_buffer_ptr: UnsafeMutablePointer<GtkEntryBuffer>! { get } -
Required Initialiser for types conforming to
EntryBufferProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
EntryBufferPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: EntryBufferPropertyName, 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 EntryBuffer property
Declaration
Swift
@inlinable func get(property: EntryBufferPropertyName) -> 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 EntryBuffer property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: EntryBufferPropertyName, 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
EntryBufferSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: EntryBufferSignalName, 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
EntryBufferSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: EntryBufferSignalName, 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)
-
onDeletedText(flags:Extension methodhandler: ) The text is altered in the default handler for this signal.
If you want access to the text after the text has been modified, use
G_CONNECT_AFTER.Note
This represents the underlyingdeleted-textsignalDeclaration
Swift
@discardableResult @inlinable func onDeletedText(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EntryBufferRef, _ position: UInt, _ nChars: UInt) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
positionthe position the text was deleted at.
nCharsThe number of characters that were deleted.
handlerThe signal handler to call Run the given callback whenever the
deletedTextsignal is emitted -
deletedTextSignalExtension methodTyped
deleted-textsignal for using theconnect(signal:)methodsDeclaration
Swift
static var deletedTextSignal: EntryBufferSignalName { get } -
onInsertedText(flags:Extension methodhandler: ) This signal is emitted after text is inserted into the buffer.
Note
This represents the underlyinginserted-textsignalDeclaration
Swift
@discardableResult @inlinable func onInsertedText(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EntryBufferRef, _ position: UInt, _ chars: String, _ nChars: UInt) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
positionthe position the text was inserted at.
charsThe text that was inserted.
nCharsThe number of characters that were inserted.
handlerThe signal handler to call Run the given callback whenever the
insertedTextsignal is emitted -
insertedTextSignalExtension methodTyped
inserted-textsignal for using theconnect(signal:)methodsDeclaration
Swift
static var insertedTextSignal: EntryBufferSignalName { get } -
onNotifyLength(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::lengthsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyLength(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EntryBufferRef, _ 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
notifyLengthsignal is emitted -
notifyLengthSignalExtension methodTyped
notify::lengthsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyLengthSignal: EntryBufferSignalName { get } -
onNotifyMaxLength(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::max-lengthsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyMaxLength(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EntryBufferRef, _ 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
notifyMaxLengthsignal is emitted -
notifyMaxLengthSignalExtension methodTyped
notify::max-lengthsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyMaxLengthSignal: EntryBufferSignalName { 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: EntryBufferRef, _ 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: EntryBufferSignalName { get }
-
deleteText(position:Extension methodnChars: ) Deletes a sequence of characters from the buffer.
n_charscharacters are deleted starting atposition. Ifn_charsis negative, then all characters until the end of the text are deleted.If
positionorn_charsare out of bounds, then they are coerced to sane values.Note that the positions are specified in characters, not bytes.
Declaration
Swift
@inlinable func deleteText(position: Int, nChars: Int) -> Int -
emitDeletedText(position:Extension methodnChars: ) Used when subclassing
GtkEntryBuffer.Declaration
Swift
@inlinable func emitDeletedText(position: Int, nChars: Int) -
emitInsertedText(position:Extension methodchars: nChars: ) Used when subclassing
GtkEntryBuffer.Declaration
Swift
@inlinable func emitInsertedText(position: Int, chars: UnsafePointer<CChar>!, nChars: Int) -
getBytes()Extension methodRetrieves the length in bytes of the buffer.
See [method
Gtk.EntryBuffer.get_length].Declaration
Swift
@inlinable func getBytes() -> Int -
getLength()Extension methodRetrieves the length in characters of the buffer.
Declaration
Swift
@inlinable func getLength() -> Int -
getMaxLength()Extension methodRetrieves the maximum allowed length of the text in
buffer.Declaration
Swift
@inlinable func getMaxLength() -> Int -
getText()Extension methodRetrieves the contents of the buffer.
The memory pointer returned by this call will not change unless this object emits a signal, or is finalized.
Declaration
Swift
@inlinable func getText() -> String! -
insertText(position:Extension methodchars: nChars: ) Inserts
n_charscharacters ofcharsinto the contents of the buffer, at positionposition.If
n_charsis negative, then characters from chars will be inserted until a null-terminator is found. Ifpositionorn_charsare out of bounds, or the maximum buffer text length is exceeded, then they are coerced to sane values.Note that the position and length are in characters, not in bytes.
Declaration
Swift
@inlinable func insertText(position: Int, chars: UnsafePointer<CChar>!, nChars: Int) -> Int -
set(maxLength:Extension method) Sets the maximum allowed length of the contents of the buffer.
If the current contents are longer than the given length, then they will be truncated to fit.
Declaration
Swift
@inlinable func set(maxLength: Int) -
setText(chars:Extension methodnChars: ) Sets the text in the buffer.
This is roughly equivalent to calling [method
Gtk.EntryBuffer.delete_text] and [methodGtk.EntryBuffer.insert_text].Note that
n_charsis in characters, not in bytes.Declaration
Swift
@inlinable func setText(chars: UnsafePointer<CChar>!, nChars: Int) -
bytesExtension methodRetrieves the length in bytes of the buffer.
See [method
Gtk.EntryBuffer.get_length].Declaration
Swift
@inlinable var bytes: Int { get } -
lengthExtension methodThe length (in characters) of the text in buffer.
Declaration
Swift
@inlinable var length: Int { get } -
maxLengthExtension methodRetrieves the maximum allowed length of the text in
buffer.Declaration
Swift
@inlinable var maxLength: Int { get nonmutating set } -
textExtension methodThe contents of the buffer.
Declaration
Swift
@inlinable var text: String! { get } -
parentInstanceExtension methodUndocumented
Declaration
Swift
@inlinable var parentInstance: GObject { get }
View on GitHub
Install in Dash
EntryBufferProtocol Protocol Reference