guion/widgets/area/
mod.rs1use super::*;
2use std::marker::PhantomData;
3
4pub mod widget;
5pub mod imp;
6
7pub struct Area<'w,E,W,Scroll> where
8 E: Env,
9 W: 'w,
10 Scroll: 'w,
11{
12 id: E::WidgetID,
13 pub size: ESize<E>,
14 pub style: EStyle<E>,
15 pub inner: W,
16 pub scroll: Scroll,
17 p: PhantomData<&'w mut &'w ()>,
18}
19
20impl<'w,E,W> Area<'w,E,W,(u32,u32)> where
21 E: Env,
22 W: 'w,
23{
24 #[inline]
25 pub fn new(id: E::WidgetID, inner: W) -> Self {
26 Self{
27 id,
28 size: Gonstraints::empty(),
29 style: Default::default(),
30 inner,
31 scroll: (0,0),
32 p: PhantomData,
33 }
34 }
35}
36
37impl<'w,E,W,Scroll> Area<'w,E,W,Scroll> where
38 E: Env,
39 W: 'w,
40 Scroll: 'w,
41{
42 #[inline]
44 pub fn with_state<PScroll>(self, scroll: PScroll) -> Area<'w,E,W,PScroll> where PScroll: 'w {
45 Area{
46 id: self.id,
47 size: self.size,
48 style: self.style,
49 inner: self.inner,
50 scroll: scroll,
51 p: PhantomData,
52 }
53 }
54
55 #[inline]
56 pub fn with_size(mut self, s: ESize<E>) -> Self {
57 self.size = s;
58 self
59 }
60 #[inline]
61 pub fn with_style(mut self, style: EStyle<E>) -> Self {
62 self.style = style;
63 self
64 }
65}