Struct egui_multiwin::multi_window::MultiWindow
source · pub struct MultiWindow<T, U: EventTrait = DefaultCustomEvent> { /* private fields */ }Expand description
The main struct of the crate. Manages multiple TrackedWindows by forwarding events to them.
T represents the common data struct for the user program. U is the type representing custom events.
Implementations§
source§impl<T: 'static + CommonEventHandler<T, U>, U: EventTrait + 'static> MultiWindow<T, U>
impl<T: 'static + CommonEventHandler<T, U>, U: EventTrait + 'static> MultiWindow<T, U>
sourcepub fn add_font(&mut self, name: String, fd: FontData)
pub fn add_font(&mut self, name: String, fd: FontData)
Add a font that is applied to every window. Be sure to call this before calling add
multi_window is an instance of MultiWindow<T,U>, DATA is a static &[u8] - most like defined with a include_bytes!() macro
use egui_multiwin::multi_window::NewWindowRequest;
struct Custom {}
impl egui_multiwin::multi_window::CommonEventHandler<Custom, u32> for Custom {
fn process_event(&mut self, _event: u32) -> Vec<NewWindowRequest<Custom>>{
vec!()
}
}
let mut multi_window: egui_multiwin::multi_window::MultiWindow<Custom, u32> = egui_multiwin::multi_window::MultiWindow::new();
let DATA = include_bytes!("cmunbtl.ttf");
multi_window.add_font("my_font".to_string(), egui_multiwin::egui::FontData::from_static(DATA));sourcepub fn add<TE>(
&mut self,
window: NewWindowRequest<T, U>,
c: &mut T,
event_loop: &EventLoopWindowTarget<TE>
) -> Result<(), DisplayCreationError>
pub fn add<TE>( &mut self, window: NewWindowRequest<T, U>, c: &mut T, event_loop: &EventLoopWindowTarget<TE> ) -> Result<(), DisplayCreationError>
Adds a new TrackedWindow to the MultiWindow. If custom fonts are desired, call add_font first.
sourcepub fn do_window_events(
&mut self,
c: &mut T,
event: &Event<'_, U>,
event_loop_window_target: &EventLoopWindowTarget<U>
) -> Vec<ControlFlow>
pub fn do_window_events( &mut self, c: &mut T, event: &Event<'_, U>, event_loop_window_target: &EventLoopWindowTarget<U> ) -> Vec<ControlFlow>
Process the given event for the applicable window(s)
Trait Implementations§
source§impl<T: 'static + CommonEventHandler<T, U>, U: EventTrait + 'static> Default for MultiWindow<T, U>
impl<T: 'static + CommonEventHandler<T, U>, U: EventTrait + 'static> Default for MultiWindow<T, U>
Auto Trait Implementations§
impl<T, U = DefaultCustomEvent> !RefUnwindSafe for MultiWindow<T, U>
impl<T, U = DefaultCustomEvent> !Send for MultiWindow<T, U>
impl<T, U = DefaultCustomEvent> !Sync for MultiWindow<T, U>
impl<T, U> Unpin for MultiWindow<T, U>where
U: Unpin,
impl<T, U = DefaultCustomEvent> !UnwindSafe for MultiWindow<T, U>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more