X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FBaseComponents%2FImageView.cs;h=3641ddbb9b6408000b9898eca90307bdf7a3890d;hb=9c0172f6cdc17d7558749ae086bb9263472f1f51;hp=5182c4f53518389b8e1bf9093c311f9c25578318;hpb=881b0ab7c0d2f048ba3c5897ac050fe83f80444b;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git
diff --git a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs
index 5182c4f..3641ddb 100755
--- a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs
+++ b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs
@@ -1,28 +1,31 @@
-/** Copyright (c) 2017 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-*/
+/*
+ * Copyright(c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.Runtime.InteropServices;
+using System.ComponentModel;
namespace Tizen.NUI.BaseComponents
{
- using System;
- using System.Runtime.InteropServices;
///
- /// ImageView is a class for displaying an image resource.
- /// An instance of ImageView can be created using a URL or an Image instance.
+ /// ImageView is a class for displaying an image resource.
+ /// An instance of ImageView can be created using a URL or an image instance.
///
+ /// 3
public class ImageView : View
{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
@@ -41,6 +44,7 @@ namespace Tizen.NUI.BaseComponents
///
/// Event arguments of resource ready.
///
+ /// 3
public class ResourceReadyEventArgs : EventArgs
{
private View _view;
@@ -48,6 +52,7 @@ namespace Tizen.NUI.BaseComponents
///
/// The view whose resource is ready.
///
+ /// 3
public View View
{
get
@@ -67,10 +72,11 @@ namespace Tizen.NUI.BaseComponents
private ResourceReadyEventCallbackType _resourceReadyEventCallback;
///
- /// Event for ResourceReady signal which can be used to subscribe/unsubscribe the event handler.
- /// This signal is emitted after all resources required by a control are loaded and ready.
- /// Most resources are only loaded when the control is placed on stage.
+ /// An event for ResourceReady signal which can be used to subscribe or unsubscribe the event handler.
+ /// This signal is emitted after all resources required by a control are loaded and ready.
+ /// Most resources are only loaded when the control is placed on the stage.
///
+ /// 3
public event EventHandler ResourceReady
{
add
@@ -99,7 +105,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;
}
@@ -110,7 +116,11 @@ namespace Tizen.NUI.BaseComponents
}
}
- //you can override it to clean-up your own resources.
+ ///
+ /// you can override it to clean-up your own resources.
+ ///
+ /// DisposeTypes
+ /// 3
protected override void Dispose(DisposeTypes type)
{
if (disposed)
@@ -118,7 +128,7 @@ namespace Tizen.NUI.BaseComponents
return;
}
- if(type == DisposeTypes.Explicit)
+ if (type == DisposeTypes.Explicit)
{
//Called by User
//Release your own managed resources here.
@@ -146,7 +156,7 @@ namespace Tizen.NUI.BaseComponents
base.Dispose(type);
}
- internal class Property
+ internal new class Property
{
internal static readonly int RESOURCE_URL = NDalicPINVOKE.ImageView_Property_RESOURCE_URL_get();
internal static readonly int IMAGE = NDalicPINVOKE.ImageView_Property_IMAGE_get();
@@ -157,16 +167,18 @@ namespace Tizen.NUI.BaseComponents
///
/// Creates an initialized ImageView.
///
+ /// 3
public ImageView() : this(NDalicPINVOKE.ImageView_New__SWIG_0(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
- /// Creates an initialized ImageView from an URL to an image resource.
- /// If the string is empty, ImageView will not display anything.
+ /// Creates an initialized ImageView from a URL to an image resource.
+ /// If the string is empty, ImageView will not display anything.
///
- /// The url of the image resource to display
+ /// The URL of the image resource to display.
+ /// 3
public ImageView(string url) : this(NDalicPINVOKE.ImageView_New__SWIG_2(url), true)
{
_url = url;
@@ -180,18 +192,30 @@ namespace Tizen.NUI.BaseComponents
}
- [Obsolete("Please do not use! this will be deprecated")]
+ ///
+ /// Downcasts a handle to imageView handle.
+ ///
+ /// Please do not use! this will be deprecated!
+ /// Instead please use as keyword.
+ /// 3
+ [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead! " +
+ "Like: " +
+ "BaseHandle handle = new ImageView(imagePath); " +
+ "ImageView image = handle as ImageView")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
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;
}
+
///
- /// Sets this ImageView from the given URL.
- /// If the URL is empty, ImageView will not display anything.
+ /// Sets this ImageView from the given URL.
+ /// If the URL is empty, ImageView will not display anything.
///
- /// The URL to the image resource to display
+ /// The URL to the image resource to display.
+ /// 3
public void SetImage(string url)
{
_url = url;
@@ -205,18 +229,20 @@ 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;
}
///
- /// Query if all resources required by a control are loaded and ready.
- /// Most resources are only loaded when the control is placed on stage.
- /// true if the resources are loaded and ready, false otherwise.
+ /// Queries if all resources required by a control are loaded and ready.
+ /// Most resources are only loaded when the control is placed on the stage.
+ /// True if the resources are loaded and ready, false otherwise.
///
- public bool IsResourceReady()
+ /// 3
+ public new bool IsResourceReady()
{
bool ret = NDalicPINVOKE.IsResourceReady(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending)
@@ -225,25 +251,30 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// ImageView ResourceUrl, type string
+ /// ImageView ResourceUrl, type string.
///
+ /// 3
public string ResourceUrl
{
get
{
- GetProperty(ImageView.Property.RESOURCE_URL).Get(out _url);
+ GetProperty(ImageView.Property.IMAGE).Get(out _url);
return _url;
}
set
{
- _url = value;
+ _url = (value == null? "" : value);
UpdateImage();
}
}
///
- /// 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
+ [Obsolete("Please do not use! This will be deprecated! Please use Image property instead!")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
public PropertyMap ImageMap
{
get
@@ -263,15 +294,46 @@ namespace Tizen.NUI.BaseComponents
{
if (_border == null)
{
+ if (_url != null) { value.Add("url", new PropertyValue(_url)); }
+ SetProperty(ImageView.Property.IMAGE, new Tizen.NUI.PropertyValue(value));
+ }
+ }
+ }
+
+ ///
+ /// 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)
+ {
+ if(_url != null) { value.Add("url", new PropertyValue(_url)); }
SetProperty(ImageView.Property.IMAGE, new Tizen.NUI.PropertyValue(value));
}
}
}
///
- /// ImageView PreMultipliedAlpha, type Boolean.
- /// Image must be initialized.
+ /// ImageView PreMultipliedAlpha, type Boolean.
+ /// Image must be initialized.
///
+ /// 3
public bool PreMultipliedAlpha
{
get
@@ -287,9 +349,10 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// ImageView PixelArea, type Vector4 (Animatable property).
- /// Pixel area is a relative value with the whole image area as [0.0, 0.0, 1.0, 1.0].
+ /// ImageView PixelArea, type Vector4 (Animatable property).
+ /// Pixel area is a relative value with the whole image area as [0.0, 0.0, 1.0, 1.0].
///
+ /// 3
public RelativeVector4 PixelArea
{
get
@@ -305,11 +368,12 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// The border of the image in the order: left, right, bottom, top.
- /// If set, ImageMap will be ignored.
- /// For N-Patch images only.
+ /// The border of the image in the order: left, right, bottom, top.
+ /// If set, ImageMap will be ignored.
+ /// For N-Patch images only.
/// Optional.
///
+ /// 3
public Rectangle Border
{
get
@@ -324,11 +388,12 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// Get or set whether to draws the borders only(If true).
- /// If not specified, the default is false.
- /// For N-Patch images only.
+ /// Gets or sets whether to draw the borders only (if true).
+ /// If not specified, the default is false.
+ /// For N-Patch images only.
/// Optional.
///
+ /// 3
public bool BorderOnly
{
get
@@ -342,6 +407,10 @@ namespace Tizen.NUI.BaseComponents
}
}
+ ///
+ /// Gets or sets whether to synchronos loading the resourceurl of image.
+ ///
+ /// 3
public bool SynchronosLoading
{
get
@@ -355,6 +424,60 @@ namespace Tizen.NUI.BaseComponents
}
}
+ ///
+ /// Gets or sets whether to correct orientation of image automatically.
+ ///
+ /// 5
+ public bool OrientationCorrection
+ {
+ get
+ {
+ return _orientationCorrection ?? false;
+ }
+ set
+ {
+ _orientationCorrection = value;
+ UpdateImage();
+ }
+ }
+
+
+ ///
+ /// Get the loading state of the visual resource.
+ ///
+ /// 5
+ public ImageView.LoadingStatusType LoadingStatus
+ {
+ get
+ {
+ return (ImageView.LoadingStatusType)NDalicManualPINVOKE.View_GetVisualResourceStatus(swigCPtr, (int)Property.IMAGE);
+ }
+ }
+
+ ///
+ /// Enumeration for LoadingStatus of image.
+ ///
+ /// 5
+ public enum LoadingStatusType
+ {
+ ///
+ /// Loading preparing status.
+ ///
+ /// 5
+ Preparing,
+ ///
+ /// Loading ready status.
+ ///
+ /// 5
+ Ready,
+ ///
+ /// Loading failed status.
+ ///
+ /// 5
+ Failed
+ }
+
+
private void UpdateImage()
{
if (_url != null)
@@ -366,20 +489,22 @@ namespace Tizen.NUI.BaseComponents
_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));
+ if (_synchronousLoading != null) { _nPatchMap.Add(NpatchImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); }
+ if (_orientationCorrection != null) { _nPatchMap.Add(ImageVisualProperty.OrientationCorrection, new PropertyValue((bool)_orientationCorrection)); }
SetProperty(ImageView.Property.IMAGE, new PropertyValue(_nPatchMap));
}
- else if(_synchronousLoading != null)
+ else if (_synchronousLoading != null || _orientationCorrection != 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));
+ if (_synchronousLoading != null) { imageMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); }
+ if (_orientationCorrection != null) { imageMap.Add(ImageVisualProperty.OrientationCorrection, new PropertyValue((bool)_orientationCorrection)); }
SetProperty(ImageView.Property.IMAGE, new PropertyValue(imageMap));
}
else
{ // just for normal image
- SetProperty(ImageView.Property.RESOURCE_URL, new PropertyValue(_url));
+ SetProperty(ImageView.Property.IMAGE, new PropertyValue(_url));
}
}
}
@@ -389,7 +514,7 @@ namespace Tizen.NUI.BaseComponents
private bool? _synchronousLoading = null;
private bool? _borderOnly = null;
private string _url = null;
-
+ private bool? _orientationCorrection = null;
}
}