Package ch.bailu.gtk.glib
Class Hook
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.type.Record
ch.bailu.gtk.glib.Hook
- All Implemented Interfaces:
PointerInterface
The #GHook struct represents a single hook function in a #GHookList.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
static interface
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
data which is passed to func when this hook is invokedstatic final String
the default @finalize_hook function of a #GHookList calls
this member of the hook that is being finalized
SeeHook.OnDestroyNotify.onDestroyNotify(ch.bailu.gtk.lib.handler.CallbackHandler, ch.bailu.gtk.type.Pointer)
static final String
flags which are set for this hook.static final String
the function to call when this hook is invoked.static final String
the id of this hook, which is unique within its liststatic final String
pointer to the next hook in the liststatic final String
pointer to the previous hook in the liststatic final String
the reference count of this hook -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Hook
Allocates space for a #GHook and initializes it.int
compareIds
(Hook sibling) Compares the ids of two #GHook elements, returning a negative value
if the second id is greater than the first.static boolean
Destroys a #GHook, given its ID.static void
destroyLink
(HookList hook_list, Hook hook) Removes one #GHook from a #GHookList, marking it
inactive and calling g_hook_unref() on it.static Hook
find
(HookList hook_list, boolean need_valids, Hook.OnHookFindFunc func, Pointer data) Finds a #GHook in a #GHookList using the given function to
test for a match.static Hook
Finds a #GHook in a #GHookList with the given data.static Hook
Finds a #GHook in a #GHookList with the given function.static Hook
findFuncData
(HookList hook_list, boolean need_valids, Pointer func, Pointer data) Finds a #GHook in a #GHookList with the given function and data.static Hook
firstValid
(HookList hook_list, boolean may_be_in_call) Returns the first #GHook in a #GHookList which has not been destroyed.static void
Calls the #GHookList @finalize_hook function if it exists,
and frees the memory allocated for the #GHook.static Hook
Returns the #GHook with the given id, or %NULL if it is not found.static ClassHandler
data which is passed to func when this hook is invokedch.bailu.gtk.glib.JnaHook.OnDestroyNotify
the default @finalize_hook function of a #GHookList calls
this member of the hook that is being finalized
SeeHook.OnDestroyNotify.onDestroyNotify(ch.bailu.gtk.lib.handler.CallbackHandler, ch.bailu.gtk.type.Pointer)
int
flags which are set for this hook.the function to call when this hook is invoked.long
the id of this hook, which is unique within its listpointer to the next hook in the listpointer to the previous hook in the listint
the reference count of this hookstatic void
insertBefore
(HookList hook_list, Hook sibling, Hook hook) Inserts a #GHook into a #GHookList, before a given #GHook.static void
insertSorted
(HookList hook_list, Hook hook, Hook.OnHookCompareFunc func) Inserts a #GHook into a #GHookList, sorted by the given function.static Hook
Returns the next #GHook in a #GHookList which has not been destroyed.static void
Prepends a #GHook on the start of a #GHookList.static Hook
Increments the reference count for a #GHook.void
setFieldData
(Pointer data) data which is passed to func when this hook is invokedvoid
setFieldDestroy
(Hook.OnDestroyNotify destroy) the default @finalize_hook function of a #GHookList calls
this member of the hook that is being finalized
SeeHook.OnDestroyNotify.onDestroyNotify(ch.bailu.gtk.lib.handler.CallbackHandler, ch.bailu.gtk.type.Pointer)
void
setFieldFlags
(int flags) flags which are set for this hook.void
setFieldFunc
(Pointer func) the function to call when this hook is invoked.void
setFieldHookId
(long hook_id) the id of this hook, which is unique within its listvoid
setFieldNext
(Hook next) pointer to the next hook in the listvoid
setFieldPrev
(Hook prev) pointer to the previous hook in the listvoid
setFieldRefCount
(int ref_count) the reference count of this hookstatic void
Decrements the reference count of a #GHook.Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
DATA
data which is passed to func when this hook is invoked- See Also:
-
NEXT
pointer to the next hook in the list- See Also:
-
PREV
pointer to the previous hook in the list- See Also:
-
REF_COUNT
the reference count of this hook- See Also:
-
HOOK_ID
the id of this hook, which is unique within its list- See Also:
-
FLAGS
flags which are set for this hook. See #GHookFlagMask for
predefined flags- See Also:
-
FUNC
the function to call when this hook is invoked. The possible
signatures for this function are #GHookFunc and #GHookCheckFunc- See Also:
-
DESTROY
the default @finalize_hook function of a #GHookList calls
this member of the hook that is being finalized
SeeHook.OnDestroyNotify.onDestroyNotify(ch.bailu.gtk.lib.handler.CallbackHandler, ch.bailu.gtk.type.Pointer)
- See Also:
-
-
Constructor Details
-
Hook
-
Hook
public Hook()
-
-
Method Details
-
getClassHandler
-
setFieldData
data which is passed to func when this hook is invoked -
getFieldData
data which is passed to func when this hook is invoked -
setFieldNext
pointer to the next hook in the list -
getFieldNext
pointer to the next hook in the list -
setFieldPrev
pointer to the previous hook in the list -
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
the function to call when this hook is invoked. The possible
signatures for this function are #GHookFunc and #GHookCheckFunc -
getFieldFunc
the function to call when this hook is invoked. The possible
signatures for this function are #GHookFunc and #GHookCheckFunc -
setFieldDestroy
the default @finalize_hook function of a #GHookList calls
this member of the hook that is being finalized
SeeHook.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
SeeHook.OnDestroyNotify.onDestroyNotify(ch.bailu.gtk.lib.handler.CallbackHandler, ch.bailu.gtk.type.Pointer)
-
compareIds
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
Allocates space for a #GHook and initializes it.- Parameters:
hook_list
- a #GHookList- Returns:
- a new #GHook
-
destroy
Destroys a #GHook, given its ID.- Parameters:
hook_list
- a #GHookListhook_id
- a hook ID- Returns:
- %TRUE if the #GHook was found in the #GHookList and destroyed
-
destroyLink
Removes one #GHook from a #GHookList, marking it
inactive and calling g_hook_unref() on it.- Parameters:
hook_list
- a #GHookListhook
- 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 #GHookListneed_valids
- %TRUE if #GHook elements which have been destroyed should be skippedfunc
- the function to call for each #GHook, which should return %TRUE when the #GHook has been founddata
- 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 #GHookListneed_valids
- %TRUE if #GHook elements which have been destroyed should be skippeddata
- 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 #GHookListneed_valids
- %TRUE if #GHook elements which have been destroyed should be skippedfunc
- 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 #GHookListneed_valids
- %TRUE if #GHook elements which have been destroyed should be skippedfunc
- the function to finddata
- the data to find- Returns:
- the #GHook with the given @func and @data or %NULL if no matching #GHook is found
-
firstValid
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 #GHookListmay_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
Calls the #GHookList @finalize_hook function if it exists,
and frees the memory allocated for the #GHook.- Parameters:
hook_list
- a #GHookListhook
- the #GHook to free
-
get
Returns the #GHook with the given id, or %NULL if it is not found.- Parameters:
hook_list
- a #GHookListhook_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 #GHookListsibling
- the #GHook to insert the new #GHook beforehook
- 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 #GHookListhook
- the #GHook to insertfunc
- 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 #GHookListhook
- the current #GHookmay_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
Prepends a #GHook on the start of a #GHookList.- Parameters:
hook_list
- a #GHookListhook
- the #GHook to add to the start of @hook_list
-
ref
Increments the reference count for a #GHook.- Parameters:
hook_list
- a #GHookListhook
- the #GHook to increment the reference count of- Returns:
- the @hook that was passed in (since 2.6)
-
unref
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 #GHookListhook
- the #GHook to unref
-