#[derive(Debug, Clone)]
pub enum BackgroundFill {
Solid,
Glass {
blur_radius: f64,
},
Texture {
asset_id: &'static str,
},
}
pub trait ContextMenuStyle {
fn radius(&self) -> f64;
fn border_width(&self) -> f64;
fn padding(&self) -> f64;
fn item_height(&self) -> f64;
fn separator_height(&self) -> f64;
fn item_padding_x(&self) -> f64;
fn icon_size(&self) -> f64;
fn icon_text_gap(&self) -> f64;
fn min_width(&self) -> f64;
fn max_width(&self) -> f64;
fn shadow_offset(&self) -> (f64, f64);
fn shadow_alpha(&self) -> f64;
fn item_hover_radius(&self) -> f64;
fn font_size(&self) -> f64;
fn background_fill(&self) -> BackgroundFill;
}
#[derive(Default)]
pub struct DefaultContextMenuStyle;
impl ContextMenuStyle for DefaultContextMenuStyle {
fn radius(&self) -> f64 { 4.0 }
fn border_width(&self) -> f64 { 1.0 }
fn padding(&self) -> f64 { 4.0 }
fn item_height(&self) -> f64 { 32.0 }
fn separator_height(&self) -> f64 { 9.0 }
fn item_padding_x(&self) -> f64 { 12.0 }
fn icon_size(&self) -> f64 { 16.0 }
fn icon_text_gap(&self) -> f64 { 8.0 }
fn min_width(&self) -> f64 { 180.0 }
fn max_width(&self) -> f64 { 0.0 }
fn shadow_offset(&self) -> (f64, f64) { (3.0, 3.0) }
fn shadow_alpha(&self) -> f64 { 0.3 }
fn item_hover_radius(&self) -> f64 { 2.0 }
fn font_size(&self) -> f64 { 13.0 }
fn background_fill(&self) -> BackgroundFill {
BackgroundFill::Glass { blur_radius: 12.0 }
}
}
#[derive(Default)]
pub struct MinimalContextMenuStyle;
impl ContextMenuStyle for MinimalContextMenuStyle {
fn radius(&self) -> f64 { 4.0 }
fn border_width(&self) -> f64 { 1.0 }
fn padding(&self) -> f64 { 4.0 }
fn item_height(&self) -> f64 { 28.0 }
fn separator_height(&self) -> f64 { 9.0 }
fn item_padding_x(&self) -> f64 { 12.0 }
fn icon_size(&self) -> f64 { 16.0 }
fn icon_text_gap(&self) -> f64 { 8.0 }
fn min_width(&self) -> f64 { 160.0 }
fn max_width(&self) -> f64 { 0.0 }
fn shadow_offset(&self) -> (f64, f64) { (3.0, 3.0) }
fn shadow_alpha(&self) -> f64 { 0.3 }
fn item_hover_radius(&self) -> f64 { 2.0 }
fn font_size(&self) -> f64 { 12.0 }
fn background_fill(&self) -> BackgroundFill {
BackgroundFill::Solid
}
}