Trait glib::subclass::interface::ObjectInterface
source · pub unsafe trait ObjectInterface: ObjectInterfaceType + Sized + 'static {
type Prerequisites: PrerequisiteList;
const NAME: &'static str;
// Provided methods
fn type_init(_type_: &mut InitializingType<Self>) { ... }
fn interface_init(&mut self) { ... }
fn properties() -> &'static [ParamSpec] { ... }
fn signals() -> &'static [Signal] { ... }
}
Expand description
The central trait for defining a GObject
interface.
Links together the type name, and the interface struct for type registration and allows hooking into various steps of the type registration and initialization.
This must only be implemented on #[repr(C)]
structs and have gobject_ffi::GTypeInterface
as
the first field.
See register_interface
for registering an implementation of this trait
with the type system.
Required Associated Types§
sourcetype Prerequisites: PrerequisiteList
type Prerequisites: PrerequisiteList
Prerequisites for this interface.
Any implementer of the interface must be a subclass of the prerequisites or implement them in case of interfaces.
Required Associated Constants§
Provided Methods§
sourcefn type_init(_type_: &mut InitializingType<Self>)
fn type_init(_type_: &mut InitializingType<Self>)
Additional type initialization.
This is called right after the type was registered and allows interfaces to do additional type-specific initialization.
Optional
sourcefn interface_init(&mut self)
fn interface_init(&mut self)
Interface initialization.
This is called after type_init
and before the first implementor
of the interface is created. Interfaces can use this to do interface-
specific initialization, e.g. for installing signals on the interface,
and for setting default implementations of interface functions.
Optional
sourcefn properties() -> &'static [ParamSpec]
fn properties() -> &'static [ParamSpec]
Properties installed for this interface.
All implementors of the interface must provide these properties.