use std::fmt::Debug;
use std::marker::PhantomData;
use kas::prelude::*;
use kas::widget::Menu;
#[handler(msg=M)]
#[derive(Clone, Debug, Default, Widget)]
pub struct Separator<M: Debug + 'static> {
#[widget_core]
core: CoreData,
_msg: PhantomData<M>,
}
impl Separator<event::VoidMsg> {
#[inline]
pub fn new() -> Self {
Separator {
core: Default::default(),
_msg: Default::default(),
}
}
}
impl<M: Debug> Separator<M> {
#[inline]
pub fn infer() -> Self {
Separator {
core: Default::default(),
_msg: Default::default(),
}
}
}
impl<M: Debug> Layout for Separator<M> {
fn size_rules(&mut self, size_handle: &mut dyn SizeHandle, axis: AxisInfo) -> SizeRules {
SizeRules::extract_fixed(axis.is_vertical(), size_handle.frame(), Default::default())
}
fn draw(&self, draw_handle: &mut dyn DrawHandle, _: &event::ManagerState, _: bool) {
draw_handle.separator(self.core.rect);
}
}
impl<M: Debug> Menu for Separator<M> {}