Skip to main content

flux_tui/window/
helper.rs

1use super::*;
2use std::{cell::*, rc::Rc};
3
4
5pub trait WindowHelper: Window {
6	/// Helper method for [WindowEventQueue::provoke_changed_property]
7	fn provoke_changed_property(&self, property: WindowProperty) {
8		WindowEventQueue::provoke_changed_property(self.uid(), property);
9	}
10}
11
12impl<T: Window> WindowHelper for T {}
13
14pub struct WindowFactory {}
15
16impl WindowFactory {
17	/// Create a new [Rc<RefCell<_>>] using the [Window]'s [Default] implementation
18	#[inline(always)]
19	pub fn create<T>() -> Rc<RefCell<T>>
20	where T: Window + Default {
21		Rc::new(RefCell::new(T::default()))
22	}
23}