Interface Root
- All Known Implementing Classes:
AboutDialog, AboutWindow, AppChooserDialog, ApplicationWindow, ApplicationWindow, Assistant, ColorChooserDialog, Dialog, DragIcon, FileChooserDialog, FontChooserDialog, MessageDialog, MessageDialog, PageSetupUnixDialog, PreferencesWindow, PrintUnixDialog, Root.Root$Impl, ShortcutsWindow, Window, Window
An interface for widgets that can act as the root of a widget hierarchy.
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
getDisplay().
GtkRoot also maintains the location of keyboard focus inside its widget
hierarchy, with setFocus(Widget) and getFocus().
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classThe Root$Impl type represents a native instance of the Root interface.static classNested classes/interfaces inherited from interface Native
Native.Native$Impl, Native.NativeInterface -
Method Summary
Modifier and TypeMethodDescriptiondefault DisplayReturns the display that thisGtkRootis on.default @Nullable WidgetgetFocus()Retrieves the current focused widget within the root.static @Nullable TypegetType()Get the GType of the Root class.default voidIffocusis not the current focus widget, and is focusable, sets it as the focus widget for the root.Methods inherited from interface Native
getRenderer, getSurface, getSurfaceTransform, realize, unrealize
-
Method Details
-
getType
-
getDisplay
Returns the display that thisGtkRootis on.- Returns:
- the display of
root
-
getFocus
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 befalsefor the widget.- Returns:
- the currently focused widget
-
setFocus
If
focusis not the current focus widget, and is focusable, sets it as the focus widget for the root.If
focusisnull, 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
Widget.grabFocus()instead of this function.- Parameters:
focus- widget to be the new focus widget, ornullto unset the focus widget
-