Emitted at the end of a single user-visible operation on the contents.
Emitted when text is deleted from the widget by the user.
Emitted when text is inserted into the widget by the user.
Deletes the currently selected text of the editable.
Deletes a sequence of characters.
Undoes the setup done by [method@Gtk.Editable.init_delegate].
Gets the alignment of the editable.
Retrieves a sequence of characters.
Gets the GtkEditable that @editable is delegating its implementation to.
Retrieves whether @editable is editable.
Get the main Gtk struct
Gets if undo/redo actions are enabled for @editable
Retrieves the desired maximum width of @editable, in characters.
Retrieves the current position of the cursor relative to the start of the content of the editable.
Retrieves the selection bound of the editable.
Retrieves the contents of @editable.
Gets the number of characters of space reserved for the contents of the editable.
Sets up a delegate for GtkEditable.
Inserts @length bytes of @text into the contents of the widget, at position @position.
Selects a region of text.
Sets the alignment for the contents of the editable.
Determines if the user can edit the text in the editable widget.
If enabled, changes to @editable will be saved for undo/redo actions.
Sets the desired maximum width in characters of @editable.
Sets the cursor position in the editable to the given value.
Sets the text in the editable to the given value.
Changes the size request of the editable to be about the right size for @n_chars characters.
GtkEditable is an interface for text editing widgets.
Typical examples of editable widgets are [class@Gtk.Entry] and [class@Gtk.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 [signal@Gtk.Editable::insert-text], an application can convert all entry into a widget into uppercase.
Forcing entry to uppercase.
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 [func@Gtk.Editable.install_properties], passing the first available property ID:
In your interface_init function for the GtkEditable interface, provide an implementation for the get_delegate vfunc that returns your text widget:
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 [method@Gtk.Editable.init_delegate]:
In your dispose function, call [method@Gtk.Editable.finish_delegate] before destroying your text widget:
Finally, use [func@Gtk.Editable.delegate_set_property] in your set_property function (and similar for get_property), to set the editable properties:
It is important to note that if you create a GtkEditable that uses a delegate, the low level [signal@Gtk.Editable::insert-text] and [signal@Gtk.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 [signal@Gtk.Editable::insert-text] and [signal@Gtk.Editable::delete-text] signals, you will need to connect to them on the delegate obtained via [method@Gtk.Editable.get_delegate].