[Tizen] Add translatable text in TextLabel, TextField, TextEditor
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / NUIApplication.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 NUIApplication class has a default stage.
28     /// </summary>
29     public class NUIApplication : CoreApplication
30     {\r
31         /// <summary>
32         /// The instance of ResourceManager.
33         /// </summary>
34         private static System.Resources.ResourceManager resourceManager = null;
35         /// <summary>
36         /// The default constructor.
37         /// </summary>
38         public NUIApplication() : base(new NUICoreBackend())
39         {
40         }
41
42         /// <summary>
43         /// The constructor with stylesheet.
44         /// </summary>
45         public NUIApplication(string stylesheet) : base(new NUICoreBackend(stylesheet))
46         {
47         }
48
49         /// <summary>
50         /// The constructor with stylesheet and window mode.
51         /// </summary>
52         public NUIApplication(string stylesheet, WindowMode windowMode) : base(new NUICoreBackend(stylesheet,windowMode))
53         {
54         }
55
56         /// <summary>
57         /// Overrides this method if want to handle behavior.
58         /// </summary>
59         protected override void OnLocaleChanged(LocaleChangedEventArgs e)
60         {
61         }
62
63         /// <summary>
64         /// Overrides this method if want to handle behavior.
65         /// </summary>
66         protected override void OnLowBattery(LowBatteryEventArgs e)
67         {
68             Log.Debug("NUI", "OnLowBattery() is called!");
69         }
70
71         /// <summary>
72         /// Overrides this method if want to handle behavior.
73         /// </summary>
74         protected override void OnLowMemory(LowMemoryEventArgs e)
75         {
76             Log.Debug("NUI", "OnLowMemory() is called!");
77         }
78
79         /// <summary>
80         /// Overrides this method if want to handle behavior.
81         /// </summary>
82         protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e)
83         {
84             Log.Debug("NUI", "OnRegionFormatChanged() is called!");
85         }
86
87         /// <summary>
88         /// Overrides this method if want to handle behavior.
89         /// </summary>
90         protected override void OnTerminate()
91         {
92             Log.Debug("NUI", "OnTerminate() is called!");
93         }
94
95         /// <summary>
96         /// Overrides this method if want to handle behavior.
97         /// </summary>
98         protected void OnPause()
99         {
100         }
101
102         /// <summary>
103         /// Overrides this method if want to handle behavior.
104         /// </summary>
105         protected void OnResume()
106         {
107             Log.Debug("NUI", "OnResume() is called!");
108         }
109
110         /// <summary>
111         /// Overrides this method if want to handle behavior.
112         /// </summary>
113         protected override void OnAppControlReceived(AppControlReceivedEventArgs e)
114         {
115             Log.Debug("NUI", "OnAppControlReceived() is called!");
116             if (e != null)
117             {
118                 Log.Debug("NUI", "OnAppControlReceived() is called! ApplicationId=" + e.ReceivedAppControl.ApplicationId);
119                 Log.Debug("NUI", "CallerApplicationId=" + e.ReceivedAppControl.CallerApplicationId + "   IsReplyRequest=" + e.ReceivedAppControl.IsReplyRequest);
120             }
121         }
122
123         /// <summary>
124         /// Overrides this method if want to handle behavior.
125         /// </summary>
126         protected override void OnCreate()
127         {
128             // This is also required to create DisposeQueue on main thread.
129             DisposeQueue disposeQ = DisposeQueue.Instance;
130             disposeQ.Initialize();
131             Log.Debug("NUI","OnCreate() is called!");
132         }
133
134         /// <summary>
135         /// Run NUIApplication.
136         /// </summary>
137         /// <param name="args">Arguments from commandline.</param>
138         public override void Run(string[] args)
139         {
140             string[] argsClone = null;
141
142             if (args == null)
143             {
144                 argsClone = new string[1];
145             }
146             else
147             {
148                 argsClone = new string[args.Length + 1];
149                 args.CopyTo(argsClone, 1);
150             }
151             argsClone[0] = string.Empty;
152
153             Backend.AddEventHandler(EventType.Resumed, OnResume);
154             Backend.AddEventHandler<AppControlReceivedEventArgs>(EventType.AppControlReceived, OnAppControlReceived);
155             Backend.AddEventHandler(EventType.Paused, OnPause);
156             Backend.AddEventHandler(EventType.Terminated, OnTerminate);
157             Backend.AddEventHandler<RegionFormatChangedEventArgs>(EventType.RegionFormatChanged, OnRegionFormatChanged);
158             Backend.AddEventHandler<LowMemoryEventArgs>(EventType.LowMemory, OnLowMemory);
159             Backend.AddEventHandler<LowBatteryEventArgs>(EventType.LowBattery, OnLowBattery);
160             Backend.AddEventHandler<LocaleChangedEventArgs>(EventType.LocaleChanged, OnLocaleChanged);
161             Backend.AddEventHandler(EventType.Created, OnCreate);
162
163             Backend.Run(argsClone);
164         }
165
166         /// <summary>
167         /// Exit NUIApplication.
168         /// </summary>
169         public override void Exit()
170         {
171             Backend.Exit();
172         }
173
174         /// <summary>
175         /// Enumeration for deciding whether a NUI application window is opaque or transparent.
176         /// </summary>
177         public enum WindowMode
178         {
179             Opaque = 0,
180             Transparent = 1
181         }
182 <<<<<<< HEAD
183
184
185         internal Application ApplicationHandle
186         {
187             get
188             {
189                 return ((NUICoreBackend)this.Backend).ApplicationHandle;
190             }
191         }
192
193 =======
194         /// <summary>
195         /// ResourceManager to handle multilingual
196         /// </summary>
197         public static System.Resources.ResourceManager MultilingualResourceManager
198         {
199             get
200             {
201                 return resourceManager;
202             }
203             set
204             {
205                 resourceManager = value;
206             }
207         }
208 >>>>>>> 23f9e83... Add translatable text in TextLabel, TextField, TextEditor
209     }
210 }