1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
//! # `egui_dock`: docking support for `egui`
//!
//! Originally created by [@lain-dono](https://github.com/lain-dono), this library provides docking support for `egui`.
//! It lets you open and close tabs, freely move them around, insert them in selected parts of the [`DockArea`], and resize them.
//!
//! ## Usage
//!
//! The library is centered around the [`Tree`].
//! It stores the layout of [`Node`]s which contains tabs.
//!
//! [`Tree`] is generic (`Tree<Tab>`) so you can use any data to represent a tab.
//! You show the tabs using [`DockArea`] and specify how they are shown
//! by implementing [`TabViewer`].
//!
//! ```rust
//! use egui_dock::{NodeIndex, Style, Tree};
//!
//! struct MyTabs {
//! tree: Tree<String>
//! }
//!
//! impl MyTabs {
//! pub fn new() -> Self {
//! let tab1 = "tab1".to_string();
//! let tab2 = "tab2".to_string();
//!
//! let mut tree = Tree::new(vec![tab1]);
//! tree.split_left(NodeIndex::root(), 0.20, vec![tab2]);
//!
//! Self { tree }
//! }
//!
//! fn ui(&mut self, ui: &mut egui::Ui) {
//! egui_dock::DockArea::new(&mut self.tree)
//! .style(Style::from_egui(ui.style().as_ref()))
//! .show_inside(ui, &mut TabViewer {});
//! }
//! }
//!
//! struct TabViewer;
//!
//! impl egui_dock::TabViewer for TabViewer {
//! type Tab = String;
//!
//! fn ui(&mut self, ui: &mut egui::Ui, tab: &mut Self::Tab) {
//! ui.label(format!("Content of {tab}"));
//! }
//!
//! fn title(&mut self, tab: &mut Self::Tab) -> egui::WidgetText {
//! (&*tab).into()
//! }
//! }
//!
//! # let mut my_tabs = MyTabs::new();
//! # egui::__run_test_ctx(|ctx| {
//! # egui::CentralPanel::default().show(ctx, |ui| my_tabs.ui(ui));
//! # });
//! ```
#![warn(missing_docs)]
#![forbid(unsafe_code)]
pub use egui;
#[allow(deprecated)]
pub use style::*;
pub use tree::*;
pub use widgets::*;
/// egui_dock theme (color, sizes...).
pub mod style;
pub mod tree;
mod utils;
/// Widgets provided by the library.
pub mod widgets;