pub trait ContentExt: 'static {
// Required methods
fn get_preferred_size(&self) -> Option<(f32, f32)>;
fn invalidate(&self);
fn connect_attached<F: Fn(&Self, &Actor) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_detached<F: Fn(&Self, &Actor) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
}
Required Methods§
Sourcefn get_preferred_size(&self) -> Option<(f32, f32)>
fn get_preferred_size(&self) -> Option<(f32, f32)>
Retrieves the natural size of the self
, if any.
The natural size of a Content
is defined as the size the content
would have regardless of the allocation of the actor that is painting it,
for instance the size of an image data.
§width
return location for the natural width of the content
§height
return location for the natural height of the content
§Returns
true
if the content has a preferred size, and false
otherwise
Sourcefn invalidate(&self)
fn invalidate(&self)
Invalidates a Content
.
This function should be called by Content
implementations when
they change the way a the content should be painted regardless of the
actor state.
Sourcefn connect_attached<F: Fn(&Self, &Actor) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_attached<F: Fn(&Self, &Actor) + 'static>( &self, f: F, ) -> SignalHandlerId
Sourcefn connect_detached<F: Fn(&Self, &Actor) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_detached<F: Fn(&Self, &Actor) + 'static>( &self, f: F, ) -> SignalHandlerId
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.