swoop_ui/button/
v_button.rs1use bevy_ecs::prelude::*;
2use bevy_ui::prelude::*;
3
4use crate::View;
5use crate::background::BackgroundStyle;
6use crate::border::{BorderStyle, BorderView};
7use crate::prelude::{BackgroundView, PositionView, StackView};
8use crate::shadow::BoxShadowView;
9
10#[derive(Bundle, Debug, Clone)]
31pub struct VButton {
32 name: Name,
34
35 node: Node,
37
38 botton: Button,
40
41 border: BorderStyle,
43
44 background: BackgroundStyle,
46
47 shadow: BoxShadow,
49}
50
51impl Default for VButton {
52 fn default() -> Self {
54 Self {
55 name: Name::new("VButton"),
56 node: Node {
57 display: Display::Flex,
58 flex_direction: FlexDirection::Column,
59 justify_content: JustifyContent::Center,
60 align_items: AlignItems::Center,
61 row_gap: Val::Px(0.0),
62 ..Default::default()
63 },
64 botton: Button,
65 border: BorderStyle::button(),
66 background: BackgroundStyle::button(),
67 shadow: BoxShadow::default(),
68 }
69 }
70}
71
72impl View for VButton {
73 fn name_node(&mut self) -> &mut Name {
74 &mut self.name
75 }
76
77 fn node_node(&mut self) -> &mut Node {
78 &mut self.node
79 }
80}
81
82impl StackView for VButton {}
83
84impl BackgroundView for VButton {
85 fn background_node(&mut self) -> &mut BackgroundStyle {
86 &mut self.background
87 }
88}
89
90impl BorderView for VButton {
91 fn border_node(&mut self) -> &mut BorderStyle {
92 &mut self.border
93 }
94}
95
96impl BoxShadowView for VButton {
97 fn box_shadow_node(&mut self) -> &mut BoxShadow {
98 &mut self.shadow
99 }
100}
101
102impl PositionView for VButton {}