use rgpui::{Anchor, Edges, Pixels, px};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
pub const TITLE_BAR_HEIGHT: Pixels = px(34.);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Hash, Default, JsonSchema)]
#[serde(rename_all = "lowercase")]
pub enum ScrollbarShow {
#[default]
Scrolling,
Hover,
Always,
}
impl ScrollbarShow {
pub fn is_hover(&self) -> bool {
matches!(self, Self::Hover)
}
pub fn is_always(&self) -> bool {
matches!(self, Self::Always)
}
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct ListSettings {
pub active_highlight: bool,
}
impl Default for ListSettings {
fn default() -> Self {
Self {
active_highlight: true,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct SheetSettings {
pub margin_top: Pixels,
}
impl Default for SheetSettings {
fn default() -> Self {
Self {
margin_top: TITLE_BAR_HEIGHT,
}
}
}
#[derive(Debug, Clone)]
pub struct NotificationSettings {
pub placement: Anchor,
pub margins: Edges<Pixels>,
pub max_items: usize,
}
impl Default for NotificationSettings {
fn default() -> Self {
let offset = px(16.);
Self {
placement: Anchor::TopRight,
margins: Edges {
top: TITLE_BAR_HEIGHT + offset,
right: offset,
bottom: offset,
left: offset,
},
max_items: 10,
}
}
}