rosace_widgets/tree/
pointer.rs1use super::{Widget, Children, PaintCtx};
2
3pub struct IgnorePointer<W: Widget> { child: W }
11
12impl<W: Widget + Send + Sync + 'static> IgnorePointer<W> {
13 pub fn new(child: W) -> Self { Self { child } }
14}
15
16impl<W: Widget + Send + Sync + 'static> Widget for IgnorePointer<W> {
17 fn children(&self) -> Children<'_> { Children::One(&self.child) }
18 fn paint(&self, ctx: &mut PaintCtx) {
19 ctx.set_pointer_mode(1); let r = ctx.rect;
21 self.child.paint(&mut ctx.child(r));
22 }
23}
24
25pub struct AbsorbPointer<W: Widget> { child: W }
29
30impl<W: Widget + Send + Sync + 'static> AbsorbPointer<W> {
31 pub fn new(child: W) -> Self { Self { child } }
32}
33
34impl<W: Widget + Send + Sync + 'static> Widget for AbsorbPointer<W> {
35 fn children(&self) -> Children<'_> { Children::One(&self.child) }
36 fn paint(&self, ctx: &mut PaintCtx) {
37 ctx.set_pointer_mode(2); let r = ctx.rect;
39 self.child.paint(&mut ctx.child(r));
40 }
41}