Class EventControllerFocus

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class EventControllerFocus extends EventController

Tracks keyboard focus.

The event controller offers Gtk.EventControllerFocus::enter and Gtk.EventControllerFocus::leave signals, as well as Gtk.EventControllerFocus:is-focus and Gtk.EventControllerFocus:contains-focus properties which are updated to reflect focus changes inside the widget hierarchy that is rooted at the controllers widget.

  • Constructor Details

    • EventControllerFocus

      public EventControllerFocus(MemorySegment address)
      Create a EventControllerFocus instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • EventControllerFocus

      public EventControllerFocus()
      Create a new EventControllerFocus.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the EventControllerFocus class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected EventControllerFocus asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class EventController
      Returns:
      the instance as if it were its parent type
    • containsFocus

      public boolean containsFocus()
      Returns true if focus is within this EventControllerFocus or one of its children.
      Returns:
      true if focus is within this EventControllerFocus or one of its children
    • isFocus

      public boolean isFocus()
      Returns true if focus is within self, but not one of its children.
      Returns:
      true if focus is within self, but not one of its children
    • onEnter

      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 Gtk.EventControllerFocus:is-focus property for changes.

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitEnter

      public void emitEnter()
      Emits the "enter" signal. See onEnter(EventControllerFocus.EnterCallback).
    • onLeave

      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 Gtk.EventControllerFocus:is-focus property for changes.

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitLeave

      public void emitLeave()
      Emits the "leave" signal. See onLeave(EventControllerFocus.LeaveCallback).
    • builder

      public static EventControllerFocus.Builder<? extends EventControllerFocus.Builder> builder()
      A EventControllerFocus.Builder object constructs a EventControllerFocus with the specified properties. Use the various set...() methods to set properties, and finish construction with EventControllerFocus.Builder.build().
      Returns:
      the builder object