2002-08-12 19:14:44 +00:00
|
|
|
|
// GladeViewer.cs - Silly tests for LibGlade in C#
|
|
|
|
|
//
|
|
|
|
|
// Author: Ricardo Fern<72>ndez Pascual <ric@users.sourceforge.net>
|
|
|
|
|
//
|
|
|
|
|
// (c) 2002 Ricardo Fern<72>ndez Pascual
|
|
|
|
|
|
|
|
|
|
namespace GladeSamples {
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
using Gtk;
|
|
|
|
|
using Glade;
|
|
|
|
|
|
|
|
|
|
public class GladeDemo {
|
|
|
|
|
|
|
|
|
|
public static void Main (string[] args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Length < 2) {
|
2003-09-07 10:56:40 +00:00
|
|
|
|
Console.WriteLine ("Use: ./glade-viewer.exe \"fname\" \"root\"");
|
2002-08-12 19:14:44 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-07 10:56:40 +00:00
|
|
|
|
Application.Init ();
|
2002-08-12 19:14:44 +00:00
|
|
|
|
|
|
|
|
|
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));
|
2003-09-07 10:56:40 +00:00
|
|
|
|
Console.WriteLine ("It is {0} that it was created using a Glade.XML object",
|
2002-08-12 19:14:44 +00:00
|
|
|
|
Glade.XML.GetWidgetTree (wid) != null);
|
|
|
|
|
|
|
|
|
|
Console.WriteLine ("\nList of created widgets:");
|
2004-02-13 21:16:12 +00:00
|
|
|
|
foreach (Widget w in gxml.GetWidgetPrefix ("")) {
|
2002-08-12 19:14:44 +00:00
|
|
|
|
Console.WriteLine ("{0} {1}",
|
|
|
|
|
w.GetType (),
|
|
|
|
|
Glade.XML.GetWidgetName (w));
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-07 10:56:40 +00:00
|
|
|
|
Application.Run ();
|
2002-08-12 19:14:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|