From: dongsug.song Date: Wed, 18 Oct 2017 13:23:44 +0000 (+0900) Subject: [NUI] SafeNativeWindowHandle, VideoView, Layer changed X-Git-Tag: preview1-00314^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8506d39fd2875e3a48c05e2b86c8ed11a8e9d50f;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] SafeNativeWindowHandle, VideoView, Layer changed - SafeNativeWidowHandle implementation is changed to use protected handle. - VideoView ResourceUrl is added. - Layer ChildCount is changed to use c# scene tree. - ImageView Image property is added. Change-Id: I4ba423ad42009bff1067bf8295c3c12c84fad41b Signed-off-by: dongsug.song --- diff --git a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs index 30bcac2..19336cd 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs @@ -19,6 +19,7 @@ namespace Tizen.NUI.BaseComponents { using System; using System.Runtime.InteropServices; + using System.ComponentModel; /// /// ImageView is a class for displaying an image resource.
@@ -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.
///
/// 3 - 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 } /// - /// ImageView ImageMap, type PropertyMap: string if it is a URL, map otherwise + /// This will be deprecated, please use Image instead.
+ /// ImageView ImageMap, type PropertyMap: string if it is a URL, map otherwise. ///
/// 3 + [EditorBrowsable(EditorBrowsableState.Never)] public PropertyMap ImageMap { get @@ -285,6 +289,34 @@ namespace Tizen.NUI.BaseComponents } /// + /// ImageView Image, type PropertyMap + /// + /// 4 + 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)); + } + } + } + + /// /// ImageView PreMultipliedAlpha, type Boolean.
/// Image must be initialized.
///
@@ -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)); } } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/VideoView.cs b/src/Tizen.NUI/src/public/BaseComponents/VideoView.cs index 88fd0ed..43e1d64 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/VideoView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/VideoView.cs @@ -259,7 +259,7 @@ namespace Tizen.NUI.BaseComponents } /// - /// Video file URL as string type or PropertyMap. + /// Video file setting type of PropertyMap. /// /// 3 public PropertyMap Video @@ -349,6 +349,24 @@ namespace Tizen.NUI.BaseComponents } } + /// + /// Video file URL as string type. + /// + /// 4 + 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 diff --git a/src/Tizen.NUI/src/public/Layer.cs b/src/Tizen.NUI/src/public/Layer.cs index 94e8eef..e7f3391 100755 --- a/src/Tizen.NUI/src/public/Layer.cs +++ b/src/Tizen.NUI/src/public/Layer.cs @@ -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); } } diff --git a/src/Tizen.NUI/src/public/Window.cs b/src/Tizen.NUI/src/public/Window.cs index ace40de..233e1e2 100755 --- a/src/Tizen.NUI/src/public/Window.cs +++ b/src/Tizen.NUI/src/public/Window.cs @@ -53,12 +53,12 @@ namespace Tizen.NUI /// 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; - } + } /// /// Sets whether the window accepts a focus or not. @@ -208,7 +208,8 @@ namespace Tizen.NUI /// /// The number of supported auxiliary hints. /// 3 - 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 /// The index of the supported auxiliary hint lists. /// The auxiliary hint string of the index. /// 3 - 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 /// The value string. /// The ID of created auxiliary hint, or 0 on failure. /// 3 - 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 /// The ID of the auxiliary hint. /// True if no error occurred, false otherwise. /// 3 - 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 /// The value string to be set. /// True if no error occurred, false otherwise. /// 3 - 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 /// The auxiliary hint ID. /// The string value of the auxiliary hint ID, or an empty string if none exists. /// 3 - 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 /// The auxiliary hint string. /// The ID of auxiliary hint string, or 0 on failure. /// 3 - 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 /// /// The region to accept input events. /// 3 - 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 /// The notification window level. /// True if no error occurred, false otherwise. /// 3 - 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 /// /// The notification window level. /// 3 - 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 /// /// Whether the window's visual state is opaque. /// 3 - 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 /// /// True if the window's visual state is opaque, false otherwise. /// 3 - 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 /// The screen mode. /// True if no error occurred, false otherwise. /// 3 - 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 /// /// The screen off mode. /// 3 - 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 /// The preferred brightness (0 to 100). /// True if no error occurred, false otherwise. /// 3 - 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 /// /// The preferred brightness. /// 3 - 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 } /// - /// Contains and encapsulates Native Ecore Wayland Window handle. + /// Contains and encapsulates Native Window handle. /// - /// - /// To get System.IntPtr of Native Ecore Wayland Window handle,
- /// DangerousGetHandle() method is used to get handle. - ///
/// 4 - public class NativeWindowSafeHandle : SafeHandle + public class SafeNativeWindowHandle : SafeHandle { - internal NativeWindowSafeHandle(IntPtr handle) : base(handle, true) + /// + /// Contructor, Native window handle is set to handle. + /// + /// 4 + public SafeNativeWindowHandle() : base(IntPtr.Zero, false) { + SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler()); } /// /// Null check if the handle is valid or not. /// + /// 4 public override bool IsInvalid { get @@ -1658,24 +1676,9 @@ namespace Tizen.NUI /// 4 protected override bool ReleaseHandle() { - this.SetHandle(IntPtr.Zero); return true; } } - /// - /// Gets Native Ecore Wayland Window handle. - /// - /// - /// NativeWindowSafeHandle class contains System.IntPtr of Native Ecore Wayland Window handle,
- /// DangerousGetHandle() method is used to get handle. - ///
- /// 4 - public Window.NativeWindowSafeHandle NativeWindowHandle - { - get - { - return new NativeWindowSafeHandle(GetNativeWindowHandler()); - } - } + } }