Class: Gtk::Entry

Inherits:
Widget
  • Object
show all
Defined in:
lib/gtk4/entry.rb

Overview

Class structure for GtkEntry. All virtual functions have a default implementation. Derived classes may set the virtual function pointers for the signal handlers to nil, but must keep get_text_area_size and get_frame_size non-nil; either use the default implementation, or provide a custom one.

Instance Method Summary collapse

Methods inherited from Widget

#accessible_role, #accessible_role=, #action_set_enabled, #activate, #activate_action, #activate_action_variant, #activate_default, #activate_signal, #activate_signal=, #activate_signal_from_name=, #add_binding, #add_binding_action, #add_binding_signal, #add_controller, #add_css_class, #add_mnemonic_label, #add_shortcut, #add_tick_callback, #allocate, #allocated_baseline, #allocated_height, #allocated_width, #baseline, #bind_template_callback_full, #bind_template_child, #bind_template_child_full, #can_focus, #can_focus=, #can_focus?, #can_target, #can_target=, #can_target?, #child_focus, #child_visible, #child_visible=, #children, #clipboard, #compute_bounds, #compute_expand, #compute_point, #compute_transform, #contains, #create_pango_context, #create_pango_layout, #css_classes, #css_classes=, #css_name, #css_name=, #cursor, #cursor=, #cursor_from_name=, default_direction, default_direction=, #direction, #direction=, #display, #dispose_template, #drag_check_threshold, #error_bell, #first_child, #focus_child, #focus_child=, #focus_on_click, #focus_on_click=, #focus_on_click?, #focusable, #focusable=, #focusable?, #font_map, #font_map=, #font_options, #font_options=, #frame_clock, #get_allocation, #get_ancestor, #get_color, #get_preferred_size, #get_size, #get_size_request, #get_template_child, #grab_focus, #halign, #halign=, #has_css_class, #has_default, #has_default=, #has_default?, #has_focus, #has_focus=, #has_focus?, #has_tooltip, #has_tooltip=, #has_tooltip?, #has_visible_focus, have_template?, #height, #height_request, #height_request=, #hexpand, #hexpand=, #hexpand?, #hexpand_set, #hexpand_set=, #hexpand_set?, #hide, #in_destruction, #init_template, #insert_action_group, #insert_action_group_raw, #insert_after, #insert_before, #install_action, #install_property_action, #is_ancestor, #is_drawable, #is_focus, #is_sensitive, #is_visible, #keynav_failed, #last_child, #layout_manager, #layout_manager=, #layout_manager_type, #layout_manager_type=, #list_mnemonic_labels, #map, #mapped, #margin_bottom, #margin_bottom=, #margin_end, #margin_end=, #margin_start, #margin_start=, #margin_top, #margin_top=, #measure, #mnemonic_activate, #name, #name=, #native, #next_sibling, #observe_children, #observe_controllers, #opacity, #opacity=, #overflow, #overflow=, #pango_context, #parent, #parent=, #pick, #prev_sibling, #primary_clipboard, #query_action, #queue_allocate, #queue_draw, #queue_resize, #realize, #realized, #receives_default, #receives_default=, #receives_default?, #remove_controller, #remove_css_class, #remove_mnemonic_label, #remove_tick_callback, #request_mode, #root, #root=, #scale_factor, #scale_factor=, #sensitive, #sensitive=, #sensitive?, #set_size_request, #set_size_request_raw, #set_state_flags, #set_template, #set_template_raw, #settings, #should_layout, #show, #size_allocate, #snapshot_child, #state_flags, #style_context, #style_context_raw, #template=, template_children, #template_from_resource=, #template_scope=, #tooltip_markup, #tooltip_markup=, #tooltip_text, #tooltip_text=, #translate_coordinates, #translate_coordinates_raw, #trigger_tooltip_query, #unmap, #unparent, #unrealize, #unset_state_flags, #valign, #valign=, #vexpand, #vexpand=, #vexpand?, #vexpand_set, #vexpand_set=, #vexpand_set?, #visible, #visible=, #visible?, #width, #width_request, #width_request=

Constructor Details

#initialize(buffer) ⇒ Gtk::Widget

Creates a new entry with the specified text buffer.

Parameters:

Instance Method Details

#activates_defaultBoolean

Retrieves the value set by gtk_entry_set_activates_default().

Returns:

  • (Boolean)

    true if the entry will activate the default widget

#activates_default=(activates_default) ⇒ Boolean

Whether to activate the default widget when Enter is pressed.

Parameters:

  • activates_default (Boolean)

Returns:

  • (Boolean)

    activates-default

  • (Boolean)

    activates-default

#activates_default?Boolean

Whether to activate the default widget when Enter is pressed.

Returns:

  • (Boolean)

    activates-default

#alignmentGtk::gfloat

Gets the value set by gtk_entry_set_alignment().

See also: [propertyGtk.Editable:xalign]

Returns:

  • (Gtk::gfloat)

    the alignment

#alignment=(xalign) ⇒ nil

Sets the alignment for the contents of the entry.

This controls the horizontal positioning of the contents when the displayed text is shorter than the width of the entry.

See also: [propertyGtk.Editable:xalign]

Parameters:

  • xalign (Gtk::gfloat)

    The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts

Returns:

  • (nil)

#attributesPango::AttrList

A list of Pango attributes to apply to the text of the entry.

This is mainly useful to change the size or weight of the text.

The PangoAttribute's start_index and end_index must refer to the [classGtk.EntryBuffer] text, i.e. without the preedit string.

Returns:

  • (Pango::AttrList)

    attributes

#bufferGtk::EntryBuffer

The buffer object which actually stores the text.

Returns:

#buffer=(buffer) ⇒ Gtk::EntryBuffer

The buffer object which actually stores the text.

Parameters:

Returns:

#completionGtk::EntryCompletion

The auxiliary completion object to use with the entry.

Returns:

#completion=(completion) ⇒ Gtk::EntryCompletion

The auxiliary completion object to use with the entry.

Parameters:

Returns:

#current_icon_drag_sourceInteger

Returns the index of the icon which is the source of the current DND operation, or -1.

Returns:

  • (Integer)

    index of the icon which is the source of the current DND operation, or -1.

#enable_emoji_completion=(enable_emoji_completion) ⇒ Boolean

Whether to suggest Emoji replacements for :-delimited names like :heart:.

Parameters:

  • enable_emoji_completion (Boolean)

Returns:

  • (Boolean)

    enable-emoji-completion

  • (Boolean)

    enable-emoji-completion

#enable_emoji_completion?Boolean

Whether to suggest Emoji replacements for :-delimited names like :heart:.

Returns:

  • (Boolean)

    enable-emoji-completion

#extra_menuGio::MenuModel

A menu model whose contents will be appended to the context menu.

Returns:

  • (Gio::MenuModel)

    extra-menu

#extra_menu=(extra_menu) ⇒ Gio::MenuModel

A menu model whose contents will be appended to the context menu.

Parameters:

  • extra_menu (Gio::MenuModel)

Returns:

  • (Gio::MenuModel)

    extra-menu

  • (Gio::MenuModel)

    extra-menu

#get_icon_activatable(icon_pos) ⇒ Boolean

Returns whether the icon is activatable.

Parameters:

Returns:

  • (Boolean)

    true if the icon is activatable.

#get_icon_area(icon_pos, icon_area) ⇒ nil

Gets the area where entry’s icon at icon_pos is drawn.

This function is useful when drawing something to the entry in a draw callback.

If the entry is not realized or has no icon at the given position, icon_area is filled with zeros. Otherwise, icon_area will be filled with the icon's allocation, relative to entry's allocation.

Parameters:

  • icon_pos (Gtk::EntryIconPosition)

    Icon position

  • icon_area (Gdk::Rectangle)

    Return location for the icon’s area

Returns:

  • (nil)

#get_icon_at_pos(x, y) ⇒ Integer

Finds the icon at the given position and return its index.

The position’s coordinates are relative to the entry’s top left corner. If x, y doesn’t lie inside an icon, -1 is returned. This function is intended for use in a [signalGtk.Widget::query-tooltip] signal handler.

Parameters:

  • x (Integer)

    the x coordinate of the position to find, relative to entry

  • y (Integer)

    the y coordinate of the position to find, relative to entry

Returns:

  • (Integer)

    the index of the icon at the given position, or -1

#get_icon_gicon(icon_pos) ⇒ Gio::Icon

Retrieves the GIcon used for the icon.

nil will be returned if there is no icon or if the icon was set by some other method (e.g., by GdkPaintable or icon name).

Parameters:

Returns:

  • (Gio::Icon)

    A GIcon

#get_icon_name(icon_pos) ⇒ String

Retrieves the icon name used for the icon.

nil is returned if there is no icon or if the icon was set by some other method (e.g., by GdkPaintable or gicon).

Parameters:

Returns:

  • (String)

    An icon name

#get_icon_paintable(icon_pos) ⇒ Gdk::Paintable

Retrieves the GdkPaintable used for the icon.

If no GdkPaintable was used for the icon, nil is returned.

Parameters:

Returns:

  • (Gdk::Paintable)

    A GdkPaintable if no icon is set for this position or the icon set is not a GdkPaintable.

#get_icon_sensitive(icon_pos) ⇒ Boolean

Returns whether the icon appears sensitive or insensitive.

Parameters:

Returns:

  • (Boolean)

    true if the icon is sensitive.

#get_icon_storage_type(icon_pos) ⇒ Gtk::ImageType

Gets the type of representation being used by the icon to store image data.

If the icon has no image data, the return value will be %GTK_IMAGE_EMPTY.

Parameters:

Returns:

#get_icon_tooltip_markup(icon_pos) ⇒ String

Gets the contents of the tooltip on the icon at the specified position in entry.

Parameters:

Returns:

  • (String)

    the tooltip text

#get_icon_tooltip_text(icon_pos) ⇒ String

Gets the contents of the tooltip on the icon at the specified position in entry.

Parameters:

Returns:

  • (String)

    the tooltip text

#grab_focus_without_selectingBoolean

Causes entry to have keyboard focus.

It behaves like [methodGtk.Widget.grab_focus], except that it doesn't select the contents of the entry. 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.

Returns:

  • (Boolean)

    true if focus is now inside self

#has_frameBoolean

Gets the value set by gtk_entry_set_has_frame().

Returns:

  • (Boolean)

    whether the entry has a beveled frame

#has_frame=(has_frame) ⇒ Boolean

Whether the entry should draw a frame.

Parameters:

  • has_frame (Boolean)

Returns:

  • (Boolean)

    has-frame

  • (Boolean)

    has-frame

#has_frame?Boolean

Whether the entry should draw a frame.

Returns:

  • (Boolean)

    has-frame

#im_moduleString

Which IM (input method) module should be used for this entry.

See [classGtk.IMContext].

Setting this to a non-nil value overrides the system-wide IM module setting. See the GtkSettings [propertyGtk.Settings:gtk-im-module] property.

Returns:

  • (String)

    im-module

#im_module=(im_module) ⇒ String

Which IM (input method) module should be used for this entry.

See [classGtk.IMContext].

Setting this to a non-nil value overrides the system-wide IM module setting. See the GtkSettings [propertyGtk.Settings:gtk-im-module] property.

Parameters:

  • im_module (String)

Returns:

  • (String)

    im-module

  • (String)

    im-module

#input_hintsGtk::InputHints

Additional hints that allow input methods to fine-tune their behavior.

Also see [propertyGtk.Entry:input-purpose]

Returns:

#input_hints=(input_hints) ⇒ Gtk::InputHints

Additional hints that allow input methods to fine-tune their behavior.

Also see [propertyGtk.Entry:input-purpose]

Parameters:

Returns:

#input_purposeGtk::InputPurpose

The purpose of this text field.

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

Note that setting the purpose to %GTK_INPUT_PURPOSE_PASSWORD or %GTK_INPUT_PURPOSE_PIN is independent from setting [propertyGtk.Entry:visibility].

Returns:

#input_purpose=(input_purpose) ⇒ Gtk::InputPurpose

The purpose of this text field.

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

Note that setting the purpose to %GTK_INPUT_PURPOSE_PASSWORD or %GTK_INPUT_PURPOSE_PIN is independent from setting [propertyGtk.Entry:visibility].

Parameters:

Returns:

#invisible_charInteger

The character to use when masking entry contents (“password mode”).

Returns:

  • (Integer)

    invisible-char

#invisible_char=(invisible_char) ⇒ Integer

The character to use when masking entry contents (“password mode”).

Parameters:

  • invisible_char (Integer)

Returns:

  • (Integer)

    invisible-char

  • (Integer)

    invisible-char

#invisible_char_set=(invisible_char_set) ⇒ Boolean

Whether the invisible char has been set for the GtkEntry.

Parameters:

  • invisible_char_set (Boolean)

Returns:

  • (Boolean)

    invisible-char-set

  • (Boolean)

    invisible-char-set

#invisible_char_set?Boolean

Whether the invisible char has been set for the GtkEntry.

Returns:

  • (Boolean)

    invisible-char-set

#max_lengthInteger

Maximum number of characters for this entry.

Returns:

  • (Integer)

    max-length

#max_length=(max_length) ⇒ Integer

Maximum number of characters for this entry.

Parameters:

  • max_length (Integer)

Returns:

  • (Integer)

    max-length

  • (Integer)

    max-length

#overwrite_modeBoolean

Gets whether the GtkEntry is in overwrite mode.

Returns:

  • (Boolean)

    whether the text is overwritten when typing.

#overwrite_mode=(overwrite_mode) ⇒ Boolean

If text is overwritten when typing in the GtkEntry.

Parameters:

  • overwrite_mode (Boolean)

Returns:

  • (Boolean)

    overwrite-mode

  • (Boolean)

    overwrite-mode

#overwrite_mode?Boolean

If text is overwritten when typing in the GtkEntry.

Returns:

  • (Boolean)

    overwrite-mode

#placeholder_textString

The text that will be displayed in the GtkEntry when it is empty and unfocused.

Returns:

  • (String)

    placeholder-text

#placeholder_text=(placeholder_text) ⇒ String

The text that will be displayed in the GtkEntry when it is empty and unfocused.

Parameters:

  • placeholder_text (String)

Returns:

  • (String)

    placeholder-text

  • (String)

    placeholder-text

#primary_icon_activatable=(primary_icon_activatable) ⇒ Boolean

Whether the primary icon is activatable.

GTK emits the [signalGtk.Entry::icon-press] and [signalGtk.Entry::icon-release] signals only on sensitive, activatable icons.

Sensitive, but non-activatable icons can be used for purely informational purposes.

Parameters:

  • primary_icon_activatable (Boolean)

Returns:

  • (Boolean)

    primary-icon-activatable

  • (Boolean)

    primary-icon-activatable

#primary_icon_activatable?Boolean

Whether the primary icon is activatable.

GTK emits the [signalGtk.Entry::icon-press] and [signalGtk.Entry::icon-release] signals only on sensitive, activatable icons.

Sensitive, but non-activatable icons can be used for purely informational purposes.

Returns:

  • (Boolean)

    primary-icon-activatable

#primary_icon_giconGio::Icon

The GIcon to use for the primary icon for the entry.

Returns:

  • (Gio::Icon)

    primary-icon-gicon

#primary_icon_gicon=(primary_icon_gicon) ⇒ Gio::Icon

The GIcon to use for the primary icon for the entry.

Parameters:

  • primary_icon_gicon (Gio::Icon)

Returns:

  • (Gio::Icon)

    primary-icon-gicon

  • (Gio::Icon)

    primary-icon-gicon

#primary_icon_nameString

The icon name to use for the primary icon for the entry.

Returns:

  • (String)

    primary-icon-name

#primary_icon_name=(primary_icon_name) ⇒ String

The icon name to use for the primary icon for the entry.

Parameters:

  • primary_icon_name (String)

Returns:

  • (String)

    primary-icon-name

  • (String)

    primary-icon-name

#primary_icon_paintableGdk::Paintable

A GdkPaintable to use as the primary icon for the entry.

Returns:

#primary_icon_paintable=(primary_icon_paintable) ⇒ Gdk::Paintable

A GdkPaintable to use as the primary icon for the entry.

Parameters:

Returns:

#primary_icon_sensitive=(primary_icon_sensitive) ⇒ Boolean

Whether the primary icon is sensitive.

An insensitive icon appears grayed out. GTK does not emit the [signalGtk.Entry::icon-press] and [signalGtk.Entry::icon-release] signals and does not allow DND from insensitive icons.

An icon should be set insensitive if the action that would trigger when clicked is currently not available.

Parameters:

  • primary_icon_sensitive (Boolean)

Returns:

  • (Boolean)

    primary-icon-sensitive

  • (Boolean)

    primary-icon-sensitive

#primary_icon_sensitive?Boolean

Whether the primary icon is sensitive.

An insensitive icon appears grayed out. GTK does not emit the [signalGtk.Entry::icon-press] and [signalGtk.Entry::icon-release] signals and does not allow DND from insensitive icons.

An icon should be set insensitive if the action that would trigger when clicked is currently not available.

Returns:

  • (Boolean)

    primary-icon-sensitive

#primary_icon_storage_typeGtk::ImageType

The representation which is used for the primary icon of the entry.

Returns:

#primary_icon_storage_type=(primary_icon_storage_type) ⇒ Gtk::ImageType

The representation which is used for the primary icon of the entry.

Parameters:

Returns:

#primary_icon_tooltip_markupString

The contents of the tooltip on the primary icon, with markup.

Also see [methodGtk.Entry.set_icon_tooltip_markup].

Returns:

  • (String)

    primary-icon-tooltip-markup

#primary_icon_tooltip_markup=(primary_icon_tooltip_markup) ⇒ String

The contents of the tooltip on the primary icon, with markup.

Also see [methodGtk.Entry.set_icon_tooltip_markup].

Parameters:

  • primary_icon_tooltip_markup (String)

Returns:

  • (String)

    primary-icon-tooltip-markup

  • (String)

    primary-icon-tooltip-markup

#primary_icon_tooltip_textString

The contents of the tooltip on the primary icon.

Also see [methodGtk.Entry.set_icon_tooltip_text].

Returns:

  • (String)

    primary-icon-tooltip-text

#primary_icon_tooltip_text=(primary_icon_tooltip_text) ⇒ String

The contents of the tooltip on the primary icon.

Also see [methodGtk.Entry.set_icon_tooltip_text].

Parameters:

  • primary_icon_tooltip_text (String)

Returns:

  • (String)

    primary-icon-tooltip-text

  • (String)

    primary-icon-tooltip-text

#progress_fractionFloat

The current fraction of the task that's been completed.

Returns:

  • (Float)

    progress-fraction

#progress_fraction=(progress_fraction) ⇒ Float

The current fraction of the task that's been completed.

Parameters:

  • progress_fraction (Float)

Returns:

  • (Float)

    progress-fraction

  • (Float)

    progress-fraction

#progress_pulsenil

Indicates that some progress is made, but you don’t know how much.

Causes the entry’s progress indicator to enter “activity mode”, where a block bounces back and forth. Each call to gtk_entry_progress_pulse() causes the block to move by a little bit (the amount of movement per pulse is determined by [methodGtk.Entry.set_progress_pulse_step]).

Returns:

  • (nil)

#progress_pulse_stepFloat

The fraction of total entry width to move the progress bouncing block for each pulse.

See [methodGtk.Entry.progress_pulse].

Returns:

  • (Float)

    progress-pulse-step

#progress_pulse_step=(progress_pulse_step) ⇒ Float

The fraction of total entry width to move the progress bouncing block for each pulse.

See [methodGtk.Entry.progress_pulse].

Parameters:

  • progress_pulse_step (Float)

Returns:

  • (Float)

    progress-pulse-step

  • (Float)

    progress-pulse-step

#reset_im_contextnil

Reset the input method context of the entry if needed.

This can be necessary in the case where modifying the buffer would confuse on-going input method behavior.

Returns:

  • (nil)

#scroll_offsetInteger

Number of pixels of the entry scrolled off the screen to the left.

Returns:

  • (Integer)

    scroll-offset

#scroll_offset=(scroll_offset) ⇒ Integer

Number of pixels of the entry scrolled off the screen to the left.

Parameters:

  • scroll_offset (Integer)

Returns:

  • (Integer)

    scroll-offset

  • (Integer)

    scroll-offset

#secondary_icon_activatable=(secondary_icon_activatable) ⇒ Boolean

Whether the secondary icon is activatable.

GTK emits the [signalGtk.Entry::icon-press] and [signalGtk.Entry::icon-release] signals only on sensitive, activatable icons.

Sensitive, but non-activatable icons can be used for purely informational purposes.

Parameters:

  • secondary_icon_activatable (Boolean)

Returns:

  • (Boolean)

    secondary-icon-activatable

  • (Boolean)

    secondary-icon-activatable

#secondary_icon_activatable?Boolean

Whether the secondary icon is activatable.

GTK emits the [signalGtk.Entry::icon-press] and [signalGtk.Entry::icon-release] signals only on sensitive, activatable icons.

Sensitive, but non-activatable icons can be used for purely informational purposes.

Returns:

  • (Boolean)

    secondary-icon-activatable

#secondary_icon_giconGio::Icon

The GIcon to use for the secondary icon for the entry.

Returns:

  • (Gio::Icon)

    secondary-icon-gicon

#secondary_icon_gicon=(secondary_icon_gicon) ⇒ Gio::Icon

The GIcon to use for the secondary icon for the entry.

Parameters:

  • secondary_icon_gicon (Gio::Icon)

Returns:

  • (Gio::Icon)

    secondary-icon-gicon

  • (Gio::Icon)

    secondary-icon-gicon

#secondary_icon_nameString

The icon name to use for the secondary icon for the entry.

Returns:

  • (String)

    secondary-icon-name

#secondary_icon_name=(secondary_icon_name) ⇒ String

The icon name to use for the secondary icon for the entry.

Parameters:

  • secondary_icon_name (String)

Returns:

  • (String)

    secondary-icon-name

  • (String)

    secondary-icon-name

#secondary_icon_paintableGdk::Paintable

A GdkPaintable to use as the secondary icon for the entry.

Returns:

#secondary_icon_paintable=(secondary_icon_paintable) ⇒ Gdk::Paintable

A GdkPaintable to use as the secondary icon for the entry.

Parameters:

Returns:

#secondary_icon_sensitive=(secondary_icon_sensitive) ⇒ Boolean

Whether the secondary icon is sensitive.

An insensitive icon appears grayed out. GTK does not emit the [signalGtk.Entry::icon-press[ and [signalGtk.Entry::icon-release] signals and does not allow DND from insensitive icons.

An icon should be set insensitive if the action that would trigger when clicked is currently not available.

Parameters:

  • secondary_icon_sensitive (Boolean)

Returns:

  • (Boolean)

    secondary-icon-sensitive

  • (Boolean)

    secondary-icon-sensitive

#secondary_icon_sensitive?Boolean

Whether the secondary icon is sensitive.

An insensitive icon appears grayed out. GTK does not emit the [signalGtk.Entry::icon-press[ and [signalGtk.Entry::icon-release] signals and does not allow DND from insensitive icons.

An icon should be set insensitive if the action that would trigger when clicked is currently not available.

Returns:

  • (Boolean)

    secondary-icon-sensitive

#secondary_icon_storage_typeGtk::ImageType

The representation which is used for the secondary icon of the entry.

Returns:

#secondary_icon_storage_type=(secondary_icon_storage_type) ⇒ Gtk::ImageType

The representation which is used for the secondary icon of the entry.

Parameters:

Returns:

#secondary_icon_tooltip_markupString

The contents of the tooltip on the secondary icon, with markup.

Also see [methodGtk.Entry.set_icon_tooltip_markup].

Returns:

  • (String)

    secondary-icon-tooltip-markup

#secondary_icon_tooltip_markup=(secondary_icon_tooltip_markup) ⇒ String

The contents of the tooltip on the secondary icon, with markup.

Also see [methodGtk.Entry.set_icon_tooltip_markup].

Parameters:

  • secondary_icon_tooltip_markup (String)

Returns:

  • (String)

    secondary-icon-tooltip-markup

  • (String)

    secondary-icon-tooltip-markup

#secondary_icon_tooltip_textString

The contents of the tooltip on the secondary icon.

Also see [methodGtk.Entry.set_icon_tooltip_text].

Returns:

  • (String)

    secondary-icon-tooltip-text

#secondary_icon_tooltip_text=(secondary_icon_tooltip_text) ⇒ String

The contents of the tooltip on the secondary icon.

Also see [methodGtk.Entry.set_icon_tooltip_text].

Parameters:

  • secondary_icon_tooltip_text (String)

Returns:

  • (String)

    secondary-icon-tooltip-text

  • (String)

    secondary-icon-tooltip-text

#set_attributes(attrs) ⇒ Object Also known as: attributes=



23
24
25
26
# File 'lib/gtk4/entry.rb', line 23

def set_attributes(attrs)
  attrs ||= Pango::AttrList.new
  set_attributes_raw(attrs)
end

#set_attributes_rawObject

TODO: It's workaround for a GTK+ problem: It should be removed when GTK+ fix the problem. https://github.com/ruby-gnome2/ruby-gnome2/issues/1176



22
# File 'lib/gtk4/entry.rb', line 22

alias_method :set_attributes_raw, :set_attributes

#set_icon_activatable(icon_pos, activatable) ⇒ nil

Sets whether the icon is activatable.

Parameters:

  • icon_pos (Gtk::EntryIconPosition)

    Icon position

  • activatable (Boolean)

    true if the icon should be activatable

Returns:

  • (nil)

#set_icon_drag_source(icon_pos, provider, actions) ⇒ nil

Sets up the icon at the given position as drag source.

This makes it so that GTK will start a drag operation when the user clicks and drags the icon.

Parameters:

Returns:

  • (nil)

#set_icon_from_gicon(icon_pos, icon) ⇒ nil

Sets the icon shown in the entry at the specified position from the current icon theme.

If the icon isn’t known, a “broken image” icon will be displayed instead.

If icon is nil, no icon will be shown in the specified position.

Parameters:

  • icon_pos (Gtk::EntryIconPosition)

    The position at which to set the icon

  • icon (Gio::Icon)

    The icon to set

Returns:

  • (nil)

#set_icon_from_icon_name(icon_pos, icon_name) ⇒ nil

Sets the icon shown in the entry at the specified position from the current icon theme.

If the icon name isn’t known, a “broken image” icon will be displayed instead.

If icon_name is nil, no icon will be shown in the specified position.

Parameters:

  • icon_pos (Gtk::EntryIconPosition)

    The position at which to set the icon

  • icon_name (String)

    An icon name

Returns:

  • (nil)

#set_icon_from_paintable(icon_pos, paintable) ⇒ nil

Sets the icon shown in the specified position using a GdkPaintable.

If paintable is nil, no icon will be shown in the specified position.

Parameters:

Returns:

  • (nil)

#set_icon_sensitive(icon_pos, sensitive) ⇒ nil

Sets the sensitivity for the specified icon.

Parameters:

  • icon_pos (Gtk::EntryIconPosition)

    Icon position

  • sensitive (Boolean)

    Specifies whether the icon should appear sensitive or insensitive

Returns:

  • (nil)

#set_icon_tooltip_markup(icon_pos, tooltip) ⇒ nil

Sets tooltip as the contents of the tooltip for the icon at the specified position.

tooltip is assumed to be marked up with Pango Markup.

Use nil for tooltip to remove an existing tooltip.

See also [methodGtk.Widget.set_tooltip_markup] and [methodGtk.Entry.set_icon_tooltip_text].

Parameters:

  • icon_pos (Gtk::EntryIconPosition)

    the icon position

  • tooltip (String)

    the contents of the tooltip for the icon

Returns:

  • (nil)

#set_icon_tooltip_text(icon_pos, tooltip) ⇒ nil

Sets tooltip as the contents of the tooltip for the icon at the specified position.

Use nil for tooltip to remove an existing tooltip.

See also [methodGtk.Widget.set_tooltip_text] and [methodGtk.Entry.set_icon_tooltip_markup].

If you unset the widget tooltip via [methodGtk.Widget.set_tooltip_text] or [methodGtk.Widget.set_tooltip_markup], this sets [propertyGtk.Widget:has-tooltip] to false, which suppresses icon tooltips too. You can resolve this by then calling [methodGtk.Widget.set_has_tooltip] to set [propertyGtk.Widget:has-tooltip] back to true, or setting at least one non-empty tooltip on any icon achieves the same result.

Parameters:

  • icon_pos (Gtk::EntryIconPosition)

    the icon position

  • tooltip (String)

    the contents of the tooltip for the icon

Returns:

  • (nil)

#show_emoji_icon=(show_emoji_icon) ⇒ Boolean

Parameters:

  • show_emoji_icon (Boolean)

Returns:

  • (Boolean)

    show-emoji-icon

  • (Boolean)

    show-emoji-icon

#show_emoji_icon?Boolean

Returns show-emoji-icon.

Returns:

  • (Boolean)

    show-emoji-icon

#tabsPango::TabArray

Returns tabs.

Returns:

  • (Pango::TabArray)

    tabs

#tabs=(tabs) ⇒ Pango::TabArray

Parameters:

  • tabs (Pango::TabArray)

Returns:

  • (Pango::TabArray)

    tabs

  • (Pango::TabArray)

    tabs

#text_lengthInteger

The length of the text in the GtkEntry.

Returns:

  • (Integer)

    text-length

#text_length=(text_length) ⇒ Integer

The length of the text in the GtkEntry.

Parameters:

  • text_length (Integer)

Returns:

  • (Integer)

    text-length

  • (Integer)

    text-length

#truncate_multiline=(truncate_multiline) ⇒ Boolean

When true, pasted multi-line text is truncated to the first line.

Parameters:

  • truncate_multiline (Boolean)

Returns:

  • (Boolean)

    truncate-multiline

  • (Boolean)

    truncate-multiline

#truncate_multiline?Boolean

When true, pasted multi-line text is truncated to the first line.

Returns:

  • (Boolean)

    truncate-multiline

#unset_invisible_charnil

Unsets the invisible char, so that the default invisible char is used again. See [methodGtk.Entry.set_invisible_char].

Returns:

  • (nil)

#visibilityBoolean

Retrieves whether the text in entry is visible.

See [methodGtk.Entry.set_visibility].

Returns:

  • (Boolean)

    true if the text is currently visible

#visibility=(visibility) ⇒ Boolean

Whether the entry should show the “invisible char” instead of the actual text (“password mode”).

Parameters:

  • visibility (Boolean)

Returns:

  • (Boolean)

    visibility

  • (Boolean)

    visibility

#visibility?Boolean

Whether the entry should show the “invisible char” instead of the actual text (“password mode”).

Returns:

  • (Boolean)

    visibility