gtk4::prelude

Trait DrawingAreaExtManual

Source
pub trait DrawingAreaExtManual: IsA<DrawingArea> + 'static {
    // Provided methods
    fn unset_draw_func(&self) { ... }
    fn set_draw_func<P: FnMut(&DrawingArea, &Context, i32, i32) + 'static>(
        &self,
        draw_func: P,
    ) { ... }
}
Expand description

Trait containing manually implemented methods of DrawingArea.

Provided Methods§

Source

fn unset_draw_func(&self)

Source

fn set_draw_func<P: FnMut(&DrawingArea, &Context, i32, i32) + 'static>( &self, draw_func: P, )

Setting a draw function is the main thing you want to do when using a drawing area.

The draw function is called whenever GTK needs to draw the contents of the drawing area to the screen.

The draw function will be called during the drawing stage of GTK. In the drawing stage it is not allowed to change properties of any GTK widgets or call any functions that would cause any properties to be changed. You should restrict yourself exclusively to drawing your contents in the draw function.

If what you are drawing does change, call WidgetExt::queue_draw() on the drawing area. This will cause a redraw and will call @draw_func again.

§draw_func

callback that lets you draw the drawing area’s contents

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§