Class HoverContext

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class HoverContext extends GObject

Context for populating HoverDisplay contents.

GtkSourceHoverContext contains information about the request to populate contents for a HoverDisplay.

It can be used to retrieve the View, Buffer, and Gtk.TextIter for the regions of text which are being displayed.

Use getBounds(TextIter, TextIter) to get the word that was requested. getIter(TextIter) will get you the location of the pointer when the request was made.

  • Constructor Details

    • HoverContext

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

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

    • getType

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

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

      protected HoverContext 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 GObject
      Returns:
      the instance as if it were its parent type
    • getBounds

      public boolean getBounds(@Nullable TextIter begin, @Nullable TextIter end)

      Gets the current word bounds of the hover.

      If begin is non-null, it will be set to the start position of the current word being hovered.

      If end is non-null, it will be set to the end position for the current word being hovered.

      Parameters:
      begin - a GtkTextIter
      end - a GtkTextIter
      Returns:
      true if the marks are still valid and begin or end was set.
    • getBuffer

      public Buffer getBuffer()
      A convenience function to get the buffer.
      Returns:
      The GtkSourceBuffer for the view
    • getIter

      public boolean getIter(TextIter iter)
      Gets the location of the pointer where the request was made.
      Parameters:
      iter - a GtkTextIter
      Returns:
      true if the mark is still valid and iter was set.
    • getView

      public View getView()
    • builder

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