1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
use std::rc::Rc;
use gdk::gio::ApplicationFlags;
use gdk::prelude::{ApplicationExt, ApplicationExtManual};
use gtk::gdk;
use gtk::traits::WidgetExt;
use libadwaita as adw;
use grx::prelude::*;
fn main() {
let app = adw::Application::new(Some("codes.loers.Test"), ApplicationFlags::empty());
app.connect_startup(|app| {
let c = grx! {
clamp (max_width=400) [
container(styles=[vertical, spacing(10)]) [
container(styles=[p(1), hover:m(2), spacing(10)]) [
"Label",
button(
styles=[p(10)],
on_click=|| {
println!("test1");
println!("test2");
}
) [
"Test"
]
],
scroll (styles=[vexpand]) [
container(styles=[vertical, m(10), spacing(10)]) [
list (classes="boxed-list".into()) [
action_row (
title="Test".into(),
subtitle="Foo Bar".into()
) [
button (styles=[valign(center)]) [
"Test"
]
],
action_row (
title="Test".into(),
subtitle="Foo Bar".into()
) [
button (styles=[valign(center)]) [
"Test"
]
],
expander_row (
title="Test".into(),
subtitle="Foo Bar".into(),
selectable=Some(false)
) [
container (styles=[spacing(100), vertical]) [
button (styles=[valign(center)]) [
"Test"
],
button (styles=[valign(center)]) [
"Test"
]
]
]
],
list (classes="boxed-list".into()) [
action_row (
title="Test".into(),
subtitle="Foo Bar".into()
) [
button (styles=[valign(center)]) [
"Test"
]
]
]
]
]
]
]
};
let inner = c.inner();
let w: >k::Widget = inner.downcast_ref().unwrap();
let window = gtk::ApplicationWindow::builder()
.application(app)
.child(w)
.width_request(200)
.height_request(600)
.build();
window.show();
});
app.run();
}