Skip to main content

egui_pop_api/
groups.rs

1//! Plugin groups: what an application starts from.
2
3use crate::Plugin;
4use crate::admin::AdminPlugin;
5use crate::arrangements::ArrangementsPlugin;
6use crate::dialogs::DialogsPlugin;
7use crate::files::FilesPlugin;
8use crate::links::LinksPlugin;
9use crate::palette::PalettePlugin;
10use crate::settings_window::SettingsPlugin;
11use crate::toasts::ToastsPlugin;
12use crate::window::WindowPlugin;
13
14/// Plugins added together (`AppBuilder::plugins`).
15pub trait PluginGroup {
16    fn plugins(self) -> Vec<Box<dyn Plugin>>;
17}
18
19/// The framework alone: the shell, its menus, undo and redo, quit, the
20/// focus mode setting. No palette, dialogs or toasts.
21#[derive(Clone, Copy, Debug, Default)]
22pub struct MinimalPlugins;
23
24impl PluginGroup for MinimalPlugins {
25    fn plugins(self) -> Vec<Box<dyn Plugin>> {
26        Vec::new()
27    }
28}
29
30/// What most applications want: the command palette, dialogs, the file
31/// chooser, toasts, links (opened through one policy), the Settings app
32/// (`Ctrl+,`) with the settings window behind its Advanced page, the
33/// window's place, named
34/// arrangements of the workbench (and the next components of the paved
35/// road as they come).
36#[derive(Clone, Copy, Debug, Default)]
37pub struct DefaultPlugins;
38
39impl PluginGroup for DefaultPlugins {
40    fn plugins(self) -> Vec<Box<dyn Plugin>> {
41        vec![
42            Box::new(PalettePlugin),
43            Box::new(DialogsPlugin),
44            Box::new(FilesPlugin::default()),
45            Box::new(ToastsPlugin),
46            Box::new(LinksPlugin::default()),
47            Box::new(SettingsPlugin),
48            Box::new(AdminPlugin),
49            Box::new(WindowPlugin),
50            Box::new(ArrangementsPlugin),
51        ]
52    }
53}