Skip to main content

egui_pop_views/
mounts.rs

1//! What this crate's components need, in the mount contract's terms
2//! (ADR 0013): `docs/hosts.md` and `AppHandle::where_can` are made from
3//! these.
4
5use egui_pop_model::mount::{ClaimKey, Mountable};
6
7/// The tree.
8pub const TREE: &str = "tree";
9/// The data table and the list.
10pub const TABLE: &str = "table";
11/// The library's thumbnail grid.
12pub const LIBRARY_GRID: &str = "library-grid";
13/// The library's filmstrip.
14pub const FILMSTRIP: &str = "filmstrip";
15/// The library's comparison.
16pub const COMPARE: &str = "compare";
17
18/// The tree: a lazy source, rename and drag and drop inside.
19pub fn tree() -> Mountable {
20    Mountable::new(TREE, "Tree")
21        .crate_name("egui-pop-views")
22        .claims(&[ClaimKey::Enter, ClaimKey::Space])
23        .drag()
24        .bounded_workers()
25        .fills()
26        .popups()
27        .role("tree")
28}
29
30/// The data table and the list: widths and sorting in the store.
31pub fn table() -> Mountable {
32    Mountable::new(TABLE, "Table, list")
33        .crate_name("egui-pop-views")
34        .claims(&[ClaimKey::Enter, ClaimKey::Space])
35        .drag()
36        .fills()
37        .popups()
38        .role("grid")
39}
40
41/// The library's grid: culling keys, a rubber band, thumbnails from the
42/// application's source.
43pub fn library_grid() -> Mountable {
44    Mountable::new(LIBRARY_GRID, "Library grid")
45        .crate_name("egui-pop-views")
46        .claims(&[ClaimKey::Space])
47        .keymap()
48        .drag()
49        .wheel()
50        .bounded_workers()
51        .fills()
52        .role("grid")
53}
54
55/// The filmstrip: the grid in one row of thumbnails.
56pub fn filmstrip() -> Mountable {
57    Mountable::new(FILMSTRIP, "Filmstrip")
58        .crate_name("egui-pop-views")
59        .claims(&[ClaimKey::Space])
60        .keymap()
61        .drag()
62        .wheel()
63        .bounded_workers()
64        .min(120.0, 120.0)
65        .fills()
66        .role("grid")
67}
68
69/// The comparison: images side by side, panned and zoomed together.
70pub fn compare() -> Mountable {
71    Mountable::new(COMPARE, "Compare view")
72        .crate_name("egui-pop-views")
73        .keyboard(egui_pop_model::mount::Keyboard::None)
74        .drag()
75        .wheel()
76        .bounded_workers()
77        .min(0.0, 80.0)
78        .fills()
79        .role("image")
80}
81
82/// This crate's components.
83pub fn components() -> Vec<Mountable> {
84    vec![library_grid(), filmstrip(), compare(), tree(), table()]
85}