21 lines
436 B
Rust
21 lines
436 B
Rust
use crate::prelude::*;
|
|
|
|
pub struct Masked {
|
|
pub inner: WidgetHandle,
|
|
}
|
|
|
|
impl Widget for Masked {
|
|
fn draw(&mut self, painter: &mut Painter) {
|
|
painter.set_mask(painter.region());
|
|
painter.widget(&self.inner);
|
|
}
|
|
|
|
fn desired_width(&mut self, ctx: &mut SizeCtx) -> Len {
|
|
ctx.width(&self.inner)
|
|
}
|
|
|
|
fn desired_height(&mut self, ctx: &mut SizeCtx) -> Len {
|
|
ctx.height(&self.inner)
|
|
}
|
|
}
|