Skip to content

GObject.TypeInterface

record (struct)

An opaque structure used as the base of all interface types.

Methods

peek_parent

def peek_parent(self) -> TypeInterface | None

Returns the corresponding TypeInterface structure of the parent type of the instance type to which g_iface belongs.

This is useful when deriving the implementation of an interface from the parent type and then possibly overriding some methods.

Static functions

add_prerequisite

@staticmethod
def add_prerequisite(interface_type: type | Type, prerequisite_type: type | Type) -> None

Adds prerequisite_type to the list of prerequisites of interface_type. This means that any type implementing interface_type must also implement prerequisite_type. Prerequisites can be thought of as an alternative to interface derivation (which GType doesn't support). An interface can have at most one instantiatable prerequisite type.

Parameters:

  • interface_typeGType value of an interface type
  • prerequisite_typeGType value of an interface or instantiatable type

get_plugin

@staticmethod
def get_plugin(instance_type: type | Type, interface_type: type | Type) -> TypePlugin

Returns the TypePlugin structure for the dynamic interface interface_type which has been added to instance_type, or None if interface_type has not been added to instance_type or does not have a TypePlugin structure. See type_add_interface_dynamic.

Parameters:

  • instance_typeGType of an instantiatable type
  • interface_typeGType of an interface type

instantiatable_prerequisite

@staticmethod
def instantiatable_prerequisite(interface_type: type | Type) -> type | Type

Returns the most specific instantiatable prerequisite of an interface type. If the interface type has no instantiatable prerequisite, G_TYPE_INVALID is returned.

See TypeInterface.add_prerequisite for more information about prerequisites.

Parameters:

  • interface_type — an interface type

peek

@staticmethod
def peek(instance_class: TypeClass, iface_type: type | Type) -> TypeInterface | None

Returns the TypeInterface structure of an interface to which the passed in class conforms.

Parameters:

  • instance_class — a TypeClass structure
  • iface_type — an interface ID which this class conforms to

prerequisites

@staticmethod
def prerequisites(interface_type: type | Type) -> list[type | Type]

Returns the prerequisites of an interfaces type.

Parameters:

  • interface_type — an interface type

Properties

g_type

g_type: type | Type  # read/write

g_instance_type

g_instance_type: type | Type  # read/write