Interface Carousel.PageChangedCallback

All Superinterfaces:
FunctionPointer
Enclosing class:
Carousel
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface Carousel.PageChangedCallback extends FunctionPointer

Functional interface declaration of the PageChangedCallback callback.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    run(int index)
    This signal is emitted after a page has been changed.
    Creates a native function pointer to the upcall(MemorySegment, int) method.
    default void
    upcall(MemorySegment sourceCarousel, int index)
    The upcall method is called from native code.
  • Method Details

    • run

      void run(int index)

      This signal is emitted after a page has been changed.

      It can be used to implement "infinite scrolling" by amending the pages after every scroll.

      ::: note An empty carousel is indicated by (int)index == -1.

    • upcall

      default void upcall(MemorySegment sourceCarousel, int index)
      The upcall method is called from native code. The parameters are marshaled and run(int) is executed.
    • toCallback

      default MemorySegment toCallback(Arena arena)
      Creates a native function pointer to the upcall(MemorySegment, int) method.
      Specified by:
      toCallback in interface FunctionPointer
      Parameters:
      arena - the arena in which the function pointer is allocated
      Returns:
      the native function pointer