/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

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