File: gtk-html-sample.cs

package info (click to toggle)
gnome-subtitles 1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 103,144 kB
  • sloc: xml: 406,395; cs: 364,495; ansic: 3,104; perl: 1,477; sh: 769; python: 545; javascript: 500; makefile: 49
file content (33 lines) | stat: -rw-r--r-- 661 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// mcs -pkg:gtkhtml-sharp -pkg:gtk-sharp gtk-html-sample.cs
using Gtk;
using System;
using System.IO;

class HTMLSample {
	static int Main (string [] args)
	{
		HTML html;
		Window win;
		Application.Init ();
		html = new HTML ();
		win = new Window ("Test");
		ScrolledWindow sw = new ScrolledWindow ();
		win.Add (sw);
		sw.Add (html);
		HTMLStream s = html.Begin ("text/html");

		if (args.Length > 0) {
			using (StreamReader r = File.OpenText (args [0]))
				s.Write (r.ReadToEnd ());
		} else {
			s.Write ("<html><body>");
			s.Write ("Hello world!");
		}
		
		html.End (s, HTMLStreamStatus.Ok);
		win.ShowAll ();
		Application.Run ();
		return 0;
	}
}