Class TypeClass

java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.gobject.TypeClass
All Implemented Interfaces:
Proxy
Direct Known Subclasses:
ActivateAction.ActivateActionClass, Adapter.AdapterClass, AlternativeTrigger.AlternativeTriggerClass, Animation.AnimationClass, AnimationTarget.AnimationTargetClass, AnyFilter.AnyFilterClass, ATContext.ATContextClass, BroadwayRenderer.BroadwayRendererClass, BuilderListItemFactory.BuilderListItemFactoryClass, CairoRenderer.CairoRendererClass, CallbackAction.CallbackActionClass, CallbackAnimationTarget.CallbackAnimationTargetClass, CenterBox.CenterBoxClass, CicpParams.CicpParamsClass, ColumnView.ColumnViewClass, ColumnViewCell.ColumnViewCellClass, ColumnViewColumn.ColumnViewColumnClass, ColumnViewRow.ColumnViewRowClass, Context.ContextClass, Credentials.CredentialsClass, CssProvider.CssProviderClass, DeviceProviderFactory.DeviceProviderFactoryClass, DmabufTexture.DmabufTextureClass, DmabufTextureBuilder.DmabufTextureBuilderClass, DragSource.DragSourceClass, DropControllerMotion.DropControllerMotionClass, DropTarget.DropTargetClass, DropTargetAsync.DropTargetAsyncClass, DynamicTypeFactory.DynamicTypeFactoryClass, ElementFactory.ElementFactoryClass, Emblem.EmblemClass, EmojiChooser.EmojiChooserClass, EncodingAudioProfile.EncodingAudioProfileClass, EncodingContainerProfile.EncodingContainerProfileClass, EncodingProfile.EncodingProfileClass, EncodingVideoProfile.EncodingVideoProfileClass, EventController.EventControllerClass, EventControllerFocus.EventControllerFocusClass, EventControllerKey.EventControllerKeyClass, EventControllerLegacy.EventControllerLegacyClass, EventControllerMotion.EventControllerMotionClass, EventControllerScroll.EventControllerScrollClass, EveryFilter.EveryFilterClass, FileIcon.FileIconClass, FileInfo.FileInfoClass, FontsetSimple.FontsetSimpleClass, FrameClock.FrameClockClass, Gesture.GestureClass, GestureClick.GestureClickClass, GestureDrag.GestureDragClass, GestureLongPress.GestureLongPressClass, GesturePan.GesturePanClass, GestureRotate.GestureRotateClass, GestureSingle.GestureSingleClass, GestureStylus.GestureStylusClass, GestureSwipe.GestureSwipeClass, GestureZoom.GestureZoomClass, GLRenderer.GLRendererClass, GLTexture.GLTextureClass, GLTextureBuilder.GLTextureBuilderClass, GObject.ObjectClass, GridView.GridViewClass, GtkBuilder.BuilderClass, IOModule.IOModuleClass, KeyvalTrigger.KeyvalTriggerClass, Layout.LayoutClass, ListBase.ListBaseClass, ListHeader.ListHeaderClass, ListItem.ListItemClass, ListItemFactory.ListItemFactoryClass, ListView.ListViewClass, MemoryTexture.MemoryTextureClass, MemoryTextureBuilder.MemoryTextureBuilderClass, MessageDialog.MessageDialogClass, MnemonicAction.MnemonicActionClass, MnemonicTrigger.MnemonicTriggerClass, Monitor.MonitorClass, MultiFilter.MultiFilterClass, NamedAction.NamedActionClass, NeverTrigger.NeverTriggerClass, NoneAnimationTarget.NoneAnimationTargetClass, NothingAction.NothingActionClass, PadController.PadControllerClass, ParamSpec.ParamSpecClass, PasswordEntry.PasswordEntryClass, PixbufSimpleAnim.PixbufSimpleAnimClass, Plugin.PluginClass, PluginFeature.PluginFeatureClass, PropertyAnimationTarget.PropertyAnimationTargetClass, Renderer.RendererClass, ShortcutAction.ShortcutActionClass, ShortcutController.ShortcutControllerClass, ShortcutLabel.ShortcutLabelClass, ShortcutsGroup.ShortcutsGroupClass, ShortcutsSection.ShortcutsSectionClass, ShortcutsShortcut.ShortcutsShortcutClass, ShortcutTrigger.ShortcutTriggerClass, SignalAction.SignalActionClass, SignalListItemFactory.SignalListItemFactoryClass, SimpleAsyncResult.SimpleAsyncResultClass, Snapshot.SnapshotClass, Snapshot.SnapshotClass, SpringAnimation.SpringAnimationClass, Surface.SurfaceClass, Task.TaskClass, Texture.TextureClass, ThemedIcon.ThemedIconClass, TimedAnimation.TimedAnimationClass, TracerFactory.TracerFactoryClass, TracerRecord.TracerRecordClass, TypeFindFactory.TypeFindFactoryClass, VulkanRenderer.VulkanRendererClass

@Generated("org.javagi.JavaGI") public class TypeClass extends ProxyInstance
An opaque structure used as the base of all classes.
  • Constructor Details

    • TypeClass

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

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

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

      public TypeClass(Type gType, Arena arena)
      Allocate a new TypeClass with the fields set to the provided values.
      Parameters:
      gType - value for the field gType
      arena - to control the memory allocation scope
    • TypeClass

      public TypeClass(Type gType)
      Allocate a new TypeClass with the fields set to the provided values. The memory is allocated with Arena.ofAuto().
      Parameters:
      gType - value for the field gType
  • Method Details

    • getMemoryLayout

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

      public Type readGType()
      Read the value of the field g_type.
      Returns:
      The value of the field g_type
    • writeGType

      public void writeGType(Type gType)
      Write a value in the field g_type.
      Parameters:
      gType - The new value for the field g_type
    • adjustPrivateOffset

      public static void adjustPrivateOffset(@Nullable MemorySegment gClass, MemorySegment privateSizeOrOffset)
    • get

      public static TypeClass get(Type type)

      Retrieves the type class of the given type.

      This function will create the class on demand if it does not exist already.

      If you don't want to create the class, use g_type_class_peek() instead.

      Parameters:
      type - type ID of a classed type
      Returns:
      the class structure for the type
      Since:
      2.84
    • peek

      public static @Nullable TypeClass peek(Type type)

      Retrieves the class for a give type.

      This function is essentially the same as g_type_class_get(), except that the class may have not been instantiated yet.

      As a consequence, this function may return null if the class of the type passed in does not currently exist (hasn't been referenced before).

      Parameters:
      type - type ID of a classed type
      Returns:
      the GTypeClass structure for the given type ID or null if the class does not currently exist
    • peekStatic

      public static @Nullable TypeClass peekStatic(Type type)
      A more efficient version of g_type_class_peek() which works only for static types.
      Parameters:
      type - type ID of a classed type
      Returns:
      the GTypeClass structure for the given type ID or null if the class does not currently exist or is dynamically loaded
      Since:
      2.4
    • ref

      @Deprecated public static TypeClass ref(Type type)
      Deprecated.
      Use g_type_class_get() instead

      Increments the reference count of the class structure belonging to type.

      This function will demand-create the class if it doesn't exist already.

      Parameters:
      type - type ID of a classed type
      Returns:
      the GTypeClass structure for the given type ID
    • addPrivate

      @Deprecated public void addPrivate(long privateSize)
      Deprecated.
      Use the G_ADD_PRIVATE() macro with the G_DEFINE_* family of macros to add instance private data to a type

      Registers a private structure for an instantiatable type.

      When an object is allocated, the private structures for the type and all of its parent types are allocated sequentially in the same memory block as the public structures, and are zero-filled.

      Note that the accumulated size of the private structures of a type and all its parent types cannot exceed 64 KiB.

      This function should be called in the type's class_init() function. The private structure can be retrieved using the G_TYPE_INSTANCE_GET_PRIVATE() macro.

      The following example shows attaching a private structure MyObjectPrivate to an object MyObject defined in the standard GObject fashion in the type's class_init() function.

      Note the use of a structure member "priv" to avoid the overhead of repeatedly calling MY_OBJECT_GET_PRIVATE().

      typedef struct _MyObject        MyObject;
      typedef struct _MyObjectPrivate MyObjectPrivate;
      
      struct _MyObject {
       GObject parent;
      
       MyObjectPrivate *priv;
      };
      
      struct _MyObjectPrivate {
        int some_field;
      };
      
      static void
      my_object_class_init (MyObjectClass *klass)
      {
        g_type_class_add_private (klass, sizeof (MyObjectPrivate));
      }
      
      static void
      my_object_init (MyObject *my_object)
      {
        my_object->priv = G_TYPE_INSTANCE_GET_PRIVATE (my_object,
                                                       MY_TYPE_OBJECT,
                                                       MyObjectPrivate);
        // my_object->priv->some_field will be automatically initialised to 0
      }
      
      static int
      my_object_get_some_field (MyObject *my_object)
      {
        MyObjectPrivate *priv;
      
        g_return_val_if_fail (MY_IS_OBJECT (my_object), 0);
      
        priv = my_object->priv;
      
        return priv->some_field;
      }
      
      Parameters:
      privateSize - size of private structure
      Since:
      2.4
    • getInstancePrivateOffset

      public int getInstancePrivateOffset()

      Gets the offset of the private data for instances of gClass.

      This is how many bytes you should add to the instance pointer of a class in order to get the private data for the type represented by gClass.

      You can only call this function after you have registered a private data area for this TypeClass using g_type_class_add_private().

      Returns:
      the offset, in bytes
      Since:
      2.38
    • getPrivate

      public @Nullable MemorySegment getPrivate(Type privateType)
    • peekParent

      public TypeClass peekParent()

      Retrieves the class structure of the immediate parent type of the class passed in.

      This is a convenience function often needed in class initializers.

      Since derived classes hold a reference on their parent classes as long as they are instantiated, the returned class will always exist.

      This function is essentially equivalent to: g_type_class_peek (g_type_parent (G_TYPE_FROM_CLASS (g_class)))

      Returns:
      the parent class of this TypeClass
    • unref

      @Deprecated public void unref()
      Deprecated.
      Type class reference counting has been removed and type classes now cannot be finalized. This function no longer does anything.

      Decrements the reference count of the class structure being passed in.

      Once the last reference count of a class has been released, classes may be finalized by the type system, so further dereferencing of a class pointer after g_type_class_unref() are invalid.

    • unrefUncached

      @Deprecated public void unrefUncached()
      Deprecated.
      Type class reference counting has been removed and type classes now cannot be finalized. This function no longer does anything.

      A variant of g_type_class_unref() for use in GTypeClassCacheFunc implementations.

      It unreferences a class without consulting the chain of GTypeClassCacheFuncs, avoiding the recursion which would occur otherwise.