forked from slint-ui/slint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
desktop_window.slint
69 lines (57 loc) · 2.36 KB
/
desktop_window.slint
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
// Copyright © SixtyFPS GmbH <[email protected]>
// SPDX-License-Identifier: MIT
import { Theme, ScreenSize } from "theme.slint";
import { SmallMain } from "small_main.slint";
import { BigMain } from "big_main.slint";
import { MidMain } from "mid_main.slint";
import { MidMain } from "mid_main.slint";
import { MobileMain } from "mobile_main.slint";
import { BarTileModel } from "widgets/widgets.slint";
import { Images } from "images.slint";
import { Theme } from "theme.slint";
import { HeaderAdapter } from "blocks/blocks.slint";
import { Navigation, MenuButton, Menu, Value } from "widgets/widgets.slint";
import { BalanceAdapter, OverviewAdapter, UsageAdapter, WeatherAdapter, MenuPageAdapter, MenuOverviewAdapter, SettingsAdapter } from "pages/pages.slint";
import { KioskOverlay } from "blocks/kiosk_overlay.slint";
export { OverviewAdapter, UsageAdapter, Value, WeatherAdapter, MenuPageAdapter, MenuOverviewAdapter, SettingsAdapter,
BarTileModel, Images, HeaderAdapter }
export component MainWindow inherits Window {
private property <length> big-break-point: 1366px;
private property <length> mid-break-point: 799px;
private property <length> mobile-break-point: 444px;
private property <ScreenSize> screen-size: root.get-screen-size();
title: "EnergyMNG Demo";
min-width: 320px;
min-height: 240px;
background: Theme.palette.pure-black;
preferred-width: 800px;
preferred-height: 480px;
/* The design is not finished yet
if root.screen-size == ScreenSize.Desktop : BigMain {
preferred-width: 100%;
preferred-height: 100%;
}
*/
if root.screen-size == ScreenSize.Mobile : MobileMain {
preferred-width: 100%;
preferred-height: 100%;
}
if root.screen-size == ScreenSize.EmbeddedMedium : MidMain {
preferred-width: 100%;
preferred-height: 100%;
}
if root.screen-size == ScreenSize.EmbeddedSmall : SmallMain {
preferred-width: 100%;
preferred-height: 100%;
}
if SettingsAdapter.kiosk-mode-checked : KioskOverlay {}
pure function get-screen-size() -> ScreenSize {
if (root.width <= root.mobile-break-point && root.width < root.height) {
return ScreenSize.Mobile;
}
if (root.width < root.mid-break-point) {
return ScreenSize.EmbeddedSmall;
}
return ScreenSize.EmbeddedMedium;
}
}