blob: a28d47d44c530295f802e0fa9faa2d077be809e6 [file] [log] [blame]
swissChili23958ca2022-02-21 19:23:34 -08001import QtQuick 2.5
2import QtQuick.Controls 2.15
3import QtQuick.Controls.Material 2.0
4import QtQuick.Layouts 1.3
5
swissChili4b3105a2022-02-22 16:34:39 -08006import sh.swisschili.REFAL 1.0
7
swissChili23958ca2022-02-21 19:23:34 -08008ApplicationWindow {
9 id: root
10 width: 1080
11 height: 720
12 title: "Notebook"
13 visible: true
14
swissChili4b3105a2022-02-22 16:34:39 -080015 Material.theme: Material.Light
swissChili23958ca2022-02-21 19:23:34 -080016 Material.accent: Material.Orange
17
swissChili25620b02022-02-23 17:15:16 -080018 Notebook {
19 id: notebook
swissChili4b3105a2022-02-22 16:34:39 -080020 }
21
22 Component.onCompleted: {
swissChili25620b02022-02-23 17:15:16 -080023 notebook.cellModel.addCell("Refal { = Hi!; }", "");
24 notebook.cellModel.addCell("<Refal>", "Hi!");
25 notebook.cellModel.addCell("Hello there", "Hello there");
swissChili4b3105a2022-02-22 16:34:39 -080026 }
27
swissChili23958ca2022-02-21 19:23:34 -080028 ColumnLayout {
29 id: column
30 anchors.fill: parent
31
32 TabBar {
33 id: bar
34
35 Layout.fillWidth: true
36
37 TabButton {
38 text: "Example Workspace"
swissChili25620b02022-02-23 17:15:16 -080039 width: implicitWidth
swissChili23958ca2022-02-21 19:23:34 -080040 }
41
42 TabButton {
43 text: "Another Workspace"
swissChili25620b02022-02-23 17:15:16 -080044 width: implicitWidth
swissChili23958ca2022-02-21 19:23:34 -080045 }
46
47 TabButton {
48 text: "Testing"
swissChili25620b02022-02-23 17:15:16 -080049 width: implicitWidth
swissChili23958ca2022-02-21 19:23:34 -080050 }
51 }
52
53 SplitView {
54 id: split
55 Layout.fillHeight: true
56 Layout.fillWidth: true
57 orientation: Qt.Horizontal
58
59 ListView {
60 id: codeEditor
61 SplitView.fillWidth: true
62 SplitView.minimumWidth: 400
swissChili25620b02022-02-23 17:15:16 -080063 model: notebook.cellModel
swissChili23958ca2022-02-21 19:23:34 -080064 clip: true
65
swissChili4b3105a2022-02-22 16:34:39 -080066 delegate: NotebookCell {
swissChili25620b02022-02-23 17:15:16 -080067 id: notebookCell
68
69 required property var model
70 required property var index
71
swissChili23958ca2022-02-21 19:23:34 -080072 width: codeEditor.width - 5
swissChili25620b02022-02-23 17:15:16 -080073
74 code: model.code
75 result: model.result
76
77 onCodeEditingFinished: model.code = code
78
79 onInsertBelowClicked: {
80 console.info(index)
81 cellModel.insertRows(cellModel.index(0, index), 1)
82 }
swissChili23958ca2022-02-21 19:23:34 -080083 }
84 }
85
86 Item {
87 id: variables
88 SplitView.minimumWidth: 240
89
90 Label {
91 anchors.centerIn: parent
92 text: "Vars"
93 }
94 }
95 }
96 }
97}