File: GladeTest.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 (68 lines) | stat: -rw-r--r-- 1,462 bytes parent folder | download | duplicates (9)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// GladeViewer.cs - 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 GladeTest
	{
		[Glade.Widget]
		Gtk.Window main_window;

		public static void Main (string[] args)
		{
			Application.Init ();

			new GladeTest ();

			Application.Run ();
		}

		public GladeTest () 
		{
			/* Note that we load the XML info from the assembly instead of using 
			   an external file. You don't have to distribute the .glade file if 
			   you don't want */
			Glade.XML gxml = new Glade.XML (null, "test.glade", "main_window", null);
			gxml.Autoconnect (this);

			if (main_window != null)
				Console.WriteLine ("Main Window Title: \"{0}\"", main_window.Title);
			else
				Console.WriteLine ("WidgetAttribute is broken.");
		}

		public void OnWindowDeleteEvent (object o, DeleteEventArgs args) 
		{
			Application.Quit ();
			args.RetVal = true;
		}
		
		public void OnButton1Clicked (System.Object b, EventArgs e) 
		{
			Console.WriteLine ("Button 1 clicked");
		}

		public static void OnButton2Clicked (System.Object b, EventArgs e) 
		{
			Console.WriteLine ("Button 2 clicked");
		}
		
		public void OnButton2Entered (System.Object b, EventArgs e) 
		{
			Console.WriteLine ("Button 2 entered");
		}

		public void OnQuitActivated (object o, EventArgs args)
		{
			Application.Quit ();
		}
	}
}