pub struct UINodeParams { /* private fields */ }Implementations§
Source§impl UINodeParams
impl UINodeParams
Sourcepub fn new(w: Size, h: Size) -> Self
pub fn new(w: Size, h: Size) -> Self
Examples found in repository?
More examples
examples/test.rs (line 19)
15 fn tick(&mut self, ui: &mut pierro::UI) {
16
17 let bg_color = ui.style::<pierro::Theme>().bg_dark;
18 let bg = ui.node(
19 pierro::UINodeParams::new(pierro::Size::fr(1.0), pierro::Size::fr(1.0))
20 .with_layout(pierro::Layout::vertical().with_vertical_overflow())
21 .with_fill(bg_color)
22 .with_transform(pierro::TSTransform::scale(self.zoom))
23 );
24
25 ui.with_parent(bg.node_ref, |ui| {
26
27 pierro::menu_bar(ui, |ui| {
28 pierro::menu_bar_item(ui, "File", |ui| {
29 if pierro::menu_button(ui, "New").mouse_clicked() {
30 println!("New!!");
31 }
32 if pierro::menu_button(ui, "Open").mouse_clicked() {
33 println!("Open!!");
34 }
35 pierro::menu_category(ui, "Recent", |ui| {
36 pierro::menu_button(ui, "A.txt");
37 pierro::menu_button(ui, "B.txt");
38 pierro::menu_button(ui, "C.txt");
39 pierro::menu_category(ui, "!!", |ui| {
40 pierro::menu_button(ui, "A.txt");
41 pierro::menu_button(ui, "B.txt");
42 pierro::menu_button(ui, "C.txt");
43 });
44 });
45 pierro::h_line(ui);
46 pierro::menu_button(ui, "XYZ").mouse_clicked();
47 pierro::menu_button(ui, "PQR").mouse_clicked();
48 });
49 pierro::menu_bar_item(ui, "Edit", |ui| {
50 pierro::menu_button(ui, "Undo").mouse_clicked();
51 pierro::menu_button(ui, "Redo").mouse_clicked();
52 });
53 });
54
55 pierro::v_spacing(ui, 15.0);
56 pierro::label(ui, "Above the scroll area");
57
58 pierro::dnd_source(ui, "Hello".to_string(), |ui| {
59 pierro::label(ui, "Drag me! (Hello)");
60 });
61 pierro::dnd_source(ui, "World".to_string(), |ui| {
62 pierro::label(ui, "Drag me! (World)");
63 });
64 if let Some(message) = pierro::dnd_drop_zone::<String, _>(ui, |ui| {
65 pierro::label(ui, "Drop here...");
66 }).1 {
67 println!("{}", message);
68 }
69
70 pierro::horizontal(ui, |ui| {
71 if pierro::button(ui, "+").mouse_clicked() {
72 self.zoom *= 1.25;
73 }
74 if pierro::button(ui, "-").mouse_clicked() {
75 self.zoom /= 1.25;
76 }
77
78 let button_response = pierro::button(ui, "@");
79 pierro::context_menu(ui, &button_response, |ui| {
80 pierro::label(ui, "Truly!!!");
81 });
82 });
83 pierro::v_spacing(ui, 15.0);
84 pierro::text_edit(ui, &mut self.text);
85 pierro::v_spacing(ui, 15.0);
86
87 pierro::scroll_area(ui, |ui| {
88
89 pierro::label(ui, "Button #1: 🍊");
90 if pierro::button(ui, "So long mom, I'm off to drop the bomb").mouse_clicked() {
91 self.n += 1;
92 }
93
94 pierro::label(ui, "Button #2:");
95 if pierro::button(ui, "So long mom, I'm off to drop the bomb").mouse_clicked() {
96 self.n -= 1;
97 }
98
99 pierro::label(ui, "The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.");
100
101 for i in 0..100 {
102 pierro::label(ui, format!("{} {}", i, self.n));
103 }
104
105 });
106
107 pierro::v_spacing(ui, 15.0);
108 pierro::label(ui, "Below the scroll area");
109 pierro::label(ui, "Ниже области прокрутки");
110 pierro::label(ui, "أسفل منطقة التمرير");
111 pierro::v_spacing(ui, 15.0);
112
113 });
114
115 }pub fn new_per_axis(size: PerAxis<Size>) -> Self
pub fn with_size(self, w: Size, h: Size) -> Self
Sourcepub fn with_layout(self, layout: Layout) -> Self
pub fn with_layout(self, layout: Layout) -> Self
Examples found in repository?
examples/test.rs (line 20)
15 fn tick(&mut self, ui: &mut pierro::UI) {
16
17 let bg_color = ui.style::<pierro::Theme>().bg_dark;
18 let bg = ui.node(
19 pierro::UINodeParams::new(pierro::Size::fr(1.0), pierro::Size::fr(1.0))
20 .with_layout(pierro::Layout::vertical().with_vertical_overflow())
21 .with_fill(bg_color)
22 .with_transform(pierro::TSTransform::scale(self.zoom))
23 );
24
25 ui.with_parent(bg.node_ref, |ui| {
26
27 pierro::menu_bar(ui, |ui| {
28 pierro::menu_bar_item(ui, "File", |ui| {
29 if pierro::menu_button(ui, "New").mouse_clicked() {
30 println!("New!!");
31 }
32 if pierro::menu_button(ui, "Open").mouse_clicked() {
33 println!("Open!!");
34 }
35 pierro::menu_category(ui, "Recent", |ui| {
36 pierro::menu_button(ui, "A.txt");
37 pierro::menu_button(ui, "B.txt");
38 pierro::menu_button(ui, "C.txt");
39 pierro::menu_category(ui, "!!", |ui| {
40 pierro::menu_button(ui, "A.txt");
41 pierro::menu_button(ui, "B.txt");
42 pierro::menu_button(ui, "C.txt");
43 });
44 });
45 pierro::h_line(ui);
46 pierro::menu_button(ui, "XYZ").mouse_clicked();
47 pierro::menu_button(ui, "PQR").mouse_clicked();
48 });
49 pierro::menu_bar_item(ui, "Edit", |ui| {
50 pierro::menu_button(ui, "Undo").mouse_clicked();
51 pierro::menu_button(ui, "Redo").mouse_clicked();
52 });
53 });
54
55 pierro::v_spacing(ui, 15.0);
56 pierro::label(ui, "Above the scroll area");
57
58 pierro::dnd_source(ui, "Hello".to_string(), |ui| {
59 pierro::label(ui, "Drag me! (Hello)");
60 });
61 pierro::dnd_source(ui, "World".to_string(), |ui| {
62 pierro::label(ui, "Drag me! (World)");
63 });
64 if let Some(message) = pierro::dnd_drop_zone::<String, _>(ui, |ui| {
65 pierro::label(ui, "Drop here...");
66 }).1 {
67 println!("{}", message);
68 }
69
70 pierro::horizontal(ui, |ui| {
71 if pierro::button(ui, "+").mouse_clicked() {
72 self.zoom *= 1.25;
73 }
74 if pierro::button(ui, "-").mouse_clicked() {
75 self.zoom /= 1.25;
76 }
77
78 let button_response = pierro::button(ui, "@");
79 pierro::context_menu(ui, &button_response, |ui| {
80 pierro::label(ui, "Truly!!!");
81 });
82 });
83 pierro::v_spacing(ui, 15.0);
84 pierro::text_edit(ui, &mut self.text);
85 pierro::v_spacing(ui, 15.0);
86
87 pierro::scroll_area(ui, |ui| {
88
89 pierro::label(ui, "Button #1: 🍊");
90 if pierro::button(ui, "So long mom, I'm off to drop the bomb").mouse_clicked() {
91 self.n += 1;
92 }
93
94 pierro::label(ui, "Button #2:");
95 if pierro::button(ui, "So long mom, I'm off to drop the bomb").mouse_clicked() {
96 self.n -= 1;
97 }
98
99 pierro::label(ui, "The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.");
100
101 for i in 0..100 {
102 pierro::label(ui, format!("{} {}", i, self.n));
103 }
104
105 });
106
107 pierro::v_spacing(ui, 15.0);
108 pierro::label(ui, "Below the scroll area");
109 pierro::label(ui, "Ниже области прокрутки");
110 pierro::label(ui, "أسفل منطقة التمرير");
111 pierro::v_spacing(ui, 15.0);
112
113 });
114
115 }pub fn with_margin(self, margin: Margin) -> Self
pub fn with_interaction_margin(self, margin: Margin) -> Self
Sourcepub fn with_transform(self, transform: TSTransform) -> Self
pub fn with_transform(self, transform: TSTransform) -> Self
Examples found in repository?
examples/test.rs (line 22)
15 fn tick(&mut self, ui: &mut pierro::UI) {
16
17 let bg_color = ui.style::<pierro::Theme>().bg_dark;
18 let bg = ui.node(
19 pierro::UINodeParams::new(pierro::Size::fr(1.0), pierro::Size::fr(1.0))
20 .with_layout(pierro::Layout::vertical().with_vertical_overflow())
21 .with_fill(bg_color)
22 .with_transform(pierro::TSTransform::scale(self.zoom))
23 );
24
25 ui.with_parent(bg.node_ref, |ui| {
26
27 pierro::menu_bar(ui, |ui| {
28 pierro::menu_bar_item(ui, "File", |ui| {
29 if pierro::menu_button(ui, "New").mouse_clicked() {
30 println!("New!!");
31 }
32 if pierro::menu_button(ui, "Open").mouse_clicked() {
33 println!("Open!!");
34 }
35 pierro::menu_category(ui, "Recent", |ui| {
36 pierro::menu_button(ui, "A.txt");
37 pierro::menu_button(ui, "B.txt");
38 pierro::menu_button(ui, "C.txt");
39 pierro::menu_category(ui, "!!", |ui| {
40 pierro::menu_button(ui, "A.txt");
41 pierro::menu_button(ui, "B.txt");
42 pierro::menu_button(ui, "C.txt");
43 });
44 });
45 pierro::h_line(ui);
46 pierro::menu_button(ui, "XYZ").mouse_clicked();
47 pierro::menu_button(ui, "PQR").mouse_clicked();
48 });
49 pierro::menu_bar_item(ui, "Edit", |ui| {
50 pierro::menu_button(ui, "Undo").mouse_clicked();
51 pierro::menu_button(ui, "Redo").mouse_clicked();
52 });
53 });
54
55 pierro::v_spacing(ui, 15.0);
56 pierro::label(ui, "Above the scroll area");
57
58 pierro::dnd_source(ui, "Hello".to_string(), |ui| {
59 pierro::label(ui, "Drag me! (Hello)");
60 });
61 pierro::dnd_source(ui, "World".to_string(), |ui| {
62 pierro::label(ui, "Drag me! (World)");
63 });
64 if let Some(message) = pierro::dnd_drop_zone::<String, _>(ui, |ui| {
65 pierro::label(ui, "Drop here...");
66 }).1 {
67 println!("{}", message);
68 }
69
70 pierro::horizontal(ui, |ui| {
71 if pierro::button(ui, "+").mouse_clicked() {
72 self.zoom *= 1.25;
73 }
74 if pierro::button(ui, "-").mouse_clicked() {
75 self.zoom /= 1.25;
76 }
77
78 let button_response = pierro::button(ui, "@");
79 pierro::context_menu(ui, &button_response, |ui| {
80 pierro::label(ui, "Truly!!!");
81 });
82 });
83 pierro::v_spacing(ui, 15.0);
84 pierro::text_edit(ui, &mut self.text);
85 pierro::v_spacing(ui, 15.0);
86
87 pierro::scroll_area(ui, |ui| {
88
89 pierro::label(ui, "Button #1: 🍊");
90 if pierro::button(ui, "So long mom, I'm off to drop the bomb").mouse_clicked() {
91 self.n += 1;
92 }
93
94 pierro::label(ui, "Button #2:");
95 if pierro::button(ui, "So long mom, I'm off to drop the bomb").mouse_clicked() {
96 self.n -= 1;
97 }
98
99 pierro::label(ui, "The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.");
100
101 for i in 0..100 {
102 pierro::label(ui, format!("{} {}", i, self.n));
103 }
104
105 });
106
107 pierro::v_spacing(ui, 15.0);
108 pierro::label(ui, "Below the scroll area");
109 pierro::label(ui, "Ниже области прокрутки");
110 pierro::label(ui, "أسفل منطقة التمرير");
111 pierro::v_spacing(ui, 15.0);
112
113 });
114
115 }Sourcepub fn with_fill(self, color: Color) -> Self
pub fn with_fill(self, color: Color) -> Self
Examples found in repository?
More examples
examples/test.rs (line 21)
15 fn tick(&mut self, ui: &mut pierro::UI) {
16
17 let bg_color = ui.style::<pierro::Theme>().bg_dark;
18 let bg = ui.node(
19 pierro::UINodeParams::new(pierro::Size::fr(1.0), pierro::Size::fr(1.0))
20 .with_layout(pierro::Layout::vertical().with_vertical_overflow())
21 .with_fill(bg_color)
22 .with_transform(pierro::TSTransform::scale(self.zoom))
23 );
24
25 ui.with_parent(bg.node_ref, |ui| {
26
27 pierro::menu_bar(ui, |ui| {
28 pierro::menu_bar_item(ui, "File", |ui| {
29 if pierro::menu_button(ui, "New").mouse_clicked() {
30 println!("New!!");
31 }
32 if pierro::menu_button(ui, "Open").mouse_clicked() {
33 println!("Open!!");
34 }
35 pierro::menu_category(ui, "Recent", |ui| {
36 pierro::menu_button(ui, "A.txt");
37 pierro::menu_button(ui, "B.txt");
38 pierro::menu_button(ui, "C.txt");
39 pierro::menu_category(ui, "!!", |ui| {
40 pierro::menu_button(ui, "A.txt");
41 pierro::menu_button(ui, "B.txt");
42 pierro::menu_button(ui, "C.txt");
43 });
44 });
45 pierro::h_line(ui);
46 pierro::menu_button(ui, "XYZ").mouse_clicked();
47 pierro::menu_button(ui, "PQR").mouse_clicked();
48 });
49 pierro::menu_bar_item(ui, "Edit", |ui| {
50 pierro::menu_button(ui, "Undo").mouse_clicked();
51 pierro::menu_button(ui, "Redo").mouse_clicked();
52 });
53 });
54
55 pierro::v_spacing(ui, 15.0);
56 pierro::label(ui, "Above the scroll area");
57
58 pierro::dnd_source(ui, "Hello".to_string(), |ui| {
59 pierro::label(ui, "Drag me! (Hello)");
60 });
61 pierro::dnd_source(ui, "World".to_string(), |ui| {
62 pierro::label(ui, "Drag me! (World)");
63 });
64 if let Some(message) = pierro::dnd_drop_zone::<String, _>(ui, |ui| {
65 pierro::label(ui, "Drop here...");
66 }).1 {
67 println!("{}", message);
68 }
69
70 pierro::horizontal(ui, |ui| {
71 if pierro::button(ui, "+").mouse_clicked() {
72 self.zoom *= 1.25;
73 }
74 if pierro::button(ui, "-").mouse_clicked() {
75 self.zoom /= 1.25;
76 }
77
78 let button_response = pierro::button(ui, "@");
79 pierro::context_menu(ui, &button_response, |ui| {
80 pierro::label(ui, "Truly!!!");
81 });
82 });
83 pierro::v_spacing(ui, 15.0);
84 pierro::text_edit(ui, &mut self.text);
85 pierro::v_spacing(ui, 15.0);
86
87 pierro::scroll_area(ui, |ui| {
88
89 pierro::label(ui, "Button #1: 🍊");
90 if pierro::button(ui, "So long mom, I'm off to drop the bomb").mouse_clicked() {
91 self.n += 1;
92 }
93
94 pierro::label(ui, "Button #2:");
95 if pierro::button(ui, "So long mom, I'm off to drop the bomb").mouse_clicked() {
96 self.n -= 1;
97 }
98
99 pierro::label(ui, "The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.The quick brown fox jumped over the lazy dog.");
100
101 for i in 0..100 {
102 pierro::label(ui, format!("{} {}", i, self.n));
103 }
104
105 });
106
107 pierro::v_spacing(ui, 15.0);
108 pierro::label(ui, "Below the scroll area");
109 pierro::label(ui, "Ниже области прокрутки");
110 pierro::label(ui, "أسفل منطقة التمرير");
111 pierro::v_spacing(ui, 15.0);
112
113 });
114
115 }pub fn with_rounding(self, rounding: f32) -> Self
pub fn with_stroke(self, stroke: Stroke) -> Self
pub fn with_clip(self, clip: bool) -> Self
pub fn no_clip(self) -> Self
pub fn with_text<S: Into<String>>(self, text: S) -> Self
pub fn with_text_style(self, style: TextStyle) -> Self
pub fn sense_mouse(self) -> Self
pub fn sense_scroll(self) -> Self
pub fn with_interaction_priority(self) -> Self
pub fn on_paint<F: FnOnce(&mut Painter<'_>, Rect) + 'static>( self, on_paint: F, ) -> Self
Auto Trait Implementations§
impl Freeze for UINodeParams
impl !RefUnwindSafe for UINodeParams
impl !Send for UINodeParams
impl !Sync for UINodeParams
impl Unpin for UINodeParams
impl !UnwindSafe for UINodeParams
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more