swoop_ui/container/grid/
v_grid.rs1use bevy_ecs::prelude::*;
2use bevy_ui::prelude::*;
3
4use crate::View;
5use crate::background::{BackgroundStyle, BackgroundView};
6use crate::border::{BorderStyle, BorderView};
7use crate::prelude::PositionView;
8use crate::shadow::BoxShadowView;
9
10use super::GridView;
11
12#[derive(Bundle, Debug, Clone)]
15pub struct VGrid {
16 name: Name,
18 node: Node,
20 border: BorderStyle,
22 background: BackgroundStyle,
24 shadow: BoxShadow,
26}
27
28impl Default for VGrid {
29 fn default() -> Self {
30 Self {
31 name: Name::new("VGrid"),
32 node: Node {
33 display: Display::Grid,
34 grid_auto_flow: GridAutoFlow::Row,
35 justify_content: JustifyContent::Start,
36 align_items: AlignItems::Center,
37 row_gap: Val::Px(0.0),
38 ..Default::default()
39 },
40 border: BorderStyle::default(),
41 background: BackgroundStyle::default(),
42 shadow: BoxShadow::default(),
43 }
44 }
45}
46
47impl View for VGrid {
48 fn name_node(&mut self) -> &mut Name {
49 &mut self.name
50 }
51
52 fn node_node(&mut self) -> &mut Node {
53 &mut self.node
54 }
55}
56
57impl GridView for VGrid {}
58
59impl BackgroundView for VGrid {
60 fn background_node(&mut self) -> &mut BackgroundStyle {
61 &mut self.background
62 }
63}
64
65impl BorderView for VGrid {
66 fn border_node(&mut self) -> &mut BorderStyle {
67 &mut self.border
68 }
69}
70
71impl BoxShadowView for VGrid {
72 fn box_shadow_node(&mut self) -> &mut BoxShadow {
73 &mut self.shadow
74 }
75}
76
77impl PositionView for VGrid {}