use bevy::prelude::*;
use serde::{Deserialize, Serialize};
use crate::tree::TabId;
#[derive(Resource, Clone, Default)]
pub struct IconFontHandle(pub Handle<Font>);
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
pub enum DockAreaStyle {
#[default]
TabBar,
IconSidebar,
Headless,
}
#[derive(Component, Clone, Debug)]
pub struct DockArea {
pub id: String,
pub style: DockAreaStyle,
}
#[derive(Component, Clone, Debug)]
pub struct DockWindow {
pub descriptor_id: String,
pub tab_id: TabId,
}
#[derive(Component, Clone, Debug, Default)]
pub struct ActiveDockWindow(pub Option<TabId>);
#[derive(Component)]
pub struct DockTabBar;
#[derive(Component)]
pub struct DockTab {
pub window_id: String,
pub tab_id: TabId,
}
#[derive(Component)]
pub struct DockTabCloseButton {
pub window_id: String,
pub tab_id: TabId,
}
#[derive(Component)]
pub struct DockTabContent {
pub window_id: String,
pub tab_id: TabId,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum DefaultArea {
Left,
Center,
BottomDock,
RightSidebar,
}
pub trait ToAnchorId: Copy {
fn anchor_id(self) -> String;
}
impl ToAnchorId for Option<DefaultArea> {
fn anchor_id(self) -> String {
match self {
Some(area) => area.anchor_id(),
None => String::new(),
}
}
}
impl ToAnchorId for DefaultArea {
fn anchor_id(self) -> String {
match self {
DefaultArea::Left => "left",
DefaultArea::Center => "center",
DefaultArea::BottomDock => "bottom_dock",
DefaultArea::RightSidebar => "right_sidebar",
}
.into()
}
}