-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.js
120 lines (114 loc) · 2.47 KB
/
example.js
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
const libui = require('.');
libui.init();
const menu = new libui.Menu('File', [
{
label: 'Open',
type: 'item',
onClick: () => {
const filepath = window.openFile();
if (!filepath) {
window.msgBox('No file selected', "Don't be alarmed");
return;
}
window.msgBox('File selected', filepath);
}
},
{
label: 'Save',
type: 'item',
onClick: () => {
const filepath = window.saveFile();
if (!filepath) {
window.msgBox('No file selected', "Don't be alarmed");
return;
}
window.msgBox('File selected', filepath);
},
},
{
type: 'about',
onClick: () => {
console.log('about');
},
},
{
type: 'check',
label: 'Check this',
onClick: () => {
console.log('check');
},
},
{
type: 'preferences',
onClick: () => {
console.log('preferences');
},
},
]); // has to come before window
const window = new libui.Window({
title: 'Cool',
width: 700,
height: 700,
hasMenu: true,
margined: false,
onClosing: (err) => {
console.log('exited')
},
});
libui.render();
/*
<Window>
<View>
<Group title="Controls">
<Button onClick>Button</Button>
<CheckBox onToggle>CheckBox</CheckBox>
<TextInput onChange />
<Text>Text</Text>
<HorizontalSeparator />
<DatePicker />
<TimePicker />
<DateTimePicker />
<FontButton />
<ColorButton />
</Group>
</View>
<View>
<Group title="Numbers">
<SpinBox min=0 max=100 />
<Slider min=0 max=100 />
<ProgressBar value=50 />
</Group>
<Group title="Lists">
<ComboBox>
<ComboBox.Item>1</ComboBox.Item>
<ComboBox.Item>2</ComboBox.Item>
<ComboBox.Item>3</ComboBox.Item>
</ComboBox>
<EditableComboBox>
<ComboBox.Item>1</ComboBox.Item>
<ComboBox.Item>2</ComboBox.Item>
<ComboBox.Item>3</ComboBox.Item>
</EditableComboBox>
<RadioButtons>
<RadioButtons.Button>1</RadioButtons.Button>
<RadioButtons.Button>2</RadioButtons.Button>
<RadioButtons.Button>3</RadioButtons.Button>
</RadioButtons>
<Tab>
<Tab.Page title="Page 1">
<View>
</View>
</Tab.Page>
<Tab.Page title="Page 2">
<View>
</View>
</Tab.Page>
<Tab.Page title="Page 3">
<View>
</View>
</Tab.Page>
</Tab>
</Group>
</View>
</Window>
*/