[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_New_2")]
public static extern global::System.IntPtr WebView_New_2(string jarg1, string jarg2);
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_New_3")]
+ public static extern global::System.IntPtr WebView_New_3(int jarg1, string[] jarg2);
+
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WebView__SWIG_1")]
public static extern global::System.IntPtr new_WebView__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_DEFAULT_FONT_SIZE_get")]
public static extern int WebView_Property_DEFAULT_FONT_SIZE_get();
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_SCROLL_POSITION_get")]
+ public static extern int ScrollPositionGet();
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_SCROLL_SIZE_get")]
+ public static extern int ScrollSizeGet();
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_CONTENT_SIZE_get")]
+ public static extern int ContentSizeGet();
+
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_LoadUrl")]
public static extern void WebView_LoadUrl(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Resume")]
public static extern void WebView_Resume(global::System.Runtime.InteropServices.HandleRef jarg1);
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_ScrollBy")]
+ public static extern void ScrollBy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3);
+
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_GoBack")]
public static extern void WebView_GoBack(global::System.Runtime.InteropServices.HandleRef jarg1);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewPageLoadErrorSignal_Disconnect")]
public static extern void WebViewPageLoadErrorSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WebViewScrollEdgeReachedSignal_ScrollEdgeReached")]
+ public static extern global::System.IntPtr NewWebViewScrollEdgeReachedSignalScrollEdgeReached(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_WebViewScrollEdgeReachedSignal")]
+ public static extern void DeleteWebViewScrollEdgeReachedSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewScrollEdgeReachedSignal_Connect")]
+ public static extern void WebViewScrollEdgeReachedSignalConnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewScrollEdgeReachedSignal_Disconnect")]
+ public static extern void WebViewScrollEdgeReachedSignalDisconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
}
}
-}
\ No newline at end of file
+}
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewPageLoadErrorCallbackDelegate(IntPtr data, string pageUrl, int errorCode);
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void WebViewScrollEdgeReachedCallbackDelegate(IntPtr data, int edge);
+
private readonly WebViewPageLoadSignal pageLoadStartedSignal;
private EventHandler<WebViewPageLoadEventArgs> pageLoadStartedEventHandler;
private WebViewPageLoadCallbackDelegate pageLoadStartedCallback;
private EventHandler<WebViewPageLoadErrorEventArgs> pageLoadErrorEventHandler;
private WebViewPageLoadErrorCallbackDelegate pageLoadErrorCallback;
+ private readonly WebViewScrollEdgeReachedSignal scrollEdgeReachedSignal;
+ private EventHandler<WebViewScrollEdgeReachedEventArgs> scrollEdgeReachedEventHandler;
+ private WebViewScrollEdgeReachedCallbackDelegate scrollEdgeReachedCallback;
+
internal WebView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.WebView.WebView_SWIGUpcast(cPtr), cMemoryOwn)
{
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
pageLoadStartedSignal = new WebViewPageLoadSignal(Interop.WebView.new_WebViewPageLoadSignal_PageLoadStarted(swigCPtr));
pageLoadFinishedSignal = new WebViewPageLoadSignal(Interop.WebView.new_WebViewPageLoadSignal_PageLoadFinished(swigCPtr));
pageLoadErrorSignal = new WebViewPageLoadErrorSignal(Interop.WebView.new_WebViewPageLoadErrorSignal_PageLoadError(swigCPtr));
+ scrollEdgeReachedSignal = new WebViewScrollEdgeReachedSignal(Interop.WebView.NewWebViewScrollEdgeReachedSignalScrollEdgeReached(swigCPtr));
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WebView obj)
}
}
+ private void OnScrollEdgeReached(IntPtr data, int edge)
+ {
+ WebViewScrollEdgeReachedEventArgs arg = new WebViewScrollEdgeReachedEventArgs((WebViewScrollEdgeReachedEventArgs.Edge)edge);
+ scrollEdgeReachedEventHandler?.Invoke(this, arg);
+ }
+
internal static new class Property
{
internal static readonly int URL = Interop.WebView.WebView_Property_URL_get();
internal static readonly int LOAD_IMAGES_AUTOMATICALLY = Interop.WebView.WebView_Property_LOAD_IMAGES_AUTOMATICALLY_get();
internal static readonly int DEFAULT_TEXT_ENCODING_NAME = Interop.WebView.WebView_Property_DEFAULT_TEXT_ENCODING_NAME_get();
internal static readonly int DEFAULT_FONT_SIZE = Interop.WebView.WebView_Property_DEFAULT_FONT_SIZE_get();
+ internal static readonly int ScrollPosition = Interop.WebView.ScrollPositionGet();
+ internal static readonly int ScrollSize = Interop.WebView.ScrollSizeGet();
+ internal static readonly int ContentSize = Interop.WebView.ContentSizeGet();
}
private static readonly BindableProperty UrlProperty = BindableProperty.Create(nameof(Url), typeof(string), typeof(WebView), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
return temp;
});
+
+ private static readonly BindableProperty ScrollPositionProperty = BindableProperty.Create(nameof(ScrollPosition), typeof(Vector2), typeof(WebView), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var webview = (WebView)bindable;
+ if (newValue != null)
+ {
+ Tizen.NUI.Object.SetProperty(webview.swigCPtr, WebView.Property.ScrollPosition, new Tizen.NUI.PropertyValue((Vector2)newValue));
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var webview = (WebView)bindable;
+ Vector2 temp = new Vector2(0.0f, 0.0f);
+ Tizen.NUI.Object.GetProperty(webview.swigCPtr, WebView.Property.ScrollPosition).Get(temp);
+ return temp;
+ });
+
+ 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);
+ Tizen.NUI.Object.GetProperty(webview.swigCPtr, WebView.Property.ScrollSize).Get(temp);
+ return temp;
+ });
+
+ 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);
+ Tizen.NUI.Object.GetProperty(webview.swigCPtr, WebView.Property.ContentSize).Get(temp);
+ return temp;
+ });
+
/// <summary>
/// Creates an uninitialized WebView.
/// </summary>
}
/// <summary>
+ /// Creates a WebView.
+ /// <param name="args">Argument array. The first value of array must be program's name.</param>
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public WebView(string[] args) : this(args == null ? Interop.WebView.WebView_New() : Interop.WebView.WebView_New_3(args.Length, 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>
}
/// <summary>
+ /// The postion of scroll.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Position ScrollPosition
+ {
+ get
+ {
+ Vector2 pv = (Vector2)GetValue(ScrollPositionProperty);
+ return new Position(pv.X, pv.Y);
+ }
+ set
+ {
+ if (value != null)
+ {
+ Position pv = value;
+ Vector2 vpv = new Vector2(pv.X, pv.Y);
+ SetValue(ScrollPositionProperty, vpv);
+ NotifyPropertyChanged();
+ }
+ }
+ }
+
+ /// <summary>
+ /// The size of scroll, read-only.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Size ScrollSize
+ {
+ get
+ {
+ Vector2 sv = (Vector2)GetValue(ScrollSizeProperty);
+ return new Size(sv.Width, sv.Height);
+ }
+ }
+
+ /// <summary>
+ /// The size of content, read-only.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Size ContentSize
+ {
+ get
+ {
+ Vector2 sv = (Vector2)GetValue(ContentSizeProperty);
+ return new Size(sv.Width, sv.Height);
+ }
+ }
+
+ /// <summary>
/// Event for the PageLoadStarted signal which can be used to subscribe or unsubscribe the event handler.<br />
/// This signal is emitted when page loading has started.<br />
/// </summary>
}
/// <summary>
+ /// Event for the ScrollEdgeReached signal which can be used to subscribe or unsubscribe the event handler.<br />
+ /// This signal is emitted when web view is scrolled to edge.<br />
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<WebViewScrollEdgeReachedEventArgs> ScrollEdgeReached
+ {
+ add
+ {
+ if (scrollEdgeReachedEventHandler == null)
+ {
+ scrollEdgeReachedCallback = OnScrollEdgeReached;
+ scrollEdgeReachedSignal.Connect(scrollEdgeReachedCallback);
+ }
+ scrollEdgeReachedEventHandler += value;
+ }
+ remove
+ {
+ scrollEdgeReachedEventHandler -= value;
+ if (scrollEdgeReachedEventHandler == null && scrollEdgeReachedCallback != null)
+ {
+ scrollEdgeReachedSignal.Disconnect(scrollEdgeReachedCallback);
+ }
+ }
+ }
+
+ /// <summary>
/// Loads a html.
/// <param name="url">The path of Web</param>
/// </summary>
}
/// <summary>
+ /// Scroll web view by deltaX and detlaY.
+ /// <param name="deltaX">The deltaX of scroll</param>
+ /// <param name="deltaY">The deltaY of scroll</param>
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ScrollBy(int deltaX, int deltaY)
+ {
+ Interop.WebView.ScrollBy(swigCPtr, deltaX, deltaY);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
/// Goes to the back
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
--- /dev/null
+/*
+ * Copyright (c) 2021 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.ComponentModel;
+
+namespace Tizen.NUI
+{
+ /// <summary>
+ /// Event arguments that passed via the WebView.ScrollEdgeReached.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class WebViewScrollEdgeReachedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// The enumeration for edge.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public enum Edge
+ {
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Left,
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Right,
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Top,
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Bottom,
+ }
+
+ /// <summary>
+ /// The edge, e.g. left, right, etc.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Edge ScrollEdge { get; }
+
+ internal WebViewScrollEdgeReachedEventArgs(Edge e)
+ {
+ ScrollEdge = e;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2021 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.
+ *
+ */
+
+namespace Tizen.NUI
+{
+ internal class WebViewScrollEdgeReachedSignal : Disposable
+ {
+ private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+
+ public WebViewScrollEdgeReachedSignal(global::System.IntPtr cPtr)
+ {
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+ }
+
+ public void Connect(System.Delegate func)
+ {
+ System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
+ {
+ Interop.WebView.WebViewScrollEdgeReachedSignalConnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ {
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ }
+ }
+
+ public void Disconnect(System.Delegate func)
+ {
+ System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
+ {
+ Interop.WebView.WebViewScrollEdgeReachedSignalDisconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ {
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ }
+ }
+
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ //Release your own unmanaged resources here.
+ //You should not access any managed member here except static instance.
+ //because the execution order of Finalizes is non-deterministic.
+
+ if (swigCPtr.Handle != global::System.IntPtr.Zero)
+ {
+ Interop.WebView.DeleteWebViewScrollEdgeReachedSignal(swigCPtr);
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+
+ base.Dispose(type);
+ }
+ }
+}