1    type Window
2        let aligner = Aligner.new
3        local border = Border.new
4        let stack = Stack.new
5        local header_splitter = Splitter.new
6        local header_rectangle = Rectangle.new
7        let text_block = TextBlock.new
8        let close_rectangle = Rectangle.new
9        local resize = TriangleControl
10           is_visible = is_resizable
11   
12       text_block.char_margins_height@atom.bind { h ->
13           close_rectangle.min_width = h
14                           min_height = h } |> push_token
15   
16       subscribe { _, event ->
17           if event ? FlagEvent/IsResizable x then
18               resize.is_visible = x }
19   
20       close_rectangle.is_clickable = true
21       close_rectangle.subscribe { control, event ->
22           if event.is_mouse_release
23              && captured.value == Some control
24           then
25               remove_window self }
26   
27       child = aligner
28           border
29               color = Vector3.color "999999"
30               run@ set_thickness 5
31               Rectangle
32                   color@obs = color@obs
33                   stack
34                       header_splitter
35                           ratio = 1
36                           header_rectangle
37                               color = Vector3.color "444444"
38                               text_block
39                                   text@obs = header@obs
40                                   align_h = AlignH/Center
41                                   color = Vector3.color "DDDDDD"
42                           close_rectangle
43                               color = Vector3.color "777777"
44                       Presenter
45                           content@obs = content@obs
46           resize
47               color = Vector3.color "999999"
48               min_width = 20
49               min_height = 20
50               align_h = AlignH/Right
51               align_v = AlignV/Down
52