Skip to main content

Surface

Trait Surface 

Source
pub trait Surface: Send + Sync {
    // Required method
    fn paint(&self, gfx: &GfxContext, rect: Rect);

    // Provided method
    fn pointer(&self, ev: Pointer, size: (f32, f32)) -> bool { ... }
}
Expand description

What a surface widget draws and how it takes the pointer — see the module docs.

Required Methods§

Source

fn paint(&self, gfx: &GfxContext, rect: Rect)

Draws into rect (screen GUI pixels, the widget’s box less its padding). Called every frame the widget is visible.

Provided Methods§

Source

fn pointer(&self, ev: Pointer, size: (f32, f32)) -> bool

A pointer event; true = used (a Down that returns false lets the click through to what’s under the surface). size is the box’s width and height.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§