GtkSharp/sample/GladeTest.cs
Alp Toker 978a7b8819 2003-09-07 Alp Toker <alp@atoker.com>
* makefile.win32: New clean and release targets, and don't bother
        building the samples (sample/makefile.win32 is out of date anyway)
        * api/makefile.win32:
        * glue/makefile.win32:
        * makefile.win32: Glade# works perfectly on win32 now; include it in
        the default build
        * sample/GladeTest.cs:
        * sample/GladeViewer.cs: Remove Gnome dependency and clean up

svn path=/trunk/gtk-sharp/; revision=17967
2003-09-07 10:56:40 +00:00

64 lines
1.4 KiB
C#
Raw Blame History

// GladeViewer.cs - 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;
using GtkSharp;
public class GladeTest
{
[Glade.Widget]
Gtk.Window main_window;
public static void Main (string[] args)
{
Application.Init ();
GladeTest gt = 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");
}
}
}