egui_multiwin/lib.rs
1//! [](https://github.com/uglyoldbob/egui-multiwin/actions/workflows/windows_build.yml)
2//! [](https://github.com/uglyoldbob/egui-multiwin/actions/workflows/macos_build.yml)
3//! [](https://github.com/uglyoldbob/egui-multiwin/actions/workflows/linux_build.yml)
4//!
5//! This crate is based on the work by vivlim (<https://github.com/vivlim>) and repository located (<https://github.com/vivlim/egui-glow-multiwin>).
6//! Vivlim's example repository combines the work at <https://github.com/shivshank/mini_gl_fb/blob/master/examples/multi_window.rs> and egui to form a
7//! nice package. This crate makes some modifications to make it useful as an external crate by defining a few traits for users to implement on their
8//! custom structs.
9//!
10//! There are several examples (<https://github.com/uglyoldbob/egui-multiwin/tree/master/examples>) that show how to use this crate in your project.
11//!
12//! The majority of the code is created by the pair of macros named [`multi_window`](macro.multi_window.html) and [`tracked_window`](macro.tracked_window.html)
13//!
14//! The main struct for this crate is defined by the [`multi_window`](macro.multi_window.html) macro.
15//!
16//! Generally you will create a struct for data that is common to all windows, implement the `CommonEventHandler` trait on it.
17//!
18//! It will be useful to run `cargo doc --open` on your application to fully see the documentation for this module. This is because the majority of the code is generated by a pair of macros.
19//!
20//! See the examples in the repository for example applications that can be used to start your application.
21//!
22//! Check github issues to see if wayland (linux) still has a problem with the clipboard. That issue should give a temporary solution to a segfault that
23//! occurs after closing a window in your program.
24//!
25//! In your main event, create an event loop, create an event loop proxy (if desired). The event loop proxy can be cloned and sent to other threads,
26//! allowing custom logic to send events that can create windows and modify the common state of the application as required. Create a multiwindow instance,
27//! then create window requests to make initial windows, and add them to the multiwindow with the add function. Create an instance of your common data
28//! structure, and finally call run of your multiwindow instance.
29
30#![deny(missing_docs)]
31#![deny(clippy::missing_docs_in_private_items)]
32
33use winit::window::WindowId;
34
35pub use {
36 arboard, egui, egui_glow, enum_dispatch, glutin, raw_window_handle, raw_window_handle_5,
37 thiserror, winit,
38};
39pub mod multi_window;
40pub mod tracked_window;
41
42/// A generic non-event providing struct that users can use when they don't need custom events.
43#[derive(Debug)]
44pub struct NoEvent {}
45
46impl NoEvent {
47 /// Returns a None for window_id
48 pub fn window_id(&self) -> Option<WindowId> {
49 None
50 }
51}