-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.rs
More file actions
76 lines (72 loc) · 2.29 KB
/
main.rs
File metadata and controls
76 lines (72 loc) · 2.29 KB
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
use dioxus::prelude::*;
fn main() {
let script = r#"
<link rel="stylesheet" href="src/assets/styles/reset.css">
<link rel="stylesheet" href="src/assets/styles/titlebar.css">
"#;
dioxus::desktop::launch_cfg(app, |cfg| {
cfg.with_custom_head(script.to_string())
.with_window(|w| w.with_decorations(false))
});
}
fn app(cx: Scope) -> Element {
let window = dioxus::desktop::use_window(&cx);
cx.render(rsx! (
div {
class: "titlebar",
div {
class: "drag-region left title",
onmousedown: move |_| { window.drag(); },
span {"Custom titlebar"}
}
div {
class: "right",
button {
class: "setting-button",
id: "setting",
onclick: |_| {
println!("setting!")
},
img {
src: "src/assets/icons/codicon_settings-gear.svg",
alt: "—",
}
}
button {
class: "titlebar-button",
id: "minimize",
onclick: |_| {
window.set_minimized(true);
},
img {
src: "src/assets/icons/codicon_chrome-minimize.svg",
alt: "—",
}
}
button {
class: "titlebar-button",
id: "maximize",
onclick: |_| {
window.toggle_maximized();
},
img {
src: "src/assets/icons/codicon_chrome-maximize.svg",
alt: "+",
}
}
button {
class: "titlebar-button",
id: "close",
onclick: |_| {
window.close();
},
img {
src: "src/assets/icons/codicon_close.svg",
alt: "x",
}
}
}
}
div { "Hello, world!" }
))
}