Klasse TypeClass

Alle implementierten Schnittstellen:
PointerInterface

public class TypeClass extends Record
An opaque structure used as the base of all classes.

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

  • Felddetails

  • Konstruktordetails

    • TypeClass

      public TypeClass(PointerContainer pointer)
    • TypeClass

      public TypeClass()
  • Methodendetails

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getFieldGType

      public long getFieldGType()
    • addPrivate

      @Deprecated public void addPrivate(long private_size)
      Veraltet.
      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().
      <!-- language="C" -->
       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;
       }
       
      Parameter:
      private_size - size of private structure
    • getInstancePrivateOffset

      public int getInstancePrivateOffset()
      Gets the offset of the private data for instances of @g_class.

      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
      @g_class.

      You can only call this function after you have registered a private
      data area for @g_class using g_type_class_add_private().
      Gibt zurück:
      the offset, in bytes
    • getPrivate

      public Pointer getPrivate(long private_type)
      Parameter:
      private_type -
      Gibt zurück:
    • peekParent

      public Pointer 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)))
      Gibt zurück:
      the parent class of @g_class
    • unref

      @Deprecated public void unref()
      Veraltet.
      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()
      Veraltet.
      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.
    • adjustPrivateOffset

      public static void adjustPrivateOffset(@Nullable Pointer g_class, @Nonnull Int private_size_or_offset)
      Parameter:
      g_class -
      private_size_or_offset -
    • get

      public static Pointer get(long 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.
      Parameter:
      type - type ID of a classed type
      Gibt zurück:
      the class structure for the type
    • peek

      public static Pointer peek(long 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).
      Parameter:
      type - type ID of a classed type
      Gibt zurück:
      the #GTypeClass structure for the given type ID or %NULL if the class does not currently exist
    • peekStatic

      public static Pointer peekStatic(long type)
      A more efficient version of g_type_class_peek() which works only for
      static types.
      Parameter:
      type - type ID of a classed type
      Gibt zurück:
      the #GTypeClass structure for the given type ID or %NULL if the class does not currently exist or is dynamically loaded
    • ref

      @Deprecated public static Pointer ref(long type)
      Veraltet.
      Increments the reference count of the class structure belonging to
      @type.

      This function will demand-create the class if it doesn't exist already.
      Parameter:
      type - type ID of a classed type
      Gibt zurück:
      the #GTypeClass structure for the given type ID
    • getInstanceSize

      public static int getInstanceSize()