1use std::borrow::Cow;
2
3use bevy_app::prelude::*;
4use bevy_ecs::prelude::*;
5use bevy_ui::prelude::*;
6
7pub mod container;
8
9pub mod prelude {
10 pub use super::container::prelude::*;
11 pub use super::{SwoopUiPlugin, UiBase, UiToBundle};
12}
13
14pub struct SwoopUiPlugin;
15
16pub trait UiBase {
17 fn name_node(&mut self) -> &mut Name;
18
19 fn node_node(&mut self) -> &mut Node;
20
21 fn name(mut self, name: impl Into<Cow<'static, str>>) -> Self
22 where
23 Self: Sized,
24 {
25 self.name_node().set(name);
26 self
27 }
28
29 fn padding(mut self, padding: UiRect) -> Self
30 where
31 Self: Sized,
32 {
33 self.node_node().padding = padding;
34 self
35 }
36
37 fn frame(mut self, width: Val, height: Val) -> Self
38 where
39 Self: Sized,
40 {
41 let node = self.node_node();
42 node.width = width;
43 node.height = height;
44 self
45 }
46
47 fn width(mut self, width: Val) -> Self
48 where
49 Self: Sized,
50 {
51 self.node_node().width = width;
52 self
53 }
54
55 fn height(mut self, height: Val) -> Self
56 where
57 Self: Sized,
58 {
59 self.node_node().height = height;
60 self
61 }
62}
63
64pub trait UiToBundle {
65 fn pack(self) -> impl Bundle;
66}
67
68impl Plugin for SwoopUiPlugin {
69 fn build(&self, app: &mut App) {
70 todo!()
71 }
72}