package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.gtk/Ocgtk_gtk/Gtk/Wrappers/Text/index.html

Module Wrappers.Text

type t = [ `text | `widget | `initially_unowned | `object_ ] Gobject.obj
val new_ : unit -> t

Create a new Text

val new_with_buffer : [ `entry_buffer | `object_ ] Gobject.obj -> t

Create a new Text

val unset_invisible_char : t -> unit

Unsets the invisible char.

After calling this, the default invisible char is used again.

val set_visibility : t -> bool -> unit

Sets whether the contents of the `GtkText` are visible or not.

When visibility is set to %FALSE, characters are displayed as the invisible char, and will also appear that way when the text in the widget is copied to the clipboard.

By default, GTK picks the best invisible character available in the current font, but it can be changed with method@Gtk.Text.set_invisible_char.

Note that you probably want to set property@Gtk.Text:input-purpose to %GTK_INPUT_PURPOSE_PASSWORD or %GTK_INPUT_PURPOSE_PIN to inform input methods about the purpose of this self, in addition to setting visibility to %FALSE.

val set_truncate_multiline : t -> bool -> unit

Sets whether the `GtkText` should truncate multi-line text that is pasted into the widget.

val set_tabs : t -> Ocgtk_pango.Pango.Wrappers.Tab_array.t option -> unit

Sets tabstops that are applied to the text.

val set_propagate_text_width : t -> bool -> unit

Sets whether the `GtkText` should grow and shrink with the content.

val set_placeholder_text : t -> string option -> unit

Sets text to be displayed in @self when it is empty.

This can be used to give a visual hint of the expected contents of the `GtkText`.

val set_overwrite_mode : t -> bool -> unit

Sets whether the text is overwritten when typing in the `GtkText`.

val set_max_length : t -> int -> unit

Sets the maximum allowed length of the contents of the widget.

If the current contents are longer than the given length, then they will be truncated to fit.

This is equivalent to getting @self's `GtkEntryBuffer` and calling method@Gtk.EntryBuffer.set_max_length on it.

val set_invisible_char : t -> int -> unit

Sets the character to use when in “password mode”.

By default, GTK picks the best invisible char available in the current font. If you set the invisible char to 0, then the user will get no feedback at all; there will be no text on the screen as they type.

val set_input_purpose : t -> Gtk_enums.inputpurpose -> unit

Sets the input purpose of the `GtkText`.

This can be used by on-screen keyboards and other input methods to adjust their behaviour.

val set_input_hints : t -> Gtk_enums.inputhints -> unit

Sets input hints that allow input methods to fine-tune their behaviour.

val set_extra_menu : t -> Ocgtk_gio.Gio.Wrappers.Menu_model.t option -> unit

Sets a menu model to add when constructing the context menu for @self.

val set_enable_emoji_completion : t -> bool -> unit

Sets whether Emoji completion is enabled.

If it is, typing ':', followed by a recognized keyword, will pop up a window with suggested Emojis matching the keyword.

val set_buffer : t -> [ `entry_buffer | `object_ ] Gobject.obj -> unit

Set the `GtkEntryBuffer` object which holds the text for this widget.

val set_attributes : t -> Ocgtk_pango.Pango.Wrappers.Attr_list.t option -> unit

Sets attributes that are applied to the text.

val set_activates_default : t -> bool -> unit

If @activates is %TRUE, pressing Enter will activate the default widget for the window containing @self.

This usually means that the dialog containing the `GtkText` will be closed, since the default widget is usually one of the dialog buttons.

val grab_focus_without_selecting : t -> bool

Causes @self to have keyboard focus.

It behaves like method@Gtk.Widget.grab_focus, except that it doesn't select the contents of @self. You only want to call this on some special entries which the user usually doesn't want to replace all text in, such as search-as-you-type entries.

val get_visibility : t -> bool

Retrieves whether the text in @self is visible.

val get_truncate_multiline : t -> bool

Returns whether the `GtkText` will truncate multi-line text that is pasted into the widget

val get_text_length : t -> UInt16.t

Retrieves the current length of the text in @self.

This is equivalent to getting @self's `GtkEntryBuffer` and calling method@Gtk.EntryBuffer.get_length on it.

val get_tabs : t -> Ocgtk_pango.Pango.Wrappers.Tab_array.t option

Gets the tabstops that were set on the `GtkText`.

See method@Gtk.Text.set_tabs.

val get_propagate_text_width : t -> bool

Returns whether the `GtkText` will grow and shrink with the content.

val get_placeholder_text : t -> string option

Retrieves the text that will be displayed when @self is empty and unfocused

If no placeholder text has been set, %NULL will be returned.

val get_overwrite_mode : t -> bool

Gets whether text is overwritten when typing in the `GtkText`.

See method@Gtk.Text.set_overwrite_mode.

val get_max_length : t -> int

Retrieves the maximum allowed length of the text in @self.

See method@Gtk.Text.set_max_length.

This is equivalent to getting @self's `GtkEntryBuffer` and calling method@Gtk.EntryBuffer.get_max_length on it.

val get_invisible_char : t -> int

Retrieves the character displayed when visibility is set to false.

Note that GTK does not compute this value unless it needs it, so the value returned by this function is not very useful unless it has been explicitly set with method@Gtk.Text.set_invisible_char.

val get_input_purpose : t -> Gtk_enums.inputpurpose

Gets the input purpose of the `GtkText`.

val get_input_hints : t -> Gtk_enums.inputhints

Gets the input hints of the `GtkText`.

val get_extra_menu : t -> Ocgtk_gio.Gio.Wrappers.Menu_model.t option

Gets the menu model for extra items in the context menu.

See method@Gtk.Text.set_extra_menu.

val get_enable_emoji_completion : t -> bool

Returns whether Emoji completion is enabled for this `GtkText` widget.

val get_buffer : t -> [ `entry_buffer | `object_ ] Gobject.obj

Get the `GtkEntryBuffer` object which holds the text for this widget.

val get_attributes : t -> Ocgtk_pango.Pango.Wrappers.Attr_list.t option

Gets the attribute list that was set on the `GtkText`.

See method@Gtk.Text.set_attributes.

val get_activates_default : t -> bool

Returns whether pressing Enter will activate the default widget for the window containing @self.

See method@Gtk.Text.set_activates_default.

Determine the positions of the strong and weak cursors if the insertion point in the layout is at @position.

The position of each cursor is stored as a zero-width rectangle. The strong cursor location is the location where characters of the directionality equal to the base direction are inserted. The weak cursor location is the location where characters of the directionality opposite to the base direction are inserted.

The rectangle positions are in widget coordinates.

val get_im_module : t -> string

Get property: im-module

val set_im_module : t -> string -> unit

Set property: im-module

val get_invisible_char_set : t -> bool

Get property: invisible-char-set

val set_invisible_char_set : t -> bool -> unit

Set property: invisible-char-set

val get_scroll_offset : t -> int

Get property: scroll-offset

val on_activate : ?after:bool -> t -> callback:(unit -> unit) -> Gobject.Signal.handler_id
val on_backspace : ?after:bool -> t -> callback:(unit -> unit) -> Gobject.Signal.handler_id
val on_copy_clipboard : ?after:bool -> t -> callback:(unit -> unit) -> Gobject.Signal.handler_id
val on_cut_clipboard : ?after:bool -> t -> callback:(unit -> unit) -> Gobject.Signal.handler_id
val on_delete_from_cursor : ?after:bool -> t -> callback:(type_:Gtk_enums.deletetype -> count:int -> unit) -> Gobject.Signal.handler_id
val on_insert_at_cursor : ?after:bool -> t -> callback:(string:string -> unit) -> Gobject.Signal.handler_id
val on_insert_emoji : ?after:bool -> t -> callback:(unit -> unit) -> Gobject.Signal.handler_id
val on_move_cursor : ?after:bool -> t -> callback:(step:Gtk_enums.movementstep -> count:int -> extend:bool -> unit) -> Gobject.Signal.handler_id
val on_paste_clipboard : ?after:bool -> t -> callback:(unit -> unit) -> Gobject.Signal.handler_id
val on_preedit_changed : ?after:bool -> t -> callback:(preedit:string -> unit) -> Gobject.Signal.handler_id
val on_toggle_overwrite : ?after:bool -> t -> callback:(unit -> unit) -> Gobject.Signal.handler_id