TypeClass

An opaque structure used as the base of all classes.

Constructors

this
this(GTypeClass* gTypeClass, bool ownedRef)

Sets our main struct and passes it to the parent class.

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Members

Functions

addPrivate
void addPrivate(size_t privateSize)

Registers a private structure for an instantiatable type.

getInstancePrivateOffset
int getInstancePrivateOffset()

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

getPrivate
void* getPrivate(GType privateType)
getStruct
void* getStruct()

the main Gtk struct as a void*

getTypeClassStruct
GTypeClass* getTypeClassStruct(bool transferOwnership)

Get the main Gtk struct

peekParent
TypeClass peekParent()

This is a convenience function often needed in class initializers. It returns the class structure of the immediate parent type of the class passed in. Since derived classes hold a reference count on their parent classes as long as they are instantiated, the returned class will always exist.

unref
void unref()

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 TypeClass.unref are invalid.

unrefUncached
void unrefUncached()

A variant of TypeClass.unref for use in GTypeClassCacheFunc implementations. It unreferences a class without consulting the chain of GTypeClassCacheFuncs, avoiding the recursion which would occur otherwise.

Static functions

adjustPrivateOffset
void adjustPrivateOffset(void* gClass, int* privateSizeOrOffset)
peek
TypeClass peek(GType type)

This function is essentially the same as TypeClass.ref, except that the classes reference count isn't incremented. 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).

peekStatic
TypeClass peekStatic(GType type)

A more efficient version of TypeClass.peek which works only for static types.

ref_
TypeClass ref_(GType type)

Increments the reference count of the class structure belonging to type. This function will demand-create the class if it doesn't exist already.

Variables

gTypeClass
GTypeClass* gTypeClass;

the main Gtk struct