pub trait ActorCanvasExt: 'static {
Show 13 methods
// Required methods
fn get_scale_factor(&self) -> i32;
fn set_scale_factor(&self, scale: i32);
fn set_size(&self, width: i32, height: i32) -> bool;
fn get_property_height(&self) -> i32;
fn set_property_height(&self, height: i32);
fn get_property_scale_factor_set(&self) -> bool;
fn get_property_width(&self) -> i32;
fn set_property_width(&self, width: i32);
fn connect_draw<F: Fn(&Self, &Context, i32, i32) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_height_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_scale_factor_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_scale_factor_set_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_width_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
}
Required Methods§
Sourcefn get_scale_factor(&self) -> i32
fn get_scale_factor(&self) -> i32
Retrieves the scaling factor of self
, as set using
CanvasExt::set_scale_factor
.
§Returns
the scaling factor, or -1 if the self
uses the default from Settings
Sourcefn set_scale_factor(&self, scale: i32)
fn set_scale_factor(&self, scale: i32)
Sets the scaling factor for the Cairo surface used by self
.
This function should rarely be used.
The default scaling factor of a Canvas
content uses the
Settings:window-scaling-factor
property, which is set by
the windowing system. By using this function it is possible to
override that setting.
Changing the scale factor will invalidate the self
.
§scale
the scale factor, or -1 for the default
Sourcefn set_size(&self, width: i32, height: i32) -> bool
fn set_size(&self, width: i32, height: i32) -> bool
Sets the size of the self
, and invalidates the content.
This function will cause the self
to be invalidated only
if the size of the canvas surface has changed.
If you want to invalidate the contents of the self
when setting
the size, you can use the return value of the function to conditionally
call Content::invalidate
:
if (!canvas_set_size (canvas, width, height))
content_invalidate (CONTENT (canvas));
§width
the width of the canvas, in pixels
§height
the height of the canvas, in pixels
§Returns
this function returns true
if the size change
caused a content invalidation, and false
otherwise
Sourcefn get_property_height(&self) -> i32
fn get_property_height(&self) -> i32
The height of the canvas.
Sourcefn set_property_height(&self, height: i32)
fn set_property_height(&self, height: i32)
The height of the canvas.
Sourcefn get_property_scale_factor_set(&self) -> bool
fn get_property_scale_factor_set(&self) -> bool
Whether the Canvas:scale-factor
property is set.
If the Canvas:scale-factor-set
property is false
then Canvas
will use the Settings:window-scaling-factor
property.
Sourcefn get_property_width(&self) -> i32
fn get_property_width(&self) -> i32
The width of the canvas.
Sourcefn set_property_width(&self, width: i32)
fn set_property_width(&self, width: i32)
The width of the canvas.
Sourcefn connect_draw<F: Fn(&Self, &Context, i32, i32) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_draw<F: Fn(&Self, &Context, i32, i32) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId
The Canvas::draw
signal is emitted each time a canvas is
invalidated.
It is safe to connect multiple handlers to this signal: each
handler invocation will be automatically protected by cairo_save
and cairo_restore
pairs.
§cr
the Cairo context used to draw
§width
the width of the canvas
§height
the height of the canvas
§Returns
true
if the signal emission should stop, and
false
otherwise
fn connect_property_height_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_property_scale_factor_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_property_scale_factor_set_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_property_width_notify<F: Fn(&Self) + '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.