Add some APIS into WebView. (#2564)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / WebView.cs
index 72d18da..2220cdb 100755 (executable)
@@ -167,6 +167,7 @@ namespace Tizen.NUI
             internal static readonly int ScrollPosition = Interop.WebView.ScrollPositionGet();
             internal static readonly int ScrollSize = Interop.WebView.ScrollSizeGet();
             internal static readonly int ContentSize = Interop.WebView.ContentSizeGet();
+            internal static readonly int Title = Interop.WebView.WebView_Property_TITLE_get();
         }
 
         private static readonly BindableProperty UrlProperty = BindableProperty.Create(nameof(Url), typeof(string), typeof(WebView), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
@@ -212,7 +213,7 @@ namespace Tizen.NUI
         defaultValueCreator: (bindable) =>
         {
             var webview = (WebView)bindable;
-            Vector2 temp = new Vector2(0.0f, 0.0f); ;
+            Vector2 temp = new Vector2(0.0f, 0.0f);
             Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ScrollPosition).Get(temp);
             return temp;
         });
@@ -220,7 +221,7 @@ namespace Tizen.NUI
         private static readonly BindableProperty ScrollSizeProperty = BindableProperty.Create(nameof(ScrollSize), typeof(Vector2), typeof(WebView), null, defaultValueCreator: (bindable) =>
         {
             var webview = (WebView)bindable;
-            Vector2 temp = new Vector2(0.0f, 0.0f); ;
+            Vector2 temp = new Vector2(0.0f, 0.0f);
             Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ScrollSize).Get(temp);
             return temp;
         });
@@ -228,11 +229,19 @@ namespace Tizen.NUI
         private static readonly BindableProperty ContentSizeProperty = BindableProperty.Create(nameof(ContentSize), typeof(Vector2), typeof(WebView), null, defaultValueCreator: (bindable) =>
         {
             var webview = (WebView)bindable;
-            Vector2 temp = new Vector2(0.0f, 0.0f); ;
+            Vector2 temp = new Vector2(0.0f, 0.0f);
             Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ContentSize).Get(temp);
             return temp;
         });
 
+        private static readonly BindableProperty TitleProperty = BindableProperty.Create(nameof(Title), typeof(string), typeof(WebView), null, defaultValueCreator: (bindable) =>
+        {
+            var webview = (WebView)bindable;
+            string title;
+            Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.Title).Get(out title);
+            return title;
+        });
+
         /// <summary>
         /// Creates an uninitialized WebView.
         /// </summary>
@@ -254,6 +263,17 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// Creates an uninitialized WebView.
+        /// <param name="argc">count of args</param>
+        /// <param name="args">args array</param>
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public WebView(int argc, string[] args) : this(Interop.WebView.WebView_New_3(argc, args), true)
+        {
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
         /// Copy constructor.
         /// <param name="webView">WebView to copy. The copied WebView will point at the same implementation</param>
         /// </summary>
@@ -572,6 +592,31 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// Gets title of web page.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string Title
+        {
+            get
+            {
+                return (string)GetValue(TitleProperty);
+            }
+        }
+
+        /// <summary>
+        /// Gets fav icon.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public ImageView Favicon
+        {
+            get
+            {
+                global::System.IntPtr imageView = Interop.WebView.WebView_GetFavicon(swigCPtr);
+                return new ImageView(imageView, false);
+            }
+        }
+
+        /// <summary>
         /// Loads a html.
         /// <param name="url">The path of Web</param>
         /// </summary>
@@ -743,6 +788,16 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// Clears title resources of current WebView.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void ClearAllTilesResources()
+        {
+            Interop.WebView.WebView_ClearAllTilesResources(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
         /// Clears the history of current WebView.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]