gdk_pixbuf::subclass::prelude

Trait ObjectImpl

Source
pub trait ObjectImpl: ObjectSubclass
where Self::Type: IsA<Object>,
{ // Provided methods fn properties() -> &'static [ParamSpec] { ... } fn signals() -> &'static [Signal] { ... } fn set_property(&self, _id: usize, _value: &Value, _pspec: &ParamSpec) { ... } fn property(&self, _id: usize, _pspec: &ParamSpec) -> Value { ... } fn constructed(&self) { ... } fn dispose(&self) { ... } fn notify(&self, pspec: &ParamSpec) { ... } fn dispatch_properties_changed(&self, pspecs: &[ParamSpec]) { ... } }
Expand description

Trait for implementors of glib::Object subclasses.

This allows overriding the virtual methods of glib::Object. Except for finalize as implementing Drop would allow the same behavior.

Provided Methods§

Source

fn properties() -> &'static [ParamSpec]

Properties installed for this type.

Source

fn signals() -> &'static [Signal]

Signals installed for this type.

Source

fn set_property(&self, _id: usize, _value: &Value, _pspec: &ParamSpec)

Property setter.

This is called whenever the property of this specific subclass with the given index is set. The new value is passed as glib::Value.

value is guaranteed to be of the correct type for the given property. the generic setter for all properties of this type. Should be overridden for every type with properties. If implementations of set_property don’t emit property change notification explicitly, this will be done implicitly by the type system. However, if the notify signal is emitted explicitly, the type system will not emit it a second time.

Source

fn property(&self, _id: usize, _pspec: &ParamSpec) -> Value

Property getter.

This is called whenever the property value of the specific subclass with the given index should be returned.

The returned Value must be of the correct type for the given property. the generic getter for all properties of this type. Should be overridden for every type with properties.

Source

fn constructed(&self)

Constructed.

This is called once construction of the instance is finished.

Should chain up to the parent class’ implementation. the constructed function is called by Object::new() as the final step of the object creation process. At the point of the call, all construction properties have been set on the object. The purpose of this call is to allow for object initialisation steps that can only be performed after construction properties have been set. constructed implementors should chain up to the constructed call of their parent class to allow it to complete its initialisation.

Source

fn dispose(&self)

Disposes of the object.

When dispose() ends, the object should not hold any reference to any other member object. The object is also expected to be able to answer client method invocations (with possibly an error code but no memory violation) until it is dropped. dispose() can be executed more than once. the dispose function is supposed to drop all references to other objects, but keep the instance otherwise intact, so that client method invocations still work. It may be run multiple times (due to reference loops). Before returning, dispose should chain up to the dispose method of the parent class.

Source

fn notify(&self, pspec: &ParamSpec)

Function to be called when property change is notified for with self.notify("property"). Emits a “notify” signal for the property property_name on self.

When possible, eg. when signaling a property change from within the class that registered the property, you should use ObjectExt::notify_by_pspec() instead.

Note that emission of the notify signal may be blocked with ObjectExt::freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when [ObjectExt::thaw_notify()][crate::prelude::ObjectExt::thaw_notify()] is called.

Source

fn dispatch_properties_changed(&self, pspecs: &[ParamSpec])

emits property change notification for a bunch of properties. Overriding dispatch_properties_changed should be rarely needed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§