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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
use std::sync::atomic::AtomicUsize;
use guion::layout::Size;
use crate::style::Style;
use crate::event::{key::Key, destination::StdDest};
use crate::render::Render;
use guion::backend::Backend;
use guion::{id::WidgetID, env::{EnvFlexStyleVariant, Env}, style::variant::standard::StdStyleVariant, event::dyn_evt::DynEvent};
use super::*;
use sdl2::video::Window;
use stor::SimpleStor;
use valid::SimpleValidState;
use std::{any::TypeId, sync::atomic::Ordering};
use ctx::SimpleCtx;
#[derive(Clone,PartialEq)]
pub struct SimpleEnv;
pub struct SimpleBackend;
impl Env for SimpleEnv {
type Backend = SimpleBackend;
type Context = SimpleCtx;
type Storage = SimpleStor;
type WidgetID = StdID;
type WidgetPath = StandardPath;
type ValidState = SimpleValidState;
}
impl EnvFlexStyleVariant for SimpleEnv {
type StyleVariant = StdStyleVariant;
}
impl Backend<SimpleEnv> for SimpleBackend {
type Renderer = Render<Window>;
type Event = DynEvent<SimpleEnv,Key,StdDest<SimpleDest>>;
type Style = Style;
type Size = Size;
}
static ID_ITER: AtomicUsize = AtomicUsize::new(0);
#[derive(Clone)]
pub struct SimpleDest {
pub v: usize,
}
impl GuionDestination for SimpleDest {
const ROOT: Self = Self{v: 0};
const FOCUSED: Self = Self{v: 1};
const HOVERED: Self = Self{v: 2};
const INVALID: Self = Self{v: std::usize::MAX};
}