:right-sidebar: True EventControllerFocus =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: EventControllerFocus(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.EventController`, :class:`~gi.repository.GObject.Object` :Constructors: :: EventControllerFocus(**properties) new() -> Gtk.EventController Constructors ------------ .. rst-class:: interim-class .. class:: EventControllerFocus :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.EventController Creates a new event controller that will handle focus events. Methods ------- .. rst-class:: interim-class .. class:: EventControllerFocus :no-index: .. method:: contains_focus() -> bool Returns :const:`True` if focus is within ``self`` or one of its children. .. method:: is_focus() -> bool Returns :const:`True` if focus is within ``self``, but not one of its children. Properties ---------- .. rst-class:: interim-class .. class:: EventControllerFocus :no-index: .. attribute:: props.contains_focus :type: bool :const:`True` if focus is contained in the controllers widget. See :obj:`~gi.repository.Gtk.EventControllerFocus.props.is_focus` for whether the focus is in the widget itself or inside a descendent. When handling focus events, this property is updated before :obj:`~gi.repository.Gtk.EventControllerFocus.signals.enter` or :obj:`~gi.repository.Gtk.EventControllerFocus.signals.leave` are emitted. .. attribute:: props.is_focus :type: bool :const:`True` if focus is in the controllers widget itself, as opposed to in a descendent widget. See also :obj:`~gi.repository.Gtk.EventControllerFocus.props.contains_focus`. When handling focus events, this property is updated before :obj:`~gi.repository.Gtk.EventControllerFocus.signals.enter` or :obj:`~gi.repository.Gtk.EventControllerFocus.signals.leave` are emitted. Signals ------- .. rst-class:: interim-class .. class:: EventControllerFocus.signals :no-index: .. method:: enter() -> None Emitted whenever the focus enters into the widget or one of its descendents. Note that this means you may not get an ::enter signal even though the widget becomes the focus location, in certain cases (such as when the focus moves from a descendent of the widget to the widget itself). If you are interested in these cases, you can monitor the :obj:`~gi.repository.Gtk.EventControllerFocus.props.is_focus` property for changes. .. method:: leave() -> None Emitted whenever the focus leaves the widget hierarchy that is rooted at the widget that the controller is attached to. Note that this means you may not get a ::leave signal even though the focus moves away from the widget, in certain cases (such as when the focus moves from the widget to a descendent). If you are interested in these cases, you can monitor the :obj:`~gi.repository.Gtk.EventControllerFocus.props.is_focus` property for changes.