1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: MIT
3
4import { MenuOverviewAdapter } from "menu_overview.slint";
5import { Settings, SettingsAdapter } from "settings.slint";
6import { Theme } from "../../theme.slint";
7
8export { MenuOverviewAdapter, SettingsAdapter }
9
10export global MenuPageAdapter {
11 in property <[StandardListViewItem]> model: [
12 { text: "Production & Self-consumption"},
13 { text: "Usage"},
14 { text: "Balance"},
15 { text: "Weather"},
16 ];
17 in-out property <int> selected-index;
18}
19
20export component MenuPage {
21 in-out property <int> current-index;
22
23 callback page-changed(/* index */ int);
24 callback close;
25
26 private property <bool> show-settings;
27
28 function back() {
29 current-index = 0;
30 }
31
32 Rectangle {
33 x: -parent.width * current-index;
34 width: 2 * parent.width;
35 clip: true;
36
37 animate x { duration: Theme.durations.fast; }
38
39 if(current-index == 0) : Settings {
40 close => {
41 root.close();
42 }
43
44 width: root.width;
45 }
46 }
47 }
48