Class (GI Class)

Gtk-3.0GtkSpinButton

A Gtk.SpinButton is an ideal way to allow the user to set the value of some attribute. Rather than having to directly type a number into a Gtk.Entry, GtkSpinButton allows the user to click on one of two arrows to increment or decrement the displayed value. A value can still be typed in, with the bonus that it can be checked to ensure it is in a given range.

The main properties of a GtkSpinButton are through an adjustment. See the Gtk.Adjustment section for more details about an adjustment's properties. Note that GtkSpinButton will by default make its entry large enough to accomodate the lower and upper bounds of the adjustment, which can lead to surprising results. Best practice is to set both the Gtk.Entry.width_chars and Gtk.Entry.max_width_chars poperties to the desired number of characters to display in the entry.

CSS nodes

spinbutton.horizontal
├── undershoot.left
├── undershoot.right
├── entry
│ ╰── ...
├── button.down
╰── button.up
spinbutton.vertical
├── undershoot.left
├── undershoot.right
├── button.up
├── entry
│ ╰── ...
╰── button.down

GtkSpinButtons main CSS node has the name spinbutton. It creates subnodes for the entry and the two buttons, with these names. The button nodes have the style classes .up and .down. The GtkEntry subnodes (if present) are put below the entry node. The orientation of the spin button is reflected in the .vertical or .horizontal style class on the main node.

// Provides a function to retrieve an integer value from a GtkSpinButton
// and creates a spin button to model percentage values.

gint
grab_int_value (GtkSpinButton *button,
gpointer user_data)
{
return gtk_spin_button_get_value_as_int (button);
}

void
create_integer_spin_button (void)
{

GtkWidget *window, *button;
GtkAdjustment *adjustment;

adjustment = gtk_adjustment_new (50.0, 0.0, 100.0, 1.0, 5.0, 0.0);

window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (window), 5);

// creates the spinbutton, with no decimal places
button = gtk_spin_button_new (adjustment, 1.0, 0);
gtk_container_add (GTK_CONTAINER (window), button);

gtk_widget_show_all (window);
}
// Provides a function to retrieve a floating point value from a
// GtkSpinButton, and creates a high precision spin button.

gfloat
grab_float_value (GtkSpinButton *button,
gpointer user_data)
{
return gtk_spin_button_get_value (button);
}

void
create_floating_spin_button (void)
{
GtkWidget *window, *button;
GtkAdjustment *adjustment;

adjustment = gtk_adjustment_new (2.500, 0.0, 5.0, 0.001, 0.1, 0.0);

window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (window), 5);

// creates the spinbutton, with three decimal places
button = gtk_spin_button_new (adjustment, 0.001, 3);
gtk_container_add (GTK_CONTAINER (window), button);

gtk_widget_show_all (window);
}

Hierarchy (View Summary)

Implements

Index

Constructors

Properties

Accessors

Accessors - Inherited from Gtk.CellEditable

Accessors - Inherited from Gtk.Orientable

Accessors - Inherited from Gtk.Widget

Accessors - Inherited from Gtk.Entry

activates_default activatesDefault attributes buffer caps_lock_warning capsLockWarning completion cursor_position cursorPosition editable enable_emoji_completion enableEmojiCompletion has_frame hasFrame im_module imModule inner_border innerBorder input_hints input_purpose inputHints inputPurpose invisible_char invisible_char_set invisibleChar invisibleCharSet max_length max_width_chars maxLength maxWidthChars overwrite_mode overwriteMode placeholder_text placeholderText populate_all populateAll primary_icon_activatable primary_icon_gicon primary_icon_name primary_icon_pixbuf primary_icon_sensitive primary_icon_stock primary_icon_storage_type primary_icon_tooltip_markup primary_icon_tooltip_text primaryIconActivatable primaryIconGicon primaryIconName primaryIconPixbuf primaryIconSensitive primaryIconStock primaryIconStorageType primaryIconTooltipMarkup primaryIconTooltipText progress_fraction progress_pulse_step progressFraction progressPulseStep scroll_offset scrollOffset secondary_icon_activatable secondary_icon_gicon secondary_icon_name secondary_icon_pixbuf secondary_icon_sensitive secondary_icon_stock secondary_icon_storage_type secondary_icon_tooltip_markup secondary_icon_tooltip_text secondaryIconActivatable secondaryIconGicon secondaryIconName secondaryIconPixbuf secondaryIconSensitive secondaryIconStock secondaryIconStorageType secondaryIconTooltipMarkup secondaryIconTooltipText selection_bound selectionBound shadow_type shadowType show_emoji_icon showEmojiIcon tabs text text_length textLength truncate_multiline truncateMultiline visibility width_chars widthChars xalign

Methods

_init activate add_accelerator add_device_events add_events add_mnemonic_label add_tick_callback bind_property bind_property_full block_signal_handler can_activate_accel child_focus child_notify class_path compute_expand configure connect connect_after copy_clipboard create_pango_context create_pango_layout cut_clipboard delete_selection delete_text destroy destroyed device_is_shadowed disconnect drag_begin drag_begin_with_coordinates drag_check_threshold drag_dest_add_image_targets drag_dest_add_text_targets drag_dest_add_uri_targets drag_dest_find_target drag_dest_get_target_list drag_dest_get_track_motion drag_dest_set drag_dest_set_proxy drag_dest_set_target_list drag_dest_set_track_motion drag_dest_unset drag_get_data drag_highlight drag_source_add_image_targets drag_source_add_text_targets drag_source_add_uri_targets drag_source_get_target_list drag_source_set drag_source_set_icon_gicon drag_source_set_icon_name drag_source_set_icon_pixbuf drag_source_set_icon_stock drag_source_set_target_list drag_source_unset drag_unhighlight draw editing_done emit ensure_style error_bell event force_floating freeze_child_notify freeze_notify get_accessible get_action_group get_adjustment get_allocated_baseline get_allocated_height get_allocated_size get_allocated_width get_allocation get_ancestor get_app_paintable get_can_default get_can_focus get_chars get_child_requisition get_child_visible get_clip get_clipboard get_composite_name get_data get_device_enabled get_device_events get_digits get_direction get_display get_double_buffered get_editable get_events get_focus_on_click get_font_map get_font_options get_frame_clock get_halign get_has_tooltip get_has_window get_hexpand get_hexpand_set get_increments get_mapped get_margin_bottom get_margin_end get_margin_left get_margin_right get_margin_start get_margin_top get_modifier_mask get_modifier_style get_name get_no_show_all get_numeric get_opacity get_orientation get_pango_context get_parent get_parent_window get_path get_pointer get_position get_preferred_height get_preferred_height_and_baseline_for_width get_preferred_height_for_width get_preferred_size get_preferred_width get_preferred_width_for_height get_property get_qdata get_range get_realized get_receives_default get_request_mode get_requisition get_root_window get_scale_factor get_screen get_selection_bounds get_sensitive get_settings get_size_request get_snap_to_ticks get_state get_state_flags get_style get_style_context get_support_multidevice get_template_child get_tooltip_markup get_tooltip_text get_tooltip_window get_toplevel get_update_policy get_valign get_valign_with_baseline get_value get_value_as_int get_vexpand get_vexpand_set get_visible get_visual get_window get_wrap getv grab_add grab_default grab_focus grab_remove has_grab has_rc_style has_screen has_visible_focus hide hide_on_delete in_destruction init_template input_shape_combine_region insert_action_group insert_text intersect is_ancestor is_composited is_drawable is_floating is_sensitive is_toplevel is_visible keynav_failed list_accel_closures list_action_prefixes list_mnemonic_labels map mnemonic_activate modify_base modify_bg modify_cursor modify_fg modify_font modify_style modify_text notify notify_by_pspec override_background_color override_color override_cursor override_font override_symbolic_color paste_clipboard path queue_allocate queue_compute_expand queue_draw queue_draw_area queue_draw_region queue_resize queue_resize_no_redraw realize ref ref_sink region_intersect register_window remove_accelerator remove_mnemonic_label remove_tick_callback remove_widget render_icon render_icon_pixbuf reparent reset_rc_styles reset_style run_dispose select_region send_expose send_focus_change set set_accel_path set_adjustment set_allocation set_app_paintable set_can_default set_can_focus set_child_visible set_clip set_composite_name set_data set_device_enabled set_device_events set_digits set_direction set_double_buffered set_editable set_events set_focus_on_click set_font_map set_font_options set_halign set_has_tooltip set_has_window set_hexpand set_hexpand_set set_increments set_mapped set_margin_bottom set_margin_end set_margin_left set_margin_right set_margin_start set_margin_top set_name set_no_show_all set_numeric set_opacity set_orientation set_parent set_parent_window set_position set_property set_range set_realized set_receives_default set_redraw_on_allocate set_sensitive set_size_request set_snap_to_ticks set_state set_state_flags set_style set_support_multidevice set_tooltip_markup set_tooltip_text set_tooltip_window set_update_policy set_valign set_value set_vexpand set_vexpand_set set_visible set_visual set_window set_wrap shape_combine_region show show_all show_now size_allocate size_allocate_with_baseline size_request spin start_editing steal_data steal_qdata stop_emission_by_name style_attach style_get_property thaw_child_notify thaw_notify translate_coordinates trigger_tooltip_query unblock_signal_handler unmap unparent unrealize unref unregister_window unset_state_flags update vfunc_adjust_baseline_allocation vfunc_adjust_baseline_request vfunc_adjust_size_allocation vfunc_adjust_size_request vfunc_button_press_event vfunc_button_release_event vfunc_can_activate_accel vfunc_change_value vfunc_changed vfunc_child_notify vfunc_composited_changed vfunc_compute_expand vfunc_configure_event vfunc_constructed vfunc_damage_event vfunc_delete_event vfunc_delete_text vfunc_destroy vfunc_destroy_event vfunc_direction_changed vfunc_dispatch_child_properties_changed vfunc_dispatch_properties_changed vfunc_dispose vfunc_do_delete_text vfunc_do_insert_text vfunc_drag_begin vfunc_drag_data_delete vfunc_drag_data_get vfunc_drag_data_received vfunc_drag_drop vfunc_drag_end vfunc_drag_failed vfunc_drag_leave vfunc_drag_motion vfunc_draw vfunc_editing_done vfunc_enter_notify_event vfunc_event vfunc_finalize vfunc_focus vfunc_focus_in_event vfunc_focus_out_event vfunc_get_accessible vfunc_get_chars vfunc_get_position vfunc_get_preferred_height vfunc_get_preferred_height_and_baseline_for_width vfunc_get_preferred_height_for_width vfunc_get_preferred_width vfunc_get_preferred_width_for_height vfunc_get_property vfunc_get_request_mode vfunc_get_selection_bounds vfunc_grab_broken_event vfunc_grab_focus vfunc_grab_notify vfunc_hide vfunc_hierarchy_changed vfunc_input vfunc_insert_text vfunc_key_press_event vfunc_key_release_event vfunc_keynav_failed vfunc_leave_notify_event vfunc_map vfunc_map_event vfunc_mnemonic_activate vfunc_motion_notify_event vfunc_move_focus vfunc_notify vfunc_output vfunc_parent_set vfunc_popup_menu vfunc_property_notify_event vfunc_proximity_in_event vfunc_proximity_out_event vfunc_query_tooltip vfunc_queue_draw_region vfunc_realize vfunc_remove_widget vfunc_screen_changed vfunc_scroll_event vfunc_selection_clear_event vfunc_selection_get vfunc_selection_notify_event vfunc_selection_received vfunc_selection_request_event vfunc_set_position vfunc_set_property vfunc_set_selection_bounds vfunc_show vfunc_show_all vfunc_show_help vfunc_size_allocate vfunc_start_editing vfunc_state_changed vfunc_state_flags_changed vfunc_style_set vfunc_style_updated vfunc_touch_event vfunc_unmap vfunc_unmap_event vfunc_unrealize vfunc_value_changed vfunc_visibility_notify_event vfunc_window_state_event vfunc_wrapped watch_closure new new_with_range

Methods - Inherited from Gtk.Entry

add_child construct_child custom_finished custom_tag_end custom_tag_start get_activates_default get_alignment get_attributes get_buffer get_completion get_current_icon_drag_source get_cursor_hadjustment get_has_frame get_icon_activatable get_icon_area get_icon_at_pos get_icon_gicon get_icon_name get_icon_pixbuf get_icon_sensitive get_icon_stock get_icon_storage_type get_icon_tooltip_markup get_icon_tooltip_text get_inner_border get_input_hints get_input_purpose get_internal_child get_invisible_char get_layout get_layout_offsets get_max_length get_max_width_chars get_overwrite_mode get_placeholder_text get_progress_fraction get_progress_pulse_step get_tabs get_text get_text_area get_text_length get_visibility get_width_chars grab_focus_without_selecting im_context_filter_keypress layout_index_to_text_index parser_finished progress_pulse reset_im_context set_activates_default set_alignment set_attributes set_buffer set_buildable_property set_completion set_cursor_hadjustment set_has_frame set_icon_activatable set_icon_drag_source set_icon_from_gicon set_icon_from_icon_name set_icon_from_pixbuf set_icon_from_stock set_icon_sensitive set_icon_tooltip_markup set_icon_tooltip_text set_inner_border set_input_hints set_input_purpose set_invisible_char set_max_length set_max_width_chars set_overwrite_mode set_placeholder_text set_progress_fraction set_progress_pulse_step set_tabs set_text set_visibility set_width_chars text_index_to_layout_index unset_invisible_char vfunc_activate vfunc_add_child vfunc_backspace vfunc_construct_child vfunc_copy_clipboard vfunc_custom_finished vfunc_custom_tag_end vfunc_custom_tag_start vfunc_cut_clipboard vfunc_delete_from_cursor vfunc_get_frame_size vfunc_get_internal_child vfunc_get_name vfunc_get_text_area_size vfunc_insert_at_cursor vfunc_insert_emoji vfunc_move_cursor vfunc_parser_finished vfunc_paste_clipboard vfunc_populate_popup vfunc_set_buildable_property vfunc_set_name vfunc_toggle_direction vfunc_toggle_overwrite _classInit bind_template_callback_full bind_template_child_full compat_control find_property find_style_property get_css_name get_default_direction get_default_style install_properties install_property install_style_property interface_find_property interface_install_property interface_list_properties list_properties list_style_properties new_with_buffer newv override_property pop_composite_child push_composite_child set_accessible_role set_accessible_type set_connect_func set_css_name set_default_direction set_template set_template_from_resource

Constructors

Properties

Compile-time signal type information.

This instance property is generated only for TypeScript type checking. It is not defined at runtime and should not be accessed in JS code.

entry

entry: Gtk.Entry

Accessors

Accessors - Inherited from Gtk.CellEditable

  • get editing_canceled(): boolean

    Indicates whether editing on the cell has been canceled.

    Returns boolean

    2.20

  • set editing_canceled(val: boolean): void

    Indicates whether editing on the cell has been canceled.

    Parameters

    • val: boolean

    Returns void

    2.20

  • get editingCanceled(): boolean

    Indicates whether editing on the cell has been canceled.

    Returns boolean

    2.20

  • set editingCanceled(val: boolean): void

    Indicates whether editing on the cell has been canceled.

    Parameters

    • val: boolean

    Returns void

    2.20

Accessors - Inherited from Gtk.Orientable

Accessors - Inherited from Gtk.Widget

  • get app_paintable(): boolean

    Returns boolean

  • set app_paintable(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get appPaintable(): boolean

    Returns boolean

  • set appPaintable(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get can_default(): boolean

    Returns boolean

  • set can_default(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get can_focus(): boolean

    Returns boolean

  • set can_focus(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get canDefault(): boolean

    Returns boolean

  • set canDefault(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get canFocus(): boolean

    Returns boolean

  • set canFocus(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get composite_child(): boolean

    Returns boolean

  • get compositeChild(): boolean

    Returns boolean

  • get double_buffered(): boolean

    Whether the widget is double buffered.

    Returns boolean

    2.18

    since 3.14: Widgets should not use this property.

  • set double_buffered(val: boolean): void

    Whether the widget is double buffered.

    Parameters

    • Deprecatedval: boolean

    Returns void

    2.18

    since 3.14: Widgets should not use this property.

  • get doubleBuffered(): boolean

    Whether the widget is double buffered.

    Returns boolean

    2.18

    since 3.14: Widgets should not use this property.

  • set doubleBuffered(val: boolean): void

    Whether the widget is double buffered.

    Parameters

    • Deprecatedval: boolean

    Returns void

    2.18

    since 3.14: Widgets should not use this property.

  • get focus_on_click(): boolean

    Whether the widget should grab focus when it is clicked with the mouse.

    This property is only relevant for widgets that can take focus.

    Before 3.20, several widgets (GtkButton, GtkFileChooserButton, GtkComboBox) implemented this property individually.

    Returns boolean

    3.20

  • set focus_on_click(val: boolean): void

    Whether the widget should grab focus when it is clicked with the mouse.

    This property is only relevant for widgets that can take focus.

    Before 3.20, several widgets (GtkButton, GtkFileChooserButton, GtkComboBox) implemented this property individually.

    Parameters

    • val: boolean

    Returns void

    3.20

  • get focusOnClick(): boolean

    Whether the widget should grab focus when it is clicked with the mouse.

    This property is only relevant for widgets that can take focus.

    Before 3.20, several widgets (GtkButton, GtkFileChooserButton, GtkComboBox) implemented this property individually.

    Returns boolean

    3.20

  • set focusOnClick(val: boolean): void

    Whether the widget should grab focus when it is clicked with the mouse.

    This property is only relevant for widgets that can take focus.

    Before 3.20, several widgets (GtkButton, GtkFileChooserButton, GtkComboBox) implemented this property individually.

    Parameters

    • val: boolean

    Returns void

    3.20

  • get has_default(): boolean

    Returns boolean

  • set has_default(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get has_focus(): boolean

    Returns boolean

  • set has_focus(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get has_tooltip(): boolean

    Enables or disables the emission of Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip on widget. A value of true indicates that widget can have a tooltip, in this case the widget will be queried using Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip to determine whether it will provide a tooltip or not.

    Note that setting this property to true for the first time will change the event masks of the GdkWindows of this widget to include leave-notify and motion-notify events. This cannot and will not be undone when the property is set to false again.

    Returns boolean

    2.12

  • set has_tooltip(val: boolean): void

    Enables or disables the emission of Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip on widget. A value of true indicates that widget can have a tooltip, in this case the widget will be queried using Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip to determine whether it will provide a tooltip or not.

    Note that setting this property to true for the first time will change the event masks of the GdkWindows of this widget to include leave-notify and motion-notify events. This cannot and will not be undone when the property is set to false again.

    Parameters

    • val: boolean

    Returns void

    2.12

  • get hasDefault(): boolean

    Returns boolean

  • set hasDefault(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get hasFocus(): boolean

    Returns boolean

  • set hasFocus(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get hasTooltip(): boolean

    Enables or disables the emission of Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip on widget. A value of true indicates that widget can have a tooltip, in this case the widget will be queried using Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip to determine whether it will provide a tooltip or not.

    Note that setting this property to true for the first time will change the event masks of the GdkWindows of this widget to include leave-notify and motion-notify events. This cannot and will not be undone when the property is set to false again.

    Returns boolean

    2.12

  • set hasTooltip(val: boolean): void

    Enables or disables the emission of Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip on widget. A value of true indicates that widget can have a tooltip, in this case the widget will be queried using Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip to determine whether it will provide a tooltip or not.

    Note that setting this property to true for the first time will change the event masks of the GdkWindows of this widget to include leave-notify and motion-notify events. This cannot and will not be undone when the property is set to false again.

    Parameters

    • val: boolean

    Returns void

    2.12

  • get height_request(): number

    Returns number

  • set height_request(val: number): void

    Parameters

    • val: number

    Returns void

  • get heightRequest(): number

    Returns number

  • set heightRequest(val: number): void

    Parameters

    • val: number

    Returns void

  • get hexpand(): boolean

    Whether to expand horizontally. See gtk_widget_set_hexpand().

    Returns boolean

    3.0

  • set hexpand(val: boolean): void

    Whether to expand horizontally. See gtk_widget_set_hexpand().

    Parameters

    • val: boolean

    Returns void

    3.0

  • get hexpand_set(): boolean

    Whether to use the Gtk.Widget.hexpand property. See gtk_widget_get_hexpand_set().

    Returns boolean

    3.0

  • set hexpand_set(val: boolean): void

    Whether to use the Gtk.Widget.hexpand property. See gtk_widget_get_hexpand_set().

    Parameters

    • val: boolean

    Returns void

    3.0

  • get hexpandSet(): boolean

    Whether to use the Gtk.Widget.hexpand property. See gtk_widget_get_hexpand_set().

    Returns boolean

    3.0

  • set hexpandSet(val: boolean): void

    Whether to use the Gtk.Widget.hexpand property. See gtk_widget_get_hexpand_set().

    Parameters

    • val: boolean

    Returns void

    3.0

  • get is_focus(): boolean

    Returns boolean

  • set is_focus(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get isFocus(): boolean

    Returns boolean

  • set isFocus(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get margin(): number

    Sets all four sides' margin at once. If read, returns max margin on any side.

    Returns number

    3.0

  • set margin(val: number): void

    Sets all four sides' margin at once. If read, returns max margin on any side.

    Parameters

    • val: number

    Returns void

    3.0

  • get margin_bottom(): number

    Margin on bottom side of widget.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Returns number

    3.0

  • set margin_bottom(val: number): void

    Margin on bottom side of widget.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Parameters

    • val: number

    Returns void

    3.0

  • get margin_end(): number

    Margin on end of widget, horizontally. This property supports left-to-right and right-to-left text directions.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Returns number

    3.12

  • set margin_end(val: number): void

    Margin on end of widget, horizontally. This property supports left-to-right and right-to-left text directions.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Parameters

    • val: number

    Returns void

    3.12

  • get margin_left(): number

    Margin on left side of widget.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Returns number

    3.0

    since 3.12: Use Gtk.Widget.margin_start instead.

  • set margin_left(val: number): void

    Margin on left side of widget.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Parameters

    • Deprecatedval: number

    Returns void

    3.0

    since 3.12: Use Gtk.Widget.margin_start instead.

  • get margin_right(): number

    Margin on right side of widget.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Returns number

    3.0

    since 3.12: Use Gtk.Widget.margin_end instead.

  • set margin_right(val: number): void

    Margin on right side of widget.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Parameters

    • Deprecatedval: number

    Returns void

    3.0

    since 3.12: Use Gtk.Widget.margin_end instead.

  • get margin_start(): number

    Margin on start of widget, horizontally. This property supports left-to-right and right-to-left text directions.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Returns number

    3.12

  • set margin_start(val: number): void

    Margin on start of widget, horizontally. This property supports left-to-right and right-to-left text directions.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Parameters

    • val: number

    Returns void

    3.12

  • get margin_top(): number

    Margin on top side of widget.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Returns number

    3.0

  • set margin_top(val: number): void

    Margin on top side of widget.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Parameters

    • val: number

    Returns void

    3.0

  • get marginBottom(): number

    Margin on bottom side of widget.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Returns number

    3.0

  • set marginBottom(val: number): void

    Margin on bottom side of widget.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Parameters

    • val: number

    Returns void

    3.0

  • get marginEnd(): number

    Margin on end of widget, horizontally. This property supports left-to-right and right-to-left text directions.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Returns number

    3.12

  • set marginEnd(val: number): void

    Margin on end of widget, horizontally. This property supports left-to-right and right-to-left text directions.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Parameters

    • val: number

    Returns void

    3.12

  • get marginLeft(): number

    Margin on left side of widget.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Returns number

    3.0

    since 3.12: Use Gtk.Widget.margin_start instead.

  • set marginLeft(val: number): void

    Margin on left side of widget.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Parameters

    • Deprecatedval: number

    Returns void

    3.0

    since 3.12: Use Gtk.Widget.margin_start instead.

  • get marginRight(): number

    Margin on right side of widget.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Returns number

    3.0

    since 3.12: Use Gtk.Widget.margin_end instead.

  • set marginRight(val: number): void

    Margin on right side of widget.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Parameters

    • Deprecatedval: number

    Returns void

    3.0

    since 3.12: Use Gtk.Widget.margin_end instead.

  • get marginStart(): number

    Margin on start of widget, horizontally. This property supports left-to-right and right-to-left text directions.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Returns number

    3.12

  • set marginStart(val: number): void

    Margin on start of widget, horizontally. This property supports left-to-right and right-to-left text directions.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Parameters

    • val: number

    Returns void

    3.12

  • get marginTop(): number

    Margin on top side of widget.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Returns number

    3.0

  • set marginTop(val: number): void

    Margin on top side of widget.

    This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.

    Parameters

    • val: number

    Returns void

    3.0

  • get name(): string

    Returns string

  • set name(val: string): void

    Parameters

    • val: string

    Returns void

  • get no_show_all(): boolean

    Returns boolean

  • set no_show_all(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get noShowAll(): boolean

    Returns boolean

  • set noShowAll(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get opacity(): number

    The requested opacity of the widget. See gtk_widget_set_opacity() for more details about window opacity.

    Before 3.8 this was only available in GtkWindow

    Returns number

    3.8

  • set opacity(val: number): void

    The requested opacity of the widget. See gtk_widget_set_opacity() for more details about window opacity.

    Before 3.8 this was only available in GtkWindow

    Parameters

    • val: number

    Returns void

    3.8

  • get receives_default(): boolean

    Returns boolean

  • set receives_default(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get receivesDefault(): boolean

    Returns boolean

  • set receivesDefault(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get scale_factor(): number

    The scale factor of the widget. See gtk_widget_get_scale_factor() for more details about widget scaling.

    Returns number

    3.10

  • get scaleFactor(): number

    The scale factor of the widget. See gtk_widget_get_scale_factor() for more details about widget scaling.

    Returns number

    3.10

  • get sensitive(): boolean

    Returns boolean

  • set sensitive(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get tooltip_markup(): string

    Sets the text of tooltip to be the given string, which is marked up with the [Pango text markup language][PangoMarkupFormat]. Also see gtk_tooltip_set_markup().

    This is a convenience property which will take care of getting the tooltip shown if the given string is not null: Gtk.Widget.has_tooltip will automatically be set to true and there will be taken care of Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip in the default signal handler.

    Note that if both Gtk.Widget.tooltip_text and Gtk.Widget.tooltip_markup are set, the last one wins.

    Returns string

    2.12

  • set tooltip_markup(val: string): void

    Sets the text of tooltip to be the given string, which is marked up with the [Pango text markup language][PangoMarkupFormat]. Also see gtk_tooltip_set_markup().

    This is a convenience property which will take care of getting the tooltip shown if the given string is not null: Gtk.Widget.has_tooltip will automatically be set to true and there will be taken care of Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip in the default signal handler.

    Note that if both Gtk.Widget.tooltip_text and Gtk.Widget.tooltip_markup are set, the last one wins.

    Parameters

    • val: string

    Returns void

    2.12

  • get tooltip_text(): string

    Sets the text of tooltip to be the given string.

    Also see gtk_tooltip_set_text().

    This is a convenience property which will take care of getting the tooltip shown if the given string is not null: Gtk.Widget.has_tooltip will automatically be set to true and there will be taken care of Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip in the default signal handler.

    Note that if both Gtk.Widget.tooltip_text and Gtk.Widget.tooltip_markup are set, the last one wins.

    Returns string

    2.12

  • set tooltip_text(val: string): void

    Sets the text of tooltip to be the given string.

    Also see gtk_tooltip_set_text().

    This is a convenience property which will take care of getting the tooltip shown if the given string is not null: Gtk.Widget.has_tooltip will automatically be set to true and there will be taken care of Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip in the default signal handler.

    Note that if both Gtk.Widget.tooltip_text and Gtk.Widget.tooltip_markup are set, the last one wins.

    Parameters

    • val: string

    Returns void

    2.12

  • get tooltipMarkup(): string

    Sets the text of tooltip to be the given string, which is marked up with the [Pango text markup language][PangoMarkupFormat]. Also see gtk_tooltip_set_markup().

    This is a convenience property which will take care of getting the tooltip shown if the given string is not null: Gtk.Widget.has_tooltip will automatically be set to true and there will be taken care of Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip in the default signal handler.

    Note that if both Gtk.Widget.tooltip_text and Gtk.Widget.tooltip_markup are set, the last one wins.

    Returns string

    2.12

  • set tooltipMarkup(val: string): void

    Sets the text of tooltip to be the given string, which is marked up with the [Pango text markup language][PangoMarkupFormat]. Also see gtk_tooltip_set_markup().

    This is a convenience property which will take care of getting the tooltip shown if the given string is not null: Gtk.Widget.has_tooltip will automatically be set to true and there will be taken care of Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip in the default signal handler.

    Note that if both Gtk.Widget.tooltip_text and Gtk.Widget.tooltip_markup are set, the last one wins.

    Parameters

    • val: string

    Returns void

    2.12

  • get tooltipText(): string

    Sets the text of tooltip to be the given string.

    Also see gtk_tooltip_set_text().

    This is a convenience property which will take care of getting the tooltip shown if the given string is not null: Gtk.Widget.has_tooltip will automatically be set to true and there will be taken care of Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip in the default signal handler.

    Note that if both Gtk.Widget.tooltip_text and Gtk.Widget.tooltip_markup are set, the last one wins.

    Returns string

    2.12

  • set tooltipText(val: string): void

    Sets the text of tooltip to be the given string.

    Also see gtk_tooltip_set_text().

    This is a convenience property which will take care of getting the tooltip shown if the given string is not null: Gtk.Widget.has_tooltip will automatically be set to true and there will be taken care of Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip in the default signal handler.

    Note that if both Gtk.Widget.tooltip_text and Gtk.Widget.tooltip_markup are set, the last one wins.

    Parameters

    • val: string

    Returns void

    2.12

  • get vexpand(): boolean

    Whether to expand vertically. See gtk_widget_set_vexpand().

    Returns boolean

    3.0

  • set vexpand(val: boolean): void

    Whether to expand vertically. See gtk_widget_set_vexpand().

    Parameters

    • val: boolean

    Returns void

    3.0

  • get vexpand_set(): boolean

    Whether to use the Gtk.Widget.vexpand property. See gtk_widget_get_vexpand_set().

    Returns boolean

    3.0

  • set vexpand_set(val: boolean): void

    Whether to use the Gtk.Widget.vexpand property. See gtk_widget_get_vexpand_set().

    Parameters

    • val: boolean

    Returns void

    3.0

  • get vexpandSet(): boolean

    Whether to use the Gtk.Widget.vexpand property. See gtk_widget_get_vexpand_set().

    Returns boolean

    3.0

  • set vexpandSet(val: boolean): void

    Whether to use the Gtk.Widget.vexpand property. See gtk_widget_get_vexpand_set().

    Parameters

    • val: boolean

    Returns void

    3.0

  • get visible(): boolean

    Returns boolean

  • set visible(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get width_request(): number

    Returns number

  • set width_request(val: number): void

    Parameters

    • val: number

    Returns void

  • get widthRequest(): number

    Returns number

  • set widthRequest(val: number): void

    Parameters

    • val: number

    Returns void

Accessors - Inherited from Gtk.Entry

  • get activates_default(): boolean

    Returns boolean

  • set activates_default(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get activatesDefault(): boolean

    Returns boolean

  • set activatesDefault(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get caps_lock_warning(): boolean

    Whether password entries will show a warning when Caps Lock is on.

    Note that the warning is shown using a secondary icon, and thus does not work if you are using the secondary icon position for some other purpose.

    Returns boolean

    2.16

  • set caps_lock_warning(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get capsLockWarning(): boolean

    Whether password entries will show a warning when Caps Lock is on.

    Note that the warning is shown using a secondary icon, and thus does not work if you are using the secondary icon position for some other purpose.

    Returns boolean

    2.16

  • set capsLockWarning(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get enable_emoji_completion(): boolean

    Returns boolean

  • set enable_emoji_completion(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get enableEmojiCompletion(): boolean

    Returns boolean

  • set enableEmojiCompletion(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get im_module(): string

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

    Setting this to a non-null value overrides the system-wide IM module setting. See the GtkSettings Gtk.Settings.gtk_im_module property.

    Returns string

    2.16

  • set im_module(val: string): void

    Parameters

    • val: string

    Returns void

  • get imModule(): string

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

    Setting this to a non-null value overrides the system-wide IM module setting. See the GtkSettings Gtk.Settings.gtk_im_module property.

    Returns string

    2.16

  • set imModule(val: string): void

    Parameters

    • val: string

    Returns void

  • get invisible_char(): number

    The invisible character is used when masking entry contents (in "password mode")"). When it is not explicitly set with the Gtk.Entry.invisible_char property, GTK+ determines the character to use from a list of possible candidates, depending on availability in the current font.

    This style property allows the theme to prepend a character to the list of candidates.

    Returns number

    2.18

  • set invisible_char(val: number): void

    Parameters

    • val: number

    Returns void

  • get invisible_char_set(): boolean

    Whether the invisible char has been set for the Gtk.Entry.

    Returns boolean

    2.16

  • set invisible_char_set(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get invisibleChar(): number

    The invisible character is used when masking entry contents (in "password mode")"). When it is not explicitly set with the Gtk.Entry.invisible_char property, GTK+ determines the character to use from a list of possible candidates, depending on availability in the current font.

    This style property allows the theme to prepend a character to the list of candidates.

    Returns number

    2.18

  • set invisibleChar(val: number): void

    Parameters

    • val: number

    Returns void

  • get invisibleCharSet(): boolean

    Whether the invisible char has been set for the Gtk.Entry.

    Returns boolean

    2.16

  • set invisibleCharSet(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get max_width_chars(): number

    The desired maximum width of the entry, in characters. If this property is set to -1, the width will be calculated automatically.

    Returns number

    3.12

  • set max_width_chars(val: number): void

    Parameters

    • val: number

    Returns void

  • get maxWidthChars(): number

    The desired maximum width of the entry, in characters. If this property is set to -1, the width will be calculated automatically.

    Returns number

    3.12

  • set maxWidthChars(val: number): void

    Parameters

    • val: number

    Returns void

  • get overwrite_mode(): boolean

    If text is overwritten when typing in the Gtk.Entry.

    Returns boolean

    2.14

  • set overwrite_mode(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get overwriteMode(): boolean

    If text is overwritten when typing in the Gtk.Entry.

    Returns boolean

    2.14

  • set overwriteMode(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get placeholder_text(): string

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

    Returns string

    3.2

  • set placeholder_text(val: string): void

    Parameters

    • val: string

    Returns void

  • get placeholderText(): string

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

    Returns string

    3.2

  • set placeholderText(val: string): void

    Parameters

    • val: string

    Returns void

  • get populate_all(): boolean

    If :populate-all is true, the Gtk.Entry.SignalSignatures.populate_popup | Gtk.Entry::populate-popup signal is also emitted for touch popups.

    Returns boolean

    3.8

  • set populate_all(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get populateAll(): boolean

    If :populate-all is true, the Gtk.Entry.SignalSignatures.populate_popup | Gtk.Entry::populate-popup signal is also emitted for touch popups.

    Returns boolean

    3.8

  • set populateAll(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get primary_icon_activatable(): boolean

    Whether the primary icon is activatable.

    GTK+ emits the Gtk.Entry.SignalSignatures.icon_press | Gtk.Entry::icon-press and Gtk.Entry.SignalSignatures.icon_release | Gtk.Entry::icon-release signals only on sensitive, activatable icons.

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

    Returns boolean

    2.16

  • set primary_icon_activatable(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get primary_icon_name(): string

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

    Returns string

    2.16

  • set primary_icon_name(val: string): void

    Parameters

    • val: string

    Returns void

  • get primary_icon_sensitive(): boolean

    Whether the primary icon is sensitive.

    An insensitive icon appears grayed out. GTK+ does not emit the Gtk.Entry.SignalSignatures.icon_press | Gtk.Entry::icon-press and Gtk.Entry.SignalSignatures.icon_release | Gtk.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

    2.16

  • set primary_icon_sensitive(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get primary_icon_stock(): string

    The stock id to use for the primary icon for the entry.

    Returns string

    2.16

    since 3.10: Use Gtk.Entry.primary_icon_name instead.

  • set primary_icon_stock(val: string): void

    Parameters

    • val: string

    Returns void

  • get primary_icon_tooltip_markup(): string

    The contents of the tooltip on the primary icon, which is marked up with the [Pango text markup language][PangoMarkupFormat].

    Also see gtk_entry_set_icon_tooltip_markup().

    Returns string

    2.16

  • set primary_icon_tooltip_markup(val: string): void

    Parameters

    • val: string

    Returns void

  • get primary_icon_tooltip_text(): string

    The contents of the tooltip on the primary icon.

    Also see gtk_entry_set_icon_tooltip_text().

    Returns string

    2.16

  • set primary_icon_tooltip_text(val: string): void

    Parameters

    • val: string

    Returns void

  • get primaryIconActivatable(): boolean

    Whether the primary icon is activatable.

    GTK+ emits the Gtk.Entry.SignalSignatures.icon_press | Gtk.Entry::icon-press and Gtk.Entry.SignalSignatures.icon_release | Gtk.Entry::icon-release signals only on sensitive, activatable icons.

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

    Returns boolean

    2.16

  • set primaryIconActivatable(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get primaryIconName(): string

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

    Returns string

    2.16

  • set primaryIconName(val: string): void

    Parameters

    • val: string

    Returns void

  • get primaryIconSensitive(): boolean

    Whether the primary icon is sensitive.

    An insensitive icon appears grayed out. GTK+ does not emit the Gtk.Entry.SignalSignatures.icon_press | Gtk.Entry::icon-press and Gtk.Entry.SignalSignatures.icon_release | Gtk.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

    2.16

  • set primaryIconSensitive(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get primaryIconTooltipMarkup(): string

    The contents of the tooltip on the primary icon, which is marked up with the [Pango text markup language][PangoMarkupFormat].

    Also see gtk_entry_set_icon_tooltip_markup().

    Returns string

    2.16

  • set primaryIconTooltipMarkup(val: string): void

    Parameters

    • val: string

    Returns void

  • get primaryIconTooltipText(): string

    The contents of the tooltip on the primary icon.

    Also see gtk_entry_set_icon_tooltip_text().

    Returns string

    2.16

  • set primaryIconTooltipText(val: string): void

    Parameters

    • val: string

    Returns void

  • get progress_fraction(): number

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

    Returns number

    2.16

  • set progress_fraction(val: number): void

    Parameters

    • val: number

    Returns void

  • get progress_pulse_step(): number

    The fraction of total entry width to move the progress bouncing block for each call to gtk_entry_progress_pulse().

    Returns number

    2.16

  • set progress_pulse_step(val: number): void

    Parameters

    • val: number

    Returns void

  • get progressFraction(): number

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

    Returns number

    2.16

  • set progressFraction(val: number): void

    Parameters

    • val: number

    Returns void

  • get progressPulseStep(): number

    The fraction of total entry width to move the progress bouncing block for each call to gtk_entry_progress_pulse().

    Returns number

    2.16

  • set progressPulseStep(val: number): void

    Parameters

    • val: number

    Returns void

  • get secondary_icon_activatable(): boolean

    Whether the secondary icon is activatable.

    GTK+ emits the Gtk.Entry.SignalSignatures.icon_press | Gtk.Entry::icon-press and Gtk.Entry.SignalSignatures.icon_release | Gtk.Entry::icon-release signals only on sensitive, activatable icons.

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

    Returns boolean

    2.16

  • set secondary_icon_activatable(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get secondary_icon_name(): string

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

    Returns string

    2.16

  • set secondary_icon_name(val: string): void

    Parameters

    • val: string

    Returns void

  • get secondary_icon_sensitive(): boolean

    Whether the secondary icon is sensitive.

    An insensitive icon appears grayed out. GTK+ does not emit the Gtk.Entry.SignalSignatures.icon_press | Gtk.Entry::icon-press and Gtk.Entry.SignalSignatures.icon_release | Gtk.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

    2.16

  • set secondary_icon_sensitive(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get secondary_icon_stock(): string

    The stock id to use for the secondary icon for the entry.

    Returns string

    2.16

    since 3.10: Use Gtk.Entry.secondary_icon_name instead.

  • set secondary_icon_stock(val: string): void

    Parameters

    • val: string

    Returns void

  • get secondary_icon_tooltip_markup(): string

    The contents of the tooltip on the secondary icon, which is marked up with the [Pango text markup language][PangoMarkupFormat].

    Also see gtk_entry_set_icon_tooltip_markup().

    Returns string

    2.16

  • set secondary_icon_tooltip_markup(val: string): void

    Parameters

    • val: string

    Returns void

  • get secondary_icon_tooltip_text(): string

    The contents of the tooltip on the secondary icon.

    Also see gtk_entry_set_icon_tooltip_text().

    Returns string

    2.16

  • set secondary_icon_tooltip_text(val: string): void

    Parameters

    • val: string

    Returns void

  • get secondaryIconActivatable(): boolean

    Whether the secondary icon is activatable.

    GTK+ emits the Gtk.Entry.SignalSignatures.icon_press | Gtk.Entry::icon-press and Gtk.Entry.SignalSignatures.icon_release | Gtk.Entry::icon-release signals only on sensitive, activatable icons.

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

    Returns boolean

    2.16

  • set secondaryIconActivatable(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get secondaryIconName(): string

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

    Returns string

    2.16

  • set secondaryIconName(val: string): void

    Parameters

    • val: string

    Returns void

  • get secondaryIconSensitive(): boolean

    Whether the secondary icon is sensitive.

    An insensitive icon appears grayed out. GTK+ does not emit the Gtk.Entry.SignalSignatures.icon_press | Gtk.Entry::icon-press and Gtk.Entry.SignalSignatures.icon_release | Gtk.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

    2.16

  • set secondaryIconSensitive(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get secondaryIconStock(): string

    The stock id to use for the secondary icon for the entry.

    Returns string

    2.16

    since 3.10: Use Gtk.Entry.secondary_icon_name instead.

  • set secondaryIconStock(val: string): void

    Parameters

    • val: string

    Returns void

  • get secondaryIconTooltipMarkup(): string

    The contents of the tooltip on the secondary icon, which is marked up with the [Pango text markup language][PangoMarkupFormat].

    Also see gtk_entry_set_icon_tooltip_markup().

    Returns string

    2.16

  • set secondaryIconTooltipMarkup(val: string): void

    Parameters

    • val: string

    Returns void

  • get secondaryIconTooltipText(): string

    The contents of the tooltip on the secondary icon.

    Also see gtk_entry_set_icon_tooltip_text().

    Returns string

    2.16

  • set secondaryIconTooltipText(val: string): void

    Parameters

    • val: string

    Returns void

  • get show_emoji_icon(): boolean

    Returns boolean

  • set show_emoji_icon(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get truncate_multiline(): boolean

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

    Returns boolean

    2.10

  • set truncate_multiline(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get truncateMultiline(): boolean

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

    Returns boolean

    2.10

  • set truncateMultiline(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get xalign(): number

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

    Returns number

    2.4

  • set xalign(val: number): void

    Parameters

    • val: number

    Returns void

Methods

  • For widgets that can be “activated” (buttons, menu items, etc.) this function activates them. Activation is what happens when you press Enter on a widget during key navigation. If widget isn't activatable, the function returns false.

    Returns boolean

    true if the widget was activatable

  • Installs an accelerator for this widget in accel_group that causes accel_signal to be emitted if the accelerator is activated. The accel_group needs to be added to the widget’s toplevel via gtk_window_add_accel_group(), and the signal must be of type GObject.SignalFlags.ACTION. Accelerators added through this function are not user changeable during runtime. If you want to support accelerators that can be changed by the user, use gtk_accel_map_add_entry() and gtk_widget_set_accel_path() or gtk_menu_item_set_accel_path() instead.

    Parameters

    • accel_signal: string

      widget signal to emit on accelerator activation

    • accel_group: Gtk.AccelGroup

      accel group for this widget, added to its toplevel

    • accel_key: number

      GDK keyval of the accelerator

    • accel_mods: Gdk.ModifierType

      modifier key combination of the accelerator

    • accel_flags: Gtk.AccelFlags

      flag accelerators, e.g. Gtk.AccelFlags.VISIBLE

    Returns void

  • Queues an animation frame update and adds a callback to be called before each frame. Until the tick callback is removed, it will be called frequently (usually at the frame rate of the output device or as quickly as the application can be repainted, whichever is slower). For this reason, is most suitable for handling graphics that change every frame or every few frames. The tick callback does not automatically imply a relayout or repaint. If you want a repaint or relayout, and aren’t changing widget properties that would trigger that (for example, changing the text of a Gtk.Label), then you will have to call gtk_widget_queue_resize() or gtk_widget_queue_draw_area() yourself.

    gdk_frame_clock_get_frame_time() should generally be used for timing continuous animations and gdk_frame_timings_get_predicted_presentation_time() if you are trying to display isolated frames at particular times.

    This is a more convenient alternative to connecting directly to the Gdk.FrameClock::update signal of Gdk.FrameClock, since you don't have to worry about when a Gdk.FrameClock is assigned to a widget.

    Parameters

    Returns number

    an id for the connection of this callback. Remove the callback by passing it to gtk_widget_remove_tick_callback()

  • Creates a binding between source_property on source and target_property on target.

    Whenever the source_property is changed the target_property is updated using the same value. For instance:

      g_object_bind_property (action, "active", widget, "sensitive", 0);
    

    Will result in the "sensitive" property of the widget GObject.Object instance to be updated with the same value of the "active" property of the action GObject.Object instance.

    If flags contains GObject.BindingFlags.BIDIRECTIONAL then the binding will be mutual: if target_property on target changes then the source_property on source will be updated as well.

    The binding will automatically be removed when either the source or the target instances are finalized. To remove the binding without affecting the source and the target you can just call g_object_unref() on the returned GObject.Binding instance.

    Removing the binding by calling g_object_unref() on it must only be done if the binding, source and target are only used from a single thread and it is clear that both source and target outlive the binding. Especially it is not safe to rely on this if the binding, source or target can be finalized from different threads. Keep another reference to the binding and use g_binding_unbind() instead to be on the safe side.

    A GObject.Object can have multiple bindings.

    Parameters

    Returns GObject.Binding

    the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.

  • Complete version of g_object_bind_property().

    Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.

    If flags contains GObject.BindingFlags.BIDIRECTIONAL then the binding will be mutual: if target_property on target changes then the source_property on source will be updated as well. The transform_from function is only used in case of bidirectional bindings, otherwise it will be ignored

    The binding will automatically be removed when either the source or the target instances are finalized. This will release the reference that is being held on the GObject.Binding instance; if you want to hold on to the GObject.Binding instance, you will need to hold a reference to it.

    To remove the binding, call g_binding_unbind().

    A GObject.Object can have multiple bindings.

    The same user_data parameter will be used for both transform_to and transform_from transformation functions; the notify function will be called once, when the binding is removed. If you need different data for each transformation function, please use g_object_bind_property_with_closures() instead.

    Parameters

    • source_property: string

      the property on source to bind

    • target: GObject.Object

      the target GObject.Object

    • target_property: string

      the property on target to bind

    • flags: GObject.BindingFlags

      flags to pass to GObject.Binding

    • Optionaltransform_to: BindingTransformFunc

      the transformation function from the source to the target, or null to use the default

    • Optionaltransform_from: BindingTransformFunc

      the transformation function from the target to the source, or null to use the default

    • Optionalnotify: DestroyNotify

      a function to call when disposing the binding, to free resources used by the transformation functions, or null if not required

    Returns GObject.Binding

    the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.

  • Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.

    This function is the language bindings friendly version of g_object_bind_property_full(), using GClosures instead of function pointers.

    Parameters

    • ...args: never[]

      the property on source to bind

    Returns any

    the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.

  • Determines whether an accelerator that activates the signal identified by signal_id can currently be activated. This is done by emitting the Gtk.Widget.SignalSignatures.can_activate_accel | Gtk.Widget::can-activate-accel signal on widget; if the signal isn’t overridden by a handler or in a derived widget, then the default check is that the widget must be sensitive, and the widget and all its ancestors mapped.

    Parameters

    • signal_id: number

      the ID of a signal installed on widget

    Returns boolean

    true if the accelerator can be activated.

  • This function is used by custom widget implementations; if you're writing an app, you’d use gtk_widget_grab_focus() to move the focus to a particular widget, and gtk_container_set_focus_chain() to change the focus tab order. So you may want to investigate those functions instead.

    gtk_widget_child_focus() is called by containers as the user moves around the window using keyboard shortcuts. direction indicates what kind of motion is taking place (up, down, left, right, tab forward, tab backward). gtk_widget_child_focus() emits the Gtk.Widget::focus signal; widgets override the default handler for this signal in order to implement appropriate focus behavior.

    The default ::focus handler for a widget should return true if moving in direction left the focus on a focusable location inside that widget, and false if moving in direction moved the focus outside the widget. If returning true, widgets normally call gtk_widget_grab_focus() to place the focus accordingly; if returning false, they don’t modify the current focus location.

    Parameters

    Returns boolean

    true if focus ended up inside widget

  • Emits a Gtk.Widget.SignalSignatures.child_notify | Gtk.Widget::child-notify signal for the [child property][child-properties] child_property on widget.

    This is the analogue of g_object_notify() for child properties.

    Also see gtk_container_child_notify().

    Parameters

    • child_property: string

      the name of a child property installed on the class of widget’s parent

    Returns void

  • Computes whether a container should give this widget extra space when possible. Containers should check this, rather than looking at gtk_widget_get_hexpand() or gtk_widget_get_vexpand().

    This function already checks whether the widget is visible, so visibility does not need to be checked separately. Non-visible widgets are not expanded.

    The computed expand value uses either the expand setting explicitly set on the widget itself, or, if none has been explicitly set, the widget may expand if some of its children do.

    Parameters

    Returns boolean

    whether widget tree rooted here should be expanded

  • Changes the properties of an existing spin button. The adjustment, climb rate, and number of decimal places are updated accordingly.

    Parameters

    • adjustment: Gtk.Adjustment

      a Gtk.Adjustment to replace the spin button’s existing adjustment, or null to leave its current adjustment unchanged

    • climb_rate: number

      the new climb rate

    • digits: number

      the number of decimal places to display in the spin button

    Returns void

  • Deletes 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.

    Parameters

    • start_pos: number

      start position

    • end_pos: number

      end position

    Returns void

  • Destroys a widget.

    When a widget is destroyed all references it holds on other objects will be released:

    • if the widget is inside a container, it will be removed from its parent
    • if the widget is a container, all its children will be destroyed, recursively
    • if the widget is a top level, it will be removed from the list of top level widgets that GTK+ maintains internally

    It's expected that all references held on the widget will also be released; you should connect to the Gtk.Widget::destroy signal if you hold a reference to widget and you wish to remove it when this function is called. It is not necessary to do so if you are implementing a Gtk.Container, as you'll be able to use the Gtk.ContainerClass.remove() virtual function for that.

    It's important to notice that gtk_widget_destroy() will only cause the widget to be finalized if no additional references, acquired using g_object_ref(), are held on it. In case additional references are in place, the widget will be in an "inert" state after calling this function; widget will still point to valid memory, allowing you to release the references you hold, but you may not query the widget's own state.

    You should typically call this function on top level widgets, and rarely on child widgets.

    See also: gtk_container_remove()

    Returns void

  • This function sets *widget_pointer to null if widget_pointer != null. It’s intended to be used as a callback connected to the “destroy” signal of a widget. You connect gtk_widget_destroyed() as a signal handler, and pass the address of your widget variable as user data. Then when the widget is destroyed, the variable will be set to null. Useful for example to avoid multiple copies of the same dialog.

    Parameters

    • widget_pointer: Gtk.Widget

      address of a variable that contains widget

    Returns Gtk.Widget

  • Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.

    Parameters

    • id: number

      Handler ID of the handler to be disconnected

    Returns void

  • Initiates a drag on the source side. The function only needs to be used when the application is starting drags itself, and is not needed when gtk_drag_source_set() is used.

    The event is used to retrieve the timestamp that will be used internally to grab the pointer. If event is null, then GDK_CURRENT_TIME will be used. However, you should try to pass a real event in all cases, since that can be used to get information about the drag.

    Generally there are three cases when you want to start a drag by hand by calling this function:

    1. During a Gtk.Widget.SignalSignatures.button_press_event | Gtk.Widget::button-press-event handler, if you want to start a drag immediately when the user presses the mouse button. Pass the event that you have in your Gtk.Widget.SignalSignatures.button_press_event | Gtk.Widget::button-press-event handler.

    2. During a Gtk.Widget.SignalSignatures.motion_notify_event | Gtk.Widget::motion-notify-event handler, if you want to start a drag when the mouse moves past a certain threshold distance after a button-press. Pass the event that you have in your Gtk.Widget.SignalSignatures.motion_notify_event | Gtk.Widget::motion-notify-event handler.

    3. During a timeout handler, if you want to start a drag after the mouse button is held down for some time. Try to save the last event that you got from the mouse, using gdk_event_copy(), and pass it to this function (remember to free the event with gdk_event_free() when you are done). If you really cannot pass a real event, pass null instead.

    Parameters

    • targets: TargetList

      The targets (data formats) in which the source can provide the data

    • actions: Gdk.DragAction

      A bitmask of the allowed drag actions for this drag

    • button: number

      The button the user clicked to start the drag

    • event: Gdk.Event

      The event that triggered the start of the drag, or null if none can be obtained.

    • x: number

      The initial x coordinate to start dragging from, in the coordinate space of widget. If -1 is passed, the coordinates are retrieved from event or the current pointer position

    • y: number

      The initial y coordinate to start dragging from, in the coordinate space of widget. If -1 is passed, the coordinates are retrieved from event or the current pointer position

    Returns Gdk.DragContext

    the context for this drag

  • Checks to see if a mouse drag starting at (start_x, start_y) and ending at (current_x, current_y) has passed the GTK+ drag threshold, and thus should trigger the beginning of a drag-and-drop operation.

    Parameters

    • start_x: number

      X coordinate of start of drag

    • start_y: number

      Y coordinate of start of drag

    • current_x: number

      current X coordinate

    • current_y: number

      current Y coordinate

    Returns boolean

    true if the drag threshold has been passed.

  • Looks for a match between the supported targets of context and the dest_target_list, returning the first matching target, otherwise returning GDK_NONE. dest_target_list should usually be the return value from gtk_drag_dest_get_target_list(), but some widgets may have different valid targets for different parts of the widget; in that case, they will have to implement a drag_motion handler that passes the correct target list to this function.

    Parameters

    • context: Gdk.DragContext

      drag context

    • Optionaltarget_list: TargetList

      list of droppable targets, or null to use gtk_drag_dest_get_target_list (widget).

    Returns Gdk.Atom

    first target that the source offers and the dest can accept, or GDK_NONE

  • Sets a widget as a potential drop destination, and adds default behaviors.

    The default behaviors listed in flags have an effect similar to installing default handlers for the widget’s drag-and-drop signals (Gtk.Widget.SignalSignatures.drag_motion | Gtk.Widget::drag-motion, Gtk.Widget.SignalSignatures.drag_drop | Gtk.Widget::drag-drop, ...). They all exist for convenience. When passing #GTK_DEST_DEFAULT_ALL for instance it is sufficient to connect to the widget’s Gtk.Widget.SignalSignatures.drag_data_received | Gtk.Widget::drag-data-received signal to get primitive, but consistent drag-and-drop support.

    Things become more complicated when you try to preview the dragged data, as described in the documentation for Gtk.Widget.SignalSignatures.drag_motion | Gtk.Widget::drag-motion. The default behaviors described by flags make some assumptions, that can conflict with your own signal handlers. For instance #GTK_DEST_DEFAULT_DROP causes invokations of gdk_drag_status() in the context of Gtk.Widget.SignalSignatures.drag_motion | Gtk.Widget::drag-motion, and invokations of gtk_drag_finish() in Gtk.Widget.SignalSignatures.drag_data_received | Gtk.Widget::drag-data-received. Especially the later is dramatic, when your own Gtk.Widget.SignalSignatures.drag_motion | Gtk.Widget::drag-motion handler calls gtk_drag_get_data() to inspect the dragged data.

    There’s no way to set a default action here, you can use the Gtk.Widget.SignalSignatures.drag_motion | Gtk.Widget::drag-motion callback for that. Here’s an example which selects the action to use depending on whether the control key is pressed or not:

    static void
    drag_motion (GtkWidget *widget,
    GdkDragContext *context,
    gint x,
    gint y,
    guint time)
    {
    GdkModifierType mask;

    gdk_window_get_pointer (gtk_widget_get_window (widget),
    NULL, NULL, &mask);
    if (mask & GDK_CONTROL_MASK)
    gdk_drag_status (context, GDK_ACTION_COPY, time);
    else
    gdk_drag_status (context, GDK_ACTION_MOVE, time);
    }

    Parameters

    • flags: Gtk.DestDefaults

      which types of default drag behavior to use

    • targets: TargetEntry[]

      a pointer to an array of GtkTargetEntrys indicating the drop types that this widget will accept, or null. Later you can access the list with gtk_drag_dest_get_target_list() and gtk_drag_dest_find_target().

    • actions: Gdk.DragAction

      a bitmask of possible actions for a drop onto this widget.

    Returns void

  • Tells the widget to emit Gtk.Widget.SignalSignatures.drag_motion | Gtk.Widget::drag-motion and Gtk.Widget.SignalSignatures.drag_leave | Gtk.Widget::drag-leave events regardless of the targets and the Gtk.DestDefaults.MOTION flag.

    This may be used when a widget wants to do generic actions regardless of the targets that the source offers.

    Parameters

    • track_motion: boolean

      whether to accept all targets

    Returns void

  • Gets the data associated with a drag. When the data is received or the retrieval fails, GTK+ will emit a Gtk.Widget.SignalSignatures.drag_data_received | Gtk.Widget::drag-data-received signal. Failure of the retrieval is indicated by the length field of the selection_data signal parameter being negative. However, when gtk_drag_get_data() is called implicitely because the Gtk.DestDefaults.DROP was set, then the widget will not receive notification of failed drops.

    Parameters

    • context: Gdk.DragContext

      the drag context

    • target: Gdk.Atom

      the target (form of the data) to retrieve

    • time_: number

      a timestamp for retrieving the data. This will generally be the time received in a Gtk.Widget.SignalSignatures.drag_motion | Gtk.Widget::drag-motion or Gtk.Widget.SignalSignatures.drag_drop | Gtk.Widget::drag-drop signal

    Returns void

  • Draws widget to cr. The top left corner of the widget will be drawn to the currently set origin point of cr.

    You should pass a cairo context as cr argument that is in an original state. Otherwise the resulting drawing is undefined. For example changing the operator using cairo_set_operator() or the line width using cairo_set_line_width() might have unwanted side effects. You may however change the context’s transform matrix - like with cairo_scale(), cairo_translate() or cairo_set_matrix() and clip region with cairo_clip() prior to calling this function. Also, it is fine to modify the context with cairo_save() and cairo_push_group() prior to calling this function.

    Note that special-purpose widgets may contain special code for rendering to the screen and might appear differently on screen and when rendered using gtk_widget_draw().

    Parameters

    Returns void

  • Ensures that widget has a style (widget->style).

    Not a very useful function; most of the time, if you want the style, the widget is realized, and realized widgets are guaranteed to have a style already.

    Returns void

  • Notifies the user about an input-related error on this widget. If the Gtk.Settings.gtk_error_bell setting is true, it calls gdk_window_beep(), otherwise it does nothing.

    Note that the effect of gdk_window_beep() can be configured in many ways, depending on the windowing backend and the desktop environment or window manager that is used.

    Returns void

  • Rarely-used function. This function is used to emit the event signals on a widget (those signals should never be emitted without using this function to do so). If you want to synthesize an event though, don’t use this function; instead, use gtk_main_do_event() so the event will behave as if it were in the event queue. Don’t synthesize expose events; instead, use gdk_window_invalidate_rect() to invalidate a region of the window.

    Parameters

    Returns boolean

    return from the event signal emission (true if the event was handled)

  • This function is intended for GObject.Object implementations to re-enforce a [floating][floating-ref] object reference. Doing this is seldom required: all GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling g_object_ref_sink().

    Returns void

  • Stops emission of Gtk.Widget.SignalSignatures.child_notify | Gtk.Widget::child-notify signals on widget. The signals are queued until gtk_widget_thaw_child_notify() is called on widget.

    This is the analogue of g_object_freeze_notify() for child properties.

    Returns void

  • Increases the freeze count on object. If the freeze count is non-zero, the emission of "notify" signals on object is stopped. The signals are queued until the freeze count is decreased to zero. Duplicate notifications are squashed so that at most one GObject.Object::notify signal is emitted for each property modified while the object is frozen.

    This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.

    Returns void

  • Returns the accessible object that describes the widget to an assistive technology.

    If accessibility support is not available, this Atk.Object instance may be a no-op. Likewise, if no class-specific Atk.Object implementation is available for the widget instance in question, it will inherit an Atk.Object implementation from the first ancestor class for which such an implementation is defined.

    The documentation of the ATK library contains more information about accessible objects and their uses.

    Returns Atk.Object

    the Atk.Object associated with widget

  • Retrieves the widget’s allocated size.

    This function returns the last values passed to gtk_widget_size_allocate_with_baseline(). The value differs from the size returned in gtk_widget_get_allocation() in that functions like gtk_widget_set_halign() can adjust the allocation, but not the value returned by this function.

    If a widget is not visible, its allocated size is 0.

    Returns [Gdk.Rectangle, number]

  • Retrieves the widget’s allocation.

    Note, when implementing a Gtk.Container: a widget’s allocation will be its “adjusted” allocation, that is, the widget’s parent container typically calls gtk_widget_size_allocate() with an allocation, and that allocation is then adjusted (to handle margin and alignment for example) before assignment to the widget. gtk_widget_get_allocation() returns the adjusted allocation that was actually assigned to the widget. The adjusted allocation is guaranteed to be completely contained within the gtk_widget_size_allocate() allocation, however. So a Gtk.Container is guaranteed that its children stay inside the assigned bounds, but not that they have exactly the bounds the container assigned. There is no way to get the original allocation assigned by gtk_widget_size_allocate(), since it isn’t stored; if a container implementation needs that information it will have to track it itself.

    Returns Gdk.Rectangle

  • Gets the first ancestor of widget with type widget_type. For example, gtk_widget_get_ancestor (widget, GTK_TYPE_BOX) gets the first Gtk.Box that’s an ancestor of widget. No reference will be added to the returned widget; it should not be unreferenced. See note about checking for a toplevel Gtk.Window in the docs for gtk_widget_get_toplevel().

    Note that unlike gtk_widget_is_ancestor(), gtk_widget_get_ancestor() considers widget to be an ancestor of itself.

    Parameters

    • widget_type: GType

      ancestor type

    Returns Gtk.Widget

    the ancestor widget, or null if not found

  • Retrieves 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.

    Parameters

    • start_pos: number

      start of text

    • end_pos: number

      end of text

    Returns string

    a pointer to the contents of the widget as a string. This string is allocated by the Gtk.Editable implementation and should be freed by the caller.

  • This function is only for use in widget implementations. Obtains widget->requisition, unless someone has forced a particular geometry on the widget (e.g. with gtk_widget_set_size_request()), in which case it returns that geometry instead of the widget's requisition.

    This function differs from gtk_widget_size_request() in that it retrieves the last size request value from widget->requisition, while gtk_widget_size_request() actually calls the "size_request" method on widget to compute the size request and fill in widget->requisition, and only then returns widget->requisition.

    Because this function does not call the “size_request” method, it can only be used when you know that widget->requisition is up-to-date, that is, gtk_widget_size_request() has been called since the last time a resize was queued. In general, only container implementations have this information; applications should use gtk_widget_size_request().

    Returns Gtk.Requisition

  • Gets the value set with gtk_widget_set_child_visible(). If you feel a need to use this function, your code probably needs reorganization.

    This function is only useful for container implementations and never should be called by an application.

    Returns boolean

    true if the widget is mapped with the parent.

  • Returns the clipboard object for the given selection to be used with widget. widget must have a Gdk.Display associated with it, so must be attached to a toplevel window.

    Parameters

    • selection: Gdk.Atom

      a Gdk.Atom which identifies the clipboard to use. GDK_SELECTION_CLIPBOARD gives the default clipboard. Another common value is GDK_SELECTION_PRIMARY, which gives the primary X selection.

    Returns Gtk.Clipboard

    the appropriate clipboard object. If no clipboard already exists, a new one will be created. Once a clipboard object has been created, it is persistent for all time.

  • Gets a named field from the objects table of associations (see g_object_set_data()).

    Parameters

    • key: string

      name of the key for that association

    Returns any

    the data if found, or null if no such data exists.

  • Fetches the precision of spin_button. See gtk_spin_button_set_digits().

    Returns number

    the current precision

  • Returns the event mask (see Gdk.EventMask) for the widget. These are the events that the widget will receive.

    Note: Internally, the widget event mask will be the logical OR of the event mask set through gtk_widget_set_events() or gtk_widget_add_events(), and the event mask necessary to cater for every Gtk.EventController created for the widget.

    Returns number

    event mask for widget

  • Obtains the frame clock for a widget. The frame clock is a global “ticker” that can be used to drive animations and repaints. The most common reason to get the frame clock is to call gdk_frame_clock_get_frame_time(), in order to get a time to use for animating. For example you might record the start of the animation with an initial value from gdk_frame_clock_get_frame_time(), and then update the animation by calling gdk_frame_clock_get_frame_time() again during each repaint.

    gdk_frame_clock_request_phase() will result in a new frame on the clock, but won’t necessarily repaint any widgets. To repaint a widget, you have to use gtk_widget_queue_draw() which invalidates the widget (thus scheduling it to receive a draw on the next frame). gtk_widget_queue_draw() will also end up requesting a frame on the appropriate frame clock.

    A widget’s frame clock will not change while the widget is mapped. Reparenting a widget (which implies a temporary unmap) can change the widget’s frame clock.

    Unrealized widgets do not have a frame clock.

    Returns Gdk.FrameClock

    a Gdk.FrameClock, or null if widget is unrealized

  • Gets whether the widget would like any available extra horizontal space. When a user resizes a Gtk.Window, widgets with expand=TRUE generally receive the extra space. For example, a list or scrollable area or document in your window would often be set to expand.

    Containers should use gtk_widget_compute_expand() rather than this function, to see whether a widget, or any of its children, has the expand flag set. If any child of a widget wants to expand, the parent may ask to expand also.

    This function only looks at the widget’s own hexpand flag, rather than computing whether the entire widget tree rooted at this widget wants to expand.

    Returns boolean

    whether hexpand flag is set

  • Gets whether gtk_widget_set_hexpand() has been used to explicitly set the expand flag on this widget.

    If hexpand is set, then it overrides any computed expand value based on child widgets. If hexpand is not set, then the expand value depends on whether any children of the widget would like to expand.

    There are few reasons to use this function, but it’s here for completeness and consistency.

    Returns boolean

    whether hexpand has been explicitly set

  • Gets the current step and page the increments used by spin_button. See gtk_spin_button_set_increments().

    Returns [number, number]

  • Returns the current modifier style for the widget. (As set by gtk_widget_modify_style().) If no style has previously set, a new Gtk.RcStyle will be created with all values unset, and set as the modifier style for the widget. If you make changes to this rc style, you must call gtk_widget_modify_style(), passing in the returned rc style, to make sure that your changes take effect.

    Caution: passing the style back to gtk_widget_modify_style() will normally end up destroying it, because gtk_widget_modify_style() copies the passed-in style and sets the copy as the new modifier style, thus dropping any reference to the old modifier style. Add a reference to the modifier style if you want to keep it alive.

    Returns Gtk.RcStyle

    the modifier style for the widget. This rc style is owned by the widget. If you want to keep a pointer to value this around, you must add a refcount using g_object_ref().

  • Retrieves the name of a widget. See gtk_widget_set_name() for the significance of widget names.

    Returns string

    name of the widget. This string is owned by GTK+ and should not be modified or freed

  • Returns whether non-numeric text can be typed into the spin button. See gtk_spin_button_set_numeric().

    Returns boolean

    true if only numeric text can be entered

  • Gets a Pango.Context with the appropriate font map, font description, and base direction for this widget. Unlike the context returned by gtk_widget_create_pango_context(), this context is owned by the widget (it can be used until the screen for the widget changes or the widget is removed from its toplevel), and will be updated to match any changes to the widget’s attributes. This can be tracked by using the Gtk.Widget.SignalSignatures.screen_changed | Gtk.Widget::screen-changed signal on the widget.

    Returns Pango.Context

    the Pango.Context for the widget.

  • Obtains the location of the mouse pointer in widget coordinates. Widget coordinates are a bit odd; for historical reasons, they are defined as widget->window coordinates for widgets that return true for gtk_widget_get_has_window(); and are relative to widget->allocation.x, widget->allocation.y otherwise.

    Returns [number, number]

  • Retrieves a widget’s initial minimum and natural height.

    This call is specific to width-for-height requests.

    The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

    Returns [number, number]

  • Retrieves a widget’s minimum and natural height and the corresponding baselines if it would be given the specified width, or the default height if width is -1. The baselines may be -1 which means that no baseline is requested for this widget.

    The returned request will be modified by the GtkWidgetClass::adjust_size_request and GtkWidgetClass::adjust_baseline_request virtual methods and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

    Parameters

    • width: number

      the width which is available for allocation, or -1 if none

    Returns [number, number, number, number]

  • Retrieves a widget’s minimum and natural height if it would be given the specified width.

    The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

    Parameters

    • width: number

      the width which is available for allocation

    Returns [number, number]

  • Retrieves the minimum and natural size of a widget, taking into account the widget’s preference for height-for-width management.

    This is used to retrieve a suitable size by container widgets which do not impose any restrictions on the child placement. It can be used to deduce toplevel window and menu sizes as well as child widgets in free-form containers such as GtkLayout.

    Handle with care. Note that the natural height of a height-for-width widget will generally be a smaller size than the minimum height, since the required height for the natural width is generally smaller than the required height for the minimum width.

    Use gtk_widget_get_preferred_height_and_baseline_for_width() if you want to support baseline alignment.

    Returns [Gtk.Requisition, Gtk.Requisition]

  • Retrieves a widget’s initial minimum and natural width.

    This call is specific to height-for-width requests.

    The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

    Returns [number, number]

  • Retrieves a widget’s minimum and natural width if it would be given the specified height.

    The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

    Parameters

    • height: number

      the height which is available for allocation

    Returns [number, number]

  • Gets a property of an object.

    The value can be:

    • an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
    • a GObject.Value initialized with the expected type of the property
    • a GObject.Value initialized with a type to which the expected type of the property can be transformed

    In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.

    Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.

    Parameters

    • property_name: string

      The name of the property to get

    • value: any

      Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type

    Returns any

  • Gets the range allowed for spin_button. See gtk_spin_button_set_range().

    Returns [number, number]

  • Determines whether widget is always treated as the default widget within its toplevel when it has the focus, even if another widget is the default.

    See gtk_widget_set_receives_default().

    Returns boolean

    true if widget acts as the default widget when focused, false otherwise

  • Retrieves the widget’s requisition.

    This function should only be used by widget implementations in order to figure whether the widget’s requisition has actually changed after some internal state change (so that they can call gtk_widget_queue_resize() instead of gtk_widget_queue_draw()).

    Normally, gtk_widget_size_request() should be used.

    Returns Gtk.Requisition

  • Get the root window where this widget is located. This function can only be called after the widget has been added to a widget hierarchy with Gtk.Window at the top.

    The root window is useful for such purposes as creating a popup Gdk.Window associated with the window. In general, you should only create display specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.

    Returns Gdk.Window

    the Gdk.Window root window for the toplevel for this widget.

  • Retrieves the internal scale factor that maps from window coordinates to the actual device pixels. On traditional systems this is 1, on high density outputs, it can be a higher value (typically 2).

    See gdk_window_get_scale_factor().

    Returns number

    the scale factor for widget

  • Retrieves 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.

    Returns [boolean, number, number]

    true if an area is selected, false otherwise

  • Returns the widget’s sensitivity (in the sense of returning the value that has been set using gtk_widget_set_sensitive()).

    The effective sensitivity of a widget is however determined by both its own and its parent widget’s sensitivity. See gtk_widget_is_sensitive().

    Returns boolean

    true if the widget is sensitive

  • Gets the size request that was explicitly set for the widget using gtk_widget_set_size_request(). A value of -1 stored in width or height indicates that that dimension has not been set explicitly and the natural requisition of the widget will be used instead. See gtk_widget_set_size_request(). To get the size a widget will actually request, call gtk_widget_get_preferred_size() instead of this function.

    Returns [number, number]

  • Returns whether the values are corrected to the nearest step. See gtk_spin_button_set_snap_to_ticks().

    Returns boolean

    true if values are snapped to the nearest step

  • Fetch an object build from the template XML for widget_type in this widget instance.

    This will only report children which were previously declared with gtk_widget_class_bind_template_child_full() or one of its variants.

    This function is only meant to be called for code which is private to the widget_type which declared the child and is meant for language bindings which cannot easily make use of the GObject structure offsets.

    Type Parameters

    Parameters

    • widget_type: GType

      The GObject.GType to get a template child for

    • name: string

      The “id” of the child defined in the template XML

    Returns T

    The object built in the template XML with the id name

  • This function returns the topmost widget in the container hierarchy widget is a part of. If widget has no parent widgets, it will be returned as the topmost widget. No reference will be added to the returned widget; it should not be unreferenced.

    Note the difference in behavior vs. gtk_widget_get_ancestor(); gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) would return null if widget wasn’t inside a toplevel window, and if the window was inside a Gtk.Window-derived widget which was in turn inside the toplevel Gtk.Window. While the second case may seem unlikely, it actually happens when a Gtk.Plug is embedded inside a Gtk.Socket within the same application.

    To reliably find the toplevel Gtk.Window, use gtk_widget_get_toplevel() and call GTK_IS_WINDOW() on the result. For instance, to get the title of a widget's toplevel window, one might use:

    static const char *
    get_widget_toplevel_title (GtkWidget *widget)
    {
    GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
    if (GTK_IS_WINDOW (toplevel))
    {
    return gtk_window_get_title (GTK_WINDOW (toplevel));
    }

    return NULL;
    }

    Returns Gtk.Widget

    the topmost ancestor of widget, or widget itself if there’s no ancestor.

  • Get the value spin_button represented as an integer.

    Returns number

    the value of spin_button

  • Determines whether the widget is visible. If you want to take into account whether the widget’s parent is also marked as visible, use gtk_widget_is_visible() instead.

    This function does not check if the widget is obscured in any way.

    See gtk_widget_set_visible().

    Returns boolean

    true if the widget is visible

  • Returns whether the spin button’s value wraps around to the opposite limit when the upper or lower limit of the range is exceeded. See gtk_spin_button_set_wrap().

    Returns boolean

    true if the spin button wraps around

  • Gets n_properties properties for an object. Obtained properties will be set to values. All properties must be valid. Warnings will be emitted and undefined behaviour may result if invalid properties are passed in.

    Parameters

    • names: string[]

      the names of each property to get

    • values: any[]

      the values of each property to get

    Returns void

  • Makes widget the current grabbed widget.

    This means that interaction with other widgets in the same application is blocked and mouse as well as keyboard events are delivered to this widget.

    If widget is not sensitive, it is not set as the current grabbed widget and this function does nothing.

    Returns void

  • Causes widget to become the default widget. widget must be able to be a default widget; typically you would ensure this yourself by calling gtk_widget_set_can_default() with a true value. The default widget is activated when the user presses Enter in a window. Default widgets must be activatable, that is, gtk_widget_activate() should affect them. Note that Gtk.Entry widgets require the “activates-default” property set to true before they activate the default widget when Enter is pressed and the Gtk.Entry is focused.

    Returns void

  • Causes widget to have the keyboard focus for the Gtk.Window it's inside. widget must be a focusable widget, such as a Gtk.Entry; something like Gtk.Frame won’t work.

    More precisely, it must have the GTK_CAN_FOCUS flag set. Use gtk_widget_set_can_focus() to modify that flag.

    The widget also needs to be realized and mapped. This is indicated by the related signals. Grabbing the focus immediately after creating the widget will likely fail and cause critical warnings.

    Returns void

  • Determines whether the widget is currently grabbing events, so it is the only widget receiving input events (keyboard and mouse).

    See also gtk_grab_add().

    Returns boolean

    true if the widget is in the grab_widgets stack

  • Determines if the widget should show a visible indication that it has the global input focus. This is a convenience function for use in ::draw handlers that takes into account whether focus indication should currently be shown in the toplevel window of widget. See gtk_window_get_focus_visible() for more information about focus indication.

    To find out if the widget has the global input focus, use gtk_widget_has_focus().

    Returns boolean

    true if the widget should display a “focus rectangle”

  • Utility function; intended to be connected to the Gtk.Widget.SignalSignatures.delete_event | Gtk.Widget::delete-event signal on a Gtk.Window. The function calls gtk_widget_hide() on its argument, then returns true. If connected to ::delete-event, the result is that clicking the close button for a window (on the window frame, top right corner usually) will hide but not destroy the window. By default, GTK+ destroys windows when ::delete-event is received.

    Returns boolean

    true

  • Creates and initializes child widgets defined in templates. This function must be called in the instance initializer for any class which assigned itself a template using gtk_widget_class_set_template()

    It is important to call this function in the instance initializer of a Gtk.Widget subclass and not in GObject.Object.constructed() or GObject.Object.constructor() for two reasons.

    One reason is that generally derived widgets will assume that parent class composite widgets have been created in their instance initializers.

    Another reason is that when calling g_object_new() on a widget with composite templates, it’s important to build the composite widgets before the construct properties are set. Properties passed to g_object_new() should take precedence over properties set in the private template XML.

    Returns void

  • Inserts new_text_length bytes of new_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.

    Parameters

    • new_text: string

      the text to append

    • new_text_length: number

      the length of the text in bytes, or -1

    • position: number

      location of the position text will be inserted at

    Returns number

  • Whether widget can rely on having its alpha channel drawn correctly. On X11 this function returns whether a compositing manager is running for widget’s screen.

    Please note that the semantics of this call will change in the future if used on a widget that has a composited window in its hierarchy (as set by gdk_window_set_composited()).

    Returns boolean

    true if the widget can rely on its alpha channel being drawn correctly.

  • Determines whether the widget and all its parents are marked as visible.

    This function does not check if the widget is obscured in any way.

    See also gtk_widget_get_visible() and gtk_widget_set_visible()

    Returns boolean

    true if the widget and all its parents are visible

  • This function should be called whenever keyboard navigation within a single widget hits a boundary. The function emits the Gtk.Widget.SignalSignatures.keynav_failed | Gtk.Widget::keynav-failed signal on the widget and its return value should be interpreted in a way similar to the return value of gtk_widget_child_focus():

    When true is returned, stay in the widget, the failed keyboard navigation is OK and/or there is nowhere we can/should move the focus to.

    When false is returned, the caller should continue with keyboard navigation outside the widget, e.g. by calling gtk_widget_child_focus() on the widget’s toplevel.

    The default ::keynav-failed handler returns false for Gtk.DirectionType.TAB_FORWARD and Gtk.DirectionType.TAB_BACKWARD. For the other values of Gtk.DirectionType it returns true.

    Whenever the default handler returns true, it also calls gtk_widget_error_bell() to notify the user of the failed keyboard navigation.

    A use case for providing an own implementation of ::keynav-failed (either by connecting to it or by overriding it) would be a row of Gtk.Entry widgets where the user should be able to navigate the entire row with the cursor keys, as e.g. known from user interfaces that require entering license keys.

    Parameters

    Returns boolean

    true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent container(s).

  • Returns a newly allocated list of the widgets, normally labels, for which this widget is the target of a mnemonic (see for example, gtk_label_set_mnemonic_widget()).

    The widgets in the list are not individually referenced. If you want to iterate through the list and perform actions involving callbacks that might destroy the widgets, you must call g_list_foreach (result, (GFunc)g_object_ref, NULL) first, and then unref all the widgets afterwards.

    Returns Gtk.Widget[]

    the list of mnemonic labels; free this list with g_list_free() when you are done with it.

  • Emits the Gtk.Widget.SignalSignatures.mnemonic_activate | Gtk.Widget::mnemonic-activate signal.

    Parameters

    • group_cycling: boolean

      true if there are other widgets with the same mnemonic

    Returns boolean

    true if the signal has been handled

  • Sets the base color for a widget in a particular state. All other style values are left untouched. The base color is the background color used along with the text color (see gtk_widget_modify_text()) for widgets such as Gtk.Entry and Gtk.TextView. See also gtk_widget_modify_style().

    Note that “no window” widgets (which have the GTK_NO_WINDOW flag set) draw on their parent container’s window and thus may not draw any background themselves. This is the case for e.g. Gtk.Label.

    To modify the background of such widgets, you have to set the base color on their parent; if you want to set the background of a rectangular area around a label, try placing the label in a Gtk.EventBox widget and setting the base color on that.

    Parameters

    • state: Gtk.StateType

      the state for which to set the base color

    • Optionalcolor: Gdk.Color

      the color to assign (does not need to be allocated), or null to undo the effect of previous calls to of gtk_widget_modify_base().

    Returns void

  • Sets the background color for a widget in a particular state.

    All other style values are left untouched. See also gtk_widget_modify_style().

    Note that “no window” widgets (which have the GTK_NO_WINDOW flag set) draw on their parent container’s window and thus may not draw any background themselves. This is the case for e.g. Gtk.Label.

    To modify the background of such widgets, you have to set the background color on their parent; if you want to set the background of a rectangular area around a label, try placing the label in a Gtk.EventBox widget and setting the background color on that.

    Parameters

    • state: Gtk.StateType

      the state for which to set the background color

    • Optionalcolor: Gdk.Color

      the color to assign (does not need to be allocated), or null to undo the effect of previous calls to of gtk_widget_modify_bg().

    Returns void

  • Sets the cursor color to use in a widget, overriding the Gtk.Widget cursor-color and secondary-cursor-color style properties.

    All other style values are left untouched. See also gtk_widget_modify_style().

    Parameters

    • Optionalprimary: Gdk.Color

      the color to use for primary cursor (does not need to be allocated), or null to undo the effect of previous calls to of gtk_widget_modify_cursor().

    • Optionalsecondary: Gdk.Color

      the color to use for secondary cursor (does not need to be allocated), or null to undo the effect of previous calls to of gtk_widget_modify_cursor().

    Returns void

  • Sets the foreground color for a widget in a particular state.

    All other style values are left untouched. See also gtk_widget_modify_style().

    Parameters

    • state: Gtk.StateType

      the state for which to set the foreground color

    • Optionalcolor: Gdk.Color

      the color to assign (does not need to be allocated), or null to undo the effect of previous calls to of gtk_widget_modify_fg().

    Returns void

  • Modifies style values on the widget.

    Modifications made using this technique take precedence over style values set via an RC file, however, they will be overridden if a style is explicitly set on the widget using gtk_widget_set_style(). The Gtk.RcStyle-struct is designed so each field can either be set or unset, so it is possible, using this function, to modify some style values and leave the others unchanged.

    Note that modifications made with this function are not cumulative with previous calls to gtk_widget_modify_style() or with such functions as gtk_widget_modify_fg(). If you wish to retain previous values, you must first call gtk_widget_get_modifier_style(), make your modifications to the returned style, then call gtk_widget_modify_style() with that style. On the other hand, if you first call gtk_widget_modify_style(), subsequent calls to such functions gtk_widget_modify_fg() will have a cumulative effect with the initial modifications.

    Parameters

    Returns void

  • Sets the text color for a widget in a particular state.

    All other style values are left untouched. The text color is the foreground color used along with the base color (see gtk_widget_modify_base()) for widgets such as Gtk.Entry and Gtk.TextView. See also gtk_widget_modify_style().

    Parameters

    • state: Gtk.StateType

      the state for which to set the text color

    • Optionalcolor: Gdk.Color

      the color to assign (does not need to be allocated), or null to undo the effect of previous calls to of gtk_widget_modify_text().

    Returns void

  • Emits a "notify" signal for the property property_name on object.

    When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.

    Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.

    Parameters

    • property_name: string

      the name of a property installed on the class of object.

    Returns void

  • Emits a "notify" signal for the property specified by pspec on object.

    This function omits the property name lookup, hence it is faster than g_object_notify().

    One way to avoid using g_object_notify() from within the class that registered the properties, and using g_object_notify_by_pspec() instead, is to store the GParamSpec used with g_object_class_install_property() inside a static array, e.g.:

      typedef enum
    {
    PROP_FOO = 1,
    PROP_LAST
    } MyObjectProperty;

    static GParamSpec *properties[PROP_LAST];

    static void
    my_object_class_init (MyObjectClass *klass)
    {
    properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
    0, 100,
    50,
    G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
    g_object_class_install_property (gobject_class,
    PROP_FOO,
    properties[PROP_FOO]);
    }

    and then notify a change on the "foo" property with:

      g_object_notify_by_pspec (self, properties[PROP_FOO]);
    

    Parameters

    Returns void

  • Sets the color to use for a widget.

    All other style values are left untouched.

    This function does not act recursively. Setting the color of a container does not affect its children. Note that some widgets that you may not think of as containers, for instance GtkButtons, are actually containers.

    This API is mostly meant as a quick way for applications to change a widget appearance. If you are developing a widgets library and intend this change to be themeable, it is better done by setting meaningful CSS classes in your widget/container implementation through gtk_style_context_add_class().

    This way, your widget library can install a Gtk.CssProvider with the GTK_STYLE_PROVIDER_PRIORITY_FALLBACK priority in order to provide a default styling for those widgets that need so, and this theming may fully overridden by the user’s theme.

    Note that for complex widgets this may bring in undesired results (such as uniform background color everywhere), in these cases it is better to fully style such widgets through a Gtk.CssProvider with the GTK_STYLE_PROVIDER_PRIORITY_APPLICATION priority.

    Parameters

    • state: Gtk.StateFlags

      the state for which to set the color

    • Optionalcolor: Gdk.RGBA

      the color to assign, or null to undo the effect of previous calls to gtk_widget_override_color()

    Returns void

  • Sets the cursor color to use in a widget, overriding the cursor-color and secondary-cursor-color style properties. All other style values are left untouched. See also gtk_widget_modify_style().

    Note that the underlying properties have the Gdk.Color type, so the alpha value in primary and secondary will be ignored.

    Parameters

    • Optionalcursor: Gdk.RGBA

      the color to use for primary cursor (does not need to be allocated), or null to undo the effect of previous calls to of gtk_widget_override_cursor().

    • Optionalsecondary_cursor: Gdk.RGBA

      the color to use for secondary cursor (does not need to be allocated), or null to undo the effect of previous calls to of gtk_widget_override_cursor().

    Returns void

  • Sets a symbolic color for a widget.

    All other style values are left untouched. See gtk_widget_override_color() for overriding the foreground or background color.

    Parameters

    • name: string

      the name of the symbolic color to modify

    • Optionalcolor: Gdk.RGBA

      the color to assign (does not need to be allocated), or null to undo the effect of previous calls to gtk_widget_override_symbolic_color()

    Returns void

  • Obtains the full path to widget. The path is simply the name of a widget and all its parents in the container hierarchy, separated by periods. The name of a widget comes from gtk_widget_get_name(). Paths are used to apply styles to a widget in gtkrc configuration files. Widget names are the type of the widget by default (e.g. “GtkButton”) or can be set to an application-specific value with gtk_widget_set_name(). By setting the name of a widget, you allow users or theme authors to apply styles to that specific widget in their gtkrc file. path_reversed_p fills in the path in reverse order, i.e. starting with widget’s name instead of starting with the name of widget’s outermost ancestor.

    Returns [number, string, string]

  • This function is only for use in widget implementations.

    Flags the widget for a rerun of the GtkWidgetClass::size_allocate function. Use this function instead of gtk_widget_queue_resize() when the widget's size request didn't change but it wants to reposition its contents.

    An example user of this function is gtk_widget_set_halign().

    Returns void

  • Convenience function that calls gtk_widget_queue_draw_region() on the region created from the given coordinates.

    The region here is specified in widget coordinates. Widget coordinates are a bit odd; for historical reasons, they are defined as widget->window coordinates for widgets that return true for gtk_widget_get_has_window(), and are relative to widget->allocation.x, widget->allocation.y otherwise.

    width or height may be 0, in this case this function does nothing. Negative values for width and height are not allowed.

    Parameters

    • x: number

      x coordinate of upper-left corner of rectangle to redraw

    • y: number

      y coordinate of upper-left corner of rectangle to redraw

    • width: number

      width of region to draw

    • height: number

      height of region to draw

    Returns void

  • Invalidates the area of widget defined by region by calling gdk_window_invalidate_region() on the widget’s window and all its child windows. Once the main loop becomes idle (after the current batch of events has been processed, roughly), the window will receive expose events for the union of all regions that have been invalidated.

    Normally you would only use this function in widget implementations. You might also use it to schedule a redraw of a Gtk.DrawingArea or some portion thereof.

    Parameters

    Returns void

  • This function is only for use in widget implementations. Flags a widget to have its size renegotiated; should be called when a widget for some reason has a new size request. For example, when you change the text in a Gtk.Label, Gtk.Label queues a resize to ensure there’s enough space for the new text.

    Note that you cannot call gtk_widget_queue_resize() on a widget from inside its implementation of the GtkWidgetClass::size_allocate virtual method. Calls to gtk_widget_queue_resize() from inside GtkWidgetClass::size_allocate will be silently ignored.

    Returns void

  • Creates the GDK (windowing system) resources associated with a widget. For example, widget->window will be created when a widget is realized. Normally realization happens implicitly; if you show a widget and all its parent containers, then the widget will be realized and mapped automatically.

    Realizing a widget requires all the widget’s parent widgets to be realized; calling gtk_widget_realize() realizes the widget’s parents in addition to widget itself. If a widget is not yet inside a toplevel window when you realize it, bad things will happen.

    This function is primarily used in widget implementations, and isn’t very useful otherwise. Many times when you think you might need it, a better approach is to connect to a signal that will be called after the widget is realized automatically, such as Gtk.Widget::draw. Or simply g_signal_connect () to the Gtk.Widget::realize signal.

    Returns void

  • Increases the reference count of object.

    Since GLib 2.56, if GLIB_VERSION_MAX_ALLOWED is 2.56 or greater, the type of object will be propagated to the return type (using the GCC typeof() extension), so any casting the caller needs to do on the return type must be explicit.

    Returns GObject.Object

    the same object

  • Increase the reference count of object, and possibly remove the [floating][floating-ref] reference, if object has a floating reference.

    In other words, if the object is floating, then this call "assumes ownership" of the floating reference, converting it to a normal reference by clearing the floating flag while leaving the reference count unchanged. If the object is not floating, then this call adds a new normal reference increasing the reference count by one.

    Since GLib 2.56, the type of object will be propagated to the return type under the same conditions as for g_object_ref().

    Returns GObject.Object

    object

  • Registers a Gdk.Window with the widget and sets it up so that the widget receives events for it. Call gtk_widget_unregister_window() when destroying the window.

    Before 3.8 you needed to call gdk_window_set_user_data() directly to set this up. This is now deprecated and you should use gtk_widget_register_window() instead. Old code will keep working as is, although some new features like transparency might not work perfectly.

    Parameters

    Returns void

  • A convenience function that uses the theme settings for widget to look up stock_id and render it to a pixbuf. stock_id should be a stock icon ID such as #GTK_STOCK_OPEN or #GTK_STOCK_OK. size should be a size such as #GTK_ICON_SIZE_MENU. detail should be a string that identifies the widget or code doing the rendering, so that theme engines can special-case rendering for that widget or code.

    The pixels in the returned GdkPixbuf.Pixbuf are shared with the rest of the application and should not be modified. The pixbuf should be freed after use with g_object_unref().

    Parameters

    • stock_id: string

      a stock ID

    • size: number

      a stock size (Gtk.IconSize). A size of (GtkIconSize)-1 means render at the size of the source and don’t scale (if there are multiple source sizes, GTK+ picks one of the available sizes).

    • Optionaldetail: string

      render detail to pass to theme engine

    Returns GdkPixbuf.Pixbuf

    a new pixbuf, or null if the stock ID wasn’t known

  • A convenience function that uses the theme engine and style settings for widget to look up stock_id and render it to a pixbuf. stock_id should be a stock icon ID such as #GTK_STOCK_OPEN or #GTK_STOCK_OK. size should be a size such as #GTK_ICON_SIZE_MENU.

    The pixels in the returned GdkPixbuf.Pixbuf are shared with the rest of the application and should not be modified. The pixbuf should be freed after use with g_object_unref().

    Parameters

    • stock_id: string

      a stock ID

    • size: number

      a stock size (Gtk.IconSize). A size of (GtkIconSize)-1 means render at the size of the source and don’t scale (if there are multiple source sizes, GTK+ picks one of the available sizes).

    Returns GdkPixbuf.Pixbuf

    a new pixbuf, or null if the stock ID wasn’t known

  • Updates the style context of widget and all descendants by updating its widget path. GtkContainers may want to use this on a child when reordering it in a way that a different style might apply to it. See also gtk_container_get_path_for_child().

    Returns void

  • Selects 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.

    Parameters

    • start_pos: number

      start of region

    • end_pos: number

      end of region

    Returns void

  • Very rarely-used function. This function is used to emit an expose event on a widget. This function is not normally used directly. The only time it is used is when propagating an expose event to a windowless child widget (gtk_widget_get_has_window() is false), and that is normally done using gtk_container_propagate_draw().

    If you want to force an area of a window to be redrawn, use gdk_window_invalidate_rect() or gdk_window_invalidate_region(). To cause the redraw to be done immediately, follow that call with a call to gdk_window_process_updates().

    Parameters

    Returns number

    return from the event signal emission (true if the event was handled)

  • Sends the focus change event to widget

    This function is not meant to be used by applications. The only time it should be used is when it is necessary for a Gtk.Widget to assign focus to a widget that is semantically owned by the first widget even though it’s not a direct child - for instance, a search entry in a floating window similar to the quick search in Gtk.TreeView.

    An example of its usage is:

      GdkEvent *fevent = gdk_event_new (GDK_FOCUS_CHANGE);

    fevent->focus_change.type = GDK_FOCUS_CHANGE;
    fevent->focus_change.in = TRUE;
    fevent->focus_change.window = _gtk_widget_get_window (widget);
    if (fevent->focus_change.window != NULL)
    g_object_ref (fevent->focus_change.window);

    gtk_widget_send_focus_change (widget, fevent);

    gdk_event_free (event);

    Parameters

    Returns boolean

    the return value from the event signal emission: true if the event was handled, and false otherwise

  • Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.

    Parameters

    • properties: { [key: string]: any }

      Object containing the properties to set

    Returns void

  • Given an accelerator group, accel_group, and an accelerator path, accel_path, sets up an accelerator in accel_group so whenever the key binding that is defined for accel_path is pressed, widget will be activated. This removes any accelerators (for any accelerator group) installed by previous calls to gtk_widget_set_accel_path(). Associating accelerators with paths allows them to be modified by the user and the modifications to be saved for future use. (See gtk_accel_map_save().)

    This function is a low level function that would most likely be used by a menu creation system like Gtk.UIManager. If you use Gtk.UIManager, setting up accelerator paths will be done automatically.

    Even when you you aren’t using Gtk.UIManager, if you only want to set up accelerators on menu items gtk_menu_item_set_accel_path() provides a somewhat more convenient interface.

    Note that accel_path string will be stored in a GLib.Quark. Therefore, if you pass a static string, you can save some memory by interning it first with g_intern_static_string().

    Parameters

    Returns void

  • Sets the widget’s allocation. This should not be used directly, but from within a widget’s size_allocate method.

    The allocation set should be the “adjusted” or actual allocation. If you’re implementing a Gtk.Container, you want to use gtk_widget_size_allocate() instead of gtk_widget_set_allocation(). The GtkWidgetClass::adjust_size_allocation virtual method adjusts the allocation inside gtk_widget_size_allocate() to create an adjusted allocation.

    Parameters

    Returns void

  • Sets whether the application intends to draw on the widget in an Gtk.Widget::draw handler.

    This is a hint to the widget and does not affect the behavior of the GTK+ core; many widgets ignore this flag entirely. For widgets that do pay attention to the flag, such as Gtk.EventBox and Gtk.Window, the effect is to suppress default themed drawing of the widget's background. (Children of the widget will still be drawn.) The application is then entirely responsible for drawing the widget background.

    Note that the background is still drawn when the widget is mapped.

    Parameters

    • app_paintable: boolean

      true if the application will paint on the widget

    Returns void

  • Specifies whether widget can be a default widget. See gtk_widget_grab_default() for details about the meaning of “default”.

    Parameters

    • can_default: boolean

      whether or not widget can be a default widget.

    Returns void

  • Specifies whether widget can own the input focus. See gtk_widget_grab_focus() for actually setting the input focus on a widget.

    Parameters

    • can_focus: boolean

      whether or not widget can own the input focus.

    Returns void

  • Sets whether widget should be mapped along with its when its parent is mapped and widget has been shown with gtk_widget_show().

    The child visibility can be set for widget before it is added to a container with gtk_widget_set_parent(), to avoid mapping children unnecessary before immediately unmapping them. However it will be reset to its default state of true when the widget is removed from a container.

    Note that changing the child visibility of a widget does not queue a resize on the widget. Most of the time, the size of a widget is computed from all visible children, whether or not they are mapped. If this is not the case, the container can queue a resize itself.

    This function is only useful for container implementations and never should be called by an application.

    Parameters

    • is_visible: boolean

      if true, widget should be mapped along with its parent.

    Returns void

  • Sets the widget’s clip. This must not be used directly, but from within a widget’s size_allocate method. It must be called after gtk_widget_set_allocation() (or after chaining up to the parent class), because that function resets the clip.

    The clip set should be the area that widget draws on. If widget is a Gtk.Container, the area must contain all children's clips.

    If this function is not called by widget during a ::size-allocate handler, the clip will be set to widget's allocation.

    Parameters

    Returns void

  • Each object carries around a table of associations from strings to pointers. This function lets you set an association.

    If the object already had an association with that name, the old association will be destroyed.

    Internally, the key is converted to a GLib.Quark using g_quark_from_string(). This means a copy of key is kept permanently (even after object has been finalized) — so it is recommended to only use a small, bounded set of values for key in your program, to avoid the GLib.Quark storage growing unbounded.

    Parameters

    • key: string

      name of the key

    • Optionaldata: any

      data to associate with that key

    Returns void

  • Sets the device event mask (see Gdk.EventMask) for a widget. The event mask determines which events a widget will receive from device. Keep in mind that different widgets have different default event masks, and by changing the event mask you may disrupt a widget’s functionality, so be careful. This function must be called while a widget is unrealized. Consider gtk_widget_add_device_events() for widgets that are already realized, or if you want to preserve the existing event mask. This function can’t be used with windowless widgets (which return false from gtk_widget_get_has_window()); to get events on those widgets, place them inside a Gtk.EventBox and receive events on the event box.

    Parameters

    Returns void

  • Set the precision to be displayed by spin_button. Up to 20 digit precision is allowed.

    Parameters

    • digits: number

      the number of digits after the decimal point to be displayed for the spin button’s value

    Returns void

  • Sets the reading direction on a particular widget. This direction controls the primary direction for widgets containing text, and also the direction in which the children of a container are packed. The ability to set the direction is present in order so that correct localization into languages with right-to-left reading directions can be done. Generally, applications will let the default reading direction present, except for containers where the containers are arranged in an order that is explicitly visual rather than logical (such as buttons for text justification).

    If the direction is set to Gtk.TextDirection.NONE, then the value set by gtk_widget_set_default_direction() will be used.

    Parameters

    Returns void

  • Widgets are double buffered by default; you can use this function to turn off the buffering. “Double buffered” simply means that gdk_window_begin_draw_frame() and gdk_window_end_draw_frame() are called automatically around expose events sent to the widget. gdk_window_begin_draw_frame() diverts all drawing to a widget's window to an offscreen buffer, and gdk_window_end_draw_frame() draws the buffer to the screen. The result is that users see the window update in one smooth step, and don’t see individual graphics primitives being rendered.

    In very simple terms, double buffered widgets don’t flicker, so you would only use this function to turn off double buffering if you had special needs and really knew what you were doing.

    Note: if you turn off double-buffering, you have to handle expose events, since even the clearing to the background color or pixmap will not happen automatically (as it is done in gdk_window_begin_draw_frame()).

    In 3.10 GTK and GDK have been restructured for translucent drawing. Since then expose events for double-buffered widgets are culled into a single event to the toplevel GDK window. If you now unset double buffering, you will cause a separate rendering pass for every widget. This will likely cause rendering problems - in particular related to stacking - and usually increases rendering times significantly.

    Parameters

    • double_buffered: boolean

      true to double-buffer a widget

    Returns void

  • Sets the event mask (see Gdk.EventMask) for a widget. The event mask determines which events a widget will receive. Keep in mind that different widgets have different default event masks, and by changing the event mask you may disrupt a widget’s functionality, so be careful. This function must be called while a widget is unrealized. Consider gtk_widget_add_events() for widgets that are already realized, or if you want to preserve the existing event mask. This function can’t be used with widgets that have no window. (See gtk_widget_get_has_window()). To get events on those widgets, place them inside a Gtk.EventBox and receive events on the event box.

    Parameters

    • events: number

      event mask

    Returns void

  • Sets whether the widget should grab focus when it is clicked with the mouse. Making mouse clicks not grab focus is useful in places like toolbars where you don’t want the keyboard focus removed from the main area of the application.

    Parameters

    • focus_on_click: boolean

      whether the widget should grab focus when clicked with the mouse

    Returns void

  • Specifies whether widget has a Gdk.Window of its own. Note that all realized widgets have a non-null “window” pointer (gtk_widget_get_window() never returns a null window when a widget is realized), but for many of them it’s actually the Gdk.Window of one of its parent widgets. Widgets that do not create a %window for themselves in Gtk.Widget::realize must announce this by calling this function with has_window = false.

    This function should only be called by widget implementations, and they should call it in their init() function.

    Parameters

    • has_window: boolean

      whether or not widget has a window.

    Returns void

  • Sets whether the widget would like any available extra horizontal space. When a user resizes a Gtk.Window, widgets with expand=TRUE generally receive the extra space. For example, a list or scrollable area or document in your window would often be set to expand.

    Call this function to set the expand flag if you would like your widget to become larger horizontally when the window has extra room.

    By default, widgets automatically expand if any of their children want to expand. (To see if a widget will automatically expand given its current children and state, call gtk_widget_compute_expand(). A container can decide how the expandability of children affects the expansion of the container by overriding the compute_expand virtual method on Gtk.Widget.).

    Setting hexpand explicitly with this function will override the automatic expand behavior.

    This function forces the widget to expand or not to expand, regardless of children. The override occurs because gtk_widget_set_hexpand() sets the hexpand-set property (see gtk_widget_set_hexpand_set()) which causes the widget’s hexpand value to be used, rather than looking at children and widget state.

    Parameters

    • expand: boolean

      whether to expand

    Returns void

  • Sets whether the hexpand flag (see gtk_widget_get_hexpand()) will be used.

    The hexpand-set property will be set automatically when you call gtk_widget_set_hexpand() to set hexpand, so the most likely reason to use this function would be to unset an explicit expand flag.

    If hexpand is set, then it overrides any computed expand value based on child widgets. If hexpand is not set, then the expand value depends on whether any children of the widget would like to expand.

    There are few reasons to use this function, but it’s here for completeness and consistency.

    Parameters

    • set: boolean

      value for hexpand-set property

    Returns void

  • Sets the step and page increments for spin_button. This affects how quickly the value changes when the spin button’s arrows are activated.

    Parameters

    • step: number

      increment applied for a button 1 press.

    • page: number

      increment applied for a button 2 press.

    Returns void

  • Marks the widget as being mapped.

    This function should only ever be called in a derived widget's “map” or “unmap” implementation.

    Parameters

    • mapped: boolean

      true to mark the widget as mapped

    Returns void

  • Widgets can be named, which allows you to refer to them from a CSS file. You can apply a style to widgets with a particular name in the CSS file. See the documentation for the CSS syntax (on the same page as the docs for Gtk.StyleContext).

    Note that the CSS syntax has certain special characters to delimit and represent elements in a selector (period, #, >, *...), so using these will make your widget impossible to match by name. Any combination of alphanumeric symbols, dashes and underscores will suffice.

    Parameters

    • name: string

      name for the widget

    Returns void

  • Sets the flag that determines if non-numeric text can be typed into the spin button.

    Parameters

    • numeric: boolean

      flag indicating if only numeric entry is allowed

    Returns void

  • Request the widget to be rendered partially transparent, with opacity 0 being fully transparent and 1 fully opaque. (Opacity values are clamped to the [0,1] range.). This works on both toplevel widget, and child widgets, although there are some limitations:

    For toplevel widgets this depends on the capabilities of the windowing system. On X11 this has any effect only on X screens with a compositing manager running. See gtk_widget_is_composited(). On Windows it should work always, although setting a window’s opacity after the window has been shown causes it to flicker once on Windows.

    For child widgets it doesn’t work if any affected widget has a native window, or disables double buffering.

    Parameters

    • opacity: number

      desired opacity, between 0 and 1

    Returns void

  • This function is useful only when implementing subclasses of Gtk.Container. Sets the container as the parent of widget, and takes care of some details such as updating the state and style of the child to reflect its new location. The opposite function is gtk_widget_unparent().

    Parameters

    Returns void

  • Sets 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.

    Parameters

    • position: number

      the position of the cursor

    Returns void

  • Sets the minimum and maximum allowable values for spin_button.

    If the current value is outside this range, it will be adjusted to fit within the range, otherwise it will remain unchanged.

    Parameters

    • min: number

      minimum allowable value

    • max: number

      maximum allowable value

    Returns void

  • Marks the widget as being realized. This function must only be called after all GdkWindows for the widget have been created and registered.

    This function should only ever be called in a derived widget's “realize” or “unrealize” implementation.

    Parameters

    • realized: boolean

      true to mark the widget as realized

    Returns void

  • Specifies whether widget will be treated as the default widget within its toplevel when it has the focus, even if another widget is the default.

    See gtk_widget_grab_default() for details about the meaning of “default”.

    Parameters

    • receives_default: boolean

      whether or not widget can be a default widget.

    Returns void

  • Sets whether the entire widget is queued for drawing when its size allocation changes. By default, this setting is true and the entire widget is redrawn on every size change. If your widget leaves the upper left unchanged when made bigger, turning this setting off will improve performance.

    Note that for widgets where gtk_widget_get_has_window() is false setting this flag to false turns off all allocation on resizing: the widget will not even redraw if its position changes; this is to allow containers that don’t draw anything to avoid excess invalidations. If you set this flag on a widget with no window that does draw on widget->window, you are responsible for invalidating both the old and new allocation of the widget when the widget is moved and responsible for invalidating regions newly when the widget increases size.

    Parameters

    • redraw_on_allocate: boolean

      if true, the entire widget will be redrawn when it is allocated to a new size. Otherwise, only the new portion of the widget will be redrawn.

    Returns void

  • Sets the sensitivity of a widget. A widget is sensitive if the user can interact with it. Insensitive widgets are “grayed out” and the user can’t interact with them. Insensitive widgets are known as “inactive”, “disabled”, or “ghosted” in some other toolkits.

    Parameters

    • sensitive: boolean

      true to make the widget sensitive

    Returns void

  • Sets the minimum size of a widget; that is, the widget’s size request will be at least width by height. You can use this function to force a widget to be larger than it normally would be.

    In most cases, gtk_window_set_default_size() is a better choice for toplevel windows than this function; setting the default size will still allow users to shrink the window. Setting the size request will force them to leave the window at least as large as the size request. When dealing with window sizes, gtk_window_set_geometry_hints() can be a useful function as well.

    Note the inherent danger of setting any fixed size - themes, translations into other languages, different fonts, and user action can all change the appropriate size for a given widget. So, it's basically impossible to hardcode a size that will always be correct.

    The size request of a widget is the smallest size a widget can accept while still functioning well and drawing itself correctly. However in some strange cases a widget may be allocated less than its requested size, and in many cases a widget may be allocated more space than it requested.

    If the size request in a given direction is -1 (unset), then the “natural” size request of the widget will be used instead.

    The size request set here does not include any margin from the Gtk.Widget properties margin-left, margin-right, margin-top, and margin-bottom, but it does include pretty much all other padding or border properties set by any subclass of Gtk.Widget.

    Parameters

    • width: number

      width widget should request, or -1 to unset

    • height: number

      height widget should request, or -1 to unset

    Returns void

  • Sets the policy as to whether values are corrected to the nearest step increment when a spin button is activated after providing an invalid value.

    Parameters

    • snap_to_ticks: boolean

      a flag indicating if invalid values should be corrected

    Returns void

  • Enables or disables multiple pointer awareness. If this setting is true, widget will start receiving multiple, per device enter/leave events. Note that if custom GdkWindows are created in Gtk.Widget::realize, gdk_window_set_support_multidevice() will have to be called manually on them.

    Parameters

    • support_multidevice: boolean

      true to support input from multiple devices.

    Returns void

  • Sets markup as the contents of the tooltip, which is marked up with the [Pango text markup language][PangoMarkupFormat].

    This function will take care of setting Gtk.Widget.has_tooltip to true and of the default handler for the Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip signal.

    See also the Gtk.Widget.tooltip_markup property and gtk_tooltip_set_markup().

    Parameters

    • Optionalmarkup: string

      the contents of the tooltip for widget, or null

    Returns void

  • Sets the value of spin_button.

    Parameters

    • value: number

      the new value

    Returns void

  • Sets the visibility state of widget. Note that setting this to true doesn’t mean the widget is actually viewable, see gtk_widget_get_visible().

    This function simply calls gtk_widget_show() or gtk_widget_hide() but is nicer to use when the visibility of the widget depends on some condition.

    Parameters

    • visible: boolean

      whether the widget should be shown or not

    Returns void

  • Sets the visual that should be used for by widget and its children for creating GdkWindows. The visual must be on the same Gdk.Screen as returned by gtk_widget_get_screen(), so handling the Gtk.Widget.SignalSignatures.screen_changed | Gtk.Widget::screen-changed signal is necessary.

    Setting a new visual will not cause widget to recreate its windows, so you should call this function before widget is realized.

    Parameters

    • Optionalvisual: Gdk.Visual

      visual to be used or null to unset a previous one

    Returns void

  • Sets a widget’s window. This function should only be used in a widget’s Gtk.Widget::realize implementation. The %window passed is usually either new window created with gdk_window_new(), or the window of its parent widget as returned by gtk_widget_get_parent_window().

    Widgets must indicate whether they will create their own Gdk.Window by calling gtk_widget_set_has_window(). This is usually done in the widget’s init() function.

    Note that this function does not add any reference to window.

    Parameters

    Returns void

  • Sets the flag that determines if a spin button value wraps around to the opposite limit when the upper or lower limit of the range is exceeded.

    Parameters

    • wrap: boolean

      a flag indicating if wrapping behavior is performed

    Returns void

  • Flags a widget to be displayed. Any widget that isn’t shown will not appear on the screen. If you want to show all the widgets in a container, it’s easier to call gtk_widget_show_all() on the container, instead of individually showing the widgets.

    Remember that you have to show the containers containing a widget, in addition to the widget itself, before it will appear onscreen.

    When a toplevel container is shown, it is immediately realized and mapped; other shown widgets are realized and mapped when their toplevel container is realized and mapped.

    Returns void

  • Shows a widget. If the widget is an unmapped toplevel widget (i.e. a Gtk.Window that has not yet been shown), enter the main loop and wait for the window to actually be mapped. Be careful; because the main loop is running, anything can happen during this function.

    Returns void

  • This function is only used by Gtk.Container subclasses, to assign a size and position to their child widgets.

    In this function, the allocation may be adjusted. It will be forced to a 1x1 minimum size, and the adjust_size_allocation virtual method on the child will be used to adjust the allocation. Standard adjustments include removing the widget’s margins, and applying the widget’s Gtk.Widget.halign and Gtk.Widget.valign properties.

    For baseline support in containers you need to use gtk_widget_size_allocate_with_baseline() instead.

    Parameters

    • allocation: Gdk.Rectangle

      position and size to be allocated to widget

    Returns void

  • This function is only used by Gtk.Container subclasses, to assign a size, position and (optionally) baseline to their child widgets.

    In this function, the allocation and baseline may be adjusted. It will be forced to a 1x1 minimum size, and the adjust_size_allocation virtual and adjust_baseline_allocation methods on the child will be used to adjust the allocation and baseline. Standard adjustments include removing the widget's margins, and applying the widget’s Gtk.Widget.halign and Gtk.Widget.valign properties.

    If the child widget does not have a valign of Gtk.Align.BASELINE the baseline argument is ignored and -1 is used instead.

    Parameters

    • allocation: Gdk.Rectangle

      position and size to be allocated to widget

    • baseline: number

      The baseline of the child, or -1

    Returns void

  • This function is typically used when implementing a Gtk.Container subclass. Obtains the preferred size of a widget. The container uses this information to arrange its child widgets and decide what size allocations to give them with gtk_widget_size_allocate().

    You can also call this function from an application, with some caveats. Most notably, getting a size request requires the widget to be associated with a screen, because font information may be needed. Multihead-aware applications should keep this in mind.

    Also remember that the size request is not necessarily the size a widget will actually be allocated.

    Returns Gtk.Requisition

  • Increment or decrement a spin button’s value in a specified direction by a specified amount.

    Parameters

    • direction: Gtk.SpinType

      a Gtk.SpinType indicating the direction to spin

    • increment: number

      step increment to apply in the specified direction

    Returns void

  • Begins editing on a cell_editable.

    The Gtk.CellRenderer for the cell creates and returns a Gtk.CellEditable from gtk_cell_renderer_start_editing(), configured for the Gtk.CellRenderer type.

    gtk_cell_editable_start_editing() can then set up cell_editable suitably for editing a cell, e.g. making the Esc key emit Gtk.CellEditable.SignalSignatures.editing_done | Gtk.CellEditable::editing-done.

    Note that the cell_editable is created on-demand for the current edit; its lifetime is temporary and does not persist across other edits and/or cells.

    Parameters

    • Optionalevent: Gdk.Event

      The Gdk.Event that began the editing process, or null if editing was initiated programmatically

    Returns void

  • Remove a specified datum from the object's data associations, without invoking the association's destroy handler.

    Parameters

    • key: string

      name of the key

    Returns any

    the data if found, or null if no such data exists.

  • This function gets back user data pointers stored via g_object_set_qdata() and removes the data from object without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier, for example:

    void
    object_add_to_user_list (GObject *object,
    const gchar *new_string)
    {
    // the quark, naming the object data
    GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
    // retrieve the old string list
    GList *list = g_object_steal_qdata (object, quark_string_list);

    // prepend new string
    list = g_list_prepend (list, g_strdup (new_string));
    // this changed 'list', so we need to set it again
    g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
    }
    static void
    free_string_list (gpointer data)
    {
    GList *node, *list = data;

    for (node = list; node; node = node->next)
    g_free (node->data);
    g_list_free (list);
    }

    Using g_object_get_qdata() in the above example, instead of g_object_steal_qdata() would have left the destroy function set, and thus the partial string list would have been freed upon g_object_set_qdata_full().

    Parameters

    • quark: number

      A GLib.Quark, naming the user data pointer

    Returns any

    The user data pointer set, or null

  • This function attaches the widget’s Gtk.Style to the widget's Gdk.Window. It is a replacement for

    widget->style = gtk_style_attach (widget->style, widget->window);
    

    and should only ever be called in a derived widget’s “realize” implementation which does not chain up to its parent class' “realize” implementation, because one of the parent classes (finally Gtk.Widget) would attach the style itself.

    Returns void

  • Reverts the effect of a previous call to g_object_freeze_notify(). The freeze count is decreased on object and when it reaches zero, queued "notify" signals are emitted.

    Duplicate notifications for each property are squashed so that at most one GObject.Object::notify signal is emitted for each property, in the reverse order in which they have been queued.

    It is an error to call this function when the freeze count is zero.

    Returns void

  • Translate coordinates relative to src_widget’s allocation to coordinates relative to dest_widget’s allocations. In order to perform this operation, both widgets must be realized, and must share a common toplevel.

    Parameters

    • dest_widget: Gtk.Widget
    • src_x: number

      X position relative to src_widget

    • src_y: number

      Y position relative to src_widget

    Returns [boolean, number, number]

    false if either widget was not realized, or there was no common ancestor. In this case, nothing is stored in *dest_x and *dest_y. Otherwise true.

  • Decreases the reference count of object. When its reference count drops to 0, the object is finalized (i.e. its memory is freed).

    If the pointer to the GObject.Object may be reused in future (for example, if it is an instance variable of another object), it is recommended to clear the pointer to null rather than retain a dangling pointer to a potentially invalid GObject.Object instance. Use g_clear_object() for this.

    Returns void

  • Convert an initial size allocation assigned by a Gtk.Container using gtk_widget_size_allocate(), into an actual size allocation to be used by the widget. adjust_size_allocation adjusts to a child widget’s actual allocation from what a parent container computed for the child. The adjusted allocation must be entirely within the original allocation. In any custom implementation, chain up to the default Gtk.Widget implementation of this method, which applies the margin and alignment properties of Gtk.Widget. Chain up before performing your own adjustments so your own adjustments remove more allocation after the Gtk.Widget base class has already removed margin and alignment. The natural size passed in should be adjusted in the same way as the allocated size, which allows adjustments to perform alignments or other changes based on natural size.

    Parameters

    • orientation: Gtk.Orientation
    • minimum_size: number
    • natural_size: number
    • allocated_pos: number
    • allocated_size: number

    Returns void

  • Convert an initial size request from a widget's Gtk.SizeRequestMode virtual method implementations into a size request to be used by parent containers in laying out the widget. adjust_size_request adjusts from a child widget's original request to what a parent container should use for layout. The for_size argument will be -1 if the request should not be for a particular size in the opposing orientation, i.e. if the request is not height-for-width or width-for-height. If for_size is greater than -1, it is the proposed allocation in the opposing orientation that we need the request for. Implementations of adjust_size_request should chain up to the default implementation, which applies Gtk.Widget’s margin properties and imposes any values from gtk_widget_set_size_request(). Chaining up should be last, after your subclass adjusts the request, so Gtk.Widget can apply constraints and add the margin properly.

    Parameters

    Returns void

  • Determines whether an accelerator that activates the signal identified by signal_id can currently be activated. This is done by emitting the Gtk.Widget.SignalSignatures.can_activate_accel | Gtk.Widget::can-activate-accel signal on widget; if the signal isn’t overridden by a handler or in a derived widget, then the default check is that the widget must be sensitive, and the widget and all its ancestors mapped.

    Parameters

    • signal_id: number

      the ID of a signal installed on widget

    Returns boolean

  • Emits a Gtk.Widget.SignalSignatures.child_notify | Gtk.Widget::child-notify signal for the [child property][child-properties] child_property on widget.

    This is the analogue of g_object_notify() for child properties.

    Also see gtk_container_child_notify().

    Parameters

    • child_property: GObject.ParamSpec

      the name of a child property installed on the class of widget’s parent

    Returns void

  • the constructed function is called by g_object_new() as the final step of the object creation process. At the point of the call, all construction properties have been set on the object. The purpose of this call is to allow for object initialisation steps that can only be performed after construction properties have been set. constructed implementors should chain up to the constructed call of their parent class to allow it to complete its initialisation.

    Returns void

  • Deletes 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.

    Parameters

    • start_pos: number

      start position

    • end_pos: number

      end position

    Returns void

  • Destroys a widget.

    When a widget is destroyed all references it holds on other objects will be released:

    • if the widget is inside a container, it will be removed from its parent
    • if the widget is a container, all its children will be destroyed, recursively
    • if the widget is a top level, it will be removed from the list of top level widgets that GTK+ maintains internally

    It's expected that all references held on the widget will also be released; you should connect to the Gtk.Widget::destroy signal if you hold a reference to widget and you wish to remove it when this function is called. It is not necessary to do so if you are implementing a Gtk.Container, as you'll be able to use the Gtk.ContainerClass.remove() virtual function for that.

    It's important to notice that gtk_widget_destroy() will only cause the widget to be finalized if no additional references, acquired using g_object_ref(), are held on it. In case additional references are in place, the widget will be in an "inert" state after calling this function; widget will still point to valid memory, allowing you to release the references you hold, but you may not query the widget's own state.

    You should typically call this function on top level widgets, and rarely on child widgets.

    See also: gtk_container_remove()

    Returns void

  • the dispose function is supposed to drop all references to other objects, but keep the instance otherwise intact, so that client method invocations still work. It may be run multiple times (due to reference loops). Before returning, dispose should chain up to the dispose method of the parent class.

    Returns void

  • Deletes 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.

    Parameters

    • start_pos: number

      start position

    • end_pos: number

      end position

    Returns void

  • Inserts new_text_length bytes of new_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.

    Parameters

    • new_text: string

      the text to append

    • new_text_length: number

      the length of the text in bytes, or -1

    • position: number

      location of the position text will be inserted at

    Returns number

  • Rarely-used function. This function is used to emit the event signals on a widget (those signals should never be emitted without using this function to do so). If you want to synthesize an event though, don’t use this function; instead, use gtk_main_do_event() so the event will behave as if it were in the event queue. Don’t synthesize expose events; instead, use gdk_window_invalidate_rect() to invalidate a region of the window.

    Parameters

    Returns boolean

  • Returns the accessible object that describes the widget to an assistive technology.

    If accessibility support is not available, this Atk.Object instance may be a no-op. Likewise, if no class-specific Atk.Object implementation is available for the widget instance in question, it will inherit an Atk.Object implementation from the first ancestor class for which such an implementation is defined.

    The documentation of the ATK library contains more information about accessible objects and their uses.

    Returns Atk.Object

  • Retrieves 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.

    Parameters

    • start_pos: number

      start of text

    • end_pos: number

      end of text

    Returns string

  • Retrieves a widget’s initial minimum and natural height.

    This call is specific to width-for-height requests.

    The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

    Returns [number, number]

  • Retrieves a widget’s minimum and natural height and the corresponding baselines if it would be given the specified width, or the default height if width is -1. The baselines may be -1 which means that no baseline is requested for this widget.

    The returned request will be modified by the GtkWidgetClass::adjust_size_request and GtkWidgetClass::adjust_baseline_request virtual methods and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

    Parameters

    • width: number

      the width which is available for allocation, or -1 if none

    Returns [number, number, number, number]

  • Retrieves a widget’s minimum and natural height if it would be given the specified width.

    The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

    Parameters

    • width: number

      the width which is available for allocation

    Returns [number, number]

  • Retrieves a widget’s initial minimum and natural width.

    This call is specific to height-for-width requests.

    The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

    Returns [number, number]

  • Retrieves a widget’s minimum and natural width if it would be given the specified height.

    The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

    Parameters

    • height: number

      the height which is available for allocation

    Returns [number, number]

  • Retrieves 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.

    Returns [boolean, number, number]

  • Causes widget to have the keyboard focus for the Gtk.Window it's inside. widget must be a focusable widget, such as a Gtk.Entry; something like Gtk.Frame won’t work.

    More precisely, it must have the GTK_CAN_FOCUS flag set. Use gtk_widget_set_can_focus() to modify that flag.

    The widget also needs to be realized and mapped. This is indicated by the related signals. Grabbing the focus immediately after creating the widget will likely fail and cause critical warnings.

    Returns void

  • Inserts new_text_length bytes of new_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.

    Parameters

    • new_text: string

      the text to append

    • new_text_length: number

      the length of the text in bytes, or -1

    • position: number

      location of the position text will be inserted at

    Returns number

  • This function should be called whenever keyboard navigation within a single widget hits a boundary. The function emits the Gtk.Widget.SignalSignatures.keynav_failed | Gtk.Widget::keynav-failed signal on the widget and its return value should be interpreted in a way similar to the return value of gtk_widget_child_focus():

    When true is returned, stay in the widget, the failed keyboard navigation is OK and/or there is nowhere we can/should move the focus to.

    When false is returned, the caller should continue with keyboard navigation outside the widget, e.g. by calling gtk_widget_child_focus() on the widget’s toplevel.

    The default ::keynav-failed handler returns false for Gtk.DirectionType.TAB_FORWARD and Gtk.DirectionType.TAB_BACKWARD. For the other values of Gtk.DirectionType it returns true.

    Whenever the default handler returns true, it also calls gtk_widget_error_bell() to notify the user of the failed keyboard navigation.

    A use case for providing an own implementation of ::keynav-failed (either by connecting to it or by overriding it) would be a row of Gtk.Entry widgets where the user should be able to navigate the entire row with the cursor keys, as e.g. known from user interfaces that require entering license keys.

    Parameters

    Returns boolean

  • Emits a "notify" signal for the property property_name on object.

    When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.

    Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.

    Parameters

    Returns void

  • Signal emitted when “has-tooltip” is true and the hover timeout has expired with the cursor hovering “above” widget; or emitted when widget got focus in keyboard mode.

    Parameters

    • x: number
    • y: number
    • keyboard_tooltip: boolean
    • tooltip: Gtk.Tooltip

    Returns boolean

  • Invalidates the area of widget defined by region by calling gdk_window_invalidate_region() on the widget’s window and all its child windows. Once the main loop becomes idle (after the current batch of events has been processed, roughly), the window will receive expose events for the union of all regions that have been invalidated.

    Normally you would only use this function in widget implementations. You might also use it to schedule a redraw of a Gtk.DrawingArea or some portion thereof.

    Parameters

    Returns void

  • Creates the GDK (windowing system) resources associated with a widget. For example, widget->window will be created when a widget is realized. Normally realization happens implicitly; if you show a widget and all its parent containers, then the widget will be realized and mapped automatically.

    Realizing a widget requires all the widget’s parent widgets to be realized; calling gtk_widget_realize() realizes the widget’s parents in addition to widget itself. If a widget is not yet inside a toplevel window when you realize it, bad things will happen.

    This function is primarily used in widget implementations, and isn’t very useful otherwise. Many times when you think you might need it, a better approach is to connect to a signal that will be called after the widget is realized automatically, such as Gtk.Widget::draw. Or simply g_signal_connect () to the Gtk.Widget::realize signal.

    Returns void

  • Sets 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.

    Parameters

    • position: number

      the position of the cursor

    Returns void

  • the generic setter for all properties of this type. Should be overridden for every type with properties. If implementations of set_property don't emit property change notification explicitly, this will be done implicitly by the type system. However, if the notify signal is emitted explicitly, the type system will not emit it a second time.

    Parameters

    Returns void

  • Selects 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.

    Parameters

    • start_pos: number

      start of region

    • end_pos: number

      end of region

    Returns void

  • Flags a widget to be displayed. Any widget that isn’t shown will not appear on the screen. If you want to show all the widgets in a container, it’s easier to call gtk_widget_show_all() on the container, instead of individually showing the widgets.

    Remember that you have to show the containers containing a widget, in addition to the widget itself, before it will appear onscreen.

    When a toplevel container is shown, it is immediately realized and mapped; other shown widgets are realized and mapped when their toplevel container is realized and mapped.

    Returns void

  • This function is only used by Gtk.Container subclasses, to assign a size and position to their child widgets.

    In this function, the allocation may be adjusted. It will be forced to a 1x1 minimum size, and the adjust_size_allocation virtual method on the child will be used to adjust the allocation. Standard adjustments include removing the widget’s margins, and applying the widget’s Gtk.Widget.halign and Gtk.Widget.valign properties.

    For baseline support in containers you need to use gtk_widget_size_allocate_with_baseline() instead.

    Parameters

    • allocation: Gdk.Rectangle

      position and size to be allocated to widget

    Returns void

  • Begins editing on a cell_editable.

    The Gtk.CellRenderer for the cell creates and returns a Gtk.CellEditable from gtk_cell_renderer_start_editing(), configured for the Gtk.CellRenderer type.

    gtk_cell_editable_start_editing() can then set up cell_editable suitably for editing a cell, e.g. making the Esc key emit Gtk.CellEditable.SignalSignatures.editing_done | Gtk.CellEditable::editing-done.

    Note that the cell_editable is created on-demand for the current edit; its lifetime is temporary and does not persist across other edits and/or cells.

    Parameters

    • Optionalevent: Gdk.Event

      The Gdk.Event that began the editing process, or null if editing was initiated programmatically

    Returns void

  • This function essentially limits the life time of the closure to the life time of the object. That is, when the object is finalized, the closure is invalidated by calling g_closure_invalidate() on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, g_object_ref() and g_object_unref() are added as marshal guards to the closure, to ensure that an extra reference count is held on object during invocation of the closure. Usually, this function will be called on closures that use this object as closure data.

    Parameters

    Returns void

Methods - Inherited from Gtk.Entry

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

    This function is meant to be used in a Gtk.Widget.SignalSignatures.drag_data_get | Gtk.Widget::drag-data-get callback.

    Returns number

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

  • 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.

    See also gtk_entry_get_text_area()

    Parameters

    Returns Gdk.Rectangle

  • 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 Gtk.Widget.SignalSignatures.query_tooltip | Gtk.Widget::query-tooltip signal handler.

    Parameters

    • x: number

      the x coordinate of the position to find

    • y: number

      the y coordinate of the position to find

    Returns number

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

  • Retrieves the icon name used for the icon, or null if there is no icon or if the icon was set by some other method (e.g., by pixbuf, stock or gicon).

    Parameters

    Returns string

    An icon name, or null if no icon is set or if the icon wasn’t set from an icon name

  • Retrieves the stock id used for the icon, or null if there is no icon or if the icon was set by some other method (e.g., by pixbuf, icon name or gicon).

    Parameters

    Returns string

    A stock id, or null if no icon is set or if the icon wasn’t set from a stock id

  • Retrieves the character displayed in place of the real characters for entries with visibility set to false. See gtk_entry_set_invisible_char().

    Returns string

    the current invisible char, or 0, if the entry does not show invisible text at all.

  • Gets the Pango.Layout used to display the entry. The layout is useful to e.g. convert text positions to pixel positions, in combination with gtk_entry_get_layout_offsets(). The returned layout is owned by the entry and must not be modified or freed by the caller.

    Keep in mind that the layout text may contain a preedit string, so gtk_entry_layout_index_to_text_index() and gtk_entry_text_index_to_layout_index() are needed to convert byte indices in the layout to byte indices in the entry contents.

    Returns Pango.Layout

    the Pango.Layout for this entry

  • Obtains the position of the Pango.Layout used to render text in the entry, in widget coordinates. Useful if you want to line up the text in an entry with some other text, e.g. when using the entry to implement editable cells in a sheet widget.

    Also useful to convert mouse events into coordinates inside the Pango.Layout, e.g. to take some action if some part of the entry text is clicked.

    Note that as the user scrolls around in the entry the offsets will change; you’ll need to connect to the “notify::scroll-offset” signal to track this. Remember when using the Pango.Layout functions you need to convert to and from pixels using PANGO_PIXELS() or #PANGO_SCALE.

    Keep in mind that the layout text may contain a preedit string, so gtk_entry_layout_index_to_text_index() and gtk_entry_text_index_to_layout_index() are needed to convert byte indices in the layout to byte indices in the entry contents.

    Returns [number, number]

  • Retrieves the maximum allowed length of the text in entry. See gtk_entry_set_max_length().

    This is equivalent to getting entry's Gtk.EntryBuffer and calling gtk_entry_buffer_get_max_length() on it.

    Returns number

    the maximum allowed number of characters in Gtk.Entry, or 0 if there is no maximum.

  • Retrieves the desired maximum width of entry, in characters. See gtk_entry_set_max_width_chars().

    Returns number

    the maximum width of the entry, in characters

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

    Returns string

    a pointer to the placeholder text as a string. This string points to internally allocated storage in the widget and must not be freed, modified or stored.

  • Retrieves the contents of the entry widget. See also gtk_editable_get_chars().

    This is equivalent to getting entry's Gtk.EntryBuffer and calling gtk_entry_buffer_get_text() on it.

    Returns string

    a pointer to the contents of the widget as a string. This string points to internally allocated storage in the widget and must not be freed, modified or stored.

  • Gets the area where the entry’s text is drawn. This function is useful when drawing something to the entry in a draw callback.

    If the entry is not realized, text_area is filled with zeros.

    See also gtk_entry_get_icon_area().

    Returns Gdk.Rectangle

  • Retrieves whether the text in entry is visible. See gtk_entry_set_visibility().

    Returns boolean

    true if the text is currently visible

  • Causes entry to have keyboard focus.

    It behaves like gtk_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 void

  • Allow the Gtk.Entry input method to internally handle key press and release events. If this function returns true, then no further processing should be done for this key event. See gtk_im_context_filter_keypress().

    Note that you are expected to call this function from your handler when overriding key event handling. This is needed in the case when you need to insert your own key handling between the input method and the default key event handling of the Gtk.Entry. See gtk_text_view_reset_im_context() for an example of use.

    Parameters

    Returns boolean

    true if the input method handled the key event.

  • Converts from a position in the entry’s Pango.Layout (returned by gtk_entry_get_layout()) to a position in the entry contents (returned by gtk_entry_get_text()).

    Parameters

    • layout_index: number

      byte index into the entry layout text

    Returns number

    byte index into the entry contents

  • 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 gtk_entry_set_progress_pulse_step()).

    Returns void

  • 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 void

  • If setting is true, pressing Enter in the entry will activate the default widget for the window containing the entry. This usually means that the dialog box containing the entry will be closed, since the default widget is usually one of the dialog buttons.

    (For experts: if setting is true, the entry calls gtk_window_activate_default() on the window containing the entry, in the default handler for the Gtk.Entry::activate signal.)

    Parameters

    • setting: boolean

      true to activate window’s default widget on Enter keypress

    Returns void

  • 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.

    Parameters

    • xalign: number

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

    Returns void

  • Hooks up an adjustment to the cursor position in an entry, so that when the cursor is moved, the adjustment is scrolled to show that position. See gtk_scrolled_window_get_hadjustment() for a typical way of obtaining the adjustment.

    The adjustment has to be in pixel units and in the same coordinate system as the entry.

    Parameters

    • Optionaladjustment: Gtk.Adjustment

      an adjustment which should be adjusted when the cursor is moved, or null

    Returns void

  • Sets up the icon at the given position so that GTK+ will start a drag operation when the user clicks and drags the icon.

    To handle the drag operation, you need to connect to the usual Gtk.Widget.SignalSignatures.drag_data_get | Gtk.Widget::drag-data-get (or possibly Gtk.Widget.SignalSignatures.drag_data_delete | Gtk.Widget::drag-data-delete) signal, and use gtk_entry_get_current_icon_drag_source() in your signal handler to find out if the drag was started from an icon.

    By default, GTK+ uses the icon as the drag icon. You can use the Gtk.Widget.SignalSignatures.drag_begin | Gtk.Widget::drag-begin signal to set a different icon. Note that you have to use g_signal_connect_after() to ensure that your signal handler gets executed after the default handler.

    Parameters

    Returns void

  • 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 null, no icon will be shown in the specified position.

    Parameters

    Returns void

  • 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 null, no icon will be shown in the specified position.

    Parameters

    • icon_pos: Gtk.EntryIconPosition

      The position at which to set the icon

    • Optionalicon_name: string

      An icon name, or null

    Returns void

  • Sets tooltip as the contents of the tooltip for the icon at the specified position. tooltip is assumed to be marked up with the [Pango text markup language][PangoMarkupFormat].

    Use null for tooltip to remove an existing tooltip.

    See also gtk_widget_set_tooltip_markup() and gtk_entry_set_icon_tooltip_text().

    Parameters

    • icon_pos: Gtk.EntryIconPosition

      the icon position

    • Optionaltooltip: string

      the contents of the tooltip for the icon, or null

    Returns void

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

    Use null for tooltip to remove an existing tooltip.

    See also gtk_widget_set_tooltip_text() and gtk_entry_set_icon_tooltip_markup().

    If you unset the widget tooltip via gtk_widget_set_tooltip_text() or gtk_widget_set_tooltip_markup(), this sets GtkWidget:has-tooltip to false, which suppresses icon tooltips too. You can resolve this by then calling gtk_widget_set_has_tooltip() to set GtkWidget: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

    • Optionaltooltip: string

      the contents of the tooltip for the icon, or null

    Returns void

  • Sets %entry’s inner-border property to border, or clears it if null is passed. The inner-border is the area around the entry’s text, but inside its frame.

    If set, this property overrides the inner-border style property. Overriding the style-provided border is useful when you want to do in-place editing of some text in a canvas or list widget, where pixel-exact positioning of the entry is important.

    Parameters

    Returns void

  • Sets the character to use in place of the actual text when gtk_entry_set_visibility() has been called to set text visibility to false. i.e. this is the character used in “password mode” to show the user how many characters have been typed. 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.

    Parameters

    • ch: string

      a Unicode character

    Returns void

  • 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 entry's Gtk.EntryBuffer and calling gtk_entry_buffer_set_max_length() on it.


    @param max the maximum length of the entry, or 0 for no maximum. (other than the maximum length of entries.) The value passed in will be clamped to the range 0-

    Parameters

    • max: number

    Returns void

  • Sets the desired maximum width in characters of entry.

    Parameters

    • n_chars: number

      the new desired maximum width, in characters

    Returns void

  • Sets text to be displayed in entry when it is empty and unfocused. This can be used to give a visual hint of the expected contents of the Gtk.Entry.

    Note that since the placeholder text gets removed when the entry received focus, using this feature is a bit problematic if the entry is given the initial focus in a window. Sometimes this can be worked around by delaying the initial focus setting until the first key event arrives.

    Parameters

    • Optionaltext: string

      a string to be displayed when entry is empty and unfocused, or null

    Returns void

  • Causes the entry’s progress indicator to “fill in” the given fraction of the bar. The fraction should be between 0.0 and 1.0, inclusive.

    Parameters

    • fraction: number

      fraction of the task that’s been completed

    Returns void

  • Sets the fraction of total entry width to move the progress bouncing block for each call to gtk_entry_progress_pulse().

    Parameters

    • fraction: number

      fraction between 0.0 and 1.0

    Returns void

  • Sets the text in the widget to the given value, replacing the current contents.

    See gtk_entry_buffer_set_text().

    Parameters

    • text: string

      the new text

    Returns void

  • Sets whether the contents of the entry 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 entry widget is copied elsewhere.

    By default, GTK+ picks the best invisible character available in the current font, but it can be changed with gtk_entry_set_invisible_char().

    Note that you probably want to set Gtk.Entry.input_purpose to Gtk.InputPurpose.PASSWORD or Gtk.InputPurpose.PIN to inform input methods about the purpose of this entry, in addition to setting visibility to false.

    Parameters

    • visible: boolean

      true if the contents of the entry are displayed as plaintext

    Returns void

  • Changes the size request of the entry 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 entry size.

    Parameters

    • n_chars: number

      width in chars

    Returns void

  • Converts from a position in the entry contents (returned by gtk_entry_get_text()) to a position in the entry’s Pango.Layout (returned by gtk_entry_get_layout(), with text retrieved via pango_layout_get_text()).

    Parameters

    • text_index: number

      byte index into the entry contents

    Returns number

    byte index into the entry layout text

  • Class handler for the Gtk.Entry.SignalSignatures.copy_clipboard | Gtk.Entry::copy-clipboard signal. The default implementation copies the selection, if one exists.

    Returns void

  • Class handler for the Gtk.Entry.SignalSignatures.cut_clipboard | Gtk.Entry::cut-clipboard signal. The default implementation cuts the selection, if one exists.

    Returns void

  • Class handler for the Gtk.Entry.SignalSignatures.delete_from_cursor | Gtk.Entry::delete-from-cursor signal. The default implementation deletes the selection or the specified number of characters or words.

    Parameters

    Returns void

  • Calculate the size of the text area frame, which is its allocated width and requested height, minus space for margins and borders, and taking baseline and text height into account. This virtual function must be non-null.

    Parameters

    • x: number
    • y: number
    • width: number
    • height: number

    Returns void

  • Calculate the size of the text area, which is its allocated width and requested height, minus space for margins and borders. This virtual function must be non-null.

    Parameters

    • x: number
    • y: number
    • width: number
    • height: number

    Returns void

  • Class handler for the Gtk.Entry.SignalSignatures.insert_at_cursor | Gtk.Entry::insert-at-cursor signal. The default implementation inserts text at the cursor.

    Parameters

    • str: string

    Returns void

  • Class handler for the Gtk.Entry.SignalSignatures.move_cursor | Gtk.Entry::move-cursor signal. The default implementation specifies the standard Gtk.Entry cursor movement behavior.

    Parameters

    Returns void

  • Class handler for the Gtk.Entry.SignalSignatures.paste_clipboard | Gtk.Entry::paste-clipboard signal. The default implementation pastes at the current cursor position or over the current selection if one exists.

    Returns void

  • Class handler for the Gtk.Entry.SignalSignatures.populate_popup | Gtk.Entry::populate-popup signal. If non-null, this will be called to add additional entries to the context menu when it is displayed.

    Parameters

    Returns void

  • Class handler for the Gtk.Entry.SignalSignatures.toggle_overwrite | Gtk.Entry::toggle-overwrite signal. The default implementation toggles overwrite mode and blinks the cursor.

    Returns void

  • Parameters

    • name: string

      The “id” of the child defined in the template XML

    • internal_child: boolean

      Whether the child should be accessible as an “internal-child” when this class is used in GtkBuilder XML

    • struct_offset: number

      The structure offset into the composite widget’s instance public or private structure where the automated child pointer should be set, or 0 to not assign the pointer.

    Returns void

  • Add a property to an interface; this is only useful for interfaces that are added to GObject-derived types. Adding a property to an interface forces all objects classes with that interface to have a compatible property. The compatible property could be a newly created GObject.ParamSpec, but normally g_object_class_override_property() will be used so that the object class only needs to provide an implementation and inherits the property description, default value, bounds, and so forth from the interface property.

    This function is meant to be called from the interface's default vtable initialization function (the class_init member of GObject.TypeInfo.) It must not be called after after class_init has been called for any object types implementing this interface.

    If pspec is a floating reference, it will be consumed.

    Parameters

    Returns void

  • Parameters

    • property_id: number

      the new property ID

    • name: string

      the name of a property registered in a parent class or in an interface of this class.

    Returns void

  • Makes all newly-created widgets as composite children until the corresponding gtk_widget_pop_composite_child() call.

    A composite child is a child that’s an implementation detail of the container it’s inside and should not be visible to people using the container. Composite children aren’t treated differently by GTK+ (but see gtk_container_foreach() vs. gtk_container_forall()), but e.g. GUI builders might want to treat them in a different way.

    Returns void

Interfaces

ConstructorProps
SignalSignatures