1use crate::menu::Menu;
9use kas::prelude::*;
10use std::marker::PhantomData;
11
12#[impl_self]
13mod Separator {
14 #[autoimpl(Clone, Debug, Default)]
18 #[widget]
19 pub struct Separator<A> {
20 core: widget_core!(),
21 _pd: PhantomData<A>,
22 }
23
24 impl Self {
25 #[inline]
27 pub fn new() -> Self {
28 Separator {
29 core: Default::default(),
30 _pd: PhantomData,
31 }
32 }
33 }
34
35 impl Layout for Self {
36 fn size_rules(&mut self, sizer: SizeCx, axis: AxisInfo) -> SizeRules {
37 sizer.feature(kas::theme::Feature::Separator, axis)
38 }
39
40 fn draw(&self, mut draw: DrawCx) {
41 draw.separator(self.rect());
42 }
43 }
44
45 impl Tile for Self {
46 fn role(&self, _: &mut dyn RoleCx) -> Role<'_> {
47 Role::Border
48 }
49 }
50
51 impl Events for Self {
52 type Data = A;
53 }
54
55 impl Menu for Self {}
57}