EditableProtocol
public protocol EditableProtocol : WidgetProtocol
GtkEditable
is an interface for text editing widgets.
Typical examples of editable widgets are [classGtk.Entry
] and
[classGtk.SpinButton
]. It contains functions for generically manipulating
an editable widget, a large number of action signals used for key bindings,
and several signals that an application can connect to modify the behavior
of a widget.
As an example of the latter usage, by connecting the following handler to
[signalGtk.Editable::insert-text
], an application can convert all entry
into a widget into uppercase.
Forcing entry to uppercase.
`include` <ctype.h>
void
insert_text_handler (GtkEditable *editable,
const char *text,
int length,
int *position,
gpointer data)
{
char *result = g_utf8_strup (text, length);
g_signal_handlers_block_by_func (editable,
(gpointer) insert_text_handler, data);
gtk_editable_insert_text (editable, result, length, position);
g_signal_handlers_unblock_by_func (editable,
(gpointer) insert_text_handler, data);
g_signal_stop_emission_by_name (editable, "insert_text");
g_free (result);
}
Implementing GtkEditable
The most likely scenario for implementing GtkEditable
on your own widget
is that you will embed a GtkText
inside a complex widget, and want to
delegate the editable functionality to that text widget. GtkEditable
provides some utility functions to make this easy.
In your class_init function, call [funcGtk.Editable.install_properties
],
passing the first available property ID:
static void
my_class_init (MyClass *class)
{
...
g_object_class_install_properties (object_class, NUM_PROPERTIES, props);
gtk_editable_install_properties (object_clas, NUM_PROPERTIES);
...
}
In your interface_init function for the GtkEditable
interface, provide
an implementation for the get_delegate vfunc that returns your text widget:
GtkEditable *
get_editable_delegate (GtkEditable *editable)
{
return GTK_EDITABLE (MY_WIDGET (editable)->text_widget);
}
static void
my_editable_init (GtkEditableInterface *iface)
{
iface->get_delegate = get_editable_delegate;
}
You don’t need to provide any other vfuncs. The default implementations
work by forwarding to the delegate that the GtkEditableInterface.get_delegate()
vfunc returns.
In your instance_init function, create your text widget, and then call
[methodGtk.Editable.init_delegate
]:
static void
my_widget_init (MyWidget *self)
{
...
self->text_widget = gtk_text_new ();
gtk_editable_init_delegate (GTK_EDITABLE (self));
...
}
In your dispose function, call [methodGtk.Editable.finish_delegate
] before
destroying your text widget:
static void
my_widget_dispose (GObject *object)
{
...
gtk_editable_finish_delegate (GTK_EDITABLE (self));
g_clear_pointer (&self->text_widget, gtk_widget_unparent);
...
}
Finally, use [funcGtk.Editable.delegate_set_property
] in your set_property
function (and similar for get_property
), to set the editable properties:
...
if (gtk_editable_delegate_set_property (object, prop_id, value, pspec))
return;
switch (prop_id)
...
It is important to note that if you create a GtkEditable
that uses
a delegate, the low level [signalGtk.Editable::insert-text
] and
[signalGtk.Editable::delete-text
] signals will be propagated from the
“wrapper” editable to the delegate, but they will not be propagated from
the delegate to the “wrapper” editable, as they would cause an infinite
recursion. If you wish to connect to the [signalGtk.Editable::insert-text
]
and [signalGtk.Editable::delete-text
] signals, you will need to connect
to them on the delegate obtained via [methodGtk.Editable.get_delegate
].
The EditableProtocol
protocol exposes the methods and properties of an underlying GtkEditable
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 Editable
.
Alternatively, use EditableRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkEditable
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
editable_ptr
Default implementationTyped pointer to the underlying
GtkEditable
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkEditable
instance.Declaration
Swift
var editable_ptr: UnsafeMutablePointer<GtkEditable>! { get }
-
Required Initialiser for types conforming to
EditableProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
EditablePropertyName
source property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: EditablePropertyName, 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 Editable property
Declaration
Swift
@inlinable func get(property: EditablePropertyName) -> 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 Editable property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: EditablePropertyName, 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
EditableSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: EditableSignalName, 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
EditableSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: EditableSignalName, 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)
-
insertTextSignal
Extension methodEmitted when text is inserted into the widget by the user.
The default handler for this signal will normally be responsible for inserting the text, so by connecting to this signal and then stopping the signal with
g_signal_stop_emission()
, it is possible to modify the inserted text, or prevent it from being inserted entirely.Note
This represents the underlyinginsert-text
signalWarning
aonInsertText
wrapper for this signal could not be generated because it contains unimplemented features: { (1) argument with ownership transfer is not allowed, (2)out
orinout
argument direction is not allowed }Note
Instead, you can connectinsertTextSignal
using theconnect(signal:)
methodsDeclaration
Swift
static var insertTextSignal: EditableSignalName { get }
Parameters
flags
Flags
unownedSelf
Reference to instance of self
text
the new text to insert
length
the length of the new text, in bytes, or -1 if new_text is nul-terminated
position
the position, in characters, at which to insert the new text. this is an in-out parameter. After the signal emission is finished, it should point after the newly inserted text.
handler
The signal handler to call
-
onChanged(flags:
Extension methodhandler: ) Emitted at the end of a single user-visible operation on the contents.
E.g., a paste operation that replaces the contents of the selection will cause only one signal emission (even though it is implemented by first deleting the selection, then inserting the new content, and may cause multiple
notify::text
signals to be emitted).Note
This represents the underlyingchanged
signalDeclaration
Swift
@discardableResult @inlinable func onChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EditableRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
changed
signal is emitted -
changedSignal
Extension methodTyped
changed
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var changedSignal: EditableSignalName { get }
-
onDeleteText(flags:
Extension methodhandler: ) Emitted when text is deleted from the widget by the user.
The default handler for this signal will normally be responsible for deleting the text, so by connecting to this signal and then stopping the signal with
g_signal_stop_emission()
, it is possible to modify the range of deleted text, or prevent it from being deleted entirely.The
start_pos
andend_pos
parameters are interpreted as for [methodGtk.Editable.delete_text
].Note
This represents the underlyingdelete-text
signalDeclaration
Swift
@discardableResult @inlinable func onDeleteText(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EditableRef, _ startPos: Int, _ endPos: Int) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
startPos
the starting position
endPos
the end position
handler
The signal handler to call Run the given callback whenever the
deleteText
signal is emitted -
deleteTextSignal
Extension methodTyped
delete-text
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var deleteTextSignal: EditableSignalName { 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 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::cursor-position
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyCursorPosition(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EditableRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyCursorPosition
signal is emitted -
notifyCursorPositionSignal
Extension methodTyped
notify::cursor-position
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyCursorPositionSignal: EditableSignalName { get }
-
onNotifyEditable(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::editable
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyEditable(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EditableRef, _ 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
notifyEditable
signal is emitted -
notifyEditableSignal
Extension methodTyped
notify::editable
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyEditableSignal: EditableSignalName { get }
-
onNotifyEnableUndo(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::enable-undo
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyEnableUndo(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EditableRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyEnableUndo
signal is emitted -
notifyEnableUndoSignal
Extension methodTyped
notify::enable-undo
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyEnableUndoSignal: EditableSignalName { get }
-
onNotifyMaxWidthChars(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-width-chars
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyMaxWidthChars(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EditableRef, _ 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
notifyMaxWidthChars
signal is emitted -
notifyMaxWidthCharsSignal
Extension methodTyped
notify::max-width-chars
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyMaxWidthCharsSignal: EditableSignalName { get }
-
onNotifySelectionBound(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::selection-bound
signalDeclaration
Swift
@discardableResult @inlinable func onNotifySelectionBound(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EditableRef, _ 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
notifySelectionBound
signal is emitted -
notifySelectionBoundSignal
Extension methodTyped
notify::selection-bound
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifySelectionBoundSignal: EditableSignalName { 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: EditableRef, _ 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: EditableSignalName { get }
-
onNotifyWidthChars(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::width-chars
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyWidthChars(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EditableRef, _ 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
notifyWidthChars
signal is emitted -
notifyWidthCharsSignal
Extension methodTyped
notify::width-chars
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyWidthCharsSignal: EditableSignalName { get }
-
onNotifyXalign(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::xalign
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyXalign(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EditableRef, _ 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
notifyXalign
signal is emitted -
notifyXalignSignal
Extension methodTyped
notify::xalign
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyXalignSignal: EditableSignalName { get }
-
deleteSelection()
Extension methodDeletes the currently selected text of the editable.
This call doesn’t do anything if there is no selected text.
Declaration
Swift
@inlinable func deleteSelection()
-
deleteText(startPos:
Extension methodendPos: ) Deletes a sequence of characters.
The characters that are deleted are those characters at positions from
start_pos
up to, but not includingend_pos
. Ifend_pos
is negative, then the characters deleted are those fromstart_pos
to the end of the text.Note that the positions are specified in characters, not bytes.
Declaration
Swift
@inlinable func deleteText(startPos: Int, endPos: Int)
-
finishDelegate()
Extension methodUndoes the setup done by [method
Gtk.Editable.init_delegate
].This is a helper function that should be called from dispose, before removing the delegate object.
Declaration
Swift
@inlinable func finishDelegate()
-
getAlignment()
Extension methodGets the alignment of the editable.
Declaration
Swift
@inlinable func getAlignment() -> CFloat
-
getChars(startPos:
Extension methodendPos: ) Retrieves a sequence of characters.
The characters that are retrieved are those characters at positions from
start_pos
up to, but not includingend_pos
. Ifend_pos
is negative, then the characters retrieved are those characters fromstart_pos
to the end of the text.Note that positions are specified in characters, not bytes.
Declaration
Swift
@inlinable func getChars(startPos: Int, endPos: Int) -> String!
-
getDelegate()
Extension methodGets the
GtkEditable
thateditable
is delegating its implementation to.Typically, the delegate is a [class
Gtk.Text
] widget.Declaration
Swift
@inlinable func getDelegate() -> EditableRef!
-
getEditable()
Extension methodRetrieves whether
editable
is editable.Declaration
Swift
@inlinable func getEditable() -> Bool
-
getEnableUndo()
Extension methodGets if undo/redo actions are enabled for
editable
Declaration
Swift
@inlinable func getEnableUndo() -> Bool
-
getMaxWidthChars()
Extension methodRetrieves the desired maximum width of
editable
, in characters.Declaration
Swift
@inlinable func getMaxWidthChars() -> Int
-
getPosition()
Extension methodRetrieves the current position of the cursor relative to the start of the content of the editable.
Note that this position is in characters, not in bytes.
Declaration
Swift
@inlinable func getPosition() -> Int
-
getSelectionBounds(startPos:
Extension methodendPos: ) Retrieves the selection bound of the editable.
start_pos
will be filled with the start of the selection andend_pos
with end. If no text was selected both will be identical andfalse
will be returned.Note that positions are specified in characters, not bytes.
Declaration
Swift
@inlinable func getSelectionBounds(startPos: UnsafeMutablePointer<gint>! = nil, endPos: UnsafeMutablePointer<gint>! = nil) -> Bool
-
getText()
Extension methodRetrieves the contents of
editable
.The returned string is owned by GTK and must not be modified or freed.
Declaration
Swift
@inlinable func getText() -> String!
-
getWidthChars()
Extension methodGets the number of characters of space reserved for the contents of the editable.
Declaration
Swift
@inlinable func getWidthChars() -> Int
-
initDelegate()
Extension methodSets up a delegate for
GtkEditable
.This is assuming that the get_delegate vfunc in the
GtkEditable
interface has been set up for theeditable
‘s type.This is a helper function that should be called in instance init, after creating the delegate object.
Declaration
Swift
@inlinable func initDelegate()
-
insert(text:
Extension methodlength: position: ) Inserts
length
bytes oftext
into the contents of the widget, at positionposition
.Note that the position is in characters, not in bytes. The function updates
position
to point after the newly inserted text.Declaration
Swift
@inlinable func insert(text: UnsafePointer<CChar>!, length: Int, position: UnsafeMutablePointer<gint>!)
-
selectRegion(startPos:
Extension methodendPos: ) Selects a region of text.
The characters that are selected are those characters at positions from
start_pos
up to, but not includingend_pos
. Ifend_pos
is negative, then the characters selected are those characters fromstart_pos
to the end of the text.Note that positions are specified in characters, not bytes.
Declaration
Swift
@inlinable func selectRegion(startPos: Int, endPos: Int)
-
setAlignment(xalign:
Extension method) Sets the alignment for the contents of the editable.
This controls the horizontal positioning of the contents when the displayed text is shorter than the width of the editable.
Declaration
Swift
@inlinable func setAlignment(xalign: CFloat)
-
setEditable(isEditable:
Extension method) Determines if the user can edit the text in the editable widget.
Declaration
Swift
@inlinable func setEditable(isEditable: Bool)
-
set(enableUndo:
Extension method) If enabled, changes to
editable
will be saved for undo/redo actions.This results in an additional copy of text changes and are not stored in secure memory. As such, undo is forcefully disabled when [property
Gtk.Text:visibility
] is set tofalse
.Declaration
Swift
@inlinable func set(enableUndo: Bool)
-
setMaxWidthChars(nChars:
Extension method) Sets the desired maximum width in characters of
editable
.Declaration
Swift
@inlinable func setMaxWidthChars(nChars: Int)
-
set(position:
Extension method) Sets the cursor position in the editable to the given value.
The cursor is displayed before the character with the given (base 0) index in the contents of the editable. The value must be less than or equal to the number of characters in the editable. A value of -1 indicates that the position should be set after the last character of the editable. Note that
position
is in characters, not in bytes.Declaration
Swift
@inlinable func set(position: Int)
-
set(text:
Extension method) Sets the text in the editable to the given value.
This is replacing the current contents.
Declaration
Swift
@inlinable func set(text: UnsafePointer<CChar>!)
-
setWidthChars(nChars:
Extension method) Changes the size request of the editable to be about the right size for
n_chars
characters.Note that it changes the size request, the size can still be affected by how you pack the widget into containers. If
n_chars
is -1, the size reverts to the default size.Declaration
Swift
@inlinable func setWidthChars(nChars: Int)
-
alignment
Extension methodGets the alignment of the editable.
Declaration
Swift
@inlinable var alignment: CFloat { get nonmutating set }
-
delegate
Extension methodGets the
GtkEditable
thateditable
is delegating its implementation to.Typically, the delegate is a [class
Gtk.Text
] widget.Declaration
Swift
@inlinable var delegate: EditableRef! { get }
-
editable
Extension methodWhether the entry contents can be edited.
Declaration
Swift
@inlinable var editable: Bool { get nonmutating set }
-
enableUndo
Extension methodGets if undo/redo actions are enabled for
editable
Declaration
Swift
@inlinable var enableUndo: Bool { get nonmutating set }
-
maxWidthChars
Extension methodRetrieves the desired maximum width of
editable
, in characters.Declaration
Swift
@inlinable var maxWidthChars: Int { get nonmutating set }
-
position
Extension methodRetrieves the current position of the cursor relative to the start of the content of the editable.
Note that this position is in characters, not in bytes.
Declaration
Swift
@inlinable var position: Int { get nonmutating set }
-
text
Extension methodThe contents of the entry.
Declaration
Swift
@inlinable var text: String! { get nonmutating set }
-
widthChars
Extension methodGets the number of characters of space reserved for the contents of the editable.
Declaration
Swift
@inlinable var widthChars: Int { get nonmutating set }