PageRenderTime 27ms CodeModel.GetById 14ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/src/Main.hx

http://github.com/visup/haxe-titanium-api
Haxe | 81 lines | 57 code | 12 blank | 12 comment | 0 complexity | dde6b99d44d4e8d20ea4b8c00346d2f7 MD5 | raw file
 1import titanium.mobile.UI;
 2import titanium.mobile.UIiPhone;
 3import titanium.mobile.ui.Matrix2D;
 4import titanium.mobile.ui.Window;
 5import titanium.mobile.ui.TabGroup;
 6import titanium.mobile.ui.Tab;
 7import titanium.mobile.ui.Label;
 8
 9class Main
10{
11	public static function main()
12	{
13		var a = new Main();
14	}
15	
16	public function new()
17	{
18		// this sets the background color of the master UIView (when there are no windows/tab groups on it)
19		UI.setBackgroundColor('#000');
20		
21		// create tab group
22		var tabGroup = TabGroup.create();
23
24		//
25		// create base UI tab and root window
26		//
27		var win1 = Window.create({  
28			title:'Tab 1',
29			backgroundColor:'#fff'
30		});
31		var tab1 = Tab.create({  
32			icon:'KS_nav_views.png',
33			title:'Tab 1',
34			window:win1
35		});
36
37		var label1 = Label.create({
38			color:'#999',
39			text:'I am a Haxe Window 1',
40			font:{fontSize:20,fontFamily:'Helvetica Neue'},
41			textAlign:'center',
42			width:'auto'
43		});
44
45		win1.add(label1);
46
47		//
48		// create controls tab and root window
49		//
50		var win2 = Window.create({  
51			title:'Tab 2',
52			backgroundColor:'#fff'
53		});
54		var tab2 = Tab.create({  
55			icon:'KS_nav_ui.png',
56			title:'Tab 2',
57			window:win2
58		});
59
60		var label2 = Label.create({
61			color:'#999',
62			text:'I am a Haxe Window 2',
63			font:{fontSize:20,fontFamily:'Helvetica Neue'},
64			textAlign:'center',
65			width:'auto'
66		});
67
68		win2.add(label2);
69
70		//
71		//  add tabs
72		//
73		tabGroup.addTab(tab1);  
74		tabGroup.addTab(tab2);  
75
76		// open tab group
77		tabGroup.open();
78		
79		trace("Log from Haxe trace");
80	}
81}