package ocgtk
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054
doc/ocgtk.gtk/Ocgtk_gtk/Gtk/Wrappers/Editable/index.html
Module Wrappers.Editable
type t = [ `editable ] Gobject.objval from_gobject : 'a Gobject.obj -> tval set_width_chars : t -> int -> unitChanges 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.
val set_text : t -> string -> unitSets the text in the editable to the given value.
This is replacing the current contents.
val set_position : t -> int -> unitSets 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.
val set_max_width_chars : t -> int -> unitSets the desired maximum width in characters of @editable.
val set_enable_undo : t -> bool -> unitIf 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 to %FALSE.
val set_editable : t -> bool -> unitDetermines if the user can edit the text in the editable widget.
val set_alignment : t -> float -> unitSets 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.
val select_region : t -> int -> int -> unitSelects 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.
val insert_text : t -> string -> int -> int -> unitInserts @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.
val init_delegate : t -> unitSets 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.
val get_width_chars : t -> intGets the number of characters of space reserved for the contents of the editable.
val get_text : t -> stringRetrieves the contents of @editable.
The returned string is owned by GTK and must not be modified or freed.
val get_selection_bounds : t -> bool * int * intRetrieves 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.
val get_position : t -> intRetrieves 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.
val get_max_width_chars : t -> intRetrieves the desired maximum width of @editable, in characters.
val get_enable_undo : t -> boolGets if undo/redo actions are enabled for @editable
val get_editable : t -> boolRetrieves whether @editable is editable.
Gets the `GtkEditable` that @editable is delegating its implementation to.
Typically, the delegate is a class@Gtk.Text widget.
val get_chars : t -> int -> int -> stringRetrieves 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.
val get_alignment : t -> floatGets the alignment of the editable.
val finish_delegate : t -> unitUndoes 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.
val delete_text : t -> int -> int -> unitDeletes 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.
val delete_selection : t -> unitDeletes the currently selected text of the editable.
This call doesn’t do anything if there is no selected text.
val delegate_get_accessible_platform_state :
t ->
Gtk_enums.accessibleplatformstate ->
boolRetrieves the accessible platform state from the editable delegate.
This is an helper function to retrieve the accessible state for `GtkEditable` interface implementations using a delegate pattern.
You should call this function in your editable widget implementation of the vfunc@Gtk.Accessible.get_platform_state virtual function, for instance:
```c static void accessible_interface_init (GtkAccessibleInterface *iface)
iface->get_platform_state = your_editable_get_accessible_platform_state;
static gboolean your_editable_get_accessible_platform_state (GtkAccessible *accessible, GtkAccessiblePlatformState state)
return gtk_editable_delegate_get_accessible_platform_state (GTK_EDITABLE (accessible), state);
```
val get_cursor_position : t -> intGet property: cursor-position
val get_selection_bound : t -> intGet property: selection-bound
val get_xalign : t -> floatGet property: xalign
val set_xalign : t -> float -> unitSet property: xalign
val on_changed :
?after:bool ->
t ->
callback:(unit -> unit) ->
Gobject.Signal.handler_idval on_delete_text :
?after:bool ->
t ->
callback:(start_pos:int -> end_pos:int -> unit) ->
Gobject.Signal.handler_id