Merge "Add tag and document to Tizen.NUI."
[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         /// <since_tizen> 4 </since_tizen>
36         public NUIWidgetApplication() : base(new NUIWidgetCoreBackend())
37         {
38             Tizen.Log.Fatal("NUI", "### NUIWidgetApplication called");
39         }
40
41         /// <summary>
42         /// The constructor with stylesheet.
43         /// </summary>
44         /// <since_tizen> 4 </since_tizen>
45         public NUIWidgetApplication(string stylesheet) : base(new NUIWidgetCoreBackend(stylesheet))
46         {
47             Tizen.Log.Fatal("NUI", "### NUIWidgetApplication(string) called");
48         }
49
50         /// <summary>
51         /// Overrides this method if want to handle behavior.
52         /// </summary>
53         protected override void OnLocaleChanged(LocaleChangedEventArgs e)
54         {
55             Log.Fatal("NUI", "OnLocaleChanged() is called!");
56             base.OnLocaleChanged(e);
57         }
58
59         /// <summary>
60         /// Overrides this method if want to handle behavior.
61         /// </summary>
62         protected override void OnLowBattery(LowBatteryEventArgs e)
63         {
64             Log.Fatal("NUI", "OnLowBattery() is called!");
65             base.OnLowBattery(e);
66         }
67
68         /// <summary>
69         /// Overrides this method if want to handle behavior.
70         /// </summary>
71         protected override void OnLowMemory(LowMemoryEventArgs e)
72         {
73             Log.Fatal("NUI", "OnLowMemory() is called!");
74             base.OnLowMemory(e);
75         }
76
77         /// <summary>
78         /// Overrides this method if want to handle behavior.
79         /// </summary>
80         protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e)
81         {
82             Log.Fatal("NUI", "OnRegionFormatChanged() is called!");
83             base.OnRegionFormatChanged(e);
84         }
85
86         /// <summary>
87         /// Overrides this method if want to handle behavior.
88         /// </summary>
89         protected override void OnTerminate()
90         {
91             Log.Fatal("NUI", "OnTerminate() is called!");
92             base.OnTerminate();
93         }
94
95         /// <summary>
96         /// Overrides this method if want to handle behavior.
97         /// </summary>
98         protected virtual void OnPreCreate()
99         {
100             Log.Fatal("NUI", "OnPreCreate() is called!");
101         }
102
103         /// <summary>
104         /// Overrides this method if want to handle behavior.
105         /// </summary>
106         protected override void OnCreate()
107         {
108             // This is also required to create DisposeQueue on main thread.
109             DisposeQueue disposeQ = DisposeQueue.Instance;
110             disposeQ.Initialize();
111             Log.Fatal("NUI","OnCreate() is called!");
112             base.OnCreate();
113         }
114
115         /// <summary>
116         /// Run NUIWidgetApplication.
117         /// </summary>
118         /// <param name="args">Arguments from commandline.</param>
119         /// <since_tizen> 4 </since_tizen>
120         public override void Run(string[] args)
121         {
122             Backend.AddEventHandler(EventType.PreCreated, OnPreCreate);
123             base.Run(args);
124         }
125
126         /// <summary>
127         /// Exit NUIWidgetApplication.
128         /// </summary>
129         /// <since_tizen> 4 </since_tizen>
130         public override void Exit()
131         {
132             Tizen.Log.Fatal("NUI", "### NUIWidgetApplication Exit called");
133             base.Exit();
134         }
135
136         internal WidgetApplication ApplicationHandle
137         {
138             get
139             {
140                 return ((NUIWidgetCoreBackend)this.Backend).WidgetApplicationHandle;
141             }
142         }
143
144         /// <summary>
145         /// Get the window instance.
146         /// </summary>
147         /// <since_tizen> 4 </since_tizen>
148         public Window Window
149         {
150             get
151             {
152                 //return Window.Instance;
153                 return ApplicationHandle.GetWindow();
154             }
155         }
156     }
157 }