Merge "[NUI] SafeNativeWindowHandle, VideoView, Layer changed" preview1-00314 preview1-00317
authordongsug.song <dongsug.song@samsung.com>
Wed, 18 Oct 2017 13:36:52 +0000 (13:36 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Wed, 18 Oct 2017 13:36:52 +0000 (13:36 +0000)
src/Tizen.NUI/src/public/BaseComponents/ImageView.cs
src/Tizen.NUI/src/public/BaseComponents/VideoView.cs
src/Tizen.NUI/src/public/Layer.cs
src/Tizen.NUI/src/public/Window.cs

index 30bcac2..19336cd 100755 (executable)
@@ -19,6 +19,7 @@ namespace Tizen.NUI.BaseComponents
 {
     using System;
     using System.Runtime.InteropServices;
+    using System.ComponentModel;
 
     /// <summary>
     /// ImageView is a class for displaying an image resource.<br />
@@ -102,7 +103,7 @@ namespace Tizen.NUI.BaseComponents
         private void OnResourceReady(IntPtr data)
         {
             ResourceReadyEventArgs e = new ResourceReadyEventArgs();
-            if(data != null)
+            if (data != null)
             {
                 e.View = Registry.GetManagedBaseHandleFromNativePtr(data) as View;
             }
@@ -125,7 +126,7 @@ namespace Tizen.NUI.BaseComponents
                 return;
             }
 
-            if(type == DisposeTypes.Explicit)
+            if (type == DisposeTypes.Explicit)
             {
                 //Called by User
                 //Release your own managed resources here.
@@ -195,7 +196,7 @@ namespace Tizen.NUI.BaseComponents
         [Obsolete("Please do not use! this will be deprecated")]
         public new static ImageView DownCast(BaseHandle handle)
         {
-            ImageView ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as ImageView;
+            ImageView ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as ImageView;
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
@@ -218,7 +219,8 @@ namespace Tizen.NUI.BaseComponents
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        internal ViewResourceReadySignal ResourceReadySignal(View view) {
+        internal ViewResourceReadySignal ResourceReadySignal(View view)
+        {
             ViewResourceReadySignal ret = new ViewResourceReadySignal(NDalicPINVOKE.ResourceReadySignal(View.getCPtr(view)), false);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
@@ -230,7 +232,7 @@ namespace Tizen.NUI.BaseComponents
         /// True if the resources are loaded and ready, false otherwise.<br />
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        public new  bool IsResourceReady()
+        public new bool IsResourceReady()
         {
             bool ret = NDalicPINVOKE.IsResourceReady(swigCPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending)
@@ -246,7 +248,7 @@ namespace Tizen.NUI.BaseComponents
         {
             get
             {
-                GetProperty(ImageView.Property.RESOURCE_URL).Get(out _url);
+                GetProperty(ImageView.Property.IMAGE).Get(out _url);
                 return _url;
             }
             set
@@ -257,9 +259,11 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// ImageView ImageMap, type PropertyMap: string if it is a URL, map otherwise
+        /// This will be deprecated, please use Image instead. <br />
+        /// ImageView ImageMap, type PropertyMap: string if it is a URL, map otherwise.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public PropertyMap ImageMap
         {
             get
@@ -285,6 +289,34 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// ImageView Image, type PropertyMap
+        /// </summary>
+        /// <since_tizen> 4 </since_tizen>
+        public PropertyMap Image
+        {
+            get
+            {
+                if (_border == null)
+                {
+                    PropertyMap temp = new PropertyMap();
+                    GetProperty(ImageView.Property.IMAGE).Get(temp);
+                    return temp;
+                }
+                else
+                {
+                    return null;
+                }
+            }
+            set
+            {
+                if (_border == null)
+                {
+                    SetProperty(ImageView.Property.IMAGE, new Tizen.NUI.PropertyValue(value));
+                }
+            }
+        }
+
+        /// <summary>
         /// ImageView PreMultipliedAlpha, type Boolean.<br />
         /// Image must be initialized.<br />
         /// </summary>
@@ -393,7 +425,7 @@ namespace Tizen.NUI.BaseComponents
                     if (_synchronousLoading != null) _nPatchMap.Add(NpatchImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading));
                     SetProperty(ImageView.Property.IMAGE, new PropertyValue(_nPatchMap));
                 }
-                else if(_synchronousLoading != null)
+                else if (_synchronousLoading != null)
                 { // for normal image, with synchronous loading property
                     PropertyMap imageMap = new PropertyMap();
                     imageMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
@@ -403,7 +435,7 @@ namespace Tizen.NUI.BaseComponents
                 }
                 else
                 { // just for normal image
-                    SetProperty(ImageView.Property.RESOURCE_URL, new PropertyValue(_url));
+                    SetProperty(ImageView.Property.IMAGE, new PropertyValue(_url));
                 }
             }
         }
index 88fd0ed..43e1d64 100755 (executable)
@@ -259,7 +259,7 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// Video file URL as string type or PropertyMap.
+        /// Video file setting type of PropertyMap.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public PropertyMap Video
@@ -349,6 +349,24 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        /// <summary>
+        /// Video file URL as string type.
+        /// </summary>
+        /// <since_tizen> 4 </since_tizen>
+        public string ResourceUrl
+        {
+            get
+            {
+                string tmp;
+                GetProperty(VideoView.Property.VIDEO).Get(out tmp);
+                return tmp;
+            }
+            set
+            {
+                SetProperty(VideoView.Property.VIDEO, new PropertyValue(value));
+            }
+        }
+
     }
 
 }
\ No newline at end of file
index 94e8eef..e7f3391 100755 (executable)
@@ -516,10 +516,7 @@ namespace Tizen.NUI
         {
             get
             {
-                uint ret = NDalicPINVOKE.Actor_GetChildCount(swigCPtr);
-                if (NDalicPINVOKE.SWIGPendingException.Pending)
-                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                return ret;
+                return Convert.ToUInt32(Children.Count);
             }
         }
 
index ace40de..233e1e2 100755 (executable)
@@ -53,12 +53,12 @@ namespace Tizen.NUI
         /// </summary>
         protected override void Dispose(DisposeTypes type)
         {
-            if(disposed)
+            if (disposed)
             {
                 return;
             }
 
-            if(type == DisposeTypes.Explicit)
+            if (type == DisposeTypes.Explicit)
             {
                 //Called by User
                 //Release your own managed resources here.
@@ -140,12 +140,12 @@ namespace Tizen.NUI
             return ret;
         }
 
-       internal static bool IsInstalled()
-       {
+        internal static bool IsInstalled()
+        {
             bool ret = NDalicPINVOKE.Stage_IsInstalled();
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
-       }
+        }
 
         /// <summary>
         /// Sets whether the window accepts a focus or not.
@@ -208,7 +208,8 @@ namespace Tizen.NUI
         /// </summary>
         /// <returns>The number of supported auxiliary hints.</returns>
         /// <since_tizen> 3 </since_tizen>
-        public uint GetSupportedAuxiliaryHintCount() {
+        public uint GetSupportedAuxiliaryHintCount()
+        {
             uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
@@ -220,7 +221,8 @@ namespace Tizen.NUI
         /// <param name="index">The index of the supported auxiliary hint lists.</param>
         /// <returns>The auxiliary hint string of the index.</returns>
         /// <since_tizen> 3 </since_tizen>
-        public string GetSupportedAuxiliaryHint(uint index) {
+        public string GetSupportedAuxiliaryHint(uint index)
+        {
             string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
@@ -233,7 +235,8 @@ namespace Tizen.NUI
         /// <param name="value">The value string.</param>
         /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
         /// <since_tizen> 3 </since_tizen>
-        public uint AddAuxiliaryHint(string hint, string value) {
+        public uint AddAuxiliaryHint(string hint, string value)
+        {
             uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
@@ -245,7 +248,8 @@ namespace Tizen.NUI
         /// <param name="id">The ID of the auxiliary hint.</param>
         /// <returns>True if no error occurred, false otherwise.</returns>
         /// <since_tizen> 3 </since_tizen>
-        public bool RemoveAuxiliaryHint(uint id) {
+        public bool RemoveAuxiliaryHint(uint id)
+        {
             bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
@@ -258,7 +262,8 @@ namespace Tizen.NUI
         /// <param name="value">The value string to be set.</param>
         /// <returns>True if no error occurred, false otherwise.</returns>
         /// <since_tizen> 3 </since_tizen>
-        public bool SetAuxiliaryHintValue(uint id, string value) {
+        public bool SetAuxiliaryHintValue(uint id, string value)
+        {
             bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
@@ -270,7 +275,8 @@ namespace Tizen.NUI
         /// <param name="id">The auxiliary hint ID.</param>
         /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
         /// <since_tizen> 3 </since_tizen>
-        public string GetAuxiliaryHintValue(uint id) {
+        public string GetAuxiliaryHintValue(uint id)
+        {
             string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
@@ -282,7 +288,8 @@ namespace Tizen.NUI
         /// <param name="hint">The auxiliary hint string.</param>
         /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
         /// <since_tizen> 3 </since_tizen>
-        public uint GetAuxiliaryHintId(string hint) {
+        public uint GetAuxiliaryHintId(string hint)
+        {
             uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
@@ -293,7 +300,8 @@ namespace Tizen.NUI
         /// </summary>
         /// <param name="inputRegion">The region to accept input events.</param>
         /// <since_tizen> 3 </since_tizen>
-        public void SetInputRegion(Rectangle inputRegion) {
+        public void SetInputRegion(Rectangle inputRegion)
+        {
             NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
@@ -323,7 +331,8 @@ namespace Tizen.NUI
         /// <param name="level">The notification window level.</param>
         /// <returns>True if no error occurred, false otherwise.</returns>
         /// <since_tizen> 3 </since_tizen>
-        public bool SetNotificationLevel(NotificationLevel level) {
+        public bool SetNotificationLevel(NotificationLevel level)
+        {
             bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
@@ -334,7 +343,8 @@ namespace Tizen.NUI
         /// </summary>
         /// <returns>The notification window level.</returns>
         /// <since_tizen> 3 </since_tizen>
-        public NotificationLevel GetNotificationLevel() {
+        public NotificationLevel GetNotificationLevel()
+        {
             NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
@@ -345,7 +355,8 @@ namespace Tizen.NUI
         /// </summary>
         /// <param name="opaque">Whether the window's visual state is opaque.</param>
         /// <since_tizen> 3 </since_tizen>
-        public void SetOpaqueState(bool opaque) {
+        public void SetOpaqueState(bool opaque)
+        {
             NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
@@ -355,7 +366,8 @@ namespace Tizen.NUI
         /// </summary>
         /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
         /// <since_tizen> 3 </since_tizen>
-        public bool IsOpaqueState() {
+        public bool IsOpaqueState()
+        {
             bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
@@ -367,7 +379,8 @@ namespace Tizen.NUI
         /// <param name="screenOffMode">The screen mode.</param>
         /// <returns>True if no error occurred, false otherwise.</returns>
         /// <since_tizen> 3 </since_tizen>
-        public bool SetScreenOffMode(ScreenOffMode screenOffMode) {
+        public bool SetScreenOffMode(ScreenOffMode screenOffMode)
+        {
             bool ret = NDalicPINVOKE.SetScreenOffMode(swigCPtr, (int)screenOffMode);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
@@ -378,7 +391,8 @@ namespace Tizen.NUI
         /// </summary>
         /// <returns>The screen off mode.</returns>
         /// <since_tizen> 3 </since_tizen>
-        public ScreenOffMode GetScreenOffMode() {
+        public ScreenOffMode GetScreenOffMode()
+        {
             ScreenOffMode ret = (ScreenOffMode)NDalicPINVOKE.GetScreenOffMode(swigCPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
@@ -390,7 +404,8 @@ namespace Tizen.NUI
         /// <param name="brightness">The preferred brightness (0 to 100).</param>
         /// <returns>True if no error occurred, false otherwise.</returns>
         /// <since_tizen> 3 </since_tizen>
-        public bool SetBrightness(int brightness) {
+        public bool SetBrightness(int brightness)
+        {
             bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
@@ -401,7 +416,8 @@ namespace Tizen.NUI
         /// </summary>
         /// <returns>The preferred brightness.</returns>
         /// <since_tizen> 3 </since_tizen>
-        public int GetBrightness() {
+        public int GetBrightness()
+        {
             int ret = NDalicPINVOKE.GetBrightness(swigCPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
@@ -480,7 +496,7 @@ namespace Tizen.NUI
             set
             {
                 _windowTitle = value;
-                SetClass( _windowTitle, "" );
+                SetClass(_windowTitle, "");
             }
         }
 
@@ -707,7 +723,7 @@ namespace Tizen.NUI
             if (_rootLayer == null && Window.IsInstalled())
             {
                 _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             }
             return _rootLayer;
         }
@@ -1418,7 +1434,7 @@ namespace Tizen.NUI
 
         internal void SetPosition(Position2D position)
         {
-            var val = new Uint16Pair( (uint)position.X, (uint)position.Y );
+            var val = new Uint16Pair((uint)position.X, (uint)position.Y);
             NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
 
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
@@ -1629,21 +1645,23 @@ namespace Tizen.NUI
         }
 
         /// <summary>
-        /// Contains and encapsulates Native Ecore Wayland Window handle.
+        /// Contains and encapsulates Native Window handle.
         /// </summary>
-        /// <remarks>
-        /// To get System.IntPtr of Native Ecore Wayland Window handle, <br />
-        /// DangerousGetHandle() method is used to get handle.
-        /// </remarks>
         /// <since_tizen> 4 </since_tizen>
-        public class NativeWindowSafeHandle : SafeHandle
+        public class SafeNativeWindowHandle : SafeHandle
         {
-            internal NativeWindowSafeHandle(IntPtr handle) : base(handle, true)
+            /// <summary>
+            /// Contructor, Native window handle is set to handle.
+            /// </summary>
+            /// <since_tizen> 4 </since_tizen>
+            public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
             {
+                SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
             }
             /// <summary>
             /// Null check if the handle is valid or not.
             /// </summary>
+            /// <since_tizen> 4 </since_tizen>
             public override bool IsInvalid
             {
                 get
@@ -1658,24 +1676,9 @@ namespace Tizen.NUI
             /// <since_tizen> 4 </since_tizen>
             protected override bool ReleaseHandle()
             {
-                this.SetHandle(IntPtr.Zero);
                 return true;
             }
         }
-        /// <summary>
-        /// Gets Native Ecore Wayland Window handle.
-        /// </summary>
-        /// <remarks>
-        /// NativeWindowSafeHandle class contains System.IntPtr of Native Ecore Wayland Window handle, <br />
-        /// DangerousGetHandle() method is used to get handle.
-        /// </remarks>
-        /// <since_tizen> 4 </since_tizen>
-        public Window.NativeWindowSafeHandle NativeWindowHandle
-        {
-            get
-            {
-                return new NativeWindowSafeHandle(GetNativeWindowHandler());
-            }
-        }
+
     }
 }