Class Hook

All Implemented Interfaces:
PointerInterface

public class Hook extends Record
The #GHook struct represents a single hook function in a #GHookList.

https://docs.gtk.org/glib/struct.Hook.html

  • Field Details

  • Constructor Details

  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • setFieldData

      public void setFieldData(Pointer data)
      data which is passed to func when this hook is invoked
    • getFieldData

      public Pointer getFieldData()
      data which is passed to func when this hook is invoked
    • setFieldNext

      public void setFieldNext(Hook next)
      pointer to the next hook in the list
    • getFieldNext

      public Hook getFieldNext()
      pointer to the next hook in the list
    • setFieldPrev

      public void setFieldPrev(Hook prev)
      pointer to the previous hook in the list
    • getFieldPrev

      public Hook getFieldPrev()
      pointer to the previous hook in the list
    • setFieldRefCount

      public void setFieldRefCount(int ref_count)
      the reference count of this hook
    • getFieldRefCount

      public int getFieldRefCount()
      the reference count of this hook
    • setFieldHookId

      public void setFieldHookId(long hook_id)
      the id of this hook, which is unique within its list
    • getFieldHookId

      public long getFieldHookId()
      the id of this hook, which is unique within its list
    • setFieldFlags

      public void setFieldFlags(int flags)
      flags which are set for this hook. See #GHookFlagMask for
      predefined flags
    • getFieldFlags

      public int getFieldFlags()
      flags which are set for this hook. See #GHookFlagMask for
      predefined flags
    • setFieldFunc

      public void setFieldFunc(Pointer func)
      the function to call when this hook is invoked. The possible
      signatures for this function are #GHookFunc and #GHookCheckFunc
    • getFieldFunc

      public Pointer getFieldFunc()
      the function to call when this hook is invoked. The possible
      signatures for this function are #GHookFunc and #GHookCheckFunc
    • setFieldDestroy

      public void setFieldDestroy(Hook.OnDestroyNotify destroy)
      the default @finalize_hook function of a #GHookList calls
      this member of the hook that is being finalized
      See Hook.OnDestroyNotify.onDestroyNotify(ch.bailu.gtk.lib.handler.CallbackHandler, ch.bailu.gtk.type.Pointer)
    • getFieldDestroy

      public ch.bailu.gtk.glib.JnaHook.OnDestroyNotify getFieldDestroy()
      the default @finalize_hook function of a #GHookList calls
      this member of the hook that is being finalized
      See Hook.OnDestroyNotify.onDestroyNotify(ch.bailu.gtk.lib.handler.CallbackHandler, ch.bailu.gtk.type.Pointer)
    • compareIds

      public int compareIds(@Nonnull Hook sibling)
      Compares the ids of two #GHook elements, returning a negative value
      if the second id is greater than the first.
      Parameters:
      sibling - a #GHook to compare with @new_hook
      Returns:
      a value <= 0 if the id of @sibling is >= the id of @new_hook
    • alloc

      public static Hook alloc(@Nonnull HookList hook_list)
      Allocates space for a #GHook and initializes it.
      Parameters:
      hook_list - a #GHookList
      Returns:
      a new #GHook
    • destroy

      public static boolean destroy(@Nonnull HookList hook_list, long hook_id)
      Destroys a #GHook, given its ID.
      Parameters:
      hook_list - a #GHookList
      hook_id - a hook ID
      Returns:
      %TRUE if the #GHook was found in the #GHookList and destroyed
    • destroyLink

      public static void destroyLink(@Nonnull HookList hook_list, @Nonnull Hook hook)
      Removes one #GHook from a #GHookList, marking it
      inactive and calling g_hook_unref() on it.
      Parameters:
      hook_list - a #GHookList
      hook - the #GHook to remove
    • find

      public static Hook find(@Nonnull HookList hook_list, boolean need_valids, Hook.OnHookFindFunc func, @Nullable Pointer data)
      Finds a #GHook in a #GHookList using the given function to
      test for a match.
      Parameters:
      hook_list - a #GHookList
      need_valids - %TRUE if #GHook elements which have been destroyed should be skipped
      func - the function to call for each #GHook, which should return %TRUE when the #GHook has been found
      data - the data to pass to @func
      Returns:
      the found #GHook or %NULL if no matching #GHook is found
    • findData

      public static Hook findData(@Nonnull HookList hook_list, boolean need_valids, @Nullable Pointer data)
      Finds a #GHook in a #GHookList with the given data.
      Parameters:
      hook_list - a #GHookList
      need_valids - %TRUE if #GHook elements which have been destroyed should be skipped
      data - the data to find
      Returns:
      the #GHook with the given @data or %NULL if no matching #GHook is found
    • findFunc

      public static Hook findFunc(@Nonnull HookList hook_list, boolean need_valids, @Nullable Pointer func)
      Finds a #GHook in a #GHookList with the given function.
      Parameters:
      hook_list - a #GHookList
      need_valids - %TRUE if #GHook elements which have been destroyed should be skipped
      func - the function to find
      Returns:
      the #GHook with the given @func or %NULL if no matching #GHook is found
    • findFuncData

      public static Hook findFuncData(@Nonnull HookList hook_list, boolean need_valids, @Nonnull Pointer func, @Nullable Pointer data)
      Finds a #GHook in a #GHookList with the given function and data.
      Parameters:
      hook_list - a #GHookList
      need_valids - %TRUE if #GHook elements which have been destroyed should be skipped
      func - the function to find
      data - the data to find
      Returns:
      the #GHook with the given @func and @data or %NULL if no matching #GHook is found
    • firstValid

      public static Hook firstValid(@Nonnull HookList hook_list, boolean may_be_in_call)
      Returns the first #GHook in a #GHookList which has not been destroyed.
      The reference count for the #GHook is incremented, so you must call
      g_hook_unref() to restore it when no longer needed. (Or call
      g_hook_next_valid() if you are stepping through the #GHookList.)
      Parameters:
      hook_list - a #GHookList
      may_be_in_call - %TRUE if hooks which are currently running (e.g. in another thread) are considered valid. If set to %FALSE, these are skipped
      Returns:
      the first valid #GHook, or %NULL if none are valid
    • free

      public static void free(@Nonnull HookList hook_list, @Nonnull Hook hook)
      Calls the #GHookList @finalize_hook function if it exists,
      and frees the memory allocated for the #GHook.
      Parameters:
      hook_list - a #GHookList
      hook - the #GHook to free
    • get

      public static Hook get(@Nonnull HookList hook_list, long hook_id)
      Returns the #GHook with the given id, or %NULL if it is not found.
      Parameters:
      hook_list - a #GHookList
      hook_id - a hook id
      Returns:
      the #GHook with the given id, or %NULL if it is not found
    • insertBefore

      public static void insertBefore(@Nonnull HookList hook_list, @Nullable Hook sibling, @Nonnull Hook hook)
      Inserts a #GHook into a #GHookList, before a given #GHook.
      Parameters:
      hook_list - a #GHookList
      sibling - the #GHook to insert the new #GHook before
      hook - the #GHook to insert
    • insertSorted

      public static void insertSorted(@Nonnull HookList hook_list, @Nonnull Hook hook, Hook.OnHookCompareFunc func)
      Inserts a #GHook into a #GHookList, sorted by the given function.
      Parameters:
      hook_list - a #GHookList
      hook - the #GHook to insert
      func - the comparison function used to sort the #GHook elements
    • nextValid

      public static Hook nextValid(@Nonnull HookList hook_list, @Nonnull Hook hook, boolean may_be_in_call)
      Returns the next #GHook in a #GHookList which has not been destroyed.
      The reference count for the #GHook is incremented, so you must call
      g_hook_unref() to restore it when no longer needed. (Or continue to call
      g_hook_next_valid() until %NULL is returned.)
      Parameters:
      hook_list - a #GHookList
      hook - the current #GHook
      may_be_in_call - %TRUE if hooks which are currently running (e.g. in another thread) are considered valid. If set to %FALSE, these are skipped
      Returns:
      the next valid #GHook, or %NULL if none are valid
    • prepend

      public static void prepend(@Nonnull HookList hook_list, @Nonnull Hook hook)
      Prepends a #GHook on the start of a #GHookList.
      Parameters:
      hook_list - a #GHookList
      hook - the #GHook to add to the start of @hook_list
    • ref

      public static Hook ref(@Nonnull HookList hook_list, @Nonnull Hook hook)
      Increments the reference count for a #GHook.
      Parameters:
      hook_list - a #GHookList
      hook - the #GHook to increment the reference count of
      Returns:
      the @hook that was passed in (since 2.6)
    • unref

      public static void unref(@Nonnull HookList hook_list, @Nonnull Hook hook)
      Decrements the reference count of a #GHook.
      If the reference count falls to 0, the #GHook is removed
      from the #GHookList and g_hook_free() is called to free it.
      Parameters:
      hook_list - a #GHookList
      hook - the #GHook to unref