Merge remote-tracking branch 'nui/merge_work'
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / NUIWidgetApplication.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 using System;
19 using Tizen.Applications;
20 using Tizen.Applications.CoreBackend;
21 using Tizen.NUI;
22
23 namespace Tizen.NUI
24 {
25
26     /// <summary>
27     /// Represents an application that have UI screen. The NUIWidgetApplication class has a default stage.
28     /// </summary>
29     public class NUIWidgetApplication : CoreApplication
30     {
31
32         /// <summary>
33         /// The default constructor.
34         /// </summary>
35         public NUIWidgetApplication() : base(new NUIWidgetCoreBackend())
36         {
37             Tizen.Log.Fatal("NUI", "### NUIWidgetApplication called");
38         }
39
40         /// <summary>
41         /// The constructor with stylesheet.
42         /// </summary>
43         public NUIWidgetApplication(string stylesheet) : base(new NUIWidgetCoreBackend(stylesheet))
44         {
45             Tizen.Log.Fatal("NUI", "### NUIWidgetApplication(string) called");
46         }
47
48         /// <summary>
49         /// Overrides this method if want to handle behavior.
50         /// </summary>
51         protected override void OnLocaleChanged(LocaleChangedEventArgs e)
52         {
53             Log.Fatal("NUI", "OnLocaleChanged() is called!");
54             base.OnLocaleChanged(e);
55         }
56
57         /// <summary>
58         /// Overrides this method if want to handle behavior.
59         /// </summary>
60         protected override void OnLowBattery(LowBatteryEventArgs e)
61         {
62             Log.Fatal("NUI", "OnLowBattery() is called!");
63             base.OnLowBattery(e);
64         }
65
66         /// <summary>
67         /// Overrides this method if want to handle behavior.
68         /// </summary>
69         protected override void OnLowMemory(LowMemoryEventArgs e)
70         {
71             Log.Fatal("NUI", "OnLowMemory() is called!");
72             base.OnLowMemory(e);
73         }
74
75         /// <summary>
76         /// Overrides this method if want to handle behavior.
77         /// </summary>
78         protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e)
79         {
80             Log.Fatal("NUI", "OnRegionFormatChanged() is called!");
81             base.OnRegionFormatChanged(e);
82         }
83
84         /// <summary>
85         /// Overrides this method if want to handle behavior.
86         /// </summary>
87         protected override void OnTerminate()
88         {
89             Log.Fatal("NUI", "OnTerminate() is called!");
90             base.OnTerminate();
91         }
92
93         /// <summary>
94         /// Overrides this method if want to handle behavior.
95         /// </summary>
96         protected virtual void OnPreCreate()
97         {
98             Log.Fatal("NUI", "OnPreCreate() is called!");
99         }
100
101         /// <summary>
102         /// Overrides this method if want to handle behavior.
103         /// </summary>
104         protected override void OnCreate()
105         {
106             // This is also required to create DisposeQueue on main thread.
107             DisposeQueue disposeQ = DisposeQueue.Instance;
108             disposeQ.Initialize();
109             Log.Fatal("NUI","OnCreate() is called!");
110             base.OnCreate();
111         }
112
113         /// <summary>
114         /// Run NUIWidgetApplication.
115         /// </summary>
116         /// <param name="args">Arguments from commandline.</param>
117         public override void Run(string[] args)
118         {
119             Backend.AddEventHandler(EventType.PreCreated, OnPreCreate);
120             base.Run(args);
121         }
122
123         /// <summary>
124         /// Exit NUIWidgetApplication.
125         /// </summary>
126         public override void Exit()
127         {
128             Tizen.Log.Fatal("NUI", "### NUIWidgetApplication Exit called");
129             base.Exit();
130         }
131
132         internal WidgetApplication ApplicationHandle
133         {
134             get
135             {
136                 return ((NUIWidgetCoreBackend)this.Backend).WidgetApplicationHandle;
137             }
138         }
139
140         /// <summary>
141         /// Get the window instance.
142         /// </summary>
143         public Window Window
144         {
145             get
146             {
147                 //return Window.Instance;
148                 return ApplicationHandle.GetWindow();
149             }
150         }
151     }
152 }