-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathXinfTest.hx
92 lines (77 loc) · 2.35 KB
/
XinfTest.hx
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
import Xinf;
import xinf.ul.layout.SpringUtilities;
import xinf.ul.layout.BorderLayout;
import xinf.ul.widget.Widget;
import xinf.ul.Component;
import xinf.ul.ValueEvent;
class XinfTest {
public function new() :Void {
xinf.ul.Component.init();
var lm = xinf.ul.model.SimpleListModel.create([
"one",
"two",
"three",
"four",
"five",
"six",
"seven"
].iterator());
var c = new xinf.ul.Interface();
c.layout = xinf.ul.layout.FlowLayout.Vertical5;
c.captureRoot();
var l = new xinf.ul.widget.Label( "Hellö Xinful, how are you today?" );
c.appendChild(l);
var s = new xinf.ul.widget.Slider( 0, 100, 1 );
s.addEventListener( ValueEvent.VALUE, function(e) {
trace( "Slider Value: "+e.value );
});
c.appendChild(s);
var ed = new xinf.ul.widget.LineEdit("foo!");
ed.value = "Edit me!";
ed.addEventListener( ValueEvent.VALUE, function(e) {
trace( "Input Value: "+e.value );
});
ed.addEventListener( xinf.ul.widget.LineEdit.TEXT_CHANGED, function(e) {
trace( "Input TEXT_CHANGED: "+e );
});
c.appendChild( ed );
c.appendChild( xinf.ul.widget.Button.createSimple("Hello", function(){ trace("Hi!"); } ) );
var l = new xinf.ul.list.ListView(lm);
c.appendChild(l);
var d = new xinf.ul.widget.Dropdown(lm);
d.addEventListener( ValueEvent.VALUE, function(e) {
trace( "Dropdown Value: "+e.value );
});
c.appendChild(d);
c.relayout();
/*
*/
/*
var layout = new xinf.ul.layout.BorderLayout();
//var layout = new xinf.ul.layout.SpringLayout();
var c = new xinf.ul.widget.Pane();
c.set_size({x:300.,y:300.});
var arr = ["one","two","three","four","five"];//,"six","seven","eight","nine"];
var borders = [West,North,East,South,Center];
var count = 0;
for( t in arr ) {
var l :Component = if (count%2==0) {
if (count==4) cast(new xinf.ul.widget.CheckBox(t),Component);
else cast(new xinf.ul.widget.Label(t),Component);
} else {
cast(new xinf.ul.widget.Button(t),Component);
}
l.set_size(l.prefSize);
layout.setConstraint(l,borders[count++]);
c.appendChild(l);
}
c.layout = layout;
c.relayout();
Root.appendChild(c.getElement());
*/
}
public static function main() :Void {
var d = new XinfTest();
Root.main();
}
}