Trait components::SurfaceExt[][src]

pub trait SurfaceExt: 'static {
    fn invalidate(&self);
fn set_content_size(&self, width: f64, height: f64) -> bool;
fn connect_draw<F: Fn(&Self, &Canvas<'_>, i32, i32) -> bool + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_looped<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_animating_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; }

Required methods

fn invalidate(&self)[src]

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.

fn set_content_size(&self, width: f64, height: f64) -> bool[src]

Sets the size of the surface context, 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

fn connect_draw<F: Fn(&Self, &Canvas<'_>, i32, i32) -> bool + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

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_looped<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId[src]

fn connect_property_animating_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

Loading content...

Implementors

impl<O: Is<Surface>> SurfaceExt for O[src]

fn invalidate(&self)[src]

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.

fn set_content_size(&self, width: f64, height: f64) -> bool[src]

Sets the size of the surface context, 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

fn connect_draw<F: Fn(&Self, &Canvas<'_>, i32, i32) -> bool + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

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

Loading content...