Module: Gtk::Root

Defined in:
(unknown)

Overview

GtkRoot is the interface implemented by all widgets that can act as a toplevel widget.

The root widget takes care of providing the connection to the windowing system and manages layout, drawing and event delivery for its widget hierarchy.

The obvious example of a GtkRoot is GtkWindow.

To get the display to which a GtkRoot belongs, use [methodGtk.Root.get_display].

GtkRoot also maintains the location of keyboard focus inside its widget hierarchy, with [methodGtk.Root.set_focus] and [methodGtk.Root.get_focus].

Instance Method Summary collapse

Instance Method Details

#displayGdk::Display

Returns the display that this GtkRoot is on.

Returns:

#focusGtk::Widget

Retrieves the current focused widget within the root.

Note that this is the widget that would have the focus if the root is active; if the root is not focused then gtk_widget_has_focus (widget) will be false for the widget.

Returns:

#focus=(focus) ⇒ nil

If focus is not the current focus widget, and is focusable, sets it as the focus widget for the root.

If focus is nil, unsets the focus widget for the root.

To set the focus to a particular widget in the root, it is usually more convenient to use [methodGtk.Widget.grab_focus] instead of this function.

Parameters:

  • focus (Gtk::Widget)

    widget to be the new focus widget, or nil to unset the focus widget

Returns:

  • (nil)