diff options
author | Cody Russell <bratsche@gnome.org> | 2014-01-24 22:33:20 +0400 |
---|---|---|
committer | Cody Russell <bratsche@gnome.org> | 2014-01-24 22:33:20 +0400 |
commit | 58e318d0679819f07b3b15eb34891981b9b312db (patch) | |
tree | 38f861fe3f4965922c9501e7eec390e3e3731203 /Xwt.WPF | |
parent | c7764f52088ea97d429b4629c6328c0377ad7da8 (diff) |
WebView implementation for WPF.
Diffstat (limited to 'Xwt.WPF')
-rw-r--r-- | Xwt.WPF/Xwt.WPF.csproj | 1 | ||||
-rw-r--r-- | Xwt.WPF/Xwt.WPFBackend/WPFEngine.cs | 1 | ||||
-rw-r--r-- | Xwt.WPF/Xwt.WPFBackend/WebViewBackend.cs | 57 |
3 files changed, 59 insertions, 0 deletions
diff --git a/Xwt.WPF/Xwt.WPF.csproj b/Xwt.WPF/Xwt.WPF.csproj index 865a873c..7fb94d7c 100644 --- a/Xwt.WPF/Xwt.WPF.csproj +++ b/Xwt.WPF/Xwt.WPF.csproj @@ -146,6 +146,7 @@ <Compile Include="Xwt.WPFBackend\WpfDesktopBackend.cs" />
<Compile Include="Xwt.WPFBackend\WindowsSpinButton.xaml.cs" />
<Compile Include="Xwt.WPFBackend\WpfKeyboardHandler.cs" />
+ <Compile Include="Xwt.WPFBackend\WebViewBackend.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
diff --git a/Xwt.WPF/Xwt.WPFBackend/WPFEngine.cs b/Xwt.WPF/Xwt.WPFBackend/WPFEngine.cs index 7f0f5086..f929884a 100644 --- a/Xwt.WPF/Xwt.WPFBackend/WPFEngine.cs +++ b/Xwt.WPF/Xwt.WPFBackend/WPFEngine.cs @@ -116,6 +116,7 @@ namespace Xwt.WPFBackend RegisterBackend<IScrollbarBackend, ScrollbarBackend> ();
RegisterBackend<IEmbeddedWidgetBackend, EmbedNativeWidgetBackend>();
RegisterBackend<IPasswordEntryBackend, PasswordEntryBackend> ();
+ RegisterBackend<IWebViewBackend, WebViewBackend> ();
RegisterBackend<KeyboardHandler, WpfKeyboardHandler> ();
}
diff --git a/Xwt.WPF/Xwt.WPFBackend/WebViewBackend.cs b/Xwt.WPF/Xwt.WPFBackend/WebViewBackend.cs new file mode 100644 index 00000000..e2adb8da --- /dev/null +++ b/Xwt.WPF/Xwt.WPFBackend/WebViewBackend.cs @@ -0,0 +1,57 @@ +// +// 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 System.Windows; +using SWC = System.Windows.Controls; +using Xwt.Backends; + +namespace Xwt.WPFBackend +{ + public class WebViewBackend : WidgetBackend, IWebViewBackend + { + string url; + + public WebViewBackend () + { + Widget = new SWC.WebBrowser (); + } + + internal WebViewBackend (SWC.WebBrowser browser) + { + Widget = browser; + } + + public string Url { + get { return url; } + set { + url = value; + ((SWC.WebBrowser)Widget).Navigate (url); + } + } + } +} + |