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