makepad_widgets/
bare_step.rs

1use crate::{makepad_derive_widget::*, makepad_draw::*, widget::*};
2live_design! {
3    link widgets;
4    pub BareStep = {{BareStep}} {}
5}
6
7#[derive(Live, LiveHook, LiveRegisterWidget, WidgetRef, WidgetSet)]
8pub struct BareStep {
9    #[rust] draw_state: DrawStateWrap<()>
10}
11
12impl WidgetNode for BareStep{
13    fn walk(&mut self, _cx:&mut Cx) -> Walk{
14        Walk::default()
15    }
16    
17    fn area(&self)->Area{Area::Empty}
18    
19    fn redraw(&mut self, _cx: &mut Cx){}
20        
21    fn find_widgets(&self, _path: &[LiveId], _cached: WidgetCache, _results: &mut WidgetSet) {
22    }
23    
24    fn uid_to_widget(&self, _uid:WidgetUid)->WidgetRef{
25        WidgetRef::empty()
26    }
27}   
28
29impl Widget for BareStep {
30    fn handle_event(&mut self, _cx: &mut Cx, _event: &Event, _scope: &mut Scope) {
31    }
32
33    fn draw_walk(&mut self, cx: &mut Cx2d, _scope: &mut Scope, _walk: Walk) -> DrawStep {
34        if self.draw_state.begin(cx, ()) {
35            return DrawStep::make_step()
36        }
37        DrawStep::done()
38    }
39}