3 using Tizen.NUI.BaseComponents;
4 using Tizen.NUI.Components;
5 using System.Collections.Generic;
7 namespace NUIWindowLayout
9 class Program : NUIApplication
11 private uint numOfWindows;
12 private List<Window> windows = new List<Window>();
13 private Color[] colors = { Color.DarkGreen, Color.Aqua, Color.Coral, Color.DimGrey };
15 public Program(uint numOfWindows) : base(ThemeOptions.None, new DefaultBorder())
17 if (numOfWindows > 0 && numOfWindows <= 4)
19 this.numOfWindows = numOfWindows;
23 Tizen.Log.Error("WindowLayout", "numOfWindows is not valid. Put 0 < numOfWindows <= 4");
26 protected override void OnCreate()
29 Window window = NUIApplication.GetDefaultWindow();
30 window.KeyEvent += OnKeyEvent;
36 windows.Add(NUIApplication.GetDefaultWindow());
38 for (int i = 1; i < numOfWindows; i++)
40 windows.Add(new Window((i + 1).ToString() + "window", new DefaultBorder()));
43 for (int i = 0; i < numOfWindows; i++)
45 Window window = windows[i];
46 window.BackgroundColor = colors[i];
48 ScrollableBase scrollableBase = new ScrollableBase();
49 scrollableBase.WidthSpecification = LayoutParamPolicies.MatchParent;
50 scrollableBase.HeightSpecification = LayoutParamPolicies.MatchParent;
51 scrollableBase.ScrollingDirection = ScrollableBase.Direction.Vertical;
53 scrollableBase.Layout = new LinearLayout()
55 LinearOrientation = LinearLayout.Orientation.Vertical,
56 HorizontalAlignment = HorizontalAlignment.Center,
57 VerticalAlignment = VerticalAlignment.Center,
60 for (int idxType = 0; idxType < System.Enum.GetValues(typeof(WindowLayoutType)).Length; idxType++)
62 Button button = new Button();
63 button.TextLabel.Text = idxType.ToString() + "." + (WindowLayoutType)idxType; // Set text to the enum value
64 button.Size = new Size(200, 50);
66 button.Clicked += (object sender, ClickedEventArgs e) =>
69 number = int.Parse(((Button)sender).TextLabel.Text.Split('.')[0]);
70 WindowLayoutType type = (WindowLayoutType)number;
71 Tizen.Log.Info("WindowLayout", type.ToString());
72 window.SetLayout((WindowLayoutType)number);
74 scrollableBase.Add(button);
77 window.Add(scrollableBase);
81 public void OnKeyEvent(object sender, Window.KeyEventArgs e)
83 if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape"))
89 static void Main(string[] args)
91 var app = new Program(4);