From 1a6ad469d20c39878fbe8ca3b18fa1be60b6549f Mon Sep 17 00:00:00 2001 From: "xb.teng" Date: Fri, 26 May 2017 04:35:42 +0800 Subject: [PATCH] Add required something fixed nui-376: 1. Change public window constructor to internal; 2. Chenge Vector2/4 to high level class Size2D and Color; public Vector2 Size public Vector4 BackgroundColor 3. Add some layer apis; 4. Add SynchronousLoading property for ImageView. Change-Id: I1deff95eae359cafacfd399d0208ee4a713d582a --- .../src/public/BaseComponents/ImageView.cs | 52 ++++++++++++----- src/Tizen.NUI/src/public/Layer.cs | 62 +++++++++++++++++++++ src/Tizen.NUI/src/public/VisualMaps.cs | 7 +-- src/Tizen.NUI/src/public/Window.cs | 65 ++++------------------ 4 files changed, 115 insertions(+), 71 deletions(-) diff --git a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs index 2c721a7..f1da24c 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs @@ -448,7 +448,7 @@ namespace Tizen.NUI.BaseComponents { get { - return _borderOnly; + return _borderOnly ?? false; } set { @@ -457,27 +457,53 @@ namespace Tizen.NUI.BaseComponents } } - private void UpdateImage() + public bool SynchronosLoading { - if (_border != null && _url != null) + get + { + return _synchronousLoading ?? false; + } + set { - _nPatchMap = new PropertyMap(); - _nPatchMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch)); - _nPatchMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url)); - _nPatchMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); - if (_borderOnly) { _nPatchMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue(_borderOnly)); } - SetProperty(ImageView.Property.IMAGE, new PropertyValue(_nPatchMap)); + _synchronousLoading = value; + UpdateImage(); } - else + } + + private void UpdateImage() + { + if (_url != null) { - if (_url != null) { SetProperty(ImageView.Property.RESOURCE_URL, new PropertyValue(_url)); } + if (_border != null) + { // for nine-patch image + _nPatchMap = new PropertyMap(); + _nPatchMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch)); + _nPatchMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url)); + _nPatchMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); + if (_borderOnly != null) { _nPatchMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); } + if (_synchronousLoading != null) _nPatchMap.Add(NpatchImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); + SetProperty(ImageView.Property.IMAGE, new PropertyValue(_nPatchMap)); + } + 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)); + imageMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); + imageMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); + SetProperty(ImageView.Property.IMAGE, new PropertyValue(imageMap)); + } + else + { // just for normal image + SetProperty(ImageView.Property.RESOURCE_URL, new PropertyValue(_url)); + } } } private Rectangle _border = null; - private bool _borderOnly = false; - private string _url = null; private PropertyMap _nPatchMap = null; + private bool? _synchronousLoading = null; + private bool? _borderOnly = null; + private string _url = null; } diff --git a/src/Tizen.NUI/src/public/Layer.cs b/src/Tizen.NUI/src/public/Layer.cs index 1aff277..26df66c 100755 --- a/src/Tizen.NUI/src/public/Layer.cs +++ b/src/Tizen.NUI/src/public/Layer.cs @@ -202,6 +202,13 @@ namespace Tizen.NUI return ret; } + /// + /// Search through this layer's hierarchy for an view with the given unique ID. + /// + ///
This layer(the parent) has been initialized.
+ /// The actor itself is also considered in the search. + /// The id of the child to find + /// A handle to the view if found, or an empty handle if not. public View FindChildById(uint id) { View ret = new View(NDalicPINVOKE.Actor_FindChildById(swigCPtr, id), true); @@ -210,6 +217,13 @@ namespace Tizen.NUI return ret; } + /// + /// Adds a child view to this layer. + /// + ///
This layer(the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent layer.
+ /// The child will be referenced by its parent. This means that the child will be kept alive, even if the handle passed into this method is reset or destroyed. + /// If the child already has a parent, it will be removed from old parent and reparented to this layer. This may change child's position, color, scale etc as it now inherits them from this layer. + /// The child public void Add(View child) { NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child)); @@ -217,6 +231,11 @@ namespace Tizen.NUI throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Removes a child View from this layer. If the view was not a child of this layer, this is a no-op. + /// + ///
This layer(the parent) has been initialized. The child view is not the same as the parent view.
+ /// The child public void Remove(View child) { NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child)); @@ -489,6 +508,49 @@ namespace Tizen.NUI } } + /// + /// Gets/Sets the Layer's name. + /// + public string Name + { + get + { + return GetName(); + } + set + { + SetName(value); + } + } + + internal string GetName() + { + string ret = NDalicPINVOKE.Actor_GetName(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetName(string name) + { + NDalicPINVOKE.Actor_SetName(swigCPtr, name); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Retrieves the number of children held by the layer. + /// + ///
The layer has been initialized.
+ /// The number of children + public uint GetChildCount() + { + uint ret = NDalicPINVOKE.Actor_GetChildCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } } diff --git a/src/Tizen.NUI/src/public/VisualMaps.cs b/src/Tizen.NUI/src/public/VisualMaps.cs index 1e76181..c417461 100755 --- a/src/Tizen.NUI/src/public/VisualMaps.cs +++ b/src/Tizen.NUI/src/public/VisualMaps.cs @@ -15,9 +15,6 @@ namespace Tizen.NUI { - using System; - using System.Runtime.InteropServices; - using Tizen.NUI.UIComponents; using Tizen.NUI.BaseComponents; /// @@ -65,11 +62,11 @@ namespace Tizen.NUI /// or absolute (in world units).
/// Optional. ///
- public Vector2 Size + public Size2D Size { get { - return _visualSize ?? (new Vector2(1.0f, 1.0f)); + return _visualSize ?? (new Size2D(1, 1)); } set { diff --git a/src/Tizen.NUI/src/public/Window.cs b/src/Tizen.NUI/src/public/Window.cs index 812bd60..7da0d14 100755 --- a/src/Tizen.NUI/src/public/Window.cs +++ b/src/Tizen.NUI/src/public/Window.cs @@ -399,55 +399,26 @@ namespace Tizen.NUI return ret; } - - - /// - /// Creates an initialized handle to a new Window. - /// - /// The position and size of the Window - /// The Window title - /// Whether Window is transparent - public Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true) + internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - /// - /// Creates an initialized handle to a new Window. - /// - /// The position and size of the Window - /// The Window title - public Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true) + internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - /// - /// Creates an initialized handle to a new Window. - /// - /// The position and size of the Window - /// The Window title - /// The Window class name - /// Whether Window is transparent - public Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true) + internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - /// - /// Creates an initialized handle to a new Window. - /// - /// The position and size of the Window - /// The Window title - /// The Window class name - public Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true) + internal Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } + internal Window(Window handle) : this(NDalicPINVOKE.new_Window__SWIG_1(Window.getCPtr(handle)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -460,31 +431,18 @@ namespace Tizen.NUI return ret; } - /// - /// This sets whether the indicator bar should be shown or not. - /// - /// Visible mode for indicator bar, Visible in default internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode) { NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - /// - /// This sets the opacity mode of indicator bar. - /// - /// The opacity mode internal void SetIndicatorBgOpacity(Window.IndicatorBgOpacity opacity) { NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - /// - /// This sets the orientation of indicator bar.
- /// It does not implicitly show the indicator if it is currently hidden.
- ///
- /// The orientation internal void RotateIndicator(Window.WindowOrientation orientation) { NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation); @@ -799,6 +757,7 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } + /// /// Grabs the key specified by a key for a window in a GrabMode.
/// Details: This function can be used for following example scenarios:
@@ -815,6 +774,7 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } + /// /// Ungrabs the key specified by a key for a window.
/// Note: If this function is called between key down and up events of a grabbed key, an application doesn't receive the key up event.
@@ -827,6 +787,7 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } + internal System.IntPtr GetNativeWindowHandler() { System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr)); @@ -834,8 +795,6 @@ namespace Tizen.NUI return ret; } - - /// /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing. /// @@ -1233,11 +1192,11 @@ namespace Tizen.NUI /// /// Window size property (read-only). /// - public Vector2 Size + public Size2D Size { get { - Vector2 ret = GetSize(); + Size2D ret = GetSize(); return ret; } } @@ -1245,7 +1204,7 @@ namespace Tizen.NUI /// /// Background color property. /// - public Vector4 BackgroundColor + public Color BackgroundColor { set { @@ -1253,7 +1212,7 @@ namespace Tizen.NUI } get { - Vector4 ret = GetBackgroundColor(); + Color ret = GetBackgroundColor(); return ret; } } -- 2.7.4