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.

  • ptr

    Untyped pointer to the underlying GtkEditable instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • editable_ptr Default implementation

    Typed 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)

Editable Interface

  • 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 transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return 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:value:) Extension method

    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

Editable signals

  • Connect a Swift signal handler to the given, typed EditableSignalName signal

    Declaration

    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 by userData

    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 a C signal handler to the given, typed EditableSignalName signal

    Declaration

    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 by userData

    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 method

    Emitted 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 underlying insert-text signal

    Warning

    a onInsertText wrapper for this signal could not be generated because it contains unimplemented features: { (1) argument with ownership transfer is not allowed, (2) out or inout argument direction is not allowed }

    Note

    Instead, you can connect insertTextSignal using the connect(signal:) methods

    Declaration

    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:handler:) Extension method

    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 underlying changed signal

    Declaration

    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 method

    Typed changed signal for using the connect(signal:) methods

    Declaration

    Swift

    static var changedSignal: EditableSignalName { get }
  • onDeleteText(flags:handler:) Extension method

    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 and end_pos parameters are interpreted as for [methodGtk.Editable.delete_text].

    Note

    This represents the underlying delete-text signal

    Declaration

    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 method

    Typed delete-text signal for using the connect(signal:) methods

    Declaration

    Swift

    static var deleteTextSignal: EditableSignalName { get }
  • 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 to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_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 underlying notify::cursor-position signal

    Declaration

    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 method

    Typed notify::cursor-position signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyCursorPositionSignal: EditableSignalName { get }
  • 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 to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_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 underlying notify::editable signal

    Declaration

    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 method

    Typed notify::editable signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyEditableSignal: EditableSignalName { get }
  • 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 to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_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 underlying notify::enable-undo signal

    Declaration

    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 method

    Typed notify::enable-undo signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyEnableUndoSignal: EditableSignalName { get }
  • 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 to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_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 underlying notify::max-width-chars signal

    Declaration

    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 method

    Typed notify::max-width-chars signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyMaxWidthCharsSignal: EditableSignalName { get }
  • 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 to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_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 underlying notify::selection-bound signal

    Declaration

    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 method

    Typed notify::selection-bound signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifySelectionBoundSignal: EditableSignalName { get }
  • onNotifyText(flags:handler:) Extension method

    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 to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_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 underlying notify::text signal

    Declaration

    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 method

    Typed notify::text signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyTextSignal: EditableSignalName { get }
  • 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 to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_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 underlying notify::width-chars signal

    Declaration

    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 method

    Typed notify::width-chars signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyWidthCharsSignal: EditableSignalName { get }
  • 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 to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_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 underlying notify::xalign signal

    Declaration

    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 method

    Typed notify::xalign signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyXalignSignal: EditableSignalName { get }

Editable Interface: EditableProtocol extension (methods and fields)

  • deleteSelection() Extension method

    Deletes 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:endPos:) Extension method

    Deletes a sequence of characters.

    The characters that are deleted are those characters at positions from start_pos up to, but not including end_pos. If end_pos is negative, then the characters deleted are those from start_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 method

    Undoes the setup done by [methodGtk.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 method

    Gets the alignment of the editable.

    Declaration

    Swift

    @inlinable
    func getAlignment() -> CFloat
  • getChars(startPos:endPos:) Extension method

    Retrieves a sequence of characters.

    The characters that are retrieved are those characters at positions from start_pos up to, but not including end_pos. If end_pos is negative, then the characters retrieved are those characters from start_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 method

    Gets the GtkEditable that editable is delegating its implementation to.

    Typically, the delegate is a [classGtk.Text] widget.

    Declaration

    Swift

    @inlinable
    func getDelegate() -> EditableRef!
  • getEditable() Extension method

    Retrieves whether editable is editable.

    Declaration

    Swift

    @inlinable
    func getEditable() -> Bool
  • getEnableUndo() Extension method

    Gets if undo/redo actions are enabled for editable

    Declaration

    Swift

    @inlinable
    func getEnableUndo() -> Bool
  • getMaxWidthChars() Extension method

    Retrieves the desired maximum width of editable, in characters.

    Declaration

    Swift

    @inlinable
    func getMaxWidthChars() -> Int
  • getPosition() Extension method

    Retrieves 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
  • Retrieves the selection bound of the editable.

    start_pos will be filled with the start of the selection and end_pos with end. If no text was selected both will be identical and false 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 method

    Retrieves 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 method

    Gets the number of characters of space reserved for the contents of the editable.

    Declaration

    Swift

    @inlinable
    func getWidthChars() -> Int
  • initDelegate() Extension method

    Sets up a delegate for GtkEditable.

    This is assuming that the get_delegate vfunc in the GtkEditable interface has been set up for the editable‘s type.

    This is a helper function that should be called in instance init, after creating the delegate object.

    Declaration

    Swift

    @inlinable
    func initDelegate()
  • Inserts length bytes of text into the contents of the widget, at position position.

    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>!)
  • Selects a region of text.

    The characters that are selected are those characters at positions from start_pos up to, but not including end_pos. If end_pos is negative, then the characters selected are those characters from start_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 [propertyGtk.Text:visibility] is set to false.

    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 method

    Gets the alignment of the editable.

    Declaration

    Swift

    @inlinable
    var alignment: CFloat { get nonmutating set }
  • delegate Extension method

    Gets the GtkEditable that editable is delegating its implementation to.

    Typically, the delegate is a [classGtk.Text] widget.

    Declaration

    Swift

    @inlinable
    var delegate: EditableRef! { get }
  • editable Extension method

    Whether the entry contents can be edited.

    Declaration

    Swift

    @inlinable
    var editable: Bool { get nonmutating set }
  • enableUndo Extension method

    Gets if undo/redo actions are enabled for editable

    Declaration

    Swift

    @inlinable
    var enableUndo: Bool { get nonmutating set }
  • maxWidthChars Extension method

    Retrieves the desired maximum width of editable, in characters.

    Declaration

    Swift

    @inlinable
    var maxWidthChars: Int { get nonmutating set }
  • position Extension method

    Retrieves 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 method

    The contents of the entry.

    Declaration

    Swift

    @inlinable
    var text: String! { get nonmutating set }
  • widthChars Extension method

    Gets the number of characters of space reserved for the contents of the editable.

    Declaration

    Swift

    @inlinable
    var widthChars: Int { get nonmutating set }