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
GtkEditableinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
editable_ptrDefault implementationTyped pointer to the underlying
GtkEditableinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkEditableinstance.Declaration
Swift
var editable_ptr: UnsafeMutablePointer<GtkEditable>! { get } -
Required Initialiser for types conforming to
EditableProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
EditablePropertyNamesource 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 : 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 Editable property
Declaration
Swift
@inlinable func get(property: EditablePropertyName) -> 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 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
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
EditableSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: EditableSignalName, 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
EditableSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: EditableSignalName, 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)
-
insertTextSignalExtension 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-textsignalWarning
aonInsertTextwrapper for this signal could not be generated because it contains unimplemented features: { (1) argument with ownership transfer is not allowed, (2)outorinoutargument direction is not allowed }Note
Instead, you can connectinsertTextSignalusing theconnect(signal:)methodsDeclaration
Swift
static var insertTextSignal: EditableSignalName { get }Parameters
flagsFlags
unownedSelfReference to instance of self
textthe new text to insert
lengththe length of the new text, in bytes, or -1 if new_text is nul-terminated
positionthe 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.
handlerThe 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::textsignals to be emitted).Note
This represents the underlyingchangedsignalDeclaration
Swift
@discardableResult @inlinable func onChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EditableRef) -> 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: 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_posandend_posparameters are interpreted as for [methodGtk.Editable.delete_text].Note
This represents the underlyingdelete-textsignalDeclaration
Swift
@discardableResult @inlinable func onDeleteText(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EditableRef, _ startPos: Int, _ endPos: Int) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
startPosthe starting position
endPosthe end position
handlerThe signal handler to call Run the given callback whenever the
deleteTextsignal is emitted -
deleteTextSignalExtension methodTyped
delete-textsignal 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 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: EditableRef, _ 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: 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 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::editablesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyEditable(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EditableRef, _ 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
notifyEditablesignal is emitted -
notifyEditableSignalExtension methodTyped
notify::editablesignal 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 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::enable-undosignalDeclaration
Swift
@discardableResult @inlinable func onNotifyEnableUndo(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EditableRef, _ 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
notifyEnableUndosignal is emitted -
notifyEnableUndoSignalExtension methodTyped
notify::enable-undosignal 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 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-width-charssignalDeclaration
Swift
@discardableResult @inlinable func onNotifyMaxWidthChars(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EditableRef, _ 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
notifyMaxWidthCharssignal is emitted -
notifyMaxWidthCharsSignalExtension methodTyped
notify::max-width-charssignal 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 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::selection-boundsignalDeclaration
Swift
@discardableResult @inlinable func onNotifySelectionBound(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EditableRef, _ 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
notifySelectionBoundsignal is emitted -
notifySelectionBoundSignalExtension methodTyped
notify::selection-boundsignal 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 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: EditableRef, _ 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: 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 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::width-charssignalDeclaration
Swift
@discardableResult @inlinable func onNotifyWidthChars(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EditableRef, _ 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
notifyWidthCharssignal is emitted -
notifyWidthCharsSignalExtension methodTyped
notify::width-charssignal 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 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::xalignsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyXalign(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: EditableRef, _ 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
notifyXalignsignal is emitted -
notifyXalignSignalExtension methodTyped
notify::xalignsignal 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_posup to, but not includingend_pos. Ifend_posis negative, then the characters deleted are those fromstart_posto 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_posup to, but not includingend_pos. Ifend_posis negative, then the characters retrieved are those characters fromstart_posto 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
GtkEditablethateditableis delegating its implementation to.Typically, the delegate is a [class
Gtk.Text] widget.Declaration
Swift
@inlinable func getDelegate() -> EditableRef! -
getEditable()Extension methodRetrieves whether
editableis editable.Declaration
Swift
@inlinable func getEditable() -> Bool -
getEnableUndo()Extension methodGets if undo/redo actions are enabled for
editableDeclaration
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_poswill be filled with the start of the selection andend_poswith end. If no text was selected both will be identical andfalsewill 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
GtkEditableinterface 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
lengthbytes oftextinto the contents of the widget, at positionposition.Note that the position is in characters, not in bytes. The function updates
positionto 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_posup to, but not includingend_pos. Ifend_posis negative, then the characters selected are those characters fromstart_posto 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
editablewill 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
positionis 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_charscharacters.Note that it changes the size request, the size can still be affected by how you pack the widget into containers. If
n_charsis -1, the size reverts to the default size.Declaration
Swift
@inlinable func setWidthChars(nChars: Int) -
alignmentExtension methodGets the alignment of the editable.
Declaration
Swift
@inlinable var alignment: CFloat { get nonmutating set } -
delegateExtension methodGets the
GtkEditablethateditableis delegating its implementation to.Typically, the delegate is a [class
Gtk.Text] widget.Declaration
Swift
@inlinable var delegate: EditableRef! { get } -
editableExtension methodWhether the entry contents can be edited.
Declaration
Swift
@inlinable var editable: Bool { get nonmutating set } -
enableUndoExtension methodGets if undo/redo actions are enabled for
editableDeclaration
Swift
@inlinable var enableUndo: Bool { get nonmutating set } -
maxWidthCharsExtension methodRetrieves the desired maximum width of
editable, in characters.Declaration
Swift
@inlinable var maxWidthChars: Int { get nonmutating set } -
positionExtension 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 } -
textExtension methodThe contents of the entry.
Declaration
Swift
@inlinable var text: String! { get nonmutating set } -
widthCharsExtension methodGets the number of characters of space reserved for the contents of the editable.
Declaration
Swift
@inlinable var widthChars: Int { get nonmutating set }
View on GitHub
Install in Dash
EditableProtocol Protocol Reference