Gjsify LogoGjsify Logo

A GtkScale is a slider control used to select a numeric value. To use it, you’ll probably want to investigate the methods on its base class, #GtkRange, in addition to the methods for GtkScale itself. To set the value of a scale, you would normally use gtk_range_set_value(). To detect changes to the value, you would normally use the #GtkRange::value-changed signal.

Note that using the same upper and lower bounds for the #GtkScale (through the #GtkRange methods) will hide the slider itself. This is useful for applications that want to show an undeterminate value on the scale, without changing the layout of the application (such as movie or music players).

GtkScale as GtkBuildable

GtkScale supports a custom <marks> element, which can contain multiple <mark> elements. The “value” and “position” attributes have the same meaning as gtk_scale_add_mark() parameters of the same name. If the element is not empty, its content is taken as the markup to show at the mark. It can be translated with the usual ”translatable” and “context” attributes.

CSS nodes

|[ scale[.fine-tune][.marks-before][.marks-after] ├── marks.top │ ├── mark │ ┊ ├── [label] │ ┊ ╰── indicator ┊ ┊ │ ╰── mark ├── [value] ├── contents │ ╰── trough │ ├── slider │ ├── [highlight] │ ╰── [fill] ╰── marks.bottom ├── mark ┊ ├── indicator ┊ ╰── [label] ╰── mark



GtkScale has a main CSS node with name scale and a subnode for its contents,
with subnodes named trough and slider.

The main node gets the style class .fine-tune added when the scale is in
'fine-tuning' mode.

If the scale has an origin (see gtk_scale_set_has_origin()), there is a
subnode with name highlight below the trough node that is used for rendering
the highlighted part of the trough.

If the scale is showing a fill level (see gtk_range_set_show_fill_level()),
there is a subnode with name fill below the trough node that is used for
rendering the filled in part of the trough.

If marks are present, there is a marks subnode before or after the contents
node, below which each mark gets a node with name mark. The marks nodes get
either the .top or .bottom style class.

The mark node has a subnode named indicator. If the mark has text, it also
has a subnode named label. When the mark is either above or left of the
scale, the label subnode is the first when present. Otherwise, the indicator
subnode is the first.

The main CSS node gets the 'marks-before' and/or 'marks-after' style classes
added depending on what marks are present.

If the scale is displaying the value (see #GtkScale:draw-value), there is
subnode with name value.
@class

Hierarchy

Index

Constructors

Properties

Methods

Constructors

Properties

adjustment: Gtk.Adjustment
app_paintable: boolean
can_default: boolean
can_focus: boolean
composite_child: boolean
digits: number
double_buffered: boolean

Whether the widget is double buffered.

draw_value: boolean
events: Gdk.EventMask
expand: boolean

Whether to expand in both directions. Setting this sets both #GtkWidget:hexpand and #GtkWidget:vexpand

fill_level: number

The fill level (e.g. prebuffering of a network stream). See gtk_range_set_fill_level().

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.

g_type_instance: TypeInstance
halign: Gtk.Align

How to distribute horizontal space if widget gets extra space, see #GtkAlign

has_default: boolean
has_focus: boolean
has_origin: boolean
has_tooltip: boolean

Enables or disables the emission of #GtkWidget::query-tooltip on widget. A value of %TRUE indicates that widget can have a tooltip, in this case the widget will be queried using #GtkWidget::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.

height_request: number
hexpand: boolean

Whether to expand horizontally. See gtk_widget_set_hexpand().

hexpand_set: boolean

Whether to use the #GtkWidget:hexpand property. See gtk_widget_get_hexpand_set().

inverted: boolean
is_focus: boolean
lower_stepper_sensitivity: Gtk.SensitivityType
margin: number

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

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.

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.

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.

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.

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.

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.

name: string
no_show_all: boolean
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

orientation: Gtk.Orientation

The orientation of the orientable.

parent: Gtk.Container
parent_instance: InitiallyUnowned
range: Gtk.Range
receives_default: boolean
restrict_to_fill_level: boolean

The restrict-to-fill-level property controls whether slider movement is restricted to an upper boundary set by the fill level. See gtk_range_set_restrict_to_fill_level().

round_digits: number

The number of digits to round the value to when it changes, or -1. See #GtkRange::change-value.

scale_factor: number

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

sensitive: boolean
show_fill_level: boolean

The show-fill-level property controls whether fill level indicator graphics are displayed on the trough. See gtk_range_set_show_fill_level().

style: Gtk.Style

The style of the widget, which contains information about how it will look (colors, etc).

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: #GtkWidget:has-tooltip will automatically be set to %TRUE and there will be taken care of #GtkWidget::query-tooltip in the default signal handler.

Note that if both #GtkWidget:tooltip-text and #GtkWidget:tooltip-markup are set, the last one wins.

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: #GtkWidget:has-tooltip will automatically be set to %TRUE and there will be taken care of #GtkWidget::query-tooltip in the default signal handler.

Note that if both #GtkWidget:tooltip-text and #GtkWidget:tooltip-markup are set, the last one wins.

upper_stepper_sensitivity: Gtk.SensitivityType
valign: Gtk.Align

How to distribute vertical space if widget gets extra space, see #GtkAlign

value_pos: Gtk.PositionType
vexpand: boolean

Whether to expand vertically. See gtk_widget_set_vexpand().

vexpand_set: boolean

Whether to use the #GtkWidget:vexpand property. See gtk_widget_get_vexpand_set().

visible: boolean
widget: Gtk.Widget
width_request: number
window: Gdk.Window

The widget's window if it is realized, %NULL otherwise.

$gtype: GType<Gtk.Scale>
name: string

Methods

  • activate(): boolean
  • 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

  • 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 %G_SIGNAL_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_ACCEL_VISIBLE

    Returns void

  • add_events(events: number): void
  • Adds the events in the bitfield events to the event mask for widget. See gtk_widget_set_events() and the [input handling overview][event-masks] for details.

    Parameters

    • events: number

      an event mask, see #GdkEventMask

    Returns void

  • Adds a mark at value.

    A mark is indicated visually by drawing a tick mark next to the scale, and GTK+ makes it easy for the user to position the scale exactly at the marks value.

    If markup is not %NULL, text is shown next to the tick mark.

    To remove marks from a scale, use gtk_scale_clear_marks().

    Parameters

    • value: number

      the value at which the mark is placed, must be between the lower and upper limits of the scales’ adjustment

    • position: Gtk.PositionType

      where to draw the mark. For a horizontal scale, #GTK_POS_TOP and %GTK_POS_LEFT are drawn above the scale, anything else below. For a vertical scale, #GTK_POS_LEFT and %GTK_POS_TOP are drawn to the left of the scale, anything else to the right.

    • markup: string

      Text to be shown at the mark, using [Pango markup][PangoMarkupFormat], or %NULL

    Returns void

  • Adds a widget to the list of mnemonic labels for this widget. (See gtk_widget_list_mnemonic_labels()). Note the list of mnemonic labels for the widget is cleared when the widget is destroyed, so the caller must make sure to update its internal state at this point as well, by using a connection to the #GtkWidget::destroy signal or a weak notifier.

    Parameters

    • label: Gtk.Widget

      a #GtkWidget that acts as a mnemonic label for widget

    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 #GtkLabel), 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 #GdkFrameClock::update signal of #GdkFrameClock, since you don't have to worry about when a #GdkFrameClock is assigned to a widget.

    Parameters

    Returns number

  • 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 instance to be updated with the same value of the "active" property of the action #GObject instance.

    If flags contains %G_BINDING_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 #GBinding 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 can have multiple bindings.

    Parameters

    • source_property: string

      the property on source to bind

    • target: GObject.Object

      the target #GObject

    • target_property: string

      the property on target to bind

    • flags: BindingFlags

      flags to pass to #GBinding

    Returns Binding

  • 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

    • source_property: string

      the property on source to bind

    • target: GObject.Object

      the target #GObject

    • target_property: string

      the property on target to bind

    • flags: BindingFlags

      flags to pass to #GBinding

    • transform_to: TClosure<any, any>

      a #GClosure wrapping the transformation function from the source to the target, or %NULL to use the default

    • transform_from: TClosure<any, any>

      a #GClosure wrapping the transformation function from the target to the source, or %NULL to use the default

    Returns Binding

  • can_activate_accel(signal_id: number): boolean
  • Determines whether an accelerator that activates the signal identified by signal_id can currently be activated. This is done by emitting the #GtkWidget::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

  • 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 #GtkWidget::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

  • child_notify(child_property: string): void
  • Emits a #GtkWidget::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

  • class_path(): [number, string, string]
  • Same as gtk_widget_path(), but always uses the name of a widget’s type, never uses a custom name set with gtk_widget_set_name().

    Returns [number, string, string]

  • clear_marks(): 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

  • connect(sigName: "format-value", callback: Gtk.Scale_FormatValueSignalCallback): number
  • connect(sigName: "notify::digits", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::draw-value", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::has-origin", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::value-pos", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::adjustment", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::fill-level", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::inverted", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::lower-stepper-sensitivity", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::restrict-to-fill-level", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::round-digits", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::show-fill-level", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::upper-stepper-sensitivity", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::app-paintable", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::can-default", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::can-focus", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::composite-child", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::double-buffered", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::events", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::expand", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::focus-on-click", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::halign", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::has-default", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::has-focus", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::has-tooltip", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::height-request", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::hexpand", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::hexpand-set", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::is-focus", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::margin", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::margin-bottom", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::margin-end", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::margin-left", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::margin-right", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::margin-start", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::margin-top", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::name", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::no-show-all", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::opacity", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::parent", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::receives-default", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::scale-factor", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::sensitive", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::style", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::tooltip-markup", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::tooltip-text", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::valign", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::vexpand", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::vexpand-set", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::visible", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::width-request", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::window", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::orientation", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect(sigName: string, callback: ((...args: any[]) => void)): number
  • connect_after(sigName: "format-value", callback: Gtk.Scale_FormatValueSignalCallback): number
  • connect_after(sigName: "notify::digits", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::draw-value", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::has-origin", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::value-pos", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::adjustment", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::fill-level", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::inverted", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::lower-stepper-sensitivity", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::restrict-to-fill-level", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::round-digits", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::show-fill-level", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::upper-stepper-sensitivity", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::app-paintable", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::can-default", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::can-focus", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::composite-child", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::double-buffered", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::events", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::expand", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::focus-on-click", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::halign", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::has-default", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::has-focus", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::has-tooltip", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::height-request", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::hexpand", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::hexpand-set", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::is-focus", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::margin", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::margin-bottom", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::margin-end", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::margin-left", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::margin-right", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::margin-start", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::margin-top", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::name", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::no-show-all", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::opacity", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::parent", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::receives-default", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::scale-factor", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::sensitive", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::style", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::tooltip-markup", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::tooltip-text", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::valign", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::vexpand", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::vexpand-set", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::visible", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::width-request", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::window", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::orientation", callback: (($obj: Gtk.Scale, pspec: ParamSpec) => void)): number
  • connect_after(sigName: string, callback: ((...args: any[]) => void)): number
  • Constructs a child of buildable with the name name.

    #GtkBuilder calls this function if a “constructor” has been specified in the UI definition.

    Parameters

    • builder: Gtk.Builder

      #GtkBuilder used to construct this object

    • name: string

      name of child to construct

    Returns GObject.Object

  • Creates a new #PangoLayout with the appropriate font map, font description, and base direction for drawing text for this widget.

    If you keep a #PangoLayout created in this way around, you need to re-create it when the widget #PangoContext is replaced. This can be tracked by using the #GtkWidget::screen-changed signal on the widget.

    Parameters

    • text: string

      text to set on the layout (can be %NULL)

    Returns Pango.Layout

  • This is similar to gtk_buildable_parser_finished() but is called once for each custom tag handled by the buildable.

    Parameters

    • builder: Gtk.Builder

      a #GtkBuilder

    • child: GObject.Object

      child object or %NULL for non-child tags

    • tagname: string

      the name of the tag

    • data: object

      user data created in custom_tag_start

    Returns void

  • This is called at the end of each custom element handled by the buildable.

    Parameters

    • builder: Gtk.Builder

      #GtkBuilder used to construct this object

    • child: GObject.Object

      child object or %NULL for non-child tags

    • tagname: string

      name of tag

    • data: object

      user data that will be passed in to parser functions

    Returns void

  • destroy(): 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 #GtkWidget::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 #GtkContainer, as you'll be able to use the #GtkContainerClass.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

  • device_is_shadowed(device: Gdk.Device): boolean
  • Returns %TRUE if device has been shadowed by a GTK+ device grab on another widget, so it would stop sending events to widget. This may be used in the #GtkWidget::grab-notify signal to check for specific devices. See gtk_device_grab_add().

    Parameters

    Returns boolean

  • disconnect(id: number): void
  • This function is equivalent to gtk_drag_begin_with_coordinates(), passing -1, -1 as coordinates.

    Parameters

    • targets: Gtk.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.

    Returns Gdk.DragContext

  • 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 #GtkWidget::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 #GtkWidget::button-press-event handler.

    2. During a #GtkWidget::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 #GtkWidget::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: Gtk.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

  • drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean
  • 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

  • drag_dest_add_image_targets(): void
  • Add the image targets supported by #GtkSelectionData to the target list of the drag destination. The targets are added with info = 0. If you need another value, use gtk_target_list_add_image_targets() and gtk_drag_dest_set_target_list().

    Returns void

  • drag_dest_add_text_targets(): void
  • Add the text targets supported by #GtkSelectionData to the target list of the drag destination. The targets are added with info = 0. If you need another value, use gtk_target_list_add_text_targets() and gtk_drag_dest_set_target_list().

    Returns void

  • drag_dest_add_uri_targets(): void
  • Add the URI targets supported by #GtkSelectionData to the target list of the drag destination. The targets are added with info = 0. If you need another value, use gtk_target_list_add_uri_targets() and gtk_drag_dest_set_target_list().

    Returns void

  • 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

    • target_list: Gtk.TargetList

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

    Returns Gdk.Atom

  • drag_dest_get_track_motion(): boolean
  • 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 (#GtkWidget::drag-motion, #GtkWidget::drag-drop, ...). They all exist for convenience. When passing #GTK_DEST_DEFAULT_ALL for instance it is sufficient to connect to the widget’s #GtkWidget::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 #GtkWidget::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 #GtkWidget::drag-motion, and invokations of gtk_drag_finish() in #GtkWidget::drag-data-received. Especially the later is dramatic, when your own #GtkWidget::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 #GtkWidget::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: Gtk.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

  • Sets this widget as a proxy for drops to another window.

    Parameters

    • proxy_window: Gdk.Window

      the window to which to forward drag events

    • protocol: Gdk.DragProtocol

      the drag protocol which the proxy_window accepts (You can use gdk_drag_get_protocol() to determine this)

    • use_coordinates: boolean

      If %TRUE, send the same coordinates to the destination, because it is an embedded subwindow.

    Returns void

  • drag_dest_set_track_motion(track_motion: boolean): void
  • Tells the widget to emit #GtkWidget::drag-motion and #GtkWidget::drag-leave events regardless of the targets and the %GTK_DEST_DEFAULT_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

  • drag_dest_unset(): void
  • Gets the data associated with a drag. When the data is received or the retrieval fails, GTK+ will emit a #GtkWidget::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_DEST_DEFAULT_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 #GtkWidget::drag-motion or #GtkWidget::drag-drop signal

    Returns void

  • drag_highlight(): void
  • Highlights a widget as a currently hovered drop target. To end the highlight, call gtk_drag_unhighlight(). GTK+ calls this automatically if %GTK_DEST_DEFAULT_HIGHLIGHT is set.

    Returns void

  • drag_source_add_image_targets(): void
  • Add the writable image targets supported by #GtkSelectionData to the target list of the drag source. The targets are added with info = 0. If you need another value, use gtk_target_list_add_image_targets() and gtk_drag_source_set_target_list().

    Returns void

  • drag_source_add_text_targets(): void
  • Add the text targets supported by #GtkSelectionData to the target list of the drag source. The targets are added with info = 0. If you need another value, use gtk_target_list_add_text_targets() and gtk_drag_source_set_target_list().

    Returns void

  • drag_source_add_uri_targets(): void
  • Add the URI targets supported by #GtkSelectionData to the target list of the drag source. The targets are added with info = 0. If you need another value, use gtk_target_list_add_uri_targets() and gtk_drag_source_set_target_list().

    Returns void

  • Sets up a widget so that GTK+ will start a drag operation when the user clicks and drags on the widget. The widget must have a window.

    Parameters

    • start_button_mask: Gdk.ModifierType

      the bitmask of buttons that can start the drag

    • targets: Gtk.TargetEntry[]

      the table of targets that the drag will support, may be %NULL

    • actions: Gdk.DragAction

      the bitmask of possible actions for a drag from this widget

    Returns void

  • drag_source_set_icon_gicon(icon: Gio.Icon): void
  • drag_source_set_icon_name(icon_name: string): void
  • drag_source_set_icon_pixbuf(pixbuf: Pixbuf): void
  • drag_source_set_icon_stock(stock_id: string): void
  • drag_source_unset(): void
  • drag_unhighlight(): 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

  • emit(sigName: "format-value", value: number, ...args: any[]): void
  • emit(sigName: "notify::digits", ...args: any[]): void
  • emit(sigName: "notify::draw-value", ...args: any[]): void
  • emit(sigName: "notify::has-origin", ...args: any[]): void
  • emit(sigName: "notify::value-pos", ...args: any[]): void
  • emit(sigName: "notify::adjustment", ...args: any[]): void
  • emit(sigName: "notify::fill-level", ...args: any[]): void
  • emit(sigName: "notify::inverted", ...args: any[]): void
  • emit(sigName: "notify::lower-stepper-sensitivity", ...args: any[]): void
  • emit(sigName: "notify::restrict-to-fill-level", ...args: any[]): void
  • emit(sigName: "notify::round-digits", ...args: any[]): void
  • emit(sigName: "notify::show-fill-level", ...args: any[]): void
  • emit(sigName: "notify::upper-stepper-sensitivity", ...args: any[]): void
  • emit(sigName: "notify::app-paintable", ...args: any[]): void
  • emit(sigName: "notify::can-default", ...args: any[]): void
  • emit(sigName: "notify::can-focus", ...args: any[]): void
  • emit(sigName: "notify::composite-child", ...args: any[]): void
  • emit(sigName: "notify::double-buffered", ...args: any[]): void
  • emit(sigName: "notify::events", ...args: any[]): void
  • emit(sigName: "notify::expand", ...args: any[]): void
  • emit(sigName: "notify::focus-on-click", ...args: any[]): void
  • emit(sigName: "notify::halign", ...args: any[]): void
  • emit(sigName: "notify::has-default", ...args: any[]): void
  • emit(sigName: "notify::has-focus", ...args: any[]): void
  • emit(sigName: "notify::has-tooltip", ...args: any[]): void
  • emit(sigName: "notify::height-request", ...args: any[]): void
  • emit(sigName: "notify::hexpand", ...args: any[]): void
  • emit(sigName: "notify::hexpand-set", ...args: any[]): void
  • emit(sigName: "notify::is-focus", ...args: any[]): void
  • emit(sigName: "notify::margin", ...args: any[]): void
  • emit(sigName: "notify::margin-bottom", ...args: any[]): void
  • emit(sigName: "notify::margin-end", ...args: any[]): void
  • emit(sigName: "notify::margin-left", ...args: any[]): void
  • emit(sigName: "notify::margin-right", ...args: any[]): void
  • emit(sigName: "notify::margin-start", ...args: any[]): void
  • emit(sigName: "notify::margin-top", ...args: any[]): void
  • emit(sigName: "notify::name", ...args: any[]): void
  • emit(sigName: "notify::no-show-all", ...args: any[]): void
  • emit(sigName: "notify::opacity", ...args: any[]): void
  • emit(sigName: "notify::parent", ...args: any[]): void
  • emit(sigName: "notify::receives-default", ...args: any[]): void
  • emit(sigName: "notify::scale-factor", ...args: any[]): void
  • emit(sigName: "notify::sensitive", ...args: any[]): void
  • emit(sigName: "notify::style", ...args: any[]): void
  • emit(sigName: "notify::tooltip-markup", ...args: any[]): void
  • emit(sigName: "notify::tooltip-text", ...args: any[]): void
  • emit(sigName: "notify::valign", ...args: any[]): void
  • emit(sigName: "notify::vexpand", ...args: any[]): void
  • emit(sigName: "notify::vexpand-set", ...args: any[]): void
  • emit(sigName: "notify::visible", ...args: any[]): void
  • emit(sigName: "notify::width-request", ...args: any[]): void
  • emit(sigName: "notify::window", ...args: any[]): void
  • emit(sigName: "notify::orientation", ...args: any[]): void
  • emit(sigName: string, ...args: any[]): void
  • ensure_style(): 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

  • error_bell(): void
  • Notifies the user about an input-related error on this widget. If the #GtkSettings: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

  • force_floating(): void
  • This function is intended for #GObject 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

  • freeze_child_notify(): void
  • Stops emission of #GtkWidget::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

  • freeze_notify(): 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::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 #AtkObject instance may be a no-op. Likewise, if no class-specific #AtkObject implementation is available for the widget instance in question, it will inherit an #AtkObject 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 the #GActionGroup that was registered using prefix. The resulting #GActionGroup may have been registered to widget or any #GtkWidget in its ancestry.

    If no action group was found matching prefix, then %NULL is returned.

    Parameters

    • prefix: string

      The “prefix” of the action group.

    Returns Gio.ActionGroup

  • get_allocated_baseline(): number
  • Returns the baseline that has currently been allocated to widget. This function is intended to be used when implementing handlers for the #GtkWidget::draw function, and when allocating child widgets in #GtkWidget::size_allocate.

    Returns number

  • get_allocated_height(): number
  • 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]

  • get_allocated_width(): number
  • Retrieves the widget’s allocation.

    Note, when implementing a #GtkContainer: 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 #GtkContainer 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 #GtkBox 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 #GtkWindow 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<unknown>

      ancestor type

    Returns Gtk.Widget

  • get_app_paintable(): boolean
  • get_can_default(): boolean
  • get_can_focus(): boolean
  • 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

  • get_child_visible(): boolean
  • 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

  • Retrieves the widget’s clip area.

    The clip area is the area in which all of widget's drawing will happen. Other toolkits call it the bounding box.

    Historically, in GTK+ the clip area has been equal to the allocation retrieved via gtk_widget_get_allocation().

    Returns Gdk.Rectangle

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

    Parameters

    • selection: Gdk.Atom

      a #GdkAtom 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

  • get_composite_name(): string
  • get_data(key?: string): object
  • Gets a named field from the objects table of associations (see g_object_set_data()).

    Parameters

    • Optional key: string

      name of the key for that association

    Returns object

  • get_device_enabled(device: Gdk.Device): boolean
  • get_digits(): number
  • Get the #GdkDisplay for the toplevel window associated with this widget. This function can only be called after the widget has been added to a widget hierarchy with a #GtkWindow at the top.

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

  • get_double_buffered(): boolean
  • get_draw_value(): boolean
  • get_events(): number
  • Returns the event mask (see #GdkEventMask) 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 #GtkEventController created for the widget.

    Returns number

  • get_fill_level(): number
  • get_flippable(): boolean
  • get_focus_on_click(): boolean
  • 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

  • Gets the value of the #GtkWidget:halign property.

    For backwards compatibility reasons this method will never return %GTK_ALIGN_BASELINE, but instead it will convert it to %GTK_ALIGN_FILL. Baselines are not supported for horizontal alignment.

    Returns Gtk.Align

  • get_has_origin(): boolean
  • get_has_tooltip(): boolean
  • get_has_window(): boolean
  • get_hexpand(): boolean
  • Gets whether the widget would like any available extra horizontal space. When a user resizes a #GtkWindow, 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

  • get_hexpand_set(): boolean
  • 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

  • get_inverted(): boolean
  • get_layout_offsets(): [number, number]
  • Obtains the coordinates where the scale will draw the #PangoLayout representing the text in the scale. Remember when using the #PangoLayout function you need to convert to and from pixels using PANGO_PIXELS() or #PANGO_SCALE.

    If the #GtkScale:draw-value property is %FALSE, the return values are undefined.

    Returns [number, number]

  • get_mapped(): boolean
  • get_margin_bottom(): number
  • get_margin_end(): number
  • get_margin_left(): number
  • get_margin_right(): number
  • get_margin_start(): number
  • get_margin_top(): number
  • get_min_slider_size(): number
  • Returns the current modifier style for the widget. (As set by gtk_widget_modify_style().) If no style has previously set, a new #GtkRcStyle 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

  • get_name(): string
  • get_no_show_all(): boolean
  • get_opacity(): number
  • Gets a #PangoContext 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 #GtkWidget::screen-changed signal on the widget.

    Returns Pango.Context

  • get_pointer(): [number, number]
  • 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]

  • get_preferred_height(): [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]

  • get_preferred_height_and_baseline_for_width(width: number): [number, number, 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]

  • get_preferred_height_for_width(width: 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]

  • get_preferred_width(): [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]

  • get_preferred_width_for_height(height: number): [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]

  • get_property(property_name?: string, value?: any): void
  • Gets a property of an object.

    The value can be:

    • an empty #GValue initialized by %G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
    • a #GValue initialized with the expected type of the property
    • a #GValue 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 g_value_unset().

    Note that g_object_get_property() is really intended for language bindings, g_object_get() is much more convenient for C programming.

    Parameters

    • Optional property_name: string

      the name of the property to get

    • Optional value: any

      return location for the property value

    Returns void

  • get_qdata(quark: number): object
  • get_realized(): boolean
  • get_receives_default(): boolean
  • 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

  • Gets whether the widget prefers a height-for-width layout or a width-for-height layout.

    #GtkBin widgets generally propagate the preference of their child, container widgets need to request something either in context of their children or in context of their allocation capabilities.

    Returns Gtk.SizeRequestMode

  • 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_restrict_to_fill_level(): boolean
  • 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 #GtkWindow at the top.

    The root window is useful for such purposes as creating a popup #GdkWindow 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

  • get_round_digits(): number
  • get_scale_factor(): number
  • 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

  • Get the #GdkScreen from the toplevel window associated with this widget. This function can only be called after the widget has been added to a widget hierarchy with a #GtkWindow at the top.

    In general, you should only create screen specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.

    Returns Gdk.Screen

  • get_sensitive(): boolean
  • 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

  • Gets the settings object holding the settings used for this widget.

    Note that this function can only be called when the #GtkWidget is attached to a toplevel, since the settings object is specific to a particular #GdkScreen.

    Returns Gtk.Settings

  • get_show_fill_level(): boolean
  • get_size_request(): [number, number]
  • 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]

  • get_slider_range(): [number, number]
  • This function returns sliders range along the long dimension, in widget->window coordinates.

    This function is useful mainly for #GtkRange subclasses.

    Returns [number, number]

  • get_slider_size_fixed(): boolean
  • Returns the widget state as a flag set. It is worth mentioning that the effective %GTK_STATE_FLAG_INSENSITIVE state will be returned, that is, also based on parent insensitivity, even if widget itself is sensitive.

    Also note that if you are looking for a way to obtain the #GtkStateFlags to pass to a #GtkStyleContext method, you should look at gtk_style_context_get_state().

    Returns Gtk.StateFlags

  • get_support_multidevice(): boolean
  • 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.

    Parameters

    • widget_type: GType<unknown>

      The #GType to get a template child for

    • name: string

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

    Returns GObject.Object

  • get_tooltip_markup(): string
  • get_tooltip_text(): string
  • 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 #GtkWindow-derived widget which was in turn inside the toplevel #GtkWindow. While the second case may seem unlikely, it actually happens when a #GtkPlug is embedded inside a #GtkSocket within the same application.

    To reliably find the toplevel #GtkWindow, 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

  • Gets the value of the #GtkWidget:valign property.

    For backwards compatibility reasons this method will never return %GTK_ALIGN_BASELINE, but instead it will convert it to %GTK_ALIGN_FILL. If your widget want to support baseline aligned children it must use gtk_widget_get_valign_with_baseline(), or g_object_get (widget, "valign", &value, NULL), which will also report the true value.

    Returns Gtk.Align

  • get_value(): number
  • get_vexpand(): boolean
  • get_vexpand_set(): boolean
  • get_visible(): boolean
  • 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

  • getv(names: string[], values: any[]): void
  • 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

  • grab_add(): 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

  • grab_default(): 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 #GtkEntry widgets require the “activates-default” property set to %TRUE before they activate the default widget when Enter is pressed and the #GtkEntry is focused.

    Returns void

  • grab_focus(): void
  • Causes widget to have the keyboard focus for the #GtkWindow it's inside. widget must be a focusable widget, such as a #GtkEntry; something like #GtkFrame 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

  • grab_remove(): void
  • Removes the grab from the given widget.

    You have to pair calls to gtk_grab_add() and gtk_grab_remove().

    If widget does not have the grab, this function does nothing.

    Returns void

  • has_grab(): boolean
  • 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

  • has_rc_style(): boolean
  • has_screen(): boolean
  • Checks whether there is a #GdkScreen is associated with this widget. All toplevel widgets have an associated screen, and all widgets added into a hierarchy with a toplevel window at the top.

    Returns boolean

  • has_visible_focus(): boolean
  • 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

  • hide(): void
  • hide_on_delete(): boolean
  • Utility function; intended to be connected to the #GtkWidget::delete-event signal on a #GtkWindow. 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

  • in_destruction(): boolean
  • init_template(): void
  • 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 #GtkWidget subclass and not in #GObject.constructed() or #GObject.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

  • Sets an input shape for this widget’s GDK window. This allows for windows which react to mouse click in a nonrectangular region, see gdk_window_input_shape_combine_region() for more information.

    Parameters

    • region: cairo.Region

      shape to be added, or %NULL to remove an existing shape

    Returns void

  • Inserts group into widget. Children of widget that implement #GtkActionable can then be associated with actions in group by setting their “action-name” to prefix.action-name.

    If group is %NULL, a previously inserted group for name is removed from widget.

    Parameters

    • name: string

      the prefix for actions in group

    • group: Gio.ActionGroup

      a #GActionGroup, or %NULL

    Returns void

  • Computes the intersection of a widget’s area and area, storing the intersection in intersection, and returns %TRUE if there was an intersection. intersection may be %NULL if you’re only interested in whether there was an intersection.

    Parameters

    Returns [boolean, Gdk.Rectangle]

  • is_composited(): boolean
  • 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

  • is_drawable(): boolean
  • is_floating(): boolean
  • is_sensitive(): boolean
  • is_toplevel(): boolean
  • Determines whether widget is a toplevel widget.

    Currently only #GtkWindow and #GtkInvisible (and out-of-process #GtkPlugs) are toplevel widgets. Toplevel widgets have no parent widget.

    Returns boolean

  • is_visible(): boolean
  • 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

  • This function should be called whenever keyboard navigation within a single widget hits a boundary. The function emits the #GtkWidget::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_DIR_TAB_FORWARD and %GTK_DIR_TAB_BACKWARD. For the other values of #GtkDirectionType 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 #GtkEntry 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

  • list_accel_closures(): TClosure<any, any>[]
  • Lists the closures used by widget for accelerator group connections with gtk_accel_group_connect_by_path() or gtk_accel_group_connect(). The closures can be used to monitor accelerator changes on widget, by connecting to the GtkAccelGroup::accel-changed signal of the #GtkAccelGroup of a closure which can be found out with gtk_accel_group_from_accel_closure().

    Returns TClosure<any, any>[]

  • list_action_prefixes(): string[]
  • 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[]

  • map(): void
  • This function is only for use in widget implementations. Causes a widget to be mapped if it isn’t already.

    Returns void

  • mnemonic_activate(group_cycling: boolean): boolean
  • 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 #GtkEntry and #GtkTextView. 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. #GtkLabel.

    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 #GtkEventBox widget and setting the base color on that.

    Parameters

    • state: Gtk.StateType

      the state for which to set the base color

    • color: 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. #GtkLabel.

    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 #GtkEventBox widget and setting the background color on that.

    Parameters

    • state: Gtk.StateType

      the state for which to set the background color

    • color: 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 #GtkWidget cursor-color and secondary-cursor-color style properties.

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

    Parameters

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

    • secondary: 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

    • color: 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

  • Sets the font to use for a widget.

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

    Parameters

    • font_desc: FontDescription

      the font description to use, or %NULL to undo the effect of previous calls to gtk_widget_modify_font()

    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 #GtkRcStyle-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

    • style: Gtk.RcStyle

      the #GtkRcStyle-struct holding the style modifications

    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 #GtkEntry and #GtkTextView. See also gtk_widget_modify_style().

    Parameters

    • state: Gtk.StateType

      the state for which to set the text color

    • color: 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

  • notify(property_name: string): 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.:

      enum
    {
    PROP_0,
    PROP_FOO,
    PROP_LAST
    };

    static GParamSpec *properties[PROP_LAST];

    static void
    my_object_class_init (MyObjectClass *klass)
    {
    properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo",
    0, 100,
    50,
    G_PARAM_READWRITE);
    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

    • pspec: ParamSpec

      the #GParamSpec of a property installed on the class of object.

    Returns void

  • Sets the background color to use for a widget.

    All other style values are left untouched. See gtk_widget_override_color().

    Parameters

    • state: Gtk.StateFlags

      the state for which to set the background color

    • color: Gdk.RGBA

      the color to assign, or %NULL to undo the effect of previous calls to gtk_widget_override_background_color()

    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 #GtkCssProvider 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 #GtkCssProvider with the %GTK_STYLE_PROVIDER_PRIORITY_APPLICATION priority.

    Parameters

    • state: Gtk.StateFlags

      the state for which to set the color

    • color: 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 #GdkColor type, so the alpha value in primary and secondary will be ignored.

    Parameters

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

    • secondary_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 the font to use for a widget. All other style values are left untouched. See gtk_widget_override_color().

    Parameters

    • font_desc: FontDescription

      the font description to use, or %NULL to undo the effect of previous calls to gtk_widget_override_font()

    Returns void

  • override_symbolic_color(name: string, color: Gdk.RGBA): 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

    • color: 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

  • Called when the builder finishes the parsing of a [GtkBuilder UI definition][BUILDER-UI]. Note that this will be called once for each time gtk_builder_add_from_file() or gtk_builder_add_from_string() is called on a builder.

    Parameters

    Returns void

  • path(): [number, string, string]
  • 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]

  • queue_allocate(): void
  • 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

  • queue_compute_expand(): void
  • Mark widget as needing to recompute its expand flags. Call this function when setting legacy expand child properties on the child of a container.

    See gtk_widget_compute_expand().

    Returns void

  • queue_draw(): void
  • queue_draw_area(x: number, y: number, width: number, height: number): 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 #GtkDrawingArea or some portion thereof.

    Parameters

    Returns void

  • queue_resize(): 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 #GtkLabel, #GtkLabel 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

  • queue_resize_no_redraw(): void
  • realize(): 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 #GtkWidget::draw. Or simply g_signal_connect () to the #GtkWidget::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

  • 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

  • Computes the intersection of a widget’s area and region, returning the intersection. The result may be empty, use cairo_region_is_empty() to check.

    Parameters

    • region: cairo.Region

      a #cairo_region_t, in the same coordinate system as widget->allocation. That is, relative to widget->window for widgets which return %FALSE from gtk_widget_get_has_window(); relative to the parent window of widget->window otherwise.

    Returns cairo.Region

  • Registers a #GdkWindow 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

  • remove_mnemonic_label(label: Gtk.Widget): void
  • Removes a widget from the list of mnemonic labels for this widget. (See gtk_widget_list_mnemonic_labels()). The widget must have previously been added to the list with gtk_widget_add_mnemonic_label().

    Parameters

    • label: Gtk.Widget

      a #GtkWidget that was previously set as a mnemonic label for widget with gtk_widget_add_mnemonic_label().

    Returns void

  • remove_tick_callback(id: number): void
  • render_icon(stock_id: string, size: number, detail: string): Pixbuf
  • 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 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 (#GtkIconSize). 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).

    • detail: string

      render detail to pass to theme engine

    Returns Pixbuf

  • render_icon_pixbuf(stock_id: string, size: number): Pixbuf
  • 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 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 (#GtkIconSize). 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 Pixbuf

  • Moves a widget from one #GtkContainer to another, handling reference count issues to avoid destroying the widget.

    Parameters

    • new_parent: Gtk.Widget

      a #GtkContainer to move the widget into

    Returns void

  • reset_rc_styles(): void
  • Reset the styles of widget and all descendents, so when they are looked up again, they get the correct values for the currently loaded RC file settings.

    This function is not useful for applications.

    Returns void

  • reset_style(): void
  • 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

  • run_dispose(): void
  • Releases all references to other objects. This can be used to break reference cycles.

    This function should only be called from object system implementations.

    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

  • send_focus_change(event: Gdk.Event): boolean
  • 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 #GtkWidget 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 #GtkTreeView.

    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

    • event: Gdk.Event

      a #GdkEvent of type GDK_FOCUS_CHANGE

    Returns boolean

  • set_accel_path(accel_path: string, accel_group?: Gtk.AccelGroup): 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 #GtkUIManager. If you use #GtkUIManager, setting up accelerator paths will be done automatically.

    Even when you you aren’t using #GtkUIManager, 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 #GQuark. Therefore, if you pass a static string, you can save some memory by interning it first with g_intern_static_string().

    Parameters

    • accel_path: string

      path used to look up the accelerator

    • Optional accel_group: Gtk.AccelGroup

      a #GtkAccelGroup.

    Returns void

  • Sets the adjustment to be used as the “model” object for this range widget. The adjustment indicates the current range value, the minimum and maximum range values, the step/page increments used for keybindings and scrolling, and the page size. The page size is normally 0 for #GtkScale and nonzero for #GtkScrollbar, and indicates the size of the visible area of the widget being scrolled. The page size affects the size of the scrollbar slider.

    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 #GtkContainer, 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

    • allocation: Gdk.Rectangle

      a pointer to a #GtkAllocation to copy from

    Returns void

  • set_app_paintable(app_paintable: boolean): void
  • Sets whether the application intends to draw on the widget in an #GtkWidget::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 #GtkEventBox and #GtkWindow, 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

  • set_buildable_property(builder: Gtk.Builder, name: string, value: any): void
  • set_can_default(can_default: boolean): 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

  • set_can_focus(can_focus: boolean): 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

  • set_child_visible(is_visible: boolean): 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 #GtkContainer, 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

    • clip: Gdk.Rectangle

      a pointer to a #GtkAllocation to copy from

    Returns void

  • set_composite_name(name: string): void
  • set_data(key: string, data?: object): 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 #GQuark 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 #GQuark storage growing unbounded.

    Parameters

    • key: string

      name of the key

    • Optional data: object

      data to associate with that key

    Returns void

  • set_device_enabled(device: Gdk.Device, enabled: boolean): void
  • Enables or disables a #GdkDevice to interact with widget and all its children.

    It does so by descending through the #GdkWindow hierarchy and enabling the same mask that is has for core events (i.e. the one that gdk_window_get_events() returns).

    Parameters

    • device: Gdk.Device

      a #GdkDevice

    • enabled: boolean

      whether to enable the device

    Returns void

  • Sets the device event mask (see #GdkEventMask) 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 #GtkEventBox and receive events on the event box.

    Parameters

    Returns void

  • set_digits(digits: number): void
  • Sets the number of decimal places that are displayed in the value. Also causes the value of the adjustment to be rounded to this number of digits, so the retrieved value matches the displayed one, if #GtkScale:draw-value is %TRUE when the value changes. If you want to enforce rounding the value when #GtkScale:draw-value is %FALSE, you can set #GtkRange:round-digits instead.

    Note that rounding to a small number of digits can interfere with the smooth autoscrolling that is built into #GtkScale. As an alternative, you can use the #GtkScale::format-value signal to format the displayed value yourself.

    Parameters

    • digits: number

      the number of decimal places to display, e.g. use 1 to display 1.0, 2 to display 1.00, etc

    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_TEXT_DIR_NONE, then the value set by gtk_widget_set_default_direction() will be used.

    Parameters

    Returns void

  • set_double_buffered(double_buffered: boolean): 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

  • set_draw_value(draw_value: boolean): void
  • Specifies whether the current value is displayed as a string next to the slider.

    Parameters

    • draw_value: boolean

      %TRUE to draw the value

    Returns void

  • set_events(events: number): void
  • Sets the event mask (see #GdkEventMask) 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 #GtkEventBox and receive events on the event box.

    Parameters

    • events: number

      event mask

    Returns void

  • set_fill_level(fill_level: number): void
  • Set the new position of the fill level indicator.

    The “fill level” is probably best described by its most prominent use case, which is an indicator for the amount of pre-buffering in a streaming media player. In that use case, the value of the range would indicate the current play position, and the fill level would be the position up to which the file/stream has been downloaded.

    This amount of prebuffering can be displayed on the range’s trough and is themeable separately from the trough. To enable fill level display, use gtk_range_set_show_fill_level(). The range defaults to not showing the fill level.

    Additionally, it’s possible to restrict the range’s slider position to values which are smaller than the fill level. This is controller by gtk_range_set_restrict_to_fill_level() and is by default enabled.

    Parameters

    • fill_level: number

      the new position of the fill level indicator

    Returns void

  • set_flippable(flippable: boolean): void
  • If a range is flippable, it will switch its direction if it is horizontal and its direction is %GTK_TEXT_DIR_RTL.

    See gtk_widget_get_direction().

    Parameters

    • flippable: boolean

      %TRUE to make the range flippable

    Returns void

  • set_focus_on_click(focus_on_click: boolean): 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

  • Sets the font map to use for Pango rendering. When not set, the widget will inherit the font map from its parent.

    Parameters

    • font_map: Pango.FontMap

      a #PangoFontMap, or %NULL to unset any previously set font map

    Returns void

  • Sets the #cairo_font_options_t used for Pango rendering in this widget. When not set, the default font options for the #GdkScreen will be used.

    Parameters

    • options: FontOptions

      a #cairo_font_options_t, or %NULL to unset any previously set default font options.

    Returns void

  • set_has_origin(has_origin: boolean): void
  • If #GtkScale:has-origin is set to %TRUE (the default), the scale will highlight the part of the trough between the origin (bottom or left side) and the current value.

    Parameters

    • has_origin: boolean

      %TRUE if the scale has an origin

    Returns void

  • set_has_tooltip(has_tooltip: boolean): void
  • Sets the has-tooltip property on widget to has_tooltip. See #GtkWidget:has-tooltip for more information.

    Parameters

    • has_tooltip: boolean

      whether or not widget has a tooltip.

    Returns void

  • set_has_window(has_window: boolean): void
  • Specifies whether widget has a #GdkWindow 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 #GdkWindow of one of its parent widgets. Widgets that do not create a %window for themselves in #GtkWidget::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

  • set_hexpand(expand: boolean): void
  • Sets whether the widget would like any available extra horizontal space. When a user resizes a #GtkWindow, 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 #GtkWidget.).

    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

  • set_hexpand_set(set: boolean): 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

  • set_increments(step: number, page: number): void
  • Sets the step and page sizes for the range. The step size is used when the user clicks the #GtkScrollbar arrows or moves #GtkScale via arrow keys. The page size is used for example when moving via Page Up or Page Down keys.

    Parameters

    • step: number

      step size

    • page: number

      page size

    Returns void

  • set_inverted(setting: boolean): void
  • Ranges normally move from lower to higher values as the slider moves from top to bottom or left to right. Inverted ranges have higher values at the top or on the right rather than on the bottom or left.

    Parameters

    • setting: boolean

      %TRUE to invert the range

    Returns void

  • set_mapped(mapped: boolean): 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

  • set_margin_bottom(margin: number): void
  • set_margin_end(margin: number): void
  • set_margin_left(margin: number): void
  • set_margin_right(margin: number): void
  • set_margin_start(margin: number): void
  • set_margin_top(margin: number): void
  • set_min_slider_size(min_size: number): void
  • set_name(name: string): 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 #GtkStyleContext).

    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

  • set_no_show_all(no_show_all: boolean): void
  • Sets the #GtkWidget:no-show-all property, which determines whether calls to gtk_widget_show_all() will affect this widget.

    This is mostly for use in constructing widget hierarchies with externally controlled visibility, see #GtkUIManager.

    Parameters

    • no_show_all: boolean

      the new value for the “no-show-all” property

    Returns void

  • set_opacity(opacity: number): 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 #GtkContainer. 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

  • set_parent_window(parent_window: Gdk.Window): void
  • Sets a non default parent window for widget.

    For #GtkWindow classes, setting a parent_window effects whether the window is a toplevel window or can be embedded into other widgets.

    For #GtkWindow classes, this needs to be called before the window is realized.

    Parameters

    • parent_window: Gdk.Window

      the new parent window.

    Returns void

  • set_property(property_name: string, value?: any): void
  • set_range(min: number, max: number): void
  • Sets the allowable values in the #GtkRange, and clamps the range value to be between min and max. (If the range has a non-zero page size, it is clamped between min and max - page-size.)

    Parameters

    • min: number

      minimum range value

    • max: number

      maximum range value

    Returns void

  • set_realized(realized: boolean): 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

  • set_receives_default(receives_default: boolean): 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

  • set_redraw_on_allocate(redraw_on_allocate: boolean): 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

  • set_restrict_to_fill_level(restrict_to_fill_level: boolean): void
  • Sets whether the slider is restricted to the fill level. See gtk_range_set_fill_level() for a general description of the fill level concept.

    Parameters

    • restrict_to_fill_level: boolean

      Whether the fill level restricts slider movement.

    Returns void

  • set_round_digits(round_digits: number): void
  • set_sensitive(sensitive: boolean): 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

  • set_show_fill_level(show_fill_level: boolean): void
  • Sets whether a graphical fill level is show on the trough. See gtk_range_set_fill_level() for a general description of the fill level concept.

    Parameters

    • show_fill_level: boolean

      Whether a fill level indicator graphics is shown.

    Returns void

  • set_size_request(width: number, height: number): 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 #GtkWidget 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 #GtkWidget.

    Parameters

    • width: number

      width widget should request, or -1 to unset

    • height: number

      height widget should request, or -1 to unset

    Returns void

  • set_slider_size_fixed(size_fixed: boolean): void
  • Sets whether the range’s slider has a fixed size, or a size that depends on its adjustment’s page size.

    This function is useful mainly for #GtkRange subclasses.

    Parameters

    • size_fixed: boolean

      %TRUE to make the slider size constant

    Returns void

  • This function is for use in widget implementations. Sets the state of a widget (insensitive, prelighted, etc.) Usually you should set the state using wrapper functions such as gtk_widget_set_sensitive().

    Parameters

    Returns void

  • This function is for use in widget implementations. Turns on flag values in the current widget state (insensitive, prelighted, etc.).

    This function accepts the values %GTK_STATE_FLAG_DIR_LTR and %GTK_STATE_FLAG_DIR_RTL but ignores them. If you want to set the widget's direction, use gtk_widget_set_direction().

    It is worth mentioning that any other state than %GTK_STATE_FLAG_INSENSITIVE, will be propagated down to all non-internal children if widget is a #GtkContainer, while %GTK_STATE_FLAG_INSENSITIVE itself will be propagated down to all #GtkContainer children by different means than turning on the state flag down the hierarchy, both gtk_widget_get_state_flags() and gtk_widget_is_sensitive() will make use of these.

    Parameters

    • flags: Gtk.StateFlags

      State flags to turn on

    • clear: boolean

      Whether to clear state before turning on flags

    Returns void

  • Used to set the #GtkStyle for a widget (widget->style). Since GTK 3, this function does nothing, the passed in style is ignored.

    Parameters

    • style: Gtk.Style

      a #GtkStyle, or %NULL to remove the effect of a previous call to gtk_widget_set_style() and go back to the default style

    Returns void

  • set_support_multidevice(support_multidevice: boolean): 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 #GtkWidget::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

  • set_tooltip_markup(markup: string): 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 #GtkWidget:has-tooltip to %TRUE and of the default handler for the #GtkWidget::query-tooltip signal.

    See also the #GtkWidget:tooltip-markup property and gtk_tooltip_set_markup().

    Parameters

    • markup: string

      the contents of the tooltip for widget, or %NULL

    Returns void

  • set_tooltip_text(text: string): void
  • Sets text as the contents of the tooltip. This function will take care of setting #GtkWidget:has-tooltip to %TRUE and of the default handler for the #GtkWidget::query-tooltip signal.

    See also the #GtkWidget:tooltip-text property and gtk_tooltip_set_text().

    Parameters

    • text: string

      the contents of the tooltip for widget

    Returns void

  • set_tooltip_window(custom_window: Gtk.Window): void
  • Replaces the default window used for displaying tooltips with custom_window. GTK+ will take care of showing and hiding custom_window at the right moment, to behave likewise as the default tooltip window. If custom_window is %NULL, the default tooltip window will be used.

    Parameters

    • custom_window: Gtk.Window

      a #GtkWindow, or %NULL

    Returns void

  • set_value(value: number): void
  • Sets the current value of the range; if the value is outside the minimum or maximum range values, it will be clamped to fit inside them. The range emits the #GtkRange::value-changed signal if the value changes.

    Parameters

    • value: number

      new value of the range

    Returns void

  • set_vexpand(expand: boolean): void
  • Sets whether the widget would like any available extra vertical space.

    See gtk_widget_set_hexpand() for more detail.

    Parameters

    • expand: boolean

      whether to expand

    Returns void

  • set_vexpand_set(set: boolean): void
  • Sets whether the vexpand flag (see gtk_widget_get_vexpand()) will be used.

    See gtk_widget_set_hexpand_set() for more detail.

    Parameters

    • set: boolean

      value for vexpand-set property

    Returns void

  • set_visible(visible: boolean): 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 #GdkScreen as returned by gtk_widget_get_screen(), so handling the #GtkWidget::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

    • visual: 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 #GtkWidget::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 #GdkWindow 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 a shape for this widget’s GDK window. This allows for transparent windows etc., see gdk_window_shape_combine_region() for more information.

    Parameters

    • region: cairo.Region

      shape to be added, or %NULL to remove an existing shape

    Returns void

  • show(): 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

  • show_all(): void
  • show_now(): void
  • Shows a widget. If the widget is an unmapped toplevel widget (i.e. a #GtkWindow 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 #GtkContainer 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 #GtkWidget:halign and #GtkWidget: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

  • size_allocate_with_baseline(allocation: Gdk.Rectangle, baseline: number): void
  • This function is only used by #GtkContainer 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 #GtkWidget:halign and #GtkWidget: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 #GtkContainer 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

  • steal_data(key?: string): object
  • Remove a specified datum from the object's data associations, without invoking the association's destroy handler.

    Parameters

    • Optional key: string

      name of the key

    Returns object

  • steal_qdata(quark: number): object
  • 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 #GQuark, naming the user data pointer

    Returns object

  • style_attach(): void
  • This function attaches the widget’s #GtkStyle to the widget's #GdkWindow. It is a replacement for

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



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

    Returns void

  • style_get_property(property_name: string, value: any): void
  • thaw_child_notify(): void
  • thaw_notify(): 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::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(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number]
  • 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

      a #GtkWidget

    • src_x: number

      X position relative to src_widget

    • src_y: number

      Y position relative to src_widget

    Returns [boolean, number, number]

  • trigger_tooltip_query(): void
  • unmap(): void
  • This function is only for use in widget implementations. Causes a widget to be unmapped if it’s currently mapped.

    Returns void

  • unparent(): void
  • This function is only for use in widget implementations. Should be called by implementations of the remove method on #GtkContainer, to dissociate a child from the container.

    Returns void

  • unrealize(): void
  • This function is only useful in widget implementations. Causes a widget to be unrealized (frees all GDK resources associated with the widget, such as widget->window).

    Returns void

  • unref(): void
  • 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 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 instance. Use g_clear_object() for this.

    Returns void

  • Unregisters a #GdkWindow from the widget that was previously set up with gtk_widget_register_window(). You need to call this when the window is no longer used by the widget, such as when you destroy it.

    Parameters

    Returns void

  • vfunc_adjust_baseline_allocation(baseline: number): void
  • vfunc_adjust_baseline_request(minimum_baseline: number, natural_baseline: number): void
  • vfunc_adjust_bounds(new_value: number): void
  • vfunc_adjust_size_allocation(orientation: Gtk.Orientation, minimum_size: number, natural_size: number, allocated_pos: number, allocated_size: number): void
  • vfunc_adjust_size_request(orientation: Gtk.Orientation, minimum_size: number, natural_size: number): void
  • vfunc_can_activate_accel(signal_id: number): boolean
  • Determines whether an accelerator that activates the signal identified by signal_id can currently be activated. This is done by emitting the #GtkWidget::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.

    virtual

    Parameters

    • signal_id: number

      the ID of a signal installed on widget

    Returns boolean

  • vfunc_change_value(scroll: Gtk.ScrollType, new_value: number): boolean
  • vfunc_child_notify(child_property: ParamSpec): void
  • Emits a #GtkWidget::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().

    virtual

    Parameters

    • child_property: ParamSpec

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

    Returns void

  • vfunc_composited_changed(): void
  • vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void
  • vfunc_constructed(): void
  • This is similar to gtk_buildable_parser_finished() but is called once for each custom tag handled by the buildable.

    virtual

    Parameters

    • builder: Gtk.Builder

      a #GtkBuilder

    • child: GObject.Object

      child object or %NULL for non-child tags

    • tagname: string

      the name of the tag

    • data: object

      user data created in custom_tag_start

    Returns void

  • This is called at the end of each custom element handled by the buildable.

    virtual

    Parameters

    • builder: Gtk.Builder

      #GtkBuilder used to construct this object

    • child: GObject.Object

      child object or %NULL for non-child tags

    • tagname: string

      name of tag

    • data: object

      user data that will be passed in to parser functions

    Returns void

  • vfunc_destroy(): 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 #GtkWidget::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 #GtkContainer, as you'll be able to use the #GtkContainerClass.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()

    virtual

    Returns void

  • vfunc_dispatch_child_properties_changed(n_pspecs: number, pspecs: ParamSpec): void
  • vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: ParamSpec): void
  • vfunc_dispose(): void
  • vfunc_drag_drop(context: Gdk.DragContext, x: number, y: number, time_: number): boolean
  • vfunc_drag_motion(context: Gdk.DragContext, x: number, y: number, time_: number): boolean
  • vfunc_draw_value(): 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.

    virtual

    Parameters

    Returns boolean

  • vfunc_finalize(): void
  • vfunc_format_value(value: number): string
  • Returns the accessible object that describes the widget to an assistive technology.

    If accessibility support is not available, this #AtkObject instance may be a no-op. Likewise, if no class-specific #AtkObject implementation is available for the widget instance in question, it will inherit an #AtkObject 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.

    virtual

    Returns Atk.Object

  • vfunc_get_layout_offsets(): [number, number]
  • Obtains the coordinates where the scale will draw the #PangoLayout representing the text in the scale. Remember when using the #PangoLayout function you need to convert to and from pixels using PANGO_PIXELS() or #PANGO_SCALE.

    If the #GtkScale:draw-value property is %FALSE, the return values are undefined.

    virtual

    Returns [number, number]

  • vfunc_get_name(): string
  • Gets the name of the buildable object.

    #GtkBuilder sets the name based on the [GtkBuilder UI definition][BUILDER-UI] used to construct the buildable.

    virtual

    Returns string

  • vfunc_get_preferred_height(): [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.

    virtual

    Returns [number, number]

  • vfunc_get_preferred_height_and_baseline_for_width(width: number): [number, number, 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.

    virtual

    Parameters

    • width: number

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

    Returns [number, number, number, number]

  • vfunc_get_preferred_height_for_width(width: 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.

    virtual

    Parameters

    • width: number

      the width which is available for allocation

    Returns [number, number]

  • vfunc_get_preferred_width(): [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.

    virtual

    Returns [number, number]

  • vfunc_get_preferred_width_for_height(height: number): [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.

    virtual

    Parameters

    • height: number

      the height which is available for allocation

    Returns [number, number]

  • vfunc_get_property(property_id: number, value?: any, pspec?: ParamSpec): void
  • vfunc_get_range_border(border_: Gtk.Border): void
  • vfunc_get_range_size_request(orientation: Gtk.Orientation, minimum: number, natural: number): void
  • Gets whether the widget prefers a height-for-width layout or a width-for-height layout.

    #GtkBin widgets generally propagate the preference of their child, container widgets need to request something either in context of their children or in context of their allocation capabilities.

    virtual

    Returns Gtk.SizeRequestMode

  • vfunc_grab_focus(): void
  • Causes widget to have the keyboard focus for the #GtkWindow it's inside. widget must be a focusable widget, such as a #GtkEntry; something like #GtkFrame 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.

    virtual

    Returns void

  • vfunc_grab_notify(was_grabbed: boolean): void
  • vfunc_hide(): void
  • vfunc_hierarchy_changed(previous_toplevel: Gtk.Widget): void
  • This function should be called whenever keyboard navigation within a single widget hits a boundary. The function emits the #GtkWidget::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_DIR_TAB_FORWARD and %GTK_DIR_TAB_BACKWARD. For the other values of #GtkDirectionType 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 #GtkEntry 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.

    virtual

    Parameters

    Returns boolean

  • vfunc_map(): void
  • vfunc_mnemonic_activate(group_cycling: boolean): 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.

    virtual

    Parameters

    Returns void

  • vfunc_parent_set(previous_parent: Gtk.Widget): void
  • Called when the builder finishes the parsing of a [GtkBuilder UI definition][BUILDER-UI]. Note that this will be called once for each time gtk_builder_add_from_file() or gtk_builder_add_from_string() is called on a builder.

    virtual

    Parameters

    Returns void

  • vfunc_popup_menu(): boolean
  • vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): 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 #GtkDrawingArea or some portion thereof.

    virtual

    Parameters

    Returns void

  • vfunc_realize(): 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 #GtkWidget::draw. Or simply g_signal_connect () to the #GtkWidget::realize signal.

    virtual

    Returns void

  • vfunc_screen_changed(previous_screen: Gdk.Screen): void
  • vfunc_selection_get(selection_data: Gtk.SelectionData, info: number, time_: number): void
  • vfunc_selection_received(selection_data: Gtk.SelectionData, time_: number): void
  • vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: any): void
  • vfunc_set_name(name: string): void
  • vfunc_set_property(property_id: number, value?: any, pspec?: ParamSpec): void
  • vfunc_show(): 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.

    virtual

    Returns void

  • vfunc_show_all(): void
  • This function is only used by #GtkContainer 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 #GtkWidget:halign and #GtkWidget:valign properties.

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

    virtual

    Parameters

    • allocation: Gdk.Rectangle

      position and size to be allocated to widget

    Returns void

  • vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void
  • vfunc_style_set(previous_style: Gtk.Style): void
  • vfunc_style_updated(): void
  • vfunc_unmap(): void
  • vfunc_unrealize(): void
  • This function is only useful in widget implementations. Causes a widget to be unrealized (frees all GDK resources associated with the widget, such as widget->window).

    virtual

    Returns void

  • vfunc_value_changed(): void
  • watch_closure(closure: TClosure<any, any>): 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

    • closure: TClosure<any, any>

      #GClosure to watch

    Returns void

  • compat_control(what: number, data: object): number
  • Find the #GParamSpec with the given name for an interface. Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek().

    Parameters

    • g_iface: TypeInterface

      any interface vtable for the interface, or the default vtable for the interface

    • property_name: string

      name of a property to look up.

    Returns ParamSpec

  • 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 #GParamSpec, 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 #GTypeInfo.) 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

    • g_iface: TypeInterface

      any interface vtable for the interface, or the default vtable for the interface.

    • pspec: ParamSpec

      the #GParamSpec for the new property

    Returns void

  • Lists the properties of an interface.Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek().

    Parameters

    • g_iface: TypeInterface

      any interface vtable for the interface, or the default vtable for the interface

    Returns ParamSpec[]

  • Creates a new scale widget with the given orientation that lets the user input a number between min and max (including min and max) with the increment step. step must be nonzero; it’s the distance the slider moves when using the arrow keys to adjust the scale value.

    Note that the way in which the precision is derived works best if step is a power of ten. If the resulting precision is not suitable for your needs, use gtk_scale_set_digits() to correct it.

    Parameters

    • orientation: Gtk.Orientation

      the scale’s orientation.

    • min: number

      minimum value

    • max: number

      maximum value

    • step: number

      step increment (tick size) used with keyboard shortcuts

    Returns Gtk.Scale

  • Creates a new instance of a #GObject subtype and sets its properties.

    Construction parameters (see %G_PARAM_CONSTRUCT, %G_PARAM_CONSTRUCT_ONLY) which are not explicitly specified are set to their default values.

    Parameters

    • object_type: GType<unknown>

      the type id of the #GObject subtype to instantiate

    • parameters: GObject.Parameter[]

      an array of #GParameter

    Returns GObject.Object

  • pop_composite_child(): void
  • push_composite_child(): 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

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method