2021-07-19 16:11:36 +00:00
|
|
|
|
// This is free and unencumbered software released into the public domain.
|
|
|
|
|
// Happy coding!!! - GtkSharp Team
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using Atk;
|
|
|
|
|
using Gdk;
|
|
|
|
|
using Gtk;
|
|
|
|
|
using WebKit;
|
|
|
|
|
|
|
|
|
|
namespace Samples
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
[Section(ContentType = typeof(WebView), Category = Category.Widgets)]
|
|
|
|
|
class WebviewSection : ListSection
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public WebviewSection()
|
|
|
|
|
{
|
|
|
|
|
AddItem(ShowHtml());
|
|
|
|
|
AddItem(ShowUri());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public (string, Widget) ShowHtml()
|
|
|
|
|
{
|
|
|
|
|
var webView = new WebView {
|
|
|
|
|
HeightRequest = 100,
|
|
|
|
|
Hexpand = true
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-19 23:24:53 +00:00
|
|
|
|
webView.LoadHtml($"This is a <b>{nameof(WebView)}</b> showing html text");
|
2021-07-19 16:11:36 +00:00
|
|
|
|
return ($"{nameof(WebView)} show html text:", webView);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public (string, Widget) ShowUri()
|
|
|
|
|
{
|
2021-07-19 23:24:53 +00:00
|
|
|
|
var webView = new WebView {
|
|
|
|
|
Vexpand = true,
|
|
|
|
|
Hexpand = true,
|
2021-07-19 16:11:36 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
webView.LoadUri("https://github.com/GtkSharp/GtkSharp#readme");
|
|
|
|
|
|
2021-07-19 23:24:53 +00:00
|
|
|
|
return ($"{nameof(WebView)} show uri:", webView);
|
2021-07-19 16:11:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|