2002-07-30 23:02:12 +00:00
|
|
|
// Size.cs - struct marshalling test
|
|
|
|
//
|
|
|
|
// Author: Rachel Hestilow <hestilow@ximian.com>
|
|
|
|
//
|
|
|
|
// (c) 2002 Rachel Hestilow
|
|
|
|
|
|
|
|
namespace GtkSamples {
|
|
|
|
|
|
|
|
using Gtk;
|
|
|
|
using Gdk;
|
|
|
|
using System;
|
|
|
|
|
|
|
|
public class SizeTest {
|
|
|
|
|
|
|
|
public static int Main (string[] args)
|
|
|
|
{
|
|
|
|
Application.Init ();
|
|
|
|
Gtk.Window win = new Gtk.Window ("Gtk# Hello World");
|
|
|
|
win.DeleteEvent += new DeleteEventHandler (Window_Delete);
|
|
|
|
win.SizeAllocated += new SizeAllocatedHandler (Size_Allocated);
|
|
|
|
win.ShowAll ();
|
|
|
|
Application.Run ();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Window_Delete (object obj, DeleteEventArgs args)
|
|
|
|
{
|
|
|
|
Application.Quit ();
|
2003-11-20 01:10:46 +00:00
|
|
|
args.RetVal = true;
|
2002-07-30 23:02:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void Size_Allocated (object obj, SizeAllocatedArgs args)
|
|
|
|
{
|
2003-11-29 23:48:14 +00:00
|
|
|
System.Drawing.Rectangle rect = args.Allocation;
|
|
|
|
if (rect == System.Drawing.Rectangle.Empty)
|
2002-07-30 23:02:12 +00:00
|
|
|
Console.WriteLine ("ERROR: Allocation is null!");
|
2003-11-29 23:48:14 +00:00
|
|
|
Console.WriteLine ("Size: ({0}, {1})", rect.Width, rect.Height);
|
2002-07-30 23:02:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|