gloss_renderer/plugin_manager/gui/
window.rs

1use gloss_utils::abi_stable_aliases::std_types::{RString, RVec};
2#[cfg(not(target_arch = "wasm32"))]
3use gloss_utils::abi_stable_aliases::StableAbi;
4
5use super::widgets::Widgets;
6
7//similar to
8// https://docs.rs/egui/latest/egui/struct.Align2.html#associatedconstant.LEFT_TOP
9#[repr(C)]
10#[cfg_attr(not(target_arch = "wasm32"), derive(StableAbi))]
11pub enum WindowPivot {
12    LeftBottom,
13    LeftCenter,
14    LeftTop,
15    CenterBottom,
16    CenterCenter,
17    CenterTop,
18    RightBottom,
19    RightCenter,
20    RightTop,
21}
22//Position is normalized between [0,1]
23#[repr(C)]
24#[cfg_attr(not(target_arch = "wasm32"), derive(StableAbi))]
25pub struct WindowPosition(pub [f32; 2]);
26
27#[repr(C)]
28#[cfg_attr(not(target_arch = "wasm32"), derive(StableAbi))]
29pub enum WindowPositionType {
30    Initial,
31    Fixed,
32}
33
34#[repr(C)]
35#[cfg_attr(not(target_arch = "wasm32"), derive(StableAbi))]
36pub enum GuiWindowType {
37    Sidebar,
38    FloatWindow(WindowPivot, WindowPosition, WindowPositionType),
39}
40
41#[repr(C)]
42#[cfg_attr(not(target_arch = "wasm32"), derive(StableAbi))]
43pub struct GuiWindow {
44    pub window_name: RString,
45    pub window_type: GuiWindowType,
46    pub widgets: RVec<Widgets>,
47}