1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use super::*;
pub trait Queue<I> {
fn push(&mut self, v: I);
fn send(&self, v: I);
}
pub enum StdEnqueueable<E> where E: Env {
Render{force: bool},
Event{event: EEvent<E>, ts: u64},
MutateWidget{path: E::WidgetPath, f: fn(WidgetRefMut<E>,&mut E::Context,E::WidgetPath), invalidate: bool},
MutateWidgetClosure{path: E::WidgetPath, f: Box<dyn FnOnce(WidgetRefMut<E>,&mut E::Context,E::WidgetPath)+'static>, invalidate: bool},
MutateRoot{f: fn(&mut E::Storage,&mut E::Context)},
MutateRootClosure{f: Box<dyn FnOnce(&mut E::Storage,&mut E::Context)+'static>},
AccessWidget{path: E::WidgetPath, f: fn(WidgetRef<E>,&mut E::Context)},
AccessWidgetClosure{path: E::WidgetPath, f: Box<dyn FnOnce(WidgetRef<E>,&mut E::Context)+'static>},
AccessRoot{f: fn(&E::Storage,&mut E::Context)},
AccessRootClosure{f: Box<dyn FnOnce(&E::Storage,&mut E::Context)+'static>},
InvalidateWidget{path: E::WidgetPath},
ValidateWidgetRender{path: E::WidgetPath},
ValidateWidgetSize{path: E::WidgetPath, size: ESize<E>},
}
pub fn invalidate<E: Env>(stor: &mut E::Storage, i: E::WidgetPath) -> Result<(),()> {
stor._widget_mut(i,true)?;
Ok(())
}
pub fn validate<E: Env>(stor: &mut E::Storage, i: E::WidgetPath) -> Result<(),()> {
let mut w = stor._widget_mut(i,false)?;
w.widget().set_invalid(false);
Ok(())
}