diff options
author | Cody Russell <cody@jhu.edu> | 2014-01-24 01:17:35 +0400 |
---|---|---|
committer | Cody Russell <cody@jhu.edu> | 2014-01-24 08:51:54 +0400 |
commit | 84bda3d4e86e923ba1681dc32f2722c9afb4ecae (patch) | |
tree | 70b4e58353b2519db19493fdb6c1757f43a283e0 /Xwt.Mac | |
parent | 65b012befedee09cbad5d8910cc6bcc2ed7ab2f1 (diff) |
Basic WebView added.
Diffstat (limited to 'Xwt.Mac')
-rw-r--r-- | Xwt.Mac/Xwt.Mac.csproj | 1 | ||||
-rw-r--r-- | Xwt.Mac/Xwt.Mac/MacEngine.cs | 1 | ||||
-rw-r--r-- | Xwt.Mac/Xwt.Mac/WebViewBackend.cs | 89 |
3 files changed, 91 insertions, 0 deletions
diff --git a/Xwt.Mac/Xwt.Mac.csproj b/Xwt.Mac/Xwt.Mac.csproj index 331ad68f..9fa8bb70 100644 --- a/Xwt.Mac/Xwt.Mac.csproj +++ b/Xwt.Mac/Xwt.Mac.csproj @@ -125,6 +125,7 @@ <Compile Include="Xwt.Mac\EmbedNativeWidgetBackend.cs" /> <Compile Include="Xwt.Mac\MacKeyboardHandler.cs" /> <Compile Include="Xwt.Mac\PasswordEntryBackend.cs" /> + <Compile Include="Xwt.Mac\WebViewBackend.cs" /> </ItemGroup> <Import Project="..\BuildHelpers.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> diff --git a/Xwt.Mac/Xwt.Mac/MacEngine.cs b/Xwt.Mac/Xwt.Mac/MacEngine.cs index 9973984e..ff485ffb 100644 --- a/Xwt.Mac/Xwt.Mac/MacEngine.cs +++ b/Xwt.Mac/Xwt.Mac/MacEngine.cs @@ -122,6 +122,7 @@ namespace Xwt.Mac RegisterBackend <Xwt.Backends.IEmbeddedWidgetBackend, EmbedNativeWidgetBackend> (); RegisterBackend <Xwt.Backends.KeyboardHandler, MacKeyboardHandler> (); RegisterBackend <Xwt.Backends.IPasswordEntryBackend, PasswordEntryBackend> (); + RegisterBackend <Xwt.Backends.IWebViewBackend, WebViewBackend> (); } public override void RunApplication () diff --git a/Xwt.Mac/Xwt.Mac/WebViewBackend.cs b/Xwt.Mac/Xwt.Mac/WebViewBackend.cs new file mode 100644 index 00000000..e6f9fa52 --- /dev/null +++ b/Xwt.Mac/Xwt.Mac/WebViewBackend.cs @@ -0,0 +1,89 @@ +// +// WebViewBackend.cs +// +// Author: +// Cody Russell <cody@xamarin.com> +// +// Copyright (c) 2014 Xamarin Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using Xwt.Backends; +using MonoMac.AppKit; +using MonoMac.Foundation; +using MonoMac.WebKit; + +using MonoMac.ObjCRuntime; +using Xwt.Drawing; + +namespace Xwt.Mac +{ + public class WebViewBackend : ViewBackend<MonoMac.WebKit.WebView, IWebViewEventSink>, IWebViewBackend + { + public WebViewBackend () + { + } + + internal WebViewBackend (MacWebView macweb) + { + ViewObject = macweb; + } + + #region IWebViewBackend implementation + public override void Initialize() + { + base.Initialize (); + ViewObject = new MacWebView (); + } + + public void EnableEvent (Xwt.Backends.WebViewEvent ev) + { + } + + public void DisableEvent (Xwt.Backends.WebViewEvent ev) + { + } + + public string Url { + get { return Widget.MainFrameUrl; } + set { + Widget.MainFrameUrl = value; + } + } + #endregion + } + + class MacWebView : MonoMac.WebKit.WebView, IViewObject + { + public ViewBackend Backend { get; set; } + + public NSView View { + get { return this; } + } + + public void EnableEvent (Xwt.Backends.WebViewEvent ev) + { + } + + public void DisableEvent (Xwt.Backends.WebViewEvent ev) + { + } + } +} |