class Gtk::Text

Overview

The Gtk::Text widget is a single-line text entry widget.

Gtk::Text is the common implementation of single-line text editing that is shared between Gtk::Entry, Gtk::PasswordEntry, Gtk::SpinButton and other widgets. In all of these, Gtk::Text is used as the delegate for the Gtk::Editable implementation.

A fairly large set of key bindings are supported by default. If the entered text is longer than the allocation of the widget, the widget will scroll so that the cursor position is visible.

When using an entry for passwords and other sensitive information, it can be put into “password mode” using Gtk::Text#visibility=. In this mode, entered text is displayed using a “invisible” character. By default, GTK picks the best invisible character that is available in the current font, but it can be changed with Gtk::Text#invisible_char=.

If you are looking to add icons or progress display in an entry, look at Gtk::Entry. There other alternatives for more specialized use cases, such as Gtk::SearchEntry.

If you need multi-line editable text, look at Gtk::TextView.

CSS nodes

text[.read-only]
├── placeholder
├── undershoot.left
├── undershoot.right
├── [selection]
├── [block-cursor]
╰── [window.popup]

Gtk::Text has a main node with the name text. Depending on the properties of the widget, the .read-only style class may appear.

When the entry has a selection, it adds a subnode with the name selection.

When the entry is in overwrite mode, it adds a subnode with the name block-cursor that determines how the block cursor is drawn.

The CSS node for a context menu is added as a subnode below text as well.

The undershoot nodes are used to draw the underflow indication when content is scrolled out of view. These nodes get the .left and .right style classes added depending on where the indication is drawn.

When touch is used and touch selection handles are shown, they are using CSS nodes with name cursor-handle. They get the .top or .bottom style class depending on where they are shown in relation to the selection. If there is just a single handle for the text cursor, it gets the style class .insertion-cursor.

Accessibility

Gtk::Text uses the %GTK_ACCESSIBLE_ROLE_NONE role, which causes it to be skipped for accessibility. This is because Gtk::Text is expected to be used as a delegate for a Gtk::Editable implementation that will be represented to accessibility.

Included Modules

Defined in:

lib/gi-crystal/src/auto/gtk-4.0/text.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from module Gtk::Editable

alignment : Float32 alignment, alignment=(xalign : Float32) : Nil alignment=, changed_signal changed_signal, chars(start_pos : Int32, end_pos : Int32) : String chars, cursor_position : Int32 cursor_position, delegate : Gtk::Editable | Nil delegate, delete_selection : Nil delete_selection, delete_text(start_pos : Int32, end_pos : Int32) : Nil delete_text, delete_text_signal delete_text_signal, editable : Bool editable, editable=(is_editable : Bool) : Nil editable=, editable? : Bool editable?, enable_undo : Bool enable_undo, enable_undo=(enable_undo : Bool) : Nil enable_undo=, enable_undo? : Bool enable_undo?, finish_delegate : Nil finish_delegate, init_delegate : Nil init_delegate, insert_text(text : String, length : Int32, position : Int32) : Nil insert_text, insert_text_signal insert_text_signal, max_width_chars : Int32 max_width_chars, max_width_chars=(n_chars : Int32) : Nil max_width_chars=, position : Int32 position, position=(position : Int32) : Nil position=, select_region(start_pos : Int32, end_pos : Int32) : Nil select_region, selection_bound : Int32 selection_bound, selection_bounds : Bool selection_bounds, text : String text, text=(text : String) : Nil text=, to_unsafe to_unsafe, width_chars : Int32 width_chars, width_chars=(n_chars : Int32) : Nil width_chars=, xalign : Float32 xalign, xalign=(value : Float32) : Float32 xalign=

Constructor methods inherited from module Gtk::Editable

cast(obj : GObject::Object) : self cast

Class methods inherited from module Gtk::Editable

cast?(obj : GObject::Object) : self | Nil cast?, delegate_get_property(object : GObject::Object, prop_id : UInt32, value : _, pspec : GObject::ParamSpec) : Bool delegate_get_property, delegate_set_property(object : GObject::Object, prop_id : UInt32, value : _, pspec : GObject::ParamSpec) : Bool delegate_set_property, g_type : UInt64 g_type, install_properties(object_class : GObject::ObjectClass, first_prop : UInt32) : UInt32 install_properties

Instance methods inherited from module Gtk::ConstraintTarget

to_unsafe to_unsafe

Constructor methods inherited from module Gtk::ConstraintTarget

cast(obj : GObject::Object) : self cast

Class methods inherited from module Gtk::ConstraintTarget

cast?(obj : GObject::Object) : self | Nil cast?, g_type : UInt64 g_type

Instance methods inherited from module Gtk::Buildable

buildable_id : String | Nil buildable_id, to_unsafe to_unsafe

Constructor methods inherited from module Gtk::Buildable

cast(obj : GObject::Object) : self cast

Class methods inherited from module Gtk::Buildable

cast?(obj : GObject::Object) : self | Nil cast?, g_type : UInt64 g_type

Instance methods inherited from module Gtk::Accessible

accessible_role : Gtk::AccessibleRole accessible_role, accessible_role=(value : Gtk::AccessibleRole) : Gtk::AccessibleRole accessible_role=, reset_property(property : Gtk::AccessibleProperty) : Nil reset_property, reset_relation(relation : Gtk::AccessibleRelation) : Nil reset_relation, reset_state(state : Gtk::AccessibleState) : Nil reset_state, to_unsafe to_unsafe, update_property(properties : Enumerable(Gtk::AccessibleProperty), values : Enumerable(_)) : Nil update_property, update_relation(relations : Enumerable(Gtk::AccessibleRelation), values : Enumerable(_)) : Nil update_relation, update_state(states : Enumerable(Gtk::AccessibleState), values : Enumerable(_)) : Nil update_state

Constructor methods inherited from module Gtk::Accessible

cast(obj : GObject::Object) : self cast

Class methods inherited from module Gtk::Accessible

cast?(obj : GObject::Object) : self | Nil cast?, g_type : UInt64 g_type

Instance methods inherited from class Gtk::Widget

==(other : self) ==, action_set_enabled(action_name : String, enabled : Bool) : Nil action_set_enabled, activate : Bool activate, activate_action(name : String, args : _ | Nil) : Bool activate_action, activate_default : Nil activate_default, add_controller(controller : Gtk::EventController) : Nil add_controller, add_css_class(css_class : String) : Nil add_css_class, add_mnemonic_label(label : Gtk::Widget) : Nil add_mnemonic_label, add_tick_callback(callback : Gtk::TickCallback) : UInt32 add_tick_callback, allocate(width : Int32, height : Int32, baseline : Int32, transform : Gsk::Transform | Nil) : Nil allocate, allocated_baseline : Int32 allocated_baseline, allocated_height : Int32 allocated_height, allocated_width : Int32 allocated_width, allocation : Gdk::Rectangle allocation, ancestor(widget_type : UInt64) : Gtk::Widget | Nil ancestor, can_focus : Bool can_focus, can_focus=(can_focus : Bool) : Nil can_focus=, can_focus? : Bool can_focus?, can_target : Bool can_target, can_target=(can_target : Bool) : Nil can_target=, can_target? : Bool can_target?, child_focus(direction : Gtk::DirectionType) : Bool child_focus, child_visible : Bool child_visible, child_visible=(child_visible : Bool) : Nil child_visible=, children : Iterator(Widget) children, clipboard : Gdk::Clipboard clipboard, compute_bounds(target : Gtk::Widget) : Graphene::Rect compute_bounds, compute_expand(orientation : Gtk::Orientation) : Bool compute_expand, compute_point(target : Gtk::Widget, point : Graphene::Point) : Graphene::Point compute_point, compute_transform(target : Gtk::Widget) : Graphene::Matrix compute_transform, contains(x : Float64, y : Float64) : Bool contains, create_pango_context : Pango::Context create_pango_context, create_pango_layout(text : String | Nil) : Pango::Layout create_pango_layout, css_classes : Enumerable(String) css_classes, css_classes=(classes : Enumerable(String)) : Nil css_classes=, css_name : String css_name, css_name=(value : String) : String css_name=, cursor : Gdk::Cursor | Nil cursor, cursor=(cursor : Gdk::Cursor | Nil) : Nil cursor=, cursor_from_name=(name : String | Nil) : Nil cursor_from_name=, destroy_signal destroy_signal, direction : Gtk::TextDirection direction, direction=(dir : Gtk::TextDirection) : Nil direction=, direction_changed_signal direction_changed_signal, display : Gdk::Display display, drag_check_threshold(start_x : Int32, start_y : Int32, current_x : Int32, current_y : Int32) : Bool drag_check_threshold, error_bell : Nil error_bell, first_child : Gtk::Widget | Nil first_child, focus_child : Gtk::Widget | Nil focus_child, focus_child=(child : Gtk::Widget | Nil) : Nil focus_child=, focus_on_click : Bool focus_on_click, focus_on_click=(focus_on_click : Bool) : Nil focus_on_click=, focus_on_click? : Bool focus_on_click?, focusable : Bool focusable, focusable=(focusable : Bool) : Nil focusable=, focusable? : Bool focusable?, font_map : Pango::FontMap | Nil font_map, font_map=(font_map : Pango::FontMap | Nil) : Nil font_map=, font_options : Cairo::FontOptions | Nil font_options, font_options=(options : Cairo::FontOptions | Nil) : Nil font_options=, frame_clock : Gdk::FrameClock | Nil frame_clock, grab_focus : Bool grab_focus, halign : Gtk::Align halign, halign=(align : Gtk::Align) : Nil halign=, has_css_class(css_class : String) : Bool has_css_class, has_default : Bool has_default, has_default? : Bool has_default?, has_focus : Bool has_focus, has_focus? : Bool has_focus?, has_tooltip : Bool has_tooltip, has_tooltip=(has_tooltip : Bool) : Nil has_tooltip=, has_tooltip? : Bool has_tooltip?, has_visible_focus : Bool has_visible_focus, hash(hasher) hash, height : Int32 height, height_request : Int32 height_request, height_request=(value : Int32) : Int32 height_request=, hexpand : Bool hexpand, hexpand=(expand : Bool) : Nil hexpand=, hexpand? : Bool hexpand?, hexpand_set : Bool hexpand_set, hexpand_set=(set : Bool) : Nil hexpand_set=, hexpand_set? : Bool hexpand_set?, hide : Nil hide, hide_signal hide_signal, in_destruction : Bool in_destruction, init_template : Nil init_template, insert_action_group(name : String, group : Gio::ActionGroup | Nil) : Nil insert_action_group, insert_after(parent : Gtk::Widget, previous_sibling : Gtk::Widget | Nil) : Nil insert_after, insert_before(parent : Gtk::Widget, next_sibling : Gtk::Widget | Nil) : Nil insert_before, is_ancestor(ancestor : Gtk::Widget) : Bool is_ancestor, is_drawable : Bool is_drawable, is_focus : Bool is_focus, is_sensitive : Bool is_sensitive, is_visible : Bool is_visible, keynav_failed(direction : Gtk::DirectionType) : Bool keynav_failed, keynav_failed_signal keynav_failed_signal, last_child : Gtk::Widget | Nil last_child, layout_manager : Gtk::LayoutManager | Nil layout_manager, layout_manager=(layout_manager : Gtk::LayoutManager | Nil) : Nil layout_manager=, list_mnemonic_labels : GLib::List list_mnemonic_labels, map : Nil map, map_signal map_signal, mapped : Bool mapped, margin_bottom : Int32 margin_bottom, margin_bottom=(margin : Int32) : Nil margin_bottom=, margin_end : Int32 margin_end, margin_end=(margin : Int32) : Nil margin_end=, margin_start : Int32 margin_start, margin_start=(margin : Int32) : Nil margin_start=, margin_top : Int32 margin_top, margin_top=(margin : Int32) : Nil margin_top=, measure(orientation : Gtk::Orientation, for_size : Int32) : Nil measure, mnemonic_activate(group_cycling : Bool) : Bool mnemonic_activate, mnemonic_activate_signal mnemonic_activate_signal, move_focus_signal move_focus_signal, name : String name, name=(name : String) : Nil name=, native : Gtk::Native | Nil native, next_sibling : Gtk::Widget | Nil next_sibling, observe_children : Gio::ListModel observe_children, observe_controllers : Gio::ListModel observe_controllers, opacity : Float64 opacity, opacity=(opacity : Float64) : Nil opacity=, overflow : Gtk::Overflow overflow, overflow=(overflow : Gtk::Overflow) : Nil overflow=, pango_context : Pango::Context pango_context, parent : Gtk::Widget | Nil parent, parent=(parent : Gtk::Widget) : Nil parent=, pick(x : Float64, y : Float64, flags : Gtk::PickFlags) : Gtk::Widget | Nil pick, preferred_size : Gtk::Requisition preferred_size, prev_sibling : Gtk::Widget | Nil prev_sibling, primary_clipboard : Gdk::Clipboard primary_clipboard, query_tooltip_signal query_tooltip_signal, queue_allocate : Nil queue_allocate, queue_draw : Nil queue_draw, queue_resize : Nil queue_resize, realize : Nil realize, realize_signal realize_signal, realized : Bool realized, receives_default : Bool receives_default, receives_default=(receives_default : Bool) : Nil receives_default=, receives_default? : Bool receives_default?, remove_controller(controller : Gtk::EventController) : Nil remove_controller, remove_css_class(css_class : String) : Nil remove_css_class, remove_mnemonic_label(label : Gtk::Widget) : Nil remove_mnemonic_label, remove_tick_callback(id : UInt32) : Nil remove_tick_callback, request_mode : Gtk::SizeRequestMode request_mode, root : Gtk::Root | Nil root, scale_factor : Int32 scale_factor, sensitive : Bool sensitive, sensitive=(sensitive : Bool) : Nil sensitive=, sensitive? : Bool sensitive?, set_size_request(width : Int32, height : Int32) : Nil set_size_request, set_state_flags(flags : Gtk::StateFlags, clear : Bool) : Nil set_state_flags, settings : Gtk::Settings settings, should_layout : Bool should_layout, show : Nil show, show_signal show_signal, size(orientation : Gtk::Orientation) : Int32 size, size_allocate(allocation : Gdk::Rectangle, baseline : Int32) : Nil size_allocate, size_request : Nil size_request, snapshot_child(child : Gtk::Widget, snapshot : Gtk::Snapshot) : Nil snapshot_child, state_flags : Gtk::StateFlags state_flags, state_flags_changed_signal state_flags_changed_signal, style_context : Gtk::StyleContext style_context, template_child(widget_type : UInt64, name : String) : GObject::Object
template_child(name : String) : GObject::Object
template_child
, tooltip_markup : String | Nil tooltip_markup, tooltip_markup=(value : String) : String
tooltip_markup=(markup : String | Nil) : Nil
tooltip_markup=
, tooltip_text : String | Nil tooltip_text, tooltip_text=(value : String) : String
tooltip_text=(text : String | Nil) : Nil
tooltip_text=
, translate_coordinates(dest_widget : Gtk::Widget, src_x : Float64, src_y : Float64) : Bool translate_coordinates, trigger_tooltip_query : Nil trigger_tooltip_query, unmap : Nil unmap, unmap_signal unmap_signal, unparent : Nil unparent, unrealize : Nil unrealize, unrealize_signal unrealize_signal, unset_state_flags(flags : Gtk::StateFlags) : Nil unset_state_flags, valign : Gtk::Align valign, valign=(align : Gtk::Align) : Nil valign=, vexpand : Bool vexpand, vexpand=(expand : Bool) : Nil vexpand=, vexpand? : Bool vexpand?, vexpand_set : Bool vexpand_set, vexpand_set=(set : Bool) : Nil vexpand_set=, vexpand_set? : Bool vexpand_set?, visible : Bool visible, visible=(visible : Bool) : Nil visible=, visible? : Bool visible?, width : Int32 width, width_request : Int32 width_request, width_request=(value : Int32) : Int32 width_request=

Constructor methods inherited from class Gtk::Widget

new
new(*, accessible_role : Gtk::AccessibleRole | Nil = nil, can_focus : Bool | Nil = nil, can_target : Bool | Nil = nil, css_classes : Enumerable(String) | Nil = nil, css_name : String | Nil = nil, cursor : Gdk::Cursor | Nil = nil, focus_on_click : Bool | Nil = nil, focusable : Bool | Nil = nil, halign : Gtk::Align | Nil = nil, has_default : Bool | Nil = nil, has_focus : Bool | Nil = nil, has_tooltip : Bool | Nil = nil, height_request : Int32 | Nil = nil, hexpand : Bool | Nil = nil, hexpand_set : Bool | Nil = nil, layout_manager : Gtk::LayoutManager | Nil = nil, margin_bottom : Int32 | Nil = nil, margin_end : Int32 | Nil = nil, margin_start : Int32 | Nil = nil, margin_top : Int32 | Nil = nil, name : String | Nil = nil, opacity : Float64 | Nil = nil, overflow : Gtk::Overflow | Nil = nil, parent : Gtk::Widget | Nil = nil, receives_default : Bool | Nil = nil, root : Gtk::Root | Nil = nil, scale_factor : Int32 | Nil = nil, sensitive : Bool | Nil = nil, tooltip_markup : String | Nil = nil, tooltip_text : String | Nil = nil, valign : Gtk::Align | Nil = nil, vexpand : Bool | Nil = nil, vexpand_set : Bool | Nil = nil, visible : Bool | Nil = nil, width_request : Int32 | Nil = nil)
new

Class methods inherited from class Gtk::Widget

default_direction : Gtk::TextDirection default_direction, default_direction=(dir : Gtk::TextDirection) : Nil default_direction=, g_type : UInt64 g_type

Instance methods inherited from module Gtk::ConstraintTarget

to_unsafe to_unsafe

Constructor methods inherited from module Gtk::ConstraintTarget

cast(obj : GObject::Object) : self cast

Class methods inherited from module Gtk::ConstraintTarget

cast?(obj : GObject::Object) : self | Nil cast?, g_type : UInt64 g_type

Instance methods inherited from module Gtk::Buildable

buildable_id : String | Nil buildable_id, to_unsafe to_unsafe

Constructor methods inherited from module Gtk::Buildable

cast(obj : GObject::Object) : self cast

Class methods inherited from module Gtk::Buildable

cast?(obj : GObject::Object) : self | Nil cast?, g_type : UInt64 g_type

Instance methods inherited from module Gtk::Accessible

accessible_role : Gtk::AccessibleRole accessible_role, accessible_role=(value : Gtk::AccessibleRole) : Gtk::AccessibleRole accessible_role=, reset_property(property : Gtk::AccessibleProperty) : Nil reset_property, reset_relation(relation : Gtk::AccessibleRelation) : Nil reset_relation, reset_state(state : Gtk::AccessibleState) : Nil reset_state, to_unsafe to_unsafe, update_property(properties : Enumerable(Gtk::AccessibleProperty), values : Enumerable(_)) : Nil update_property, update_relation(relations : Enumerable(Gtk::AccessibleRelation), values : Enumerable(_)) : Nil update_relation, update_state(states : Enumerable(Gtk::AccessibleState), values : Enumerable(_)) : Nil update_state

Constructor methods inherited from module Gtk::Accessible

cast(obj : GObject::Object) : self cast

Class methods inherited from module Gtk::Accessible

cast?(obj : GObject::Object) : self | Nil cast?, g_type : UInt64 g_type

Instance methods inherited from class GObject::InitiallyUnowned

==(other : self) ==, hash(hasher) hash

Constructor methods inherited from class GObject::InitiallyUnowned

new new

Class methods inherited from class GObject::InitiallyUnowned

g_type : UInt64 g_type

Instance methods inherited from class GObject::Object

==(other : self) ==, bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding bind_property, bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding bind_property_full, data(key : String) : Pointer(Void) | Nil data, finalize finalize, freeze_notify : Nil freeze_notify, getv(names : Enumerable(String), values : Enumerable(_)) : Nil getv, hash(hasher) hash, notify(property_name : String) : Nil notify, notify_by_pspec(pspec : GObject::ParamSpec) : Nil notify_by_pspec, notify_signal notify_signal, property(property_name : String, value : _) : Nil property, qdata(quark : UInt32) : Pointer(Void) | Nil qdata, ref_count : UInt32 ref_count, run_dispose : Nil run_dispose, set_data(key : String, data : Pointer(Void) | Nil) : Nil set_data, set_property(property_name : String, value : _) : Nil set_property, steal_data(key : String) : Pointer(Void) | Nil steal_data, steal_qdata(quark : UInt32) : Pointer(Void) | Nil steal_qdata, thaw_notify : Nil thaw_notify, to_unsafe : Pointer(Void) to_unsafe, watch_closure(closure : GObject::Closure) : Nil watch_closure

Constructor methods inherited from class GObject::Object

cast(obj : GObject::Object) : self cast, new(pointer : Pointer(Void), transfer : GICrystal::Transfer)
new
new
, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv

Class methods inherited from class GObject::Object

cast?(obj : GObject::Object) : self | Nil cast?, compat_control(what : UInt64, data : Pointer(Void) | Nil) : UInt64 compat_control, g_type : UInt64 g_type, interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec interface_find_property, interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec) interface_list_properties

Constructor Detail

def self.new : self #

Creates a new Gtk::Text.


[View source]
def self.new(*, accessible_role : Gtk::AccessibleRole | Nil = nil, activates_default : Bool | Nil = nil, attributes : Pango::AttrList | Nil = nil, buffer : Gtk::EntryBuffer | Nil = nil, can_focus : Bool | Nil = nil, can_target : Bool | Nil = nil, css_classes : Enumerable(String) | Nil = nil, css_name : String | Nil = nil, cursor : Gdk::Cursor | Nil = nil, cursor_position : Int32 | Nil = nil, editable : Bool | Nil = nil, enable_emoji_completion : Bool | Nil = nil, enable_undo : Bool | Nil = nil, extra_menu : Gio::MenuModel | Nil = nil, focus_on_click : Bool | Nil = nil, focusable : Bool | Nil = nil, halign : Gtk::Align | Nil = nil, has_default : Bool | Nil = nil, has_focus : Bool | Nil = nil, has_tooltip : Bool | Nil = nil, height_request : Int32 | Nil = nil, hexpand : Bool | Nil = nil, hexpand_set : Bool | Nil = nil, im_module : String | Nil = nil, input_hints : Gtk::InputHints | Nil = nil, input_purpose : Gtk::InputPurpose | Nil = nil, invisible_char : UInt32 | Nil = nil, invisible_char_set : Bool | Nil = nil, layout_manager : Gtk::LayoutManager | Nil = nil, margin_bottom : Int32 | Nil = nil, margin_end : Int32 | Nil = nil, margin_start : Int32 | Nil = nil, margin_top : Int32 | Nil = nil, max_length : Int32 | Nil = nil, max_width_chars : Int32 | Nil = nil, name : String | Nil = nil, opacity : Float64 | Nil = nil, overflow : Gtk::Overflow | Nil = nil, overwrite_mode : Bool | Nil = nil, parent : Gtk::Widget | Nil = nil, placeholder_text : String | Nil = nil, propagate_text_width : Bool | Nil = nil, receives_default : Bool | Nil = nil, root : Gtk::Root | Nil = nil, scale_factor : Int32 | Nil = nil, scroll_offset : Int32 | Nil = nil, selection_bound : Int32 | Nil = nil, sensitive : Bool | Nil = nil, tabs : Pango::TabArray | Nil = nil, text : String | Nil = nil, tooltip_markup : String | Nil = nil, tooltip_text : String | Nil = nil, truncate_multiline : Bool | Nil = nil, valign : Gtk::Align | Nil = nil, vexpand : Bool | Nil = nil, vexpand_set : Bool | Nil = nil, visibility : Bool | Nil = nil, visible : Bool | Nil = nil, width_chars : Int32 | Nil = nil, width_request : Int32 | Nil = nil, xalign : Float32 | Nil = nil) #

[View source]
def self.new_with_buffer(buffer : Gtk::EntryBuffer) : self #

Creates a new Gtk::Text with the specified text buffer.


[View source]

Class Method Detail

def self.g_type : UInt64 #

Returns the type id (GType) registered in GLib type system.


[View source]

Instance Method Detail

def ==(other : self) #
Description copied from class Reference

Returns true if this reference is the same as other. Invokes same?.


def activate_signal #

[View source]
def activates_default : Bool #

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

See Gtk::Text#activates_default=.


[View source]
def activates_default=(activates : Bool) : Nil #

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

This usually means that the dialog containing the Gtk::Text will be closed, since the default widget is usually one of the dialog buttons.


[View source]
def activates_default? : Bool #

[View source]
def attributes : Pango::AttrList | Nil #

Gets the attribute list that was set on the Gtk::Text.

See Gtk::Text#attributes=.


[View source]
def attributes=(attrs : Pango::AttrList | Nil) : Nil #

Sets attributes that are applied to the text.


[View source]
def backspace_signal #

[View source]
def buffer : Gtk::EntryBuffer #

Get the Gtk::EntryBuffer object which holds the text for this widget.


[View source]
def buffer=(buffer : Gtk::EntryBuffer) : Nil #

Set the Gtk::EntryBuffer object which holds the text for this widget.


[View source]
def buffer=(value : Gtk::EntryBuffer | Nil) : Gtk::EntryBuffer | Nil #

[View source]
def compute_cursor_extents(position : UInt64) : Graphene::Rect #

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.


[View source]
def copy_clipboard_signal #

[View source]
def cut_clipboard_signal #

[View source]
def delete_from_cursor_signal #

[View source]
def enable_emoji_completion : Bool #

Returns whether Emoji completion is enabled for this Gtk::Text widget.


[View source]
def enable_emoji_completion=(enable_emoji_completion : Bool) : Nil #

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.


[View source]
def enable_emoji_completion? : Bool #

[View source]
def extra_menu : Gio::MenuModel | Nil #

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

See Gtk::Text#extra_menu=.


[View source]
def extra_menu=(model : Gio::MenuModel | Nil) : Nil #

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


[View source]
def grab_focus_without_selecting : Bool #

Causes self to have keyboard focus.

It behaves like 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.


[View source]
def hash(hasher) #
Description copied from class Reference

See Object#hash(hasher)


def im_module : String #

[View source]
def im_module=(value : String) : String #

[View source]
def input_hints : Gtk::InputHints #

Gets the input hints of the Gtk::Text.


[View source]
def input_hints=(hints : Gtk::InputHints) : Nil #

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


[View source]
def input_purpose : Gtk::InputPurpose #

Gets the input purpose of the Gtk::Text.


[View source]
def input_purpose=(purpose : Gtk::InputPurpose) : Nil #

Sets the input purpose of the Gtk::Text.

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


[View source]
def insert_at_cursor_signal #

[View source]
def insert_emoji_signal #

[View source]
def invisible_char : Char #

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 Gtk::Text#invisible_char=.


[View source]
def invisible_char=(value : UInt32) : UInt32 #

[View source]
def invisible_char=(ch : Char) : Nil #

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.


[View source]
def invisible_char_set=(value : Bool) : Bool #

[View source]
def invisible_char_set? : Bool #

[View source]
def max_length : Int32 #

Retrieves the maximum allowed length of the text in self.

See Gtk::Text#max_length=.

This is equivalent to getting self's Gtk::EntryBuffer and calling Gtk::EntryBuffer#max_length on it.


[View source]
def max_length=(length : Int32) : Nil #

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 Gtk::EntryBuffer and calling Gtk::EntryBuffer#max_length= on it.


[View source]
def move_cursor_signal #

[View source]
def overwrite_mode : Bool #

Gets whether text is overwritten when typing in the Gtk::Text.

See Gtk::Text#overwrite_mode=.


[View source]
def overwrite_mode=(overwrite : Bool) : Nil #

Sets whether the text is overwritten when typing in the Gtk::Text.


[View source]
def overwrite_mode? : Bool #

[View source]
def paste_clipboard_signal #

[View source]
def placeholder_text : String | Nil #

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

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


[View source]
def placeholder_text=(value : String) : String #

[View source]
def placeholder_text=(text : String | Nil) : Nil #

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 Gtk::Text.


[View source]
def preedit_changed_signal #

[View source]
def propagate_text_width : Bool #

Returns whether the Gtk::Text will grow and shrink with the content.


[View source]
def propagate_text_width=(propagate_text_width : Bool) : Nil #

Sets whether the Gtk::Text should grow and shrink with the content.


[View source]
def propagate_text_width? : Bool #

[View source]
def scroll_offset : Int32 #

[View source]
def tabs : Pango::TabArray | Nil #

Gets the tabstops that were set on the Gtk::Text.

See Gtk::Text#tabs=.


[View source]
def tabs=(tabs : Pango::TabArray | Nil) : Nil #

Sets tabstops that are applied to the text.


[View source]
def text_length : UInt16 #

Retrieves the current length of the text in self.

This is equivalent to getting self's Gtk::EntryBuffer and calling Gtk::EntryBuffer#length on it.


[View source]
def toggle_overwrite_signal #

[View source]
def truncate_multiline : Bool #

Returns whether the Gtk::Text will truncate multi-line text that is pasted into the widget


[View source]
def truncate_multiline=(truncate_multiline : Bool) : Nil #

Sets whether the Gtk::Text should truncate multi-line text that is pasted into the widget.


[View source]
def truncate_multiline? : Bool #

[View source]
def unset_invisible_char : Nil #

Unsets the invisible char.

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


[View source]
def visibility : Bool #

Retrieves whether the text in self is visible.


[View source]
def visibility=(visible : Bool) : Nil #

Sets whether the contents of the Gtk::Text 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 Gtk::Text#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.


[View source]
def visibility? : Bool #

[View source]