]> gitweb.factorcode.org Git - factor.git/blob - extra/window-controls-demo/window-controls-demo.factor
Update some copyright headers to follow the current convention
[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 locals sequences ui
4 ui.gadgets ui.gadgets.worlds ;
5 IN: window-controls-demo
6
7 CONSTANT: window-control-sets-to-test
8     H{
9         { "No controls" { } }
10         { "Normal title bar" { normal-title-bar } }
11         { "Small title bar" { small-title-bar close-button } }
12         { "Close button" { normal-title-bar close-button } }
13         { "Close and minimize buttons" { normal-title-bar close-button minimize-button } }
14         { "Minimize button" { normal-title-bar minimize-button } }
15         { "Close, minimize, and maximize buttons" { normal-title-bar close-button minimize-button maximize-button } }
16         { "Resizable" { normal-title-bar close-button minimize-button maximize-button resize-handles } }
17         { "Textured background" { normal-title-bar close-button minimize-button maximize-button resize-handles textured-background } }
18     }
19
20 TUPLE: window-controls-demo-world < world
21     windows ;
22
23 M: window-controls-demo-world end-world
24     windows>> [ close-window ] each ;
25
26 M: window-controls-demo-world pref-dim*
27     drop { 400 400 } ;
28
29 : attributes-template ( -- x )
30     T{ world-attributes
31         { world-class window-controls-demo-world }
32     } clone ;
33
34 : window-controls-demo ( -- )
35     attributes-template V{ } clone window-control-sets-to-test
36     [| title attributes windows controls |
37         f attributes
38             title >>title
39             controls >>window-controls
40         open-window*
41             windows >>windows
42             windows push
43     ] 2with assoc-each ;
44
45 MAIN: window-controls-demo