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
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringdata which is passed to func when this hook is invokedstatic final Stringthe 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 Stringflags which are set for this hook.static final Stringthe function to call when this hook is invoked.static final Stringthe id of this hook, which is unique within its liststatic final Stringpointer to the next hook in the liststatic final Stringpointer to the previous hook in the liststatic final Stringthe reference count of this hook -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic HookAllocates space for a #GHook and initializes it.intcompareIds(Hook sibling) Compares the ids of two #GHook elements, returning a negative value
if the second id is greater than the first.static booleanDestroys a #GHook, given its ID.static voiddestroyLink(HookList hook_list, Hook hook) Removes one #GHook from a #GHookList, marking it
inactive and calling g_hook_unref() on it.static Hookfind(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 HookFinds a #GHook in a #GHookList with the given data.static HookFinds a #GHook in a #GHookList with the given function.static HookfindFuncData(HookList hook_list, boolean need_valids, Pointer func, Pointer data) Finds a #GHook in a #GHookList with the given function and data.static HookfirstValid(HookList hook_list, boolean may_be_in_call) Returns the first #GHook in a #GHookList which has not been destroyed.static voidCalls the #GHookList @finalize_hook function if it exists,
and frees the memory allocated for the #GHook.static HookReturns the #GHook with the given id, or %NULL if it is not found.static ClassHandlerdata which is passed to func when this hook is invokedch.bailu.gtk.glib.JnaHook.OnDestroyNotifythe 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)intflags which are set for this hook.the function to call when this hook is invoked.longthe id of this hook, which is unique within its listpointer to the next hook in the listpointer to the previous hook in the listintthe reference count of this hookstatic voidinsertBefore(HookList hook_list, Hook sibling, Hook hook) Inserts a #GHook into a #GHookList, before a given #GHook.static voidinsertSorted(HookList hook_list, Hook hook, Hook.OnHookCompareFunc func) Inserts a #GHook into a #GHookList, sorted by the given function.static HookReturns the next #GHook in a #GHookList which has not been destroyed.static voidPrepends a #GHook on the start of a #GHookList.static HookIncrements the reference count for a #GHook.voidsetFieldData(Pointer data) data which is passed to func when this hook is invokedvoidsetFieldDestroy(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)voidsetFieldFlags(int flags) flags which are set for this hook.voidsetFieldFunc(Pointer func) the function to call when this hook is invoked.voidsetFieldHookId(long hook_id) the id of this hook, which is unique within its listvoidsetFieldNext(Hook next) pointer to the next hook in the listvoidsetFieldPrev(Hook prev) pointer to the previous hook in the listvoidsetFieldRefCount(int ref_count) the reference count of this hookstatic voidDecrements 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, unregisterCallbacksMethods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNullMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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
-