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 GtkSharp;
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
Gdk.Rectangle rect = args.Allocation;
|
2002-11-10 10:03:51 +00:00
|
|
|
if (rect == Gdk.Rectangle.Zero)
|
2002-07-30 23:02:12 +00:00
|
|
|
Console.WriteLine ("ERROR: Allocation is null!");
|
|
|
|
Console.WriteLine ("Size: ({0}, {1})", rect.width, rect.height);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|