feat(ui): frameless transparent window with drag
This commit is contained in:
@@ -4,6 +4,18 @@ import { GradientIcon } from "./gradient-icon.slint";
|
||||
|
||||
export component Header inherits Rectangle {
|
||||
in property <string> url;
|
||||
callback request-drag();
|
||||
|
||||
TouchArea {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
mouse-cursor: move;
|
||||
pointer-event(event) => {
|
||||
if (event.kind == PointerEventKind.down) {
|
||||
root.request-drag();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VerticalLayout {
|
||||
width: 100%;
|
||||
|
||||
+18
-1
@@ -5,7 +5,10 @@ import { Footer } from "./footer.slint";
|
||||
import { BrowserConfig } from "./types.slint";
|
||||
import { Theme } from "theme.slint";
|
||||
|
||||
export { Theme }
|
||||
|
||||
export component MainWindow inherits Window {
|
||||
title: "bropicker";
|
||||
in property <[BrowserConfig]> browser-model: [];
|
||||
in property <string> current-url: "";
|
||||
in-out property <bool> remember-choice: false;
|
||||
@@ -18,13 +21,26 @@ export component MainWindow inherits Window {
|
||||
callback settings-clicked();
|
||||
callback open-clicked();
|
||||
callback request-drag();
|
||||
callback esc-pressed();
|
||||
|
||||
// no-frame: true;
|
||||
no-frame: true;
|
||||
background: transparent;
|
||||
width: 488px;
|
||||
height: 800px;
|
||||
default-font-family: "Segoe UI";
|
||||
|
||||
FocusScope {
|
||||
init => { self.focus(); }
|
||||
key-pressed(event) => {
|
||||
if (event.text == Key.Escape) {
|
||||
root.esc-pressed();
|
||||
accept
|
||||
} else {
|
||||
reject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VerticalLayout {
|
||||
alignment: start;
|
||||
width: 488px;
|
||||
@@ -46,6 +62,7 @@ export component MainWindow inherits Window {
|
||||
|
||||
Header {
|
||||
url: current-url;
|
||||
request-drag => root.request-drag();
|
||||
}
|
||||
|
||||
// ListView {
|
||||
|
||||
Reference in New Issue
Block a user