Trait gtk4::prelude::RootExt

source ·
pub trait RootExt: 'static {
    // Required methods
    fn display(&self) -> Display;
    fn focus(&self) -> Option<Widget>;
    fn set_focus(&self, focus: Option<&impl IsA<Widget>>);
Expand description

Required Methods§


fn display(&self) -> Display

Returns the display that this Root is on.


the display of @root


fn focus(&self) -> Option<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.


the currently focused widget


fn set_focus(&self, focus: Option<&impl IsA<Widget>>)

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

If @focus is None, 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 WidgetExt::grab_focus() instead of this function.


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



impl<O: IsA<Root>> RootExt for O