summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxb.teng <xb.teng@samsung.com>2017-05-26 04:35:42 +0800
committerxb.teng <xb.teng@samsung.com>2017-05-26 05:18:22 +0800
commitfb6eecf3e60af623018a061d6bd95be920459cad (patch)
tree476f2b44290800b7793635bdd47e916f719aa9d9
parentaa78a8955a4d49cf1dab3d9897ce2e1151995738 (diff)
downloadnui-fb6eecf3e60af623018a061d6bd95be920459cad.tar.gz
nui-fb6eecf3e60af623018a061d6bd95be920459cad.tar.bz2
nui-fb6eecf3e60af623018a061d6bd95be920459cad.zip
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
-rwxr-xr-x[-rw-r--r--]NUISamples/NUISamples/NUISamples.TizenTV/examples/image-view.cs25
-rwxr-xr-xTizen.NUI/src/public/BaseComponents/ImageView.cs52
-rwxr-xr-xTizen.NUI/src/public/Layer.cs62
-rwxr-xr-xTizen.NUI/src/public/VisualMaps.cs7
-rwxr-xr-xTizen.NUI/src/public/Window.cs65
5 files changed, 138 insertions, 73 deletions
diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/image-view.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/image-view.cs
index 4ac8d46..b0f732f 100644..100755
--- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/image-view.cs
+++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/image-view.cs
@@ -92,6 +92,7 @@ namespace ImageViewTest
_imageView.AnchorPoint = AnchorPoint.TopLeft;
_imageView.Position = new Position(5.0f, 5.0f, 0.0f);
_imageView.PixelArea = new Vector4(0.0f, 0.0f, 0.5f, 0.5f);
+ _imageView.Size = new Size(200.0f, 80.0f, 0.0f);
//_imageView.SetResizePolicy(ResizePolicyType.USE_NATURAL_SIZE, DimensionType.ALL_DIMENSIONS);
layer.Add(_imageView);
@@ -111,17 +112,37 @@ namespace ImageViewTest
_pushButton2.Clicked += OnPushButtonClicked2;
_layer2.Add(_pushButton2);
+ ImageView syncImage = new ImageView();
+ syncImage.ParentOrigin = ParentOrigin.CenterLeft;
+ syncImage.AnchorPoint = AnchorPoint.CenterLeft;
+ syncImage.PositionUsesAnchorPoint = true;
+ syncImage.Size2D = new Size2D(150, 150);
+ syncImage.ResourceUrl = resources+"/images/gallery-3.jpg";
+ syncImage.SynchronosLoading = true;
+ layer.Add(syncImage);
+
PropertyMap _map = new PropertyMap();
_map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
_map.Add(NpatchImageVisualProperty.URL, new PropertyValue(resources+"/images/00_popup_bg.9.png"));
- _map.Add(NpatchImageVisualProperty.Border, new PropertyValue(new Rectangle(100, 100, 100, 100)));
+ _map.Add(NpatchImageVisualProperty.SynchronousLoading, new PropertyValue(true));
ImageView nPatchImage = new ImageView();
nPatchImage.ParentOrigin = ParentOrigin.BottomLeft;
nPatchImage.AnchorPoint = AnchorPoint.BottomLeft;
- nPatchImage.Size = new Size(300.0f, 512.0f, 0.0f);
+ nPatchImage.PositionUsesAnchorPoint = true;
+ nPatchImage.Size = new Size(300.0f, 100.0f, 0.0f);
nPatchImage.ImageMap = _map;
layer.Add(nPatchImage);
+ ImageView syncNineImage = new ImageView();
+ syncNineImage.ParentOrigin = ParentOrigin.CenterLeft;
+ syncNineImage.AnchorPoint = AnchorPoint.CenterLeft;
+ syncNineImage.Position2D = new Position2D(0, 200);
+ syncNineImage.PositionUsesAnchorPoint = true;
+ syncNineImage.Size = new Size(150.0f, 150.0f, 0.0f);
+ syncNineImage.ResourceUrl = resources+"/images/00_popup_bg.9.png";
+ syncNineImage.SynchronosLoading = true;
+ syncNineImage.Border = new Rectangle(0, 0, 0, 0);
+ layer.Add(syncNineImage);
}
public bool OnPushButtonClicked2(object sender, EventArgs e)
diff --git a/Tizen.NUI/src/public/BaseComponents/ImageView.cs b/Tizen.NUI/src/public/BaseComponents/ImageView.cs
index 2c721a7..f1da24c 100755
--- a/Tizen.NUI/src/public/BaseComponents/ImageView.cs
+++ b/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/Tizen.NUI/src/public/Layer.cs b/Tizen.NUI/src/public/Layer.cs
index 1aff277..26df66c 100755
--- a/Tizen.NUI/src/public/Layer.cs
+++ b/Tizen.NUI/src/public/Layer.cs
@@ -202,6 +202,13 @@ namespace Tizen.NUI
return ret;
}
+ /// <summary>
+ /// Search through this layer's hierarchy for an view with the given unique ID.
+ /// </summary>
+ /// <pre>This layer(the parent) has been initialized.</pre>
+ /// <remarks>The actor itself is also considered in the search.</remarks>
+ /// <param name="child">The id of the child to find</param>
+ /// <returns> A handle to the view if found, or an empty handle if not. </returns>
public View FindChildById(uint id)
{
View ret = new View(NDalicPINVOKE.Actor_FindChildById(swigCPtr, id), true);
@@ -210,6 +217,13 @@ namespace Tizen.NUI
return ret;
}
+ /// <summary>
+ /// Adds a child view to this layer.
+ /// </summary>
+ /// <pre>This layer(the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent layer.</pre>
+ /// <post>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.</post>
+ /// <remarks>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.</remarks>
+ /// <param name="child">The child</param>
public void Add(View child)
{
NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child));
@@ -217,6 +231,11 @@ namespace Tizen.NUI
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
+ /// <summary>
+ /// Removes a child View from this layer. If the view was not a child of this layer, this is a no-op.
+ /// </summary>
+ /// <pre>This layer(the parent) has been initialized. The child view is not the same as the parent view.</pre>
+ /// <param name="child">The child</param>
public void Remove(View child)
{
NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child));
@@ -489,6 +508,49 @@ namespace Tizen.NUI
}
}
+ /// <summary>
+ /// Gets/Sets the Layer's name.
+ /// </summary>
+ 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();
+ }
+
+ /// <summary>
+ /// Retrieves the number of children held by the layer.
+ /// </summary>
+ /// <pre>The layer has been initialized.</pre>
+ /// <returns>The number of children</returns>
+ public uint GetChildCount()
+ {
+ uint ret = NDalicPINVOKE.Actor_GetChildCount(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
}
}
diff --git a/Tizen.NUI/src/public/VisualMaps.cs b/Tizen.NUI/src/public/VisualMaps.cs
index 1e76181..c417461 100755
--- a/Tizen.NUI/src/public/VisualMaps.cs
+++ b/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;
/// <summary>
@@ -65,11 +62,11 @@ namespace Tizen.NUI
/// or absolute (in world units).<br>
/// Optional.
/// </summary>
- 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/Tizen.NUI/src/public/Window.cs b/Tizen.NUI/src/public/Window.cs
index 812bd60..7da0d14 100755
--- a/Tizen.NUI/src/public/Window.cs
+++ b/Tizen.NUI/src/public/Window.cs
@@ -399,55 +399,26 @@ namespace Tizen.NUI
return ret;
}
-
-
- /// <summary>
- /// Creates an initialized handle to a new Window.
- /// </summary>
- /// <param name="windowPosition">The position and size of the Window</param>
- /// <param name="name">The Window title</param>
- /// <param name="isTransparent">Whether Window is transparent</param>
- 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();
-
}
- /// <summary>
- /// Creates an initialized handle to a new Window.
- /// </summary>
- /// <param name="windowPosition">The position and size of the Window</param>
- /// <param name="name">The Window title</param>
- 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();
-
}
- /// <summary>
- /// Creates an initialized handle to a new Window.
- /// </summary>
- /// <param name="windowPosition">The position and size of the Window</param>
- /// <param name="name">The Window title</param>
- /// <param name="className">The Window class name</param>
- /// <param name="isTransparent">Whether Window is transparent</param>
- 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();
-
}
- /// <summary>
- /// Creates an initialized handle to a new Window.
- /// </summary>
- /// <param name="windowPosition">The position and size of the Window</param>
- /// <param name="name">The Window title</param>
- /// <param name="className">The Window class name</param>
- 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;
}
- /// <summary>
- /// This sets whether the indicator bar should be shown or not.
- /// </summary>
- /// <param name="visibleMode">Visible mode for indicator bar, Visible in default</param>
internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
{
NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- /// <summary>
- /// This sets the opacity mode of indicator bar.
- /// </summary>
- /// <param name="opacity">The opacity mode</param>
internal void SetIndicatorBgOpacity(Window.IndicatorBgOpacity opacity)
{
NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- /// <summary>
- /// This sets the orientation of indicator bar.<br>
- /// It does not implicitly show the indicator if it is currently hidden.<br>
- /// </summary>
- /// <param name="orientation">The orientation</param>
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;
}
+
/// <summary>
/// Grabs the key specified by a key for a window in a GrabMode. <br>
/// Details: This function can be used for following example scenarios: <br>
@@ -815,6 +774,7 @@ namespace Tizen.NUI
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
+
/// <summary>
/// Ungrabs the key specified by a key for a window. <br>
/// 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. <br>
@@ -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;
}
-
-
/// <summary>
/// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
/// </summary>
@@ -1233,11 +1192,11 @@ namespace Tizen.NUI
/// <summary>
/// Window size property (read-only).
/// </summary>
- public Vector2 Size
+ public Size2D Size
{
get
{
- Vector2 ret = GetSize();
+ Size2D ret = GetSize();
return ret;
}
}
@@ -1245,7 +1204,7 @@ namespace Tizen.NUI
/// <summary>
/// Background color property.
/// </summary>
- public Vector4 BackgroundColor
+ public Color BackgroundColor
{
set
{
@@ -1253,7 +1212,7 @@ namespace Tizen.NUI
}
get
{
- Vector4 ret = GetBackgroundColor();
+ Color ret = GetBackgroundColor();
return ret;
}
}