Interface TextBufferCommitNotify

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

@FunctionalInterface @Generated("org.javagi.JavaGI") public interface TextBufferCommitNotify extends FunctionPointer

Functional interface declaration of the TextBufferCommitNotify callback.

See Also:
  • Method Details

    • run

      void run(TextBuffer buffer, Set<TextBufferNotifyFlags> flags, int position, int length)

      A notification callback used by TextBuffer.addCommitNotify(Set, TextBufferCommitNotify).

      You may not modify the TextBuffer from a Gtk.TextBufferCommitNotify callback and that is enforced by the TextBuffer API.

      Gtk.TextBufferCommitNotify may be used to be notified about changes to the underlying buffer right before-or-after the changes are committed to the underlying B-Tree. This is useful if you want to observe changes to the buffer without other signal handlers potentially modifying state on the way to the default signal handler.

      When flags is GTK_TEXT_BUFFER_NOTIFY_BEFORE_INSERT, position is set to the offset in characters from the start of the buffer where the insertion will occur. length is set to the number of characters to be inserted. You may not yet retrieve the text until it has been inserted. You may access the text from GTK_TEXT_BUFFER_NOTIFY_AFTER_INSERT using TextBuffer.getSlice(TextIter, TextIter, boolean).

      When flags is GTK_TEXT_BUFFER_NOTIFY_AFTER_INSERT, position is set to offset in characters where the insertion occurred and length is set to the number of characters inserted.

      When flags is GTK_TEXT_BUFFER_NOTIFY_BEFORE_DELETE, position is set to offset in characters where the deletion will occur and length is set to the number of characters that will be removed. You may still retrieve the text from this handler using position and length.

      When flags is GTK_TEXT_BUFFER_NOTIFY_AFTER_DELETE, length is set to zero to denote that the delete-range has already been committed to the underlying B-Tree. You may no longer retrieve the text that has been deleted from the TextBuffer.

      Parameters:
      buffer - the text buffer being notified
      flags - the type of commit notification
      position - the position of the text operation
      length - the length of the text operation in characters
      Since:
      4.16
    • upcall

      default void upcall(MemorySegment buffer, int flags, int position, int length, MemorySegment userData)
      The upcall method is called from native code. The parameters are marshaled and run(TextBuffer, Set, int, int) is executed.
    • toCallback

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