Compiling checkpoint

This commit is contained in:
Nathan Sobo 2023-08-19 19:51:17 -06:00
parent 76993f6b57
commit 0747131bd4
11 changed files with 262 additions and 48 deletions

View file

@ -3392,7 +3392,8 @@ pub trait RenderContext<'a, 'b, V> {
}
pub struct LayoutContext<'a, 'b, 'c, V> {
view_context: &'c mut ViewContext<'a, 'b, V>,
// Nathan: Making this is public while I work on playground.
pub view_context: &'c mut ViewContext<'a, 'b, V>,
new_parents: &'c mut HashMap<usize, usize>,
views_to_notify_if_ancestors_change: &'c mut HashMap<usize, SmallVec<[usize; 2]>>,
text_style_stack: Vec<TextStyle>,
@ -3643,6 +3644,9 @@ impl<V> BorrowWindowContext for PaintContext<'_, '_, '_, V> {
pub struct EventContext<'a, 'b, 'c, V> {
view_context: &'c mut ViewContext<'a, 'b, V>,
pub(crate) handled: bool,
// I would like to replace handled with this.
// Being additive for now.
pub bubble: bool,
}
impl<'a, 'b, 'c, V: 'static> EventContext<'a, 'b, 'c, V> {
@ -3650,12 +3654,21 @@ impl<'a, 'b, 'c, V: 'static> EventContext<'a, 'b, 'c, V> {
EventContext {
view_context,
handled: true,
bubble: false,
}
}
pub fn propagate_event(&mut self) {
self.handled = false;
}
pub fn bubble_event(&mut self) {
self.bubble = true;
}
pub fn event_bubbled(&self) -> bool {
self.bubble
}
}
impl<'a, 'b, 'c, V> Deref for EventContext<'a, 'b, 'c, V> {