mirror of
https://codeberg.org/vyn/selenite.git
synced 2025-07-01 17:23:18 +00:00
Add Modal component
This commit is contained in:
parent
acbd56205d
commit
fa86c85483
1 changed files with 31 additions and 0 deletions
31
components/Modal.slint
Normal file
31
components/Modal.slint
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { Palette } from "Palette.slint";
|
||||
|
||||
export component Modal inherits Rectangle {
|
||||
init() => {
|
||||
if (self.absolute-position.x < 500px) {
|
||||
self.x += 500px - self.absolute-position.x;
|
||||
}
|
||||
}
|
||||
|
||||
public function show() {
|
||||
popup.show()
|
||||
}
|
||||
|
||||
public function close() {
|
||||
popup.close()
|
||||
}
|
||||
|
||||
popup := PopupWindow {
|
||||
close-policy: close-on-click-outside;
|
||||
background := Rectangle {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background: Palette.background1;
|
||||
border-color: Palette.popup-border;
|
||||
border-width: 1px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
@children
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue