File: GladeViewer.cs

package info (click to toggle)
gtk-sharp2 2.12.40-3.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 26,632 kB
  • sloc: xml: 351,292; cs: 26,444; sh: 4,228; ansic: 2,915; makefile: 1,288; perl: 1,179
file content (49 lines) | stat: -rw-r--r-- 1,214 bytes parent folder | download | duplicates (10)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// GladeViewer.cs - Silly tests for LibGlade in C#
//
// Author: Ricardo Fernndez Pascual <ric@users.sourceforge.net>
//
// (c) 2002 Ricardo Fernndez Pascual

namespace GladeSamples {
	using System;

	using Gtk;
	using Glade;

	public class GladeDemo {

		public static void Main (string[] args)
		{
			if (args.Length < 2) {
				Console.WriteLine ("Use: ./glade-viewer.exe \"fname\" \"root\"");
				return;
			}

			Application.Init ();

			string fname = args [0];
			string root = args [1];
			
			Glade.XML gxml = new Glade.XML (fname, root, null);
			Widget wid = gxml [root];
			wid.Show ();
			
			Console.WriteLine ("The filename: {0}", gxml.Filename);
			Console.WriteLine ("A relative filename: {0}", gxml.RelativeFile ("image.png"));

			Console.WriteLine ("The name of the root widget: {0}", Glade.XML.GetWidgetName (wid));
			Console.WriteLine ("It is {0} that it was created using a Glade.XML object",
					   Glade.XML.GetWidgetTree (wid) != null);

			Console.WriteLine ("\nList of created widgets:");
			foreach (Widget w in gxml.GetWidgetPrefix ("")) {
				Console.WriteLine ("{0} {1}", 
						   w.GetType (),
						   Glade.XML.GetWidgetName (w));
			}
			
			Application.Run ();
		}
		
	}
}