feat: add window api

This commit is contained in:
mrxiaozhuox committed 2022-02-10 23:33:02 +08:00
1 parent 01435d6aff
commit 81ea7a1428
2 files changed
+37

No files matched your search

+23
View File
@@ -299,6 +299,12 @@ pub fn launch_with_props<P: 'static + Send>(
// close window
*control_flow = ControlFlow::Exit;
}
UserWindowEvent::Visible(state) => {
for webview in desktop.webviews.values() {
let window = webview.window();
window.set_visible(state);
}
}
UserWindowEvent::Minimize(state) => {
// this loop just run once, because dioxus-desktop is unsupport multi-window.
for webview in desktop.webviews.values() {
@@ -333,6 +339,19 @@ pub fn launch_with_props<P: 'static + Send>(
window.set_resizable(state);
}
}
UserWindowEvent::AlwaysOnTop(state) => {
for webview in desktop.webviews.values() {
let window = webview.window();
window.set_always_on_top(state);
}
}
UserWindowEvent::CursorVisible(state) => {
for webview in desktop.webviews.values() {
let window = webview.window();
window.set_cursor_visible(state);
}
}
UserWindowEvent::SetTitle(content) => {
for webview in desktop.webviews.values() {
@@ -363,11 +382,15 @@ pub enum UserWindowEvent {
DragWindow,
CloseWindow,
FocusWindow,
Visible(bool),
Minimize(bool),
Maximize(bool),
Resizable(bool),
AlwaysOnTop(bool),
Fullscreen(Box<Option<Fullscreen>>),
CursorVisible(bool),
SetTitle(String),
SetDecorations(bool),
}