changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > demo / src/crates/ui/pages/controls.slint

changeset 22: ba323d8c0f93
parent: ui/pages/controls.slint@e4c9ec452eb6
author: ellis <ellis@rwest.io>
date: Sat, 03 Jun 2023 22:48:46 -0400
permissions: -rw-r--r--
description: refactor1
1 import { Button, GroupBox, SpinBox, ComboBox, CheckBox, LineEdit, TabWidget, VerticalBox, HorizontalBox,
2  Slider, SpinBox } from "std-widgets.slint";
3 import { UiConfig } from "../config.slint";
4 import { Page } from "page.slint";
5 
6 export component ControlsPage inherits Page {
7  title: "Controls";
8  description: "This page gives an overview of the default widget set provided by Slint. The widgets are available in different styles native, fluent-(dark/light) and material-(dark/light). The widgets can be imported from \"std-widgets.slint\".";
9 
10  GroupBox {
11  vertical-stretch: 0;
12  title: "Buttons";
13 
14  HorizontalLayout {
15  spacing: 8px;
16  alignment: start;
17 
18  Button {
19  text: "Regular Button";
20  enabled: !UiConfig.widgets-disabled;
21  }
22 
23  Button {
24  text: "Button with Icon";
25  icon: @image-url("../img/treez.png");
26  enabled: !UiConfig.widgets-disabled;
27  }
28 
29  Button {
30  checkable: true;
31  text: self.checked ? "ON" : "OFF";
32  enabled: !UiConfig.widgets-disabled;
33  }
34  }
35  }
36 
37  GroupBox {
38  title: "CheckBox - SpinBox - ComboBox";
39  vertical-stretch: 0;
40 
41  HorizontalBox {
42  alignment: start;
43  checkbox := CheckBox {
44  text: checkbox.checked ? "(checked)" : "(unchecked)";
45  checked: true;
46  enabled: !UiConfig.widgets-disabled;
47  }
48 
49 
50  SpinBox {
51  vertical-stretch: 0;
52  value: 42;
53  enabled: !UiConfig.widgets-disabled;
54  }
55 
56  ComboBox {
57  model: ["Select Something", "From this", "Combobox"];
58  enabled: !UiConfig.widgets-disabled;
59  }
60  }
61 
62 
63  }
64 
65  GroupBox {
66  title: "LineEdit";
67  vertical-stretch: 0;
68 
69  LineEdit {
70  placeholder-text: "Enter some text";
71  enabled: !UiConfig.widgets-disabled;
72  }
73  }
74 
75  GroupBox {
76  title: "Slider";
77  vertical-stretch: 0;
78 
79  Slider {
80  min-width: 160px;
81  minimum: -100;
82  maximum: 100;
83  value: 42;
84  enabled: !UiConfig.widgets-disabled;
85  }
86  }
87 
88  GroupBox {
89  title: "TabWidget";
90 
91  TabWidget {
92  Tab {
93  title: "Tab 1";
94 
95  VerticalBox {
96  alignment: start;
97 
98  GroupBox {
99  title: "Content of tab 1";
100 
101  HorizontalBox {
102  alignment: start;
103 
104  Button {
105  text: "Click me";
106  enabled: !UiConfig.widgets-disabled;
107  }
108  }
109  }
110  }
111  }
112 
113  Tab {
114  title: "Tab 2";
115 
116  VerticalBox {
117  alignment: start;
118 
119  GroupBox {
120  title: "Content of tab 2";
121 
122  VerticalBox {
123  alignment: start;
124 
125  CheckBox {
126  text: "Check me";
127  enabled: !UiConfig.widgets-disabled;
128  }
129  }
130  }
131  }
132  }
133 
134  Tab {
135  title: "Tab 3";
136 
137  VerticalBox {
138  Text {
139  text: "Content of tab 3";
140  }
141  }
142  }
143  }
144  }
145 }