Class CClosure

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class CClosure extends ProxyInstance
A GCClosure is a specialization of GClosure for C function callbacks.
  • Constructor Details

    • CClosure

      public CClosure(MemorySegment address)
      Create a CClosure proxy instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • CClosure

      public CClosure(Arena arena)
      Allocate a new CClosure.
      Parameters:
      arena - to control the memory allocation scope
    • CClosure

      public CClosure()
      Allocate a new CClosure. The memory is allocated with Arena.ofAuto().
    • CClosure

      public CClosure(Closure closure, MemorySegment callback, Arena arena)
      Allocate a new CClosure with the fields set to the provided values.
      Parameters:
      closure - value for the field closure
      callback - value for the field callback
      arena - to control the memory allocation scope
    • CClosure

      public CClosure(Closure closure, MemorySegment callback)
      Allocate a new CClosure with the fields set to the provided values. The memory is allocated with Arena.ofAuto().
      Parameters:
      closure - value for the field closure
      callback - value for the field callback
  • Method Details

    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • readClosure

      public @Nullable Closure readClosure()
      Read the value of the field closure.
      Returns:
      The value of the field closure
    • writeClosure

      public void writeClosure(@Nullable Closure closure)
      Write a value in the field closure.
      Parameters:
      closure - The new value for the field closure
    • readCallback

      public MemorySegment readCallback()
      Read the value of the field callback.
      Returns:
      The value of the field callback
    • writeCallback

      public void writeCallback(MemorySegment callback)
      Write a value in the field callback.
      Parameters:
      callback - The new value for the field callback
    • marshalBOOLEANBOXEDBOXED

      public static void marshalBOOLEANBOXEDBOXED(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with handlers that take two boxed pointers as arguments and return a boolean. If you have such a signal, you will probably also need to use an accumulator, such as g_signal_accumulator_true_handled().
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalBOOLEANFLAGS

      public static void marshalBOOLEANFLAGS(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with handlers that take a flags type as an argument and return a boolean. If you have such a signal, you will probably also need to use an accumulator, such as g_signal_accumulator_true_handled().
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalSTRINGOBJECTPOINTER

      public static void marshalSTRINGOBJECTPOINTER(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with handlers that take a GObject and a pointer and produce a string. It is highly unlikely that your signal handler fits this description.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDBOOLEAN

      public static void marshalVOIDBOOLEAN(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with a single boolean argument.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDBOXED

      public static void marshalVOIDBOXED(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with a single argument which is any boxed pointer type.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDCHAR

      public static void marshalVOIDCHAR(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with a single character argument.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDDOUBLE

      public static void marshalVOIDDOUBLE(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with one double-precision floating point argument.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDENUM

      public static void marshalVOIDENUM(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with a single argument with an enumerated type.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDFLAGS

      public static void marshalVOIDFLAGS(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with a single argument with a flags types.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDFLOAT

      public static void marshalVOIDFLOAT(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with one single-precision floating point argument.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDINT

      public static void marshalVOIDINT(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with a single integer argument.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDLONG

      public static void marshalVOIDLONG(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with with a single long integer argument.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDOBJECT

      public static void marshalVOIDOBJECT(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with a single GObject argument.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDPARAM

      public static void marshalVOIDPARAM(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with a single argument of type GParamSpec.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDPOINTER

      public static void marshalVOIDPOINTER(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)

      A GClosureMarshal function for use with signals with a single raw pointer argument type.

      If it is possible, it is better to use one of the more specific functions such as g_cclosure_marshal_VOID__OBJECT() or g_cclosure_marshal_VOID__OBJECT().

      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDSTRING

      public static void marshalVOIDSTRING(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with a single string argument.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDUCHAR

      public static void marshalVOIDUCHAR(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with a single unsigned character argument.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDUINT

      public static void marshalVOIDUINT(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with with a single unsigned integer argument.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDUINTPOINTER

      public static void marshalVOIDUINTPOINTER(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with an unsigned int and a pointer as arguments.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDULONG

      public static void marshalVOIDULONG(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with a single unsigned long integer argument.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDVARIANT

      public static void marshalVOIDVARIANT(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with a single GVariant argument.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalVOIDVOID

      public static void marshalVOIDVOID(Closure closure, Value returnValue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)
      A GClosureMarshal function for use with signals with no arguments.
      Parameters:
      closure - A GClosure.
      returnValue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalGeneric

      public static void marshalGeneric(Closure closure, Value returnGvalue, int nParamValues, Value paramValues, @Nullable MemorySegment invocationHint, @Nullable MemorySegment marshalData)

      A generic marshaller function implemented via libffi.

      Normally this function is not passed explicitly to g_signal_new(), but used automatically by GLib when specifying a null marshaller.

      Parameters:
      closure - A GClosure.
      returnGvalue - A GValue to store the return value. May be null if the callback of closure doesn't return a value.
      nParamValues - The length of the paramValues array.
      paramValues - An array of GValues holding the arguments on which to invoke the callback of closure.
      invocationHint - The invocation hint given as the last argument to g_closure_invoke().
      marshalData - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
      Since:
      2.30