Class CClosure

All Implemented Interfaces:
PointerInterface

public class CClosure extends Record
A #GCClosure is a specialization of #GClosure for C function callbacks.

https://docs.gtk.org/gobject/struct.CClosure.html

  • Field Details

  • Constructor Details

    • CClosure

      public CClosure(PointerContainer pointer)
    • CClosure

      public CClosure()
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • setFieldCallback

      public void setFieldCallback(Pointer callback)
      the callback function
    • getFieldCallback

      public Pointer getFieldCallback()
      the callback function
    • marshalBooleanBoxedBoxed

      public static void marshalBooleanBoxedBoxed(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      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.
      return_value - A #GValue to store the return value. May be %NULL if the callback of closure doesn't return a value.
      n_param_values - The length of the @param_values array.
      param_values - An array of #GValues holding the arguments on which to invoke the callback of closure.
      invocation_hint - The invocation hint given as the last argument to g_closure_invoke().
      marshal_data - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • marshalBooleanFlags

      public static void marshalBooleanFlags(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `gboolean (*callback) (gpointer instance, gint arg1, gpointer user_data)` where the #gint parameter
      denotes a flags type.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - a #GValue which can store the returned #gboolean
      n_param_values - 2
      param_values - a #GValue array holding instance and arg1
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalStringObjectPointer

      public static void marshalStringObjectPointer(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `gchar* (*callback) (gpointer instance, GObject *arg1, gpointer arg2, gpointer user_data)`.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - a #GValue, which can store the returned string
      n_param_values - 3
      param_values - a #GValue array holding instance, arg1 and arg2
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidBoolean

      public static void marshalVoidBoolean(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, gboolean arg1, gpointer user_data)`.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 2
      param_values - a #GValue array holding the instance and the #gboolean parameter
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidBoxed

      public static void marshalVoidBoxed(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, GBoxed *arg1, gpointer user_data)`.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 2
      param_values - a #GValue array holding the instance and the #GBoxed* parameter
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidChar

      public static void marshalVoidChar(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, gchar arg1, gpointer user_data)`.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 2
      param_values - a #GValue array holding the instance and the #gchar parameter
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidDouble

      public static void marshalVoidDouble(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, gdouble arg1, gpointer user_data)`.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 2
      param_values - a #GValue array holding the instance and the #gdouble parameter
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidEnum

      public static void marshalVoidEnum(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, gint arg1, gpointer user_data)` where the #gint parameter denotes an enumeration type..
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 2
      param_values - a #GValue array holding the instance and the enumeration parameter
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidFlags

      public static void marshalVoidFlags(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, gint arg1, gpointer user_data)` where the #gint parameter denotes a flags type.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 2
      param_values - a #GValue array holding the instance and the flags parameter
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidFloat

      public static void marshalVoidFloat(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, gfloat arg1, gpointer user_data)`.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 2
      param_values - a #GValue array holding the instance and the #gfloat parameter
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidInt

      public static void marshalVoidInt(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, gint arg1, gpointer user_data)`.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 2
      param_values - a #GValue array holding the instance and the #gint parameter
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidLong

      public static void marshalVoidLong(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, glong arg1, gpointer user_data)`.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 2
      param_values - a #GValue array holding the instance and the #glong parameter
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidObject

      public static void marshalVoidObject(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, GObject *arg1, gpointer user_data)`.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 2
      param_values - a #GValue array holding the instance and the #GObject* parameter
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidParam

      public static void marshalVoidParam(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, GParamSpec *arg1, gpointer user_data)`.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 2
      param_values - a #GValue array holding the instance and the #GParamSpec* parameter
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidPointer

      public static void marshalVoidPointer(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, gpointer arg1, gpointer user_data)`.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 2
      param_values - a #GValue array holding the instance and the #gpointer parameter
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidString

      public static void marshalVoidString(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, const gchar *arg1, gpointer user_data)`.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 2
      param_values - a #GValue array holding the instance and the #gchar* parameter
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidUchar

      public static void marshalVoidUchar(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, guchar arg1, gpointer user_data)`.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 2
      param_values - a #GValue array holding the instance and the #guchar parameter
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidUint

      public static void marshalVoidUint(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, guint arg1, gpointer user_data)`.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 2
      param_values - a #GValue array holding the instance and the #guint parameter
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidUintPointer

      public static void marshalVoidUintPointer(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, guint arg1, gpointer arg2, gpointer user_data)`.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 3
      param_values - a #GValue array holding instance, arg1 and arg2
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidUlong

      public static void marshalVoidUlong(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, gulong arg1, gpointer user_data)`.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 2
      param_values - a #GValue array holding the instance and the #gulong parameter
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidVariant

      public static void marshalVoidVariant(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, GVariant *arg1, gpointer user_data)`.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 2
      param_values - a #GValue array holding the instance and the #GVariant* parameter
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalVoidVoid

      public static void marshalVoidVoid(@Nonnull Closure closure, @Nonnull Value return_value, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A marshaller for a #GCClosure with a callback of type
      `void (*callback) (gpointer instance, gpointer user_data)`.
      Parameters:
      closure - the #GClosure to which the marshaller belongs
      return_value - ignored
      n_param_values - 1
      param_values - a #GValue array holding only the instance
      invocation_hint - the invocation hint given as the last argument to g_closure_invoke()
      marshal_data - additional data specified when registering the marshaller
    • marshalGeneric

      public static void marshalGeneric(@Nonnull Closure closure, @Nonnull Value return_gvalue, int n_param_values, @Nonnull Value param_values, @Nullable Pointer invocation_hint, @Nullable Pointer marshal_data)
      A generic marshaller function implemented via
      [libffi](http://sourceware.org/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.
      return_gvalue - A #GValue to store the return value. May be %NULL if the callback of closure doesn't return a value.
      n_param_values - The length of the @param_values array.
      param_values - An array of #GValues holding the arguments on which to invoke the callback of closure.
      invocation_hint - The invocation hint given as the last argument to g_closure_invoke().
      marshal_data - Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
    • _new

      public static Closure _new(CClosure.OnCallback callback_func, @Nullable Pointer user_data, CClosure.OnClosureNotify destroy_data)
      Creates a new closure which invokes @callback_func with @user_data as
      the last parameter.

      @destroy_data will be called as a finalize notifier on the #GClosure.
      Parameters:
      callback_func - the function to invoke
      user_data - user data to pass to @callback_func
      destroy_data - destroy notify to be called when @user_data is no longer used
      Returns:
      a floating reference to a new #GCClosure
    • newObject

      public static Closure newObject(CClosure.OnCallback callback_func, @Nonnull Object object)
      A variant of g_cclosure_new() which uses @object as @user_data and
      calls g_object_watch_closure() on @object and the created
      closure. This function is useful when you have a callback closely
      associated with a #GObject, and want the callback to no longer run
      after the object is is freed.
      Parameters:
      callback_func - the function to invoke
      object - a #GObject pointer to pass to @callback_func
      Returns:
      a new #GCClosure
    • newObjectSwap

      public static Closure newObjectSwap(CClosure.OnCallback callback_func, @Nonnull Object object)
      A variant of g_cclosure_new_swap() which uses @object as @user_data
      and calls g_object_watch_closure() on @object and the created
      closure. This function is useful when you have a callback closely
      associated with a #GObject, and want the callback to no longer run
      after the object is is freed.
      Parameters:
      callback_func - the function to invoke
      object - a #GObject pointer to pass to @callback_func
      Returns:
      a new #GCClosure
    • newSwap

      public static Closure newSwap(CClosure.OnCallback callback_func, @Nullable Pointer user_data, CClosure.OnClosureNotify destroy_data)
      Creates a new closure which invokes @callback_func with @user_data as
      the first parameter.

      @destroy_data will be called as a finalize notifier on the #GClosure.
      Parameters:
      callback_func - the function to invoke
      user_data - user data to pass to @callback_func
      destroy_data - destroy notify to be called when @user_data is no longer used
      Returns:
      a floating reference to a new #GCClosure