Class BuilderCScope

All Implemented Interfaces:
BuilderScope, Proxy
Direct Known Subclasses:
BuilderJavaScope

@Generated("org.javagi.JavaGI") public class BuilderCScope extends GObject implements BuilderScope

A GtkBuilderScope implementation for the C language.

GtkBuilderCScope instances use symbols explicitly added to builder with prior calls to addCallbackSymbol(String, Callback). 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 addCallbackSymbol(String, Callback) is called for all signal callbacks which are referenced by the loaded XML, this functionality will require that GModule be supported on the platform.

  • Constructor Details

    • BuilderCScope

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

      public BuilderCScope()
      Create a new BuilderCScope.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the BuilderCScope class.
      Returns:
      the GType
    • getMemoryLayout

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

      protected BuilderCScope asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • addCallbackSymbol

      public void addCallbackSymbol(String callbackName, @Nullable Callback callbackSymbol)

      Adds the callbackSymbol to the scope of builder under the given callbackName.

      Using this function overrides the behavior of GtkBuilder.createClosure(String, Set, GObject) 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:
      callbackName - The name of the callback, as expected in the XML
      callbackSymbol - The callback pointer
    • addCallbackSymbols

      public void addCallbackSymbols(String firstCallbackName, @Nullable Callback firstCallbackSymbol, Object... varargs)

      A convenience function to add many callbacks.

      This is equivalent to calling addCallbackSymbol(String, Callback) for each symbol.

      Parameters:
      firstCallbackName - The name of the callback, as expected in the XML
      firstCallbackSymbol - The callback pointer
      varargs - A list of callback name and callback symbol pairs terminated with null
    • lookupCallbackSymbol

      public @Nullable Callback lookupCallbackSymbol(String callbackName)
      Fetches a symbol previously added with gtk_builder_cscope_add_callback_symbol().
      Parameters:
      callbackName - The name of the callback
      Returns:
      The callback symbol in builder for callbackName
    • builder

      public static BuilderCScope.Builder<? extends BuilderCScope.Builder> builder()
      A BuilderCScope.Builder object constructs a BuilderCScope with the specified properties. Use the various set...() methods to set properties, and finish construction with BuilderCScope.Builder.build().
      Returns:
      the builder object