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
GtkEntryBuffer
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
entry_buffer_ptr
Default implementationTyped pointer to the underlying
GtkEntryBuffer
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkEntryBuffer
instance.Declaration
Swift
var entry_buffer_ptr: UnsafeMutablePointer<GtkEntryBuffer>! { get }
-
Required Initialiser for types conforming to
EntryBufferProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
EntryBufferPropertyName
source 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 : 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 transformationtransform_to
ValueTransformer
to use for backwards transformationReturn Value
binding reference or
nil
in case of an error -
get(property:
Extension method) Get the value of a EntryBuffer property
Declaration
Swift
@inlinable func get(property: EntryBufferPropertyName) -> GLibObject.Value
Parameters
property
the 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
property
the 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
EntryBufferSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: EntryBufferSignalName, 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 byuserData
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(signal:
Extension methodflags: data: destroyData: signalHandler: ) Connect a C signal handler to the given, typed
EntryBufferSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: EntryBufferSignalName, 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 byuserData
signalHandler
The 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-text
signalDeclaration
Swift
@discardableResult @inlinable func onDeletedText(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EntryBufferRef, _ position: UInt, _ nChars: UInt) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
position
the position the text was deleted at.
nChars
The number of characters that were deleted.
handler
The signal handler to call Run the given callback whenever the
deletedText
signal is emitted -
deletedTextSignal
Extension methodTyped
deleted-text
signal 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-text
signalDeclaration
Swift
@discardableResult @inlinable func onInsertedText(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EntryBufferRef, _ position: UInt, _ chars: String, _ nChars: UInt) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
position
the position the text was inserted at.
chars
The text that was inserted.
nChars
The number of characters that were inserted.
handler
The signal handler to call Run the given callback whenever the
insertedText
signal is emitted -
insertedTextSignal
Extension methodTyped
inserted-text
signal 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 innotify
being 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::length
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyLength(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EntryBufferRef, _ 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
notifyLength
signal is emitted -
notifyLengthSignal
Extension methodTyped
notify::length
signal 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 innotify
being 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-length
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyMaxLength(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EntryBufferRef, _ 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
notifyMaxLength
signal is emitted -
notifyMaxLengthSignal
Extension methodTyped
notify::max-length
signal 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 innotify
being 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::text
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyText(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EntryBufferRef, _ 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 methodTyped
notify::text
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyTextSignal: EntryBufferSignalName { get }
-
deleteText(position:
Extension methodnChars: ) Deletes a sequence of characters from the buffer.
n_chars
characters are deleted starting atposition
. Ifn_chars
is negative, then all characters until the end of the text are deleted.If
position
orn_chars
are 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_chars
characters ofchars
into the contents of the buffer, at positionposition
.If
n_chars
is negative, then characters from chars will be inserted until a null-terminator is found. Ifposition
orn_chars
are 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_chars
is in characters, not in bytes.Declaration
Swift
@inlinable func setText(chars: UnsafePointer<CChar>!, nChars: Int)
-
bytes
Extension methodRetrieves the length in bytes of the buffer.
See [method
Gtk.EntryBuffer.get_length
].Declaration
Swift
@inlinable var bytes: Int { get }
-
length
Extension methodThe length (in characters) of the text in buffer.
Declaration
Swift
@inlinable var length: Int { get }
-
maxLength
Extension methodRetrieves the maximum allowed length of the text in
buffer
.Declaration
Swift
@inlinable var maxLength: Int { get nonmutating set }
-
text
Extension methodThe contents of the buffer.
Declaration
Swift
@inlinable var text: String! { get }
-
parentInstance
Extension methodUndocumented
Declaration
Swift
@inlinable var parentInstance: GObject { get }