[NUI] set default theme for TV profile
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Application / NUIApplication.cs
index 33c7898..72b016c 100755 (executable)
@@ -14,6 +14,9 @@
  * limitations under the License.
  *
  */
+#if !PROFILE_TV
+#define ExternalThemeEnabled
+#endif
 
 using System;
 using System.ComponentModel;
@@ -137,7 +140,7 @@ namespace Tizen.NUI
         /// <param name="windowPosition"></param>
         /// <param name="styleSheet"></param>
         /// InhouseAPI, this could be opened in NextTizen
-        [Obsolete("Please do not use! This will be deprecated!")]
+        [Obsolete("Do not use! This will be deprecated!")]
         [EditorBrowsable(EditorBrowsableState.Never)]
         public NUIApplication(Graphics.BackendType backend, WindowMode windowMode = WindowMode.Opaque, Size2D windowSize = null, Position2D windowPosition = null, string styleSheet = "") : base(new NUICoreBackend(styleSheet, windowMode, windowSize, windowPosition))
         {
@@ -178,25 +181,89 @@ namespace Tizen.NUI
         /// <param name="windowMode">The windowMode.</param>
         /// <param name="type">The default window type.</param>
         /// <since_tizen> 9 </since_tizen>
+        [SuppressMessage("Microsoft.Design", "CA2000: Dispose objects before losing scope", Justification = "NUICoreBackend is disposed in the base class when the application is terminated")]
         public NUIApplication(string styleSheet, WindowMode windowMode, WindowType type) : base(new NUICoreBackend(styleSheet, windowMode, type))
         {
             ExternalThemeManager.Initialize();
         }
 
         /// <summary>
-        /// The constructor with a stylesheet, window mode, size, position, theme option and boderInterface
-        /// It is the only way to create an IME window.
+        /// The constructor with a stylesheet, size, position, boderInterface and window mode
         /// </summary>
         /// <param name="styleSheet">The styleSheet URL.</param>
-        /// <param name="windowMode">The windowMode.</param>
         /// <param name="windowSize">The window size.</param>
         /// <param name="windowPosition">The window position.</param>
         /// <param name="borderInterface"><see cref="Tizen.NUI.IBorderInterface"/>If borderInterface is null, defaultBorder is enabled.</param>
+        /// <param name="windowMode">The windowMode.</param>
         [EditorBrowsable(EditorBrowsableState.Never)]
+        [SuppressMessage("Microsoft.Design", "CA2000: Dispose objects before losing scope", Justification = "NUICoreBackend is disposed in the base class when the application is terminated")]
         public NUIApplication(string styleSheet, Size2D windowSize, Position2D windowPosition, IBorderInterface borderInterface, WindowMode windowMode = WindowMode.Opaque) : base(new NUICoreBackend(styleSheet, windowMode, windowSize, windowPosition))
         {
-            borderEnabled = true;
-            this.borderInterface = borderInterface;
+            EnableBorder(borderInterface);
+        }
+
+        /// <summary>
+        /// The constructor with theme option and borderInterface.
+        /// </summary>
+        /// <param name="option">The theme option.</param>
+        /// <param name="borderInterface"><see cref="Tizen.NUI.IBorderInterface"/>If borderInterface is null, defaultBorder is enabled.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        [SuppressMessage("Microsoft.Design", "CA2000: Dispose objects before losing scope", Justification = "NUICoreBackend is disposed in the base class when the application is terminated")]
+        public NUIApplication(ThemeOptions option, IBorderInterface borderInterface) : base(new NUICoreBackend())
+        {
+            EnableBorder(borderInterface);
+            ApplyThemeOption(option);
+        }
+
+        /// <summary>
+        /// The constructor with window size, position, theme option and borderInterface.
+        /// </summary>
+        /// <param name="windowSize">The window size.</param>
+        /// <param name="windowPosition">The window position.</param>
+        /// <param name="option">The theme option.</param>
+        /// <param name="borderInterface"><see cref="Tizen.NUI.IBorderInterface"/>If borderInterface is null, defaultBorder is enabled.</param>
+        [SuppressMessage("Microsoft.Design", "CA2000: Dispose objects before losing scope", Justification = "NUICoreBackend is disposed in the base class when the application is terminated")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public NUIApplication(Size2D windowSize, Position2D windowPosition, ThemeOptions option, IBorderInterface borderInterface) : base(new NUICoreBackend("", NUIApplication.WindowMode.Opaque, windowSize, windowPosition))
+        {
+            EnableBorder(borderInterface);
+            ApplyThemeOption(option);
+        }
+
+        /// <summary>
+        /// The constructor with a stylesheet, window mode, coretask
+        /// </summary>
+        /// <note>
+        /// There is the UI thread feature.
+        /// UI thread is an additional thread that an Application object creates. The thread is for UI events.
+        /// To enable the UI Thread, you have to pass CoreTask object using this contructor.
+        /// When the UI thread feature is enabled, The methods of CoreTask are emitted on the main thread,
+        /// and the NUIApplication's events are emitted on the UI thread.
+        /// If you want to handle windows or actors in cases like when the memory level of the device is low, you have to use the NUIApplication events, not the CoreTask methods.
+        /// The CoreTask is not for handling GUI.
+        /// Callbacks of the all events in NUIApplication except the CoreTask are emitted on the UI thread.
+        /// </note>
+        /// <param name="styleSheet">The styleSheet URL.</param>
+        /// <param name="windowMode">The windowMode.</param>
+        /// <param name="task">True If app creates a UI Thread</param>
+        [SuppressMessage("Microsoft.Design", "CA2000: Dispose objects before losing scope", Justification = "NUICoreBackend is disposed in the base class when the application is terminated")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public NUIApplication(string styleSheet, WindowMode windowMode, CoreTask task) : base(new NUICoreBackend(styleSheet, windowMode), task)
+        {
+        }
+
+        /// <summary>
+        /// The constructor with a stylesheet, window mode, window size, position, coretask
+        /// </summary>
+        /// <param name="styleSheet">The styleSheet URL.</param>
+        /// <param name="windowMode">The windowMode.</param>
+        /// <param name="windowSize">The window size.</param>
+        /// <param name="windowPosition">The window position.</param>
+        /// <param name="task">True If app creates a UI Thread</param>
+        [SuppressMessage("Microsoft.Design", "CA2000: Dispose objects before losing scope", Justification = "NUICoreBackend is disposed in the base class when the application is terminated")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public NUIApplication(string styleSheet, WindowMode windowMode, Size2D windowSize, Position2D windowPosition, CoreTask task) : base(new NUICoreBackend(styleSheet, windowMode, windowSize, windowPosition), task)
+        {
         }
 
         /// <summary>
@@ -303,7 +370,7 @@ namespace Tizen.NUI
         /// Gets the window instance.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        [Obsolete("Please do not use! This will be deprecated!")]
+        [Obsolete("Do not use! This will be deprecated!")]
         [EditorBrowsable(EditorBrowsableState.Never)]
         public Window Window
         {
@@ -476,10 +543,14 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         protected virtual void OnPreCreate()
         {
+            Tizen.Tracer.Begin("[NUI] OnPreCreate()");
+
             if (borderEnabled)
             {
-                GetDefaultWindow().EnableBorder(borderInterface);
+                GetDefaultWindow().EnableBorder(borderInterface, new Window.BorderCloseDelegate(Exit));
             }
+
+            Tizen.Tracer.End();
         }
 
         /// <summary>
@@ -502,7 +573,11 @@ namespace Tizen.NUI
         /// <since_tizen> 3 </since_tizen>
         protected override void OnCreate()
         {
+            Tizen.Tracer.Begin("[NUI] OnCreate()");
+
             base.OnCreate();
+
+            Tizen.Tracer.End();
         }
 
         /// <summary>
@@ -535,6 +610,12 @@ namespace Tizen.NUI
                 ThemeManager.ApplicationThemeChangeSensitive = true;
             }
         }
+
+        private void EnableBorder(IBorderInterface borderInterface)
+        {
+            borderEnabled = true;
+            this.borderInterface = borderInterface;
+        }
     }
 
     /// <summary>
@@ -542,7 +623,7 @@ namespace Tizen.NUI
     /// </summary>
     [SuppressMessage("Microsoft.Design", "CA1052:StaticHolderTypesShouldBeStaticOrNotInheritable")]
     [EditorBrowsable(EditorBrowsableState.Never)]
-    [Obsolete("Please do not use! This will be deprecated!")]
+    [Obsolete("Do not use! This will be deprecated!")]
     public class Graphics
     {
         /// <summary>