@@ -12,17 +12,27 @@ local HIGHLIGHT_PEN = dfhack.pen.parse{
12
12
13
13
HelloWorldWindow = defclass (HelloWorldWindow , widgets .Window )
14
14
HelloWorldWindow .ATTRS {
15
- frame = {w = 20 , h = 14 },
15
+ frame = {w = 25 , h = 25 },
16
16
frame_title = ' Hello World' ,
17
17
autoarrange_subviews = true ,
18
- autoarrange_gap = 1 ,
18
+ autoarrange_gap = 2 ,
19
+ resizable = true ,
20
+ resize_min = {w = 25 , h = 25 },
19
21
}
20
22
21
23
function HelloWorldWindow :init ()
24
+ local LEVEL_OPTIONS = {
25
+ {label = ' Low' , value = 1 },
26
+ {label = ' Medium' , value = 2 },
27
+ {label = ' High' , value = 3 },
28
+ {label = ' Pro' , value = 4 },
29
+ {label = ' Insane' , value = 5 },
30
+ }
31
+
22
32
self :addviews {
23
33
widgets .Label {text = {{text = ' Hello, world!' , pen = COLOR_LIGHTGREEN }}},
24
34
widgets .HotkeyLabel {
25
- frame = {l = 0 , t = 0 },
35
+ frame = {l = 0 },
26
36
label = ' Click me' ,
27
37
key = ' CUSTOM_CTRL_A' ,
28
38
on_activate = self :callback (' toggleHighlight' ),
@@ -32,6 +42,28 @@ function HelloWorldWindow:init()
32
42
frame = {w = 10 , h = 5 },
33
43
frame_style = gui .INTERIOR_FRAME ,
34
44
},
45
+ widgets .Divider {
46
+ frame = {h = 1 },
47
+ frame_style_l = false ,
48
+ frame_style_r = false ,
49
+ },
50
+ widgets .CycleHotkeyLabel {
51
+ view_id = ' level' ,
52
+ frame = {l = 0 , w = 20 },
53
+ label = ' Level:' ,
54
+ key_back = ' CUSTOM_SHIFT_C' ,
55
+ key = ' CUSTOM_SHIFT_V' ,
56
+ options = LEVEL_OPTIONS ,
57
+ initial_option = LEVEL_OPTIONS [1 ].value ,
58
+ },
59
+ widgets .Slider {
60
+ frame = {l = 1 },
61
+ num_stops =# LEVEL_OPTIONS ,
62
+ get_idx_fn = function ()
63
+ return self .subviews .level :getOptionValue ()
64
+ end ,
65
+ on_change = function (idx ) self .subviews .level :setOption (idx ) end ,
66
+ },
35
67
}
36
68
end
37
69
0 commit comments