mitsuami_widgets/
separator.rs1use mitsuami_core::{Element, ElementBuilder, NodeId, Orientation, Prop, Tweak, Ui, View, WidgetKind};
4use mitsuami_reactive::{IntoValue, Value};
5
6pub struct Separator(Element);
19
20widget!(Separator);
21
22impl Separator {
23 pub fn new() -> Separator {
24 let mut element = Element::new(WidgetKind::Separator);
25 element.prop(Value::Static(Orientation::Horizontal), Prop::Orientation);
26 Separator(element)
27 }
28
29 pub fn vertical() -> Separator {
31 Separator::new().orientation(Orientation::Vertical)
32 }
33
34 pub fn orientation(mut self, orientation: impl IntoValue<Orientation>) -> Separator {
36 self.0.prop(orientation.into_value(), Prop::Orientation);
37 self
38 }
39
40 pub fn native(mut self, tweak: Tweak<Separator>) -> Separator {
42 tweak.apply(&mut self.0);
43 self
44 }
45}
46
47impl Default for Separator {
48 fn default() -> Separator {
49 Separator::new()
50 }
51}
52
53impl Separator {
54 #[doc(hidden)]
56 pub fn __tag() -> Separator {
57 Separator::new()
58 }
59}