]> gitweb.factorcode.org Git - factor.git/blob - extra/window-controls-demo/window-controls-demo.factor
Fixes #2966
[factor.git] / extra / window-controls-demo / window-controls-demo.factor
1 ! Copyright (C) 2009 Joe Groff.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors assocs kernel sequences ui ui.gadgets ui.gadgets.worlds ;
4 IN: window-controls-demo
5
6 CONSTANT: window-control-sets-to-test
7     H{
8         { "No controls" { } }
9         { "Normal title bar" { normal-title-bar } }
10         { "Small title bar" { small-title-bar close-button } }
11         { "Close button" { normal-title-bar close-button } }
12         { "Close and minimize buttons" { normal-title-bar close-button minimize-button } }
13         { "Minimize button" { normal-title-bar minimize-button } }
14         { "Close, minimize, and maximize buttons" { normal-title-bar close-button minimize-button maximize-button } }
15         { "Resizable" { normal-title-bar close-button minimize-button maximize-button resize-handles } }
16         { "Textured background" { normal-title-bar close-button minimize-button maximize-button resize-handles textured-background } }
17     }
18
19 TUPLE: window-controls-demo-world < world
20     windows ;
21
22 M: window-controls-demo-world end-world
23     windows>> [ close-window ] each ;
24
25 M: window-controls-demo-world pref-dim*
26     drop { 400 400 } ;
27
28 : attributes-template ( -- x )
29     T{ world-attributes
30         { world-class window-controls-demo-world }
31     } clone ;
32
33 : window-controls-demo ( -- )
34     attributes-template V{ } clone window-control-sets-to-test
35     [| title attributes windows controls |
36         f attributes
37             title >>title
38             controls >>window-controls
39         open-window*
40             windows >>windows
41             windows push
42     ] 2with assoc-each ;
43
44 MAIN: window-controls-demo