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>

source

pub fn new() -> Self

Creates a new MultiWindow.

source

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));
source

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.

source

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)

source

pub fn run(self, event_loop: EventLoop<U>, c: T)

Runs the event loop until all TrackedWindows are closed.

Trait Implementations§

source§

impl<T: 'static + CommonEventHandler<T, U>, U: EventTrait + 'static> Default for MultiWindow<T, U>

source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.