Class BuilderCScope

All Implemented Interfaces:
PointerInterface

public class BuilderCScope extends Object
A `GtkBuilderScope` implementation for the C language.

`GtkBuilderCScope` instances use symbols explicitly added to @builder
with prior calls to [method@Gtk.BuilderCScope.add_callback_symbol].
If developers want to do that, they are encouraged to create their
own scopes for that purpose.

In the case that symbols are not explicitly added; GTK will uses
`GModule`’s introspective features (by opening the module %NULL) to
look at the application’s symbol table. From here it tries to match
the signal function names given in the interface description with
symbols in the application.

Note that unless [method@Gtk.BuilderCScope.add_callback_symbol] is
called for all signal callbacks which are referenced by the loaded XML,
this functionality will require that `GModule` be supported on the platform.

https://docs.gtk.org/gtk4/class.BuilderCScope.html

  • Constructor Details

    • BuilderCScope

      public BuilderCScope(PointerContainer pointer)
    • BuilderCScope

      public BuilderCScope()
      Creates a new `GtkBuilderCScope` object to use with future
      `GtkBuilder` instances.

      Calling this function is only necessary if you want to add
      custom callbacks via [method@Gtk.BuilderCScope.add_callback_symbol].
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • addCallbackSymbol

      public void addCallbackSymbol(@Nonnull Str callback_name, BuilderCScope.OnCallback callback_symbol)
      Adds the @callback_symbol to the scope of @builder under the
      given @callback_name.

      Using this function overrides the behavior of
      [method@Gtk.Builder.create_closure] for any callback symbols that
      are added. Using this method allows for better encapsulation as it
      does not require that callback symbols be declared in the global
      namespace.
      Parameters:
      callback_name - The name of the callback, as expected in the XML
      callback_symbol - The callback pointer
    • addCallbackSymbol

      public void addCallbackSymbol(String callback_name, BuilderCScope.OnCallback callback_symbol)
      Adds the @callback_symbol to the scope of @builder under the
      given @callback_name.

      Using this function overrides the behavior of
      [method@Gtk.Builder.create_closure] for any callback symbols that
      are added. Using this method allows for better encapsulation as it
      does not require that callback symbols be declared in the global
      namespace.
      Parameters:
      callback_name - The name of the callback, as expected in the XML
      callback_symbol - The callback pointer
    • addCallbackSymbols

      public void addCallbackSymbols(@Nonnull Str first_callback_name, BuilderCScope.OnCallback first_callback_symbol, Object... _elipse)
      A convenience function to add many callbacks.

      This is equivalent to calling [method@Gtk.BuilderCScope.add_callback_symbol]
      for each symbol.
      Parameters:
      first_callback_name - The name of the callback, as expected in the XML
      first_callback_symbol - The callback pointer
      _elipse - A list of callback name and callback symbol pairs terminated with %NULL
    • addCallbackSymbols

      public void addCallbackSymbols(String first_callback_name, BuilderCScope.OnCallback first_callback_symbol, Object... _elipse)
      A convenience function to add many callbacks.

      This is equivalent to calling [method@Gtk.BuilderCScope.add_callback_symbol]
      for each symbol.
      Parameters:
      first_callback_name - The name of the callback, as expected in the XML
      first_callback_symbol - The callback pointer
      _elipse - A list of callback name and callback symbol pairs terminated with %NULL
    • asBuilderScope

      public BuilderScope asBuilderScope()
      Implements interface BuilderScope. Call this to get access to interface functions.
      Returns:
      BuilderScope
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()