[Gtk-sharp-list] Stuck in gtk-demo port from c to c#

Daniel Kornhauser dkor@media.mit.edu
Mon, 29 Sep 2003 05:20:14 -0400


--=-Ip9wPCXi2HrLFMxMPLkf
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi guys:


I'm stuck in my  gtk-demo port from c to c#, I'm sending as attachment what I 
have done. I did not wanted to bother you with my small problems, but now  they have 
accumulated to become a big problem.

I have waisted lots of time trying to figure some of these things, sorry if they are
obvious but I'm newbie and I'm stuck. I haven't done any advances in a week thus 
it's time to confess my sins :-). Keep in mind I'm a newbie while you read my code ...

I'll first present my coding conventions, and then go program by program talking
about where I got stuck.

One of the first remarks is that every program is independent, because I decided
to code the main of the gtk-demo program until the end, since it looks the hardest
and I didn't want to be stuck from the beginning. Thus they all make their
window from scratch. For naming them I used the save convention that Duncan used
with test: that is each program is called, the name of the c program, prefixed 
with demo.

e.g. buttonbox.c --> DemoButtonBoxcs

I used long names for everything, usually I make an instance of a widget the 
same name except I start it by a small caps.

I took some liberties to write scrolledWindow instead of sw, I just think that 
in examples you should be as explicit as possible ...

Keep in mind, I still have to clean up, port the comments in ALL the sources.
I just copied and pasted the c comments.

If I'm infringing in any way and I wasn't explicit that I wasn't just porting 
please let me know. I hope that just stating it in the comments is enough to 
recognize the real authors.

I avoided porting the error handling, because I'm lazy ...

When I'm stuck in a program I just put a stuck comment //STUCK

Appwindow.c: Stuck at the beginning 5%
=====================================
Didn't find any ItemFactory examples :-(

DemoButtonBox.cs: Finished 100%
===============================
Allmost exactly the same example.
Couldn't find a equivalent for gtk_main() thus I used Application.Init()
I used the prefix Gtk, in window because of ambiguous reference (Gtk.Window or Gdk.Window) 
I used the prefix Gtk, with the casting of buttons because of bug in mcs compiler
		Gtk.ButtonBox bbox = null;
		if (horizontal == true){
			bbox =  new Gtk.HButtonBox();
		}
		else {
			bbox =  new Gtk.VButtonBox(); 
		}

DemoChangeDisplay.c: Skipped i*(100%)
=====================================
My card only supports one display :-(

DemoColorSelection.cs: Almost finished 95%
==========================================
I could not write ExposeEventCallback.
How the hell can I translate gdk_draw_rectangle !!!
I initialized color to Gtk.Color.Zero couldn't find NULL equivalent in c-sharp.

DemoDialog.cs: Allmost finished 99%
===================================
I Couldn't find a good equivalent to gtk_dialog_new_with_butttons, thus I
used MessageDialog. 
Check how to handle response type. Can we make the button to have the binding to
the cancel signal automagicly like in  gtk_dialog_new_with_butttons or should we
just use the if ?
Remark -> This is me just thinking aloud :  
Wonder what is the best programming style when making several widgets like a label ?
Declare a static label, for the class and use it for all the labels, or declare an 
automatic label in each scope where it's needed and use it.
I decided to declare a label in each scope since I consider it cleaner programming
and I don't think it imposes a great penalty in memory ...
Then again I don't have the slightest idea of how I compiler runs, but I
have a Master in Computer Science... figure that out :-p

DemoDrawingArea.cs: just interface done, no callbacks implemented 50%
=======================================================================
I'm lost handling colors, events, drawingareas, you name it, I don't know it
:-(

One day, when I grow up, I'll understand pointers ... 
                                          (Shit!!! I allready have gray hairs)


Images.cs just interface done, no callbacks implemented 70%
============================================================
I got timed out in the use of the timeout >:-G


ItemFactory.cs: Nothing done, stuck at the beginning. -3.14%
============================================================
OUCH, it really hurts when you can't get past the third line of code

DemoMenus.cs: Finished 100%
==========================
Copied Menus from Duncan and just did some modifications in order
to match exactly to the example.

DemoPanes.cs:  just interface done, no callbacks implemented 80%
=================================================================
Guess what ?
I Got stuck in the callbacks, :-)
My question is plain and simple :
If I have two widgets that call the same callback, how can I find out 
the name of the widget that invoked the callback ???

PixBufs.cs: Skipped  (Planck's constant)
=======================================
Didn't even have to try to know I would get stuck right at the begining.
Pixbuf isn't a trivial widget.

SizeGroups.cs : Finished 100%
=============================
I Love to use cp. 
Allready implemented by Duncan :-)

DemoStockrowser.cs:  just starting doing the interface 1%
===================
I'm sure somewhere somebody know how to say :  
  store = gtk_list_store_new (2, STOCK_ITEM_INFO_TYPE, G_TYPE_STRING);
in c#
I simply didn't find in monodoc that the StockItem Structure had an
Info member :-(
Stuck doing ListStore how de hell do they work ?!?!?!

TextWidget.cs : just starting doing the interface 5%
====================================================
stuck implementing create_tags :

  gtk_text_buffer_create_tag (buffer, "heading",
			      "weight", PANGO_WEIGHT_BOLD,
			      "size", 15 * PANGO_SCALE,
			      NULL);
TextBuffer.CreateTag should exist but it doesn't :-(

DemoEditableCells Stuck in the callbacks 70%
============================================
I definitely don't understand how ListStore's work, I should look
at an example. Wait a minute I'm actually TRYING to code the example !
Bummer
:-(

DemoListStore Skipped
=====================
According to the previous corollary I just skipped this example.


DemoTreeStore, stuck in the begining 20%
========================================
Lesson learned, I'm not capable of doing a linked list with struct in c#

If somebody ever knows how to implement a linked list that looks like this

struct ListNode
{
        string        component;
        int             indentation;
        ListNode     Link;
};

and can avoid a cycle error, please tell me !
Anyway I did it with a class and it worked fine ...
But as always I got stuck, couldn't figure how to use TreeStore in a 
Callback.

DemoMain.cs 5%
==============
Should I use reflection to get the properties out of the examples, or should
I do it by hand like in this examples ?


			That's all.

			       Daniel

--=-Ip9wPCXi2HrLFMxMPLkf
Content-Disposition: attachment; filename=DemoApplicationWindow.cs
Content-Type: application/octet-stream; name=DemoApplicationWindow.cs
Content-Transfer-Encoding: 7bit

//
// ApplicationWindow.cs, port of appwindow.c from gtk-demo
//
// Author: Daniel Kornhauser <dkor@alum.mit.edu>
//
// Copyright (C) 2003, Ximian Inc.


/* Application main window
 *
 * Demonstrates a typical application window, with menubar, toolbar, statusbar.
 */


// TODO: - embed in gtk-demo
//     : - Is this necesary? /* Set up item factory to go away with the window */

using System;

using Gtk;
using GtkSharp;

namespace GtkDemo 
{
	public class ApplicationWindow
	{
	static void Main (string [] args)
		{
			// For testing
			Application.Init ();
			// For testing
			Gtk.Window window = new Gtk.Window ("Color Selection");
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);


			Table table = new Table (1, 4, false);
			window.Add (table);

			/* Create the menubar
			 */

			AccelGroup accelGroup = new AccelGroup ();
			window.AddAccelGroup(accelGroup);

			ItemFactory itemFactory = new ItemFactory (Gtk.MenuBar.GType, "<main>", accelGroup);

			/* Set up item factory to go away with the window */
			// Is this necesary ?

			/* create menu items */			
			//STUCK : Didn't find any examples of ItemFactory 
		}

	static void WindowDelete (object o, DeleteEventArgs args)
		{
			Application.Quit ();
			args.RetVal = true;
		}
	}
}

--=-Ip9wPCXi2HrLFMxMPLkf
Content-Disposition: attachment; filename=DemoButtonBox.cs
Content-Type: application/octet-stream; name=DemoButtonBox.cs
Content-Transfer-Encoding: 7bit

//
// DemoButtonBox.cs, port of buttonbox.c from gtk-demo
//
// Author: Daniel Kornhauser <dkor@alum.mit.edu>
//
// Copyright (C) 2003, Ximian Inc.


/* Button Boxes
 *
 * The Button Box widgets are used to arrange buttons with padding.
 */
 
// TODO: - embed in gtk-demo

using System;

using Gtk;
using Gdk;
using GtkSharp;


namespace GtkDemo 
{
	public class ButtonBox 	
	{
	static int Main (string [] args){
		// For testing
		Application.Init ();
		// For testing
		
		Gtk.Window window = new Gtk.Window ("Button Boxes");
		window.DeleteEvent += new DeleteEventHandler (WindowDelete);
		window.BorderWidth = 10;
		
		VBox mainVbox = new VBox (false,0);
		window.Add (mainVbox);
		
		Frame horizontalFrame =  new Frame ("Horizontal Button Boxes");
		mainVbox.PackStart (horizontalFrame);		
		VBox vbox = new VBox (false, 0) ;
		vbox.BorderWidth = 10;
		horizontalFrame.Add( vbox);
		vbox.PackStart(CreateButtonBox(
				       true,
				       "Spread (spacing 40)", 
				       40, 85, 20, ButtonBoxStyle.Spread));
		vbox.PackStart(CreateButtonBox(
				       true,
				       "Edge (spacing 30)", 
				       30, 85, 20, ButtonBoxStyle.Edge));
		vbox.PackStart(CreateButtonBox(
				       true,
				       "Start (spacing 20)", 
				       20, 85, 20, ButtonBoxStyle.Start));
		vbox.PackStart(CreateButtonBox(
				       true,
				       "End (spacing 10)", 
				       10, 85, 20, ButtonBoxStyle.End));


		Frame verticalFrame = new Frame ("Vertical Button Boxes");
		mainVbox.PackStart(verticalFrame);
		HBox hbox = new HBox(false,0);
		hbox.BorderWidth = 10;
		verticalFrame.Add(hbox);
		
		hbox.PackStart(CreateButtonBox(
				       false,
				       "Spread (spacing 5)", 
				       5, 85, 20, ButtonBoxStyle.Spread));
		hbox.PackStart(CreateButtonBox(
				       false,
				       "Edge (spacing 30)", 
				       30, 85, 20, ButtonBoxStyle.Edge));
		hbox.PackStart(CreateButtonBox(
				       false,
				       "Start (spacing 20)", 
				       20, 85, 20, ButtonBoxStyle.Start));
		hbox.PackStart(CreateButtonBox(
				       false,
				       "End (spacing 20)", 
				       20, 85, 20, ButtonBoxStyle.End));
		
		window.ShowAll ();
		/* Enter the event loop */
		Application.Run ();

		return 0;

	}

        /* Create a Button Box with the specified parameters */
	static Frame CreateButtonBox (bool horizontal, string title,  int spacing,
			int childW , int childH , ButtonBoxStyle layout) 
	{
		Frame frame = new Frame (title);


		Gtk.ButtonBox bbox = null;
		if (horizontal == true){
			bbox =  new Gtk.HButtonBox();
		}
		else {
			bbox =  new Gtk.VButtonBox(); 
		}
		
		bbox.BorderWidth = 5;
		frame.Add (bbox);
		
		/* Set the appearance of the Button Box */
		bbox.Layout = layout;
		bbox.Spacing= spacing;
		
		Button buttonOk = Button.NewFromStock(Stock.Ok);
		bbox.Add(buttonOk);
		Button buttonCancel = Button.NewFromStock(Stock.Cancel);
		bbox.Add(buttonCancel);
		Button buttonHelp = Button.NewFromStock(Stock.Help);
		bbox.Add(buttonHelp);
		
		return frame;
	}

	static void WindowDelete (object o, DeleteEventArgs args)
	{
		Application.Quit ();
		args.RetVal = true;
	}
	}
}


--=-Ip9wPCXi2HrLFMxMPLkf
Content-Disposition: attachment; filename=DemoColorSelection.cs
Content-Type: application/octet-stream; name=DemoColorSelection.cs
Content-Transfer-Encoding: 7bit

//
// DemoColorSelection.cs, port of colorsel.c from gtk-demo
//
// Author: Daniel Kornhauser <dkor@alum.mit.edu>
//
// Copyright (C) 2003, Ximian Inc.

/* 
 *
 * GtkColorSelection lets the user choose a color. GtkColorSelectionDialog is
 * a prebuilt dialog containing a GtkColorSelection.
 *
 */


// TODO: - embed in gtk-demo
//       - write the ExposeEventCallback and understand what the hell it is for


using System;

using Gdk;
using Gtk;
using GtkSharp;


namespace GtkDemo 
{
	public class ColorSelection
	{
		static Gtk.Window window = null;
		static Gdk.Color color = Gdk.Color.Zero;
		static ColorSelectionDialog colorSelectionDialog = null;
		static Gtk.DrawingArea drawingArea = null;

	static void Main (string [] args)
		{
			// For testing
			Application.Init ();
			// For testing
			window = new Gtk.Window ("Color Selection");
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);
			window.BorderWidth = 8;
			VBox vbox = new VBox (false,8);
			vbox.BorderWidth = 8;
			window.Add (vbox);

			/*
			 * Create the color swatch area
			 */

			Frame frame = new Frame();
			frame.ShadowType = ShadowType.In;
			vbox.PackStart(frame, true, true, 0);

			drawingArea = new DrawingArea();
			drawingArea.ExposeEvent += new ExposeEventHandler (ExposeEventCallback);
			/* set a minimum size */
			drawingArea.SetSizeRequest (200,200);
			/* set the color */
			color = new Gdk.Color (0, 0, 0xff);
			drawingArea.ModifyBg (StateType.Normal, color);
			frame.Add(drawingArea);

			Alignment alignment = new Alignment (1.0f, 0.5f, 0.0f, 0.0f);
			Button button = new Button("_Change the above color");
			button.Clicked += new EventHandler (ChangeColorCallback);
			alignment.Add(button);
			vbox.PackStart(alignment);

			// For testing
			window.ShowAll ();
			Application.Run ();
			// For testing
		}			
		
	static void WindowDelete (object o, DeleteEventArgs args)
		{
			Application.Quit ();
			args.RetVal = true;
		}
        /* Expose callback for the drawing area*/		
	static void ExposeEventCallback (object o, ExposeEventArgs args)
		{
			//STUCK
		}
		
	static void ChangeColorCallback (object o, EventArgs args)
		{
			colorSelectionDialog = new ColorSelectionDialog ("Changing color");
			colorSelectionDialog.TransientFor = window;
			colorSelectionDialog.ColorSelection.PreviousColor = color;
			colorSelectionDialog.ColorSelection.CurrentColor = color;
			colorSelectionDialog.ColorSelection.HasPalette = true;			

			colorSelectionDialog.CancelButton.Clicked += new EventHandler (Color_Selection_Cancel);
			colorSelectionDialog.OkButton.Clicked += new EventHandler (Color_Selection_OK);

			colorSelectionDialog.ShowAll();
		}

		

	static void Color_Selection_OK (object o, EventArgs args)
		{
			Gdk.Color selected = colorSelectionDialog.ColorSelection.CurrentColor;
			drawingArea.ModifyBg (StateType.Normal, selected);
			colorSelectionDialog.Destroy ();
		}

	static void Color_Selection_Cancel (object o, EventArgs args)
		{
			colorSelectionDialog.Destroy ();
		}


	}
}

--=-Ip9wPCXi2HrLFMxMPLkf
Content-Disposition: attachment; filename=DemoDialog.cs
Content-Type: application/octet-stream; name=DemoDialog.cs
Content-Transfer-Encoding: 7bit

//
// DemoDialog.cs, port of dialog.c from gtk-demo
//
// Author Daniel Kornhauser <dkor@alum.mit.edu>
//
// Copyright (C) 2003, Ximian Inc.

/*
 *
 *Dialog widgets are used to pop up a transient window for user feedback.
 *
 */

// TODO: - embed in gtk-demo
//       - Couldn't find a good equivalent to gtk_dialog_new_with_butttons
//         in InteractiveDialogClicked
//       - Check how to handle response type. Can we make the button to have
//         the binding to the cancel signal automagicly like in 
//         gtk_dialog_new_with_butttons or should we just use the if ?
using System;

using Gtk;
using GtkSharp;

namespace GtkDemo 
{
	public class DialogAndMessageBoxes
	{
		static Gtk.Window window = null;
		static Entry entry1;
		static Entry entry2;

		static void Main (string []args){
			// For testing
			Application.Init ();
			// For testing
			
			window = new Gtk.Window("Dialogs");
			window.DeleteEvent += new DeleteEventHandler(WindowDelete);
			window.BorderWidth = 8;

			Frame frame = new Frame("Dialogs");
			window.Add(frame);

			VBox vbox = new VBox(false, 8);
			vbox.BorderWidth = 8;
			frame.Add(vbox);

			/* Standard message dialog */
			
			HBox hbox = new HBox (false,8);
			vbox.PackStart(hbox, false, false, 0);
			Button button = new Button ("_Message Dialog");
			button.Clicked += new EventHandler (MessageDialogClicked);
			hbox.PackStart (button, false, false, 0);
			vbox.PackStart(new HSeparator());

			/* Interactive dialog*/

			hbox = new HBox (false, 8);
			vbox.PackStart (hbox, false, false, 0);
			VBox vbox2 = new VBox (false, 0);

			button = new Button ("_Interactive Dialog");
			button.Clicked += new EventHandler (InteractiveDialogClicked);
			hbox.PackStart (vbox2, false, false, 0);
			vbox2.PackStart (button, false, false, 0);

			Table table = new Table (2, 2, false);
			table.RowSpacings = 4;
			table.ColSpacings = 4;
			hbox.PackStart(table);

			Label label = Label.NewWithMnemonic ("_Entry1");
			table.Attach (label, 0, 1, 0, 1);
			entry1 = new Entry ();
			table.Attach(entry1, 1, 2, 0, 1);
			label.MnemonicWidget = entry1;
			
			label = Label.NewWithMnemonic ("E_ntry2");
			table.Attach (label,0,1,1,2);
			entry2 = new Entry ();
			table.Attach(entry2, 1, 2, 1, 2);
			label.MnemonicWidget = entry2;			
			// For testing
			window.ShowAll ();
			Application.Run ();
			// For testing
		}

	static void WindowDelete (object o, DeleteEventArgs args)
	{
		Application.Quit ();
		args.RetVal = true;
	}

	static int i = 1;
	static void MessageDialogClicked (object o, EventArgs args)
		{
			string message = String.Format("This messagee box has been popped up the following\n number of times:\n\n {0:D} ",i);
			Dialog dialog = new MessageDialog(window, 
					DialogFlags.Modal | DialogFlags.DestroyWithParent,
					MessageType.Info,
					ButtonsType.Ok,
					message);
			dialog.Run ();
			dialog.Destroy ();
			i++;
		}

	static void InteractiveDialogClicked(object o, EventArgs args)
		{
			MessageDialog dialog = new MessageDialog (window,
					DialogFlags.Modal | DialogFlags.DestroyWithParent,
					MessageType.Question,
					ButtonsType.Ok,
					null);
			
			dialog.AddButton("_Non-stock Button", (int) ResponseType.Cancel);

			HBox hbox = new HBox (false, 8);
			hbox.BorderWidth = 8;
			dialog.VBox.PackStart (hbox, false, false, 0);

			Table table = new Table(2, 2, false);
			table.RowSpacings = 4;
			table.ColSpacings = 4;
			hbox.PackStart(table, false, false, 0);

			Label label = Label.NewWithMnemonic ("_Entry1");
			table.Attach (label, 0, 1, 0, 1);
			Entry localEntry1 = new Entry();
			localEntry1.Text = entry1.Text;
			table.Attach (localEntry1, 1, 2, 0, 1);
			label.MnemonicWidget = localEntry1;

			label = Label.NewWithMnemonic ("E_ntry2");
			table.Attach (label, 0, 1, 1, 2);
			Entry localEntry2 = new Entry();
			localEntry2.Text = entry2.Text;
			table.Attach (localEntry2, 1, 2, 1, 2);
			label.MnemonicWidget = localEntry2;
			
			hbox.ShowAll();
	
			ResponseType response = (ResponseType) dialog.Run ();

			if (response == ResponseType.Ok) {
				entry1.Text = localEntry1.Text;
				entry2.Text = localEntry2.Text;
			}			
			
			dialog.Destroy ();
		}
	}		     
}

--=-Ip9wPCXi2HrLFMxMPLkf
Content-Disposition: attachment; filename=DemoDrawingArea.cs
Content-Type: application/octet-stream; name=DemoDrawingArea.cs
Content-Transfer-Encoding: 7bit

//
// DemoDrawingArea.cs, port of drawingarea.c from gtk-demo
//
// Author: Daniel Kornhauser <dkor@alum.mit.edu>
//
// Copyright (C) 2003, Ximian Inc.
//

/* Drawing Area
 *
 * GtkDrawingArea is a blank area where you can draw custom displays
 * of various kinds.
 *
 * This demo has two drawing areas. The checkerboard area shows
 * how you can just draw something; all you have to do is write
 * a signal handler for expose_event, as shown here.
 *
 * The "scribble" area is a bit more advanced, and shows how to handle
 * events such as button presses and mouse motion. Click the mouse
 * and drag in the scribble area to draw squiggles. Resize the window
 * to clear the area.
 */

// TODO: - embed in gtk-demo
//       - Clean code: query-replace Gtk. and Gdk.
//       - stuck when programming CheckerboardExpose
//       - Most callbacks are not implemented


using System;

using Gtk;
using Gdk;
using GtkSharp;

namespace GtkDemo {
	public class DrawingAreaDemo 
	{
		private static Gdk.Pixmap pixmap = null;
		// take out this variables and access them in the call back
		// the way it should be done, that is throught the event.
		private static Gtk.DrawingArea drawingArea;
		private static Gtk.DrawingArea drawingArea1;


	static void Main (string []args)
		{
			// For testing
			Application.Init ();
			// For testing
			
			Gtk.Window window = new Gtk.Window ("Drawing Area");
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);
			window.BorderWidth = 8;
		
			VBox vbox = new VBox (false, 8);
			vbox.BorderWidth = 8;
			window.Add(vbox);
			
			/*
			 * Create the checkerboard area
			 */
			
			Gtk.Label label = new Gtk.Label(null);
			label.Markup =  "<u>Checkerboard pattern</u>";
			vbox.PackStart (label, false, false, 0);
			
			Gtk.Frame frame = new Gtk.Frame(null);
			frame.ShadowType = ShadowType.In;
			vbox.PackStart (frame, true, true, 0);

			drawingArea = new Gtk.DrawingArea();
			/* set a minimum size */
			drawingArea.SetSizeRequest (100,100);
			frame.Add(drawingArea);
			drawingArea.ExposeEvent += new ExposeEventHandler (
				CheckerboardExpose);



			/*
			 * Create the scribble area
			 */

			Gtk.Label label1 = new Gtk.Label (null);
			label1.Markup = "<u>Scribble area</u>";
			vbox.PackStart (label1, false, false, 0);
			
			Gtk.Frame frame1 = new Gtk.Frame (null);
			frame1.ShadowType = ShadowType.In;
			vbox.PackStart (frame1, true, true, 0);

			drawingArea1 = new Gtk.DrawingArea ();
			/* set a minimun size */
			drawingArea1.SetSizeRequest (100, 100);
			frame1.Add (drawingArea1)
			;      /* Signals used to handle backing pixmap */
			drawingArea1.ExposeEvent += new ExposeEventHandler (
				ScribbleExpose);
			drawingArea1.ConfigureEvent += new ConfigureEventHandler (
				ScribbleConfigure);
			/* Event signals */
			drawingArea1.MotionNotifyEvent += new MotionNotifyEventHandler (
				ScribbleMotionNotify);
			drawingArea1.ButtonPressEvent += new ButtonPressEventHandler (
				ScribbleButtonPress);

			/* Ask to receive events the drawing area doesn't normally
			 * subscribe to
			 */
			drawingArea1.Events = (int)EventMask.LeaveNotifyMask |
			                     (int)EventMask.ButtonPressMask |
			                     (int)EventMask.PointerMotionMask |
			                     (int)EventMask.PointerMotionHintMask;
			
			// For testing
			window.ShowAll ();
			Application.Run ();
			// For testing
		}
		
		
	static void WindowDelete (object o, DeleteEventArgs args)
		{
			Application.Quit ();
			args.RetVal = true;
		}
		
        /* At the start of an expose handler, a clip region of event->area
	 * is set on the window, and event->area has been cleared to the
	 * widget's background color. The docs for
	 * gdk_window_begin_paint_region() give more details on how this
	 * works.
	 */

	/* It would be a bit more efficient to keep these
	 * GC's around instead of recreating on each expose, but
	 * this is the lazy/slow way.
	 */
	static void CheckerboardExpose (object o, ExposeEventArgs args)
		{			

        /* At the start of an expose handler, a clip region of event->area
	 * is set on the window, and event->area has been cleared to the
	 * widget's background color. The docs for
	 * gdk_window_begin_paint_region() give more details on how this
	 * works.
	 */

	/* It would be a bit more efficient to keep these
	 * GC's around instead of recreating on each expose, but
	 * this is the lazy/slow way.
	 */
			Gdk.EventExpose eventExpose = args.Event;
			Gdk.Window window = eventExpose.window;

                        //       SSSSSSSSSSSSSSSSSSSTUCK !!!!!
			//Gdk.GC gc1 = new Gdk.GC (drawingArea1);
			//Gdk.Color red_color = new Gdk.Color (0xff, 0, 0);
			// Use the system colormap, easy.
			//Gdk.Colormap colormap = Gdk.Colormap.System;
			//colormap.AllocColor (red_color, true, true);
			//gc.Foreground = gray_color;
 
			// Now you can use it
			//drawable.DrawLine (gc1, 0, 0, 100, 100);

		}
	static void ScribbleExpose (object o, ExposeEventArgs args)
		{
        /* We use the "foreground GC" for the widget since it already exists,
         * but honestly any GC would work. The only thing to worry about
         * is whether the GC has an inappropriate clip region set.
         */

			Gdk.EventExpose eventExpose = args.Event;
			Gdk.Window window = eventExpose.window;
 			Gdk.Rectangle area = eventExpose.area;
			
			// TODO: TRANSLATE CORRECTLY Line 60 drawingarea.c
			window.DrawDrawable (drawingArea1.Style.BlackGC,
					pixmap,
					area.x, area.y,
					area.x, area.y,
					area.width, area.height);
			SignalArgs sa = (SignalArgs) args;
			sa.RetVal = false;
		}
        /* Create a new pixmap of the appropriate size to store our scribbles */
	static void ScribbleConfigure (object o, ConfigureEventArgs args)
		{
			Gdk.EventConfigure eventConfigure = args.Event;
			Gdk.Window window = eventConfigure.window;
			Gdk.Rectangle allocation = drawingArea1.Allocation;
			pixmap = new Gdk.Pixmap (window,
					allocation.width,
					allocation.height,
					-1);  	
			/* Initialize the pixmap to white */
			Console.WriteLine ("Darea.Style={0}", drawingArea1.Style);
			pixmap.DrawRectangle (drawingArea1.Style.WhiteGC, true, 0, 0,
					allocation.width, allocation.height);
			SignalArgs sa = (SignalArgs) args;
			/* We've handled the configure event, no need for further processing. */
			sa.RetVal = true;
		}
	static void ScribbleMotionNotify (object o, MotionNotifyEventArgs args)
		{
		}	
	static void ScribbleButtonPress (object o, ButtonPressEventArgs args)
		{
		}





	}
}

--=-Ip9wPCXi2HrLFMxMPLkf
Content-Disposition: attachment; filename=DemoEditableCells.cs
Content-Type: application/octet-stream; name=DemoEditableCells.cs
Content-Transfer-Encoding: 7bit

//
// DemoEditableCells.cs, port of appwindow.c from gtk-demo
//
// Author: Daniel Kornhauser <dkor@alum.mit.edu>
//
// Copyright (C) 2003, Ximian Inc.


/* Tree View/Editable Cells
 *
 * This demo demonstrates the use of editable cells in a GtkTreeView. If
 * you're new to the GtkTreeView widgets and associates, look into
 * the GtkListStore example first.
 *
 */

// TODO: - embed in gtk-demo
//       - correct mymodel hack, shouldn't have to do casting in C# ?
//         there should be a cleaner way to do it

using System;
using System.Drawing;

using System.Collections;

using Gtk;
using GtkSharp;

namespace GtkDemo 
{

	public class ApplicationWindow
	{
		static TreeModel model;
		static TreeView treeView;
	static void Main (string [] args)
		{
			// For testing
			Application.Init ();
			// For testing
			/* create window, etc */
			Gtk.Window window = new Gtk.Window ("Color Selection");
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);

			VBox vbox = new VBox (false, 5);
			window.Add(vbox);
			
			vbox.PackStart(new Label 
					("Shopping list (you can edit the cells!)"),
					false, false, 0);
			
			ScrolledWindow scrolledWindow = new ScrolledWindow (null, null);
			scrolledWindow.ShadowType = ShadowType.In;
			scrolledWindow.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
			vbox.PackStart(scrolledWindow);

			/* create model */
			model = CreateModel();

			/* create tree view */
			treeView = new TreeView(model);
			AddColumns (treeView);
			scrolledWindow.Add(treeView);

			/* some buttons */
			HBox hbox = new HBox (true, 4);
			vbox.PackStart(hbox, false, false, 0);

			Button button = new Button("Add item");
			button.Clicked += new EventHandler (AddItem);
			hbox.PackStart(button, true, true, 0);

			button = new Button("Remove item");
			button.Clicked += new EventHandler (RemoveItem);
			hbox.PackStart(button, true, true, 0);

			window.DefaultSize = new Size (320, 200);
			// For testing
			window.ShowAll ();
			Application.Run ();
			// For testing

		}
		static ArrayList articles = null ;

	static void AddColumns (TreeView treeView)
		{
			CellRendererText renderer;
			TreeModel model = treeView.Model;
			
			/* number column */
			renderer = new CellRendererText ();
			// renderer.Edited += new EventHandler (CellEdited);
			// renderer.Data("column", (int) Column.Number);
			treeView.AppendColumn ("Number", renderer, "text", 0);


			/* product column */
			renderer = new CellRendererText ();
			// renderer.Edited += new EventHandler (CellEdited);
			// renderer.SetData("column", (int) Column.Product);
			treeView.AppendColumn ("Product", renderer , "text", 1);
		}

	static TreeModel CreateModel ()
		{
			ListStore model = null;

			/* create array */
			articles = new ArrayList();
			AddItems();
			/* create list store */
			model = new ListStore (
				typeof(int),
				typeof(string),
				typeof(bool)
				);
			TreeIter iter = new TreeIter ();
			
			/* add items */
			foreach (Item item in articles){
				model.Append( out iter);
				model.SetValue(iter, (int) Column.Number, item.Number);
				model.SetValue(iter, (int) Column.Product, item.Product);
				model.SetValue(iter, (int) Column.Editable, item.Editable);
			}	
			return model;
		}

	static void AddItems ()
		{
			Item foo;

			foo = new Item(3, "bottles of coke", true);
			articles.Add(foo);

			foo = new Item(5, "packages of noodles", true);
			articles.Add(foo);

			foo = new Item(2, "packages of chocolate chip cookies", true);
			articles.Add(foo);

			foo = new Item(1, "can of vanilla ice cream", true);
			articles.Add(foo);

			foo = new Item(6, "eggs", true);
			articles.Add(foo);

		}

		
	static void WindowDelete (object o, DeleteEventArgs args)
		{
			Application.Quit ();
			args.RetVal = true;
		}

	static void CellEdited (object o, EventArgs args)
		{
		}

	static void AddItem (object o, EventArgs args)
		{

			Item foo = new Item(0, "Description here", true);
			articles.Add(foo);
			TreeIter iter = new TreeIter ();
			ListStore mymodel = (ListStore) model;
			mymodel.Append( out iter);
			mymodel.SetValue(iter, (int) Column.Number, foo.Number);
			mymodel.SetValue(iter, (int) Column.Product, foo.Product);
			mymodel.SetValue(iter, (int) Column.Editable, foo.Editable);
		}

		// This callback is really fucked up, the code is just really for hints ... 
	static void RemoveItem (object o, EventArgs args)
		{
//			STUCK
// 			TreeIter iter = new TreeIter ();
// 			TreeSelection selection = treeView.Selection;

// 			if (selection.GetSelected (out model, ref iter)){

// 				Console.WriteLine(selection.GetSelected (out model, ref iter));
// 				TreePath path = model.GetPath (iter);
// 				int i = path.Indices;
// 				Console.WriteLine("Index");
// 				Console.WriteLine(i);
// 				ListStore dirtymodel = (ListStore) model;
// 				dirtymodel.Remove ( out iter);
// 				articles.RemoveAt (i);
// 				path.Free ();
//			}

		}
	}
	public enum Column
	{
		Number,
		Product,
		Editable,
	};


	
 	public struct Item
 	{
		public int Number;
		public string Product;
		public bool Editable;

 		public Item (int number , string product, bool editable)
 		{
 			Console.WriteLine("Calling Contructor");
 			Number = number;
 			Product = product;
 			Editable = editable;
 		}
 	}
}

--=-Ip9wPCXi2HrLFMxMPLkf
Content-Disposition: attachment; filename=DemoImages.cs
Content-Type: application/octet-stream; name=DemoImages.cs
Content-Transfer-Encoding: 7bit

//
// DemoImages.cs - port of images.c gtk-demo
//
// Author: Daniel Kornhauser <dkor@alum.mit.edu>
//
// Copyright (C) 2003, Ximian Inc.
// 
/* Images
 *
 * GtkImage is used to display an image; the image can be in a number of formats.
 * Typically, you load an image into a GdkPixbuf, then display the pixbuf.
 *
 * This demo code shows some of the more obscure cases, in the simple
 * case a call to gtk_image_new_from_file() is all you need.
 *
 * If you want to put image data in your program as a C variable,
 * use the make-inline-pixbuf program that comes with GTK+.
 * This way you won't need to depend on loading external files, your
 * application binary can be self-contained.
 */

// TODO: - embed in gtk-demo

using System;
using System.IO;

using Gtk;
using Gdk;
using GtkSharp;

namespace GtkDemo {
	public class ImagesDemo
	{
	static void Main (string []args)
		{
			// For testing
			Application.Init ();
			// For testing	
			Gtk.Window window = new Gtk.Window ("Images");
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);
			window.BorderWidth = 8;
		
			VBox vbox = new VBox (false, 8);
			vbox.BorderWidth = 8;
			window.Add (vbox);
			
			Gtk.Label label = new Gtk.Label (null);
			label.Markup = "<u>Image loaded from a file</u>";
			vbox.PackStart(label, false, false, 0);
			
			Gtk.Frame frame = new Gtk.Frame (null);
			frame.ShadowType = ShadowType.In;
			/* The alignment keeps the frame from growing when users resize
			 * the window
			 */
			Alignment alignment = new Alignment (0.5f, 0.5f, 0f, 0f);
			alignment.Add (frame);
			vbox.PackStart(alignment, false, false, 0);
			/* demo_find_file() looks in the the current directory first,
			 * so you can run gtk-demo without installing GTK, then looks
			 * in the location where the file is installed.
			 */

			// TODO: Display system error
			/* This code shows off error handling. You can just use
			 * gtk_image_new_from_file() instead if you don't want to report
			 * errors to the user. If the file doesn't load when using
			 * gtk_image_new_from_file(), a "missing image" icon will
			 * be displayed instead.
			 */
			Gdk.Pixbuf pixbuf = null;
			try {
				FileStream fileStream = DemoFindFile ("gtk-logo-rgb.gif");
				pixbuf = new Gdk.Pixbuf(fileStream);
			}
			catch (FileNotFoundException) {	
				Gtk.Dialog dialog = new Gtk.MessageDialog(window, 
						DialogFlags.DestroyWithParent,
						MessageType.Error,
						ButtonsType.Close,
						"Unable to open image file 'gtk-logo-rgb.gif':");
				dialog.Run();
				// TODO: Use EventHadler for Destroy line 216
				//dialog.Destroy();
				dialog.Response += new ResponseHandler(ResponseCallback);
			}


			Gtk.Image image = new Gtk.Image(pixbuf);
			
			frame.Add(image);
			

			/* Animation */
			Gtk.Label label1 = new Gtk.Label(null);
			label1.Markup = "<u>Animation loaded from a file</u>";
			vbox.PackStart(label1);

			Gtk.Frame frame1 = new Gtk.Frame (null);
			frame1.ShadowType = ShadowType.In;
			/* The alignment keeps the frame from growing when users resize
			 * the window
			 */
			Alignment alignment1 = new Alignment (0.5f, 0.5f, 0f, 0f);
			alignment1.Add (frame1);
			vbox.PackStart(alignment1, false, false, 0);


			Gtk.Image image1 = new Gtk.Image("floppybuddy.gif");
			frame1.Add(image1);

			/* Progressive */
			Gtk.Label label2 = new Gtk.Label(null);
			label2.Markup = "<u>Progressive image loading</u>";
			vbox.PackStart(label2);

			Gtk.Frame frame2 = new Gtk.Frame(null);
			frame2.ShadowType = ShadowType.In;

			/* The alignment keeps the frame from growing when users resize
			 * the window
			 */
			Alignment alignment2 = new Alignment (0.5f, 0.5f, 0f, 0f);
			alignment2.Add (frame2);
			vbox.PackStart(alignment2, false, false, 0);

			/* Create an empty image for now; the progressive loader
			 * will create the pixbuf and fill it in.
			 */

			Gtk.Image image2 = new Gtk.Image();
			frame2.Add(image2);

			/* Sensitivity control */
			Gtk.ToggleButton button = new Gtk.ToggleButton("_Insensitive");
			vbox.PackStart(button, false, false, 0);
			button.Toggled += new EventHandler(ToggleSensitivity);

			// For testing
			window.ShowAll ();
			Application.Run ();
			// For testing



		}



	static FileStream DemoFindFile(String filePath) {
		try {
			FileStream fs = File.Open(filePath, FileMode.Open);
			return fs;
		}
		catch (FileNotFoundException e) {
			throw e;
		}
	}

	static uint timeout_id;
	static void StartProgressiveLoading (Gtk.Image image)
		{
                /* This is obviously totally contrived (we slow down loading
		 * on purpose to show how incremental loading works).
		 * The real purpose of incremental loading is the case where
		 * you are reading data from a slow source such as the network.
		 * The timeout simply simulates a slow data source by inserting
		 * pauses in the reading process.
		 */
		Gtk.Image image1 = null;
		timeout_id = GLib.Timeout.Add(150, new GLib.TimeoutHandler(
						 ProgressivePreparedCallback));
		//STUCK
		}
		// TODO: Destroy dialog
	static void ResponseCallback (object obj, ResponseArgs args)
                {
			Dialog dialog = (Dialog) obj ;
			dialog.Destroy ();
		}


  	static void WindowDelete (object o, DeleteEventArgs args)
		{
			Application.Quit ();
			args.RetVal = true;
		}

  	static void ToggleSensitivity (object o, EventArgs args)
		{
		}
	static  bool ProgressivePreparedCallback()
		{
			return true;
		}




	}
}

--=-Ip9wPCXi2HrLFMxMPLkf
Content-Disposition: attachment; filename=DemoItemFactory.cs
Content-Type: application/octet-stream; name=DemoItemFactory.cs
Content-Transfer-Encoding: 7bit

//
// DemoItemFactoryDemo.cs - port of item_factory from gtk-demo
//
// Author: Daniel Kornhauser <dkor@alum.mit.edu>
//
// Copyright (C) 2003, Ximian Inc.

/* Item Factory
 *
 * The GtkItemFactory object allows the easy creation of menus
 * from an array of descriptions of menu items.
 */

// TODO: - embed in gtk-demo
//       - unfinished


using System;
using System.IO;

using Gtk;
using Gdk;
using GtkSharp;

namespace GtkDemo {
	public class ItemFactory
	{
	static void Main (string []args)
		{
			// For testing
			Application.Init ();
			// For testing	
			Gtk.Window window = new Gtk.Window (null);
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);
			Gtk.AccelGroup accelGroup = new Gtk.AccelGroup ();
			//STUCK   OUCH !!!!


			// For testing
			window.ShowAll ();
			Application.Run ();
			// For testing
		}

 	static void WindowDelete (object o, DeleteEventArgs args)
		{
			Application.Quit ();
			args.RetVal = true;
		}

	}
}

--=-Ip9wPCXi2HrLFMxMPLkf
Content-Disposition: attachment; filename=DemoMain.cs
Content-Type: application/octet-stream; name=DemoMain.cs
Content-Transfer-Encoding: 7bit

//
// DemoMain.cs, port of main.c from gtk-demo
//
// Author: Daniel Kornhauser <dkor@alum.mit.edu>
//
// Copyright (C) 2003, Ximian Inc.

// TODO: - embed in gtk-demo

using System;
using System.IO;
using System.Drawing;
using System.Collections;


using Gdk;
using Gtk;
using GtkSharp;
using Pango;

namespace GtkDemo 
{

	public class DemoMain
{
	static Gtk.Window window;
	static TextBuffer infoBuffer;
	static TextBuffer sourceBuffer;
	
	static void Main (string [] args)
		{  
  /*                 Should This Be Ported ?			
  * Most code in gtk-demo is intended to be exemplary, but not
   * these few lines, which are just a hack so gtk-demo will work
   * in the GTK tree without installing it.
   *
   * if (g_file_test ("../../gdk-pixbuf/libpixbufloader-pnm.la",
   *                G_FILE_TEST_EXISTS))
   * {
   *   putenv ("GDK_PIXBUF_MODULE_FILE=../../gdk-pixbuf/gdk-pixbuf.loaders");
   *   putenv ("GTK_IM_MODULE_FILE=../../modules/input/gtk.immodules");
   * }
   * -- End of hack -- */
			Application.Init ();
			SetupDefaultIcon ();
		        window = new Gtk.Window ("GTK+ Code Demos");
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);

			HBox hbox = new HBox (false, 0);
			window.Add (hbox);
			
			TreeView tree = CreateTree ();
			hbox.PackStart (tree, false, false, 0);
			
			Notebook notebook = new Notebook ();
			hbox.PackStart (notebook, true, true, 0);
			
			infoBuffer = new TextBuffer (null);
			sourceBuffer = new TextBuffer (null);

			notebook.AppendPage (CreateText(infoBuffer, true), Label.NewWithMnemonic ("_Info"));
		        notebook.AppendPage (CreateText(sourceBuffer, true), Label.NewWithMnemonic ("_Source"));

			window.DefaultSize = new Size (600,400);
			window.ShowAll ();
			Application.Run ();

		}

	// TODO: Display system error
	static void SetupDefaultIcon () {
		Gdk.Pixbuf pixbuf = null;
		try {
			FileStream fileStream = DemoFindFile ("gtk-logo-rgb.gif");
			pixbuf = new Gdk.Pixbuf(fileStream);
		}
		/* Ignoring this error (passing NULL instead of &err above)
		 * would probably be reasonable for most apps.  We're just
		 * showing off.
		 */
		catch (FileNotFoundException) {	
			Gtk.Dialog dialog = new Gtk.MessageDialog(window, 
					DialogFlags.DestroyWithParent,
					MessageType.Error,
					ButtonsType.Close,
					"Failed to read icon file 'gtk-logo-rgb.gif':");
			dialog.Run();
			dialog.Response += new ResponseHandler(ResponseCallback);
		}
		if (pixbuf != null) {
			/* The gtk-logo-rgb icon has a white background, make it transparent */
			Pixbuf transparent  = pixbuf.AddAlpha(true, 0xff, 0xff, 0xff);
			
			GLib.List list = new GLib.List ((IntPtr) 0, typeof (Gtk.Widget));
			list.Append (transparent.Handle);
			// ugly error when I try to add the icon :
			//  DemoMain.cs(96) error CS0176: Static member `DefaultIconList' cannot be accessed with an instance reference, qualify with a type name instead
		        // window.DefaultIconList = list;
		}
	}

	// BUG: I have to click twice close in order for the dialog to desapear
	static void ResponseCallback (object obj, ResponseArgs args)
                {
			Dialog dialog = (Dialog) obj ;
			dialog.Destroy ();
		}

	// TODO: Display system error
	static FileStream DemoFindFile(String filePath) {
		try {
			FileStream fs = File.Open(filePath, FileMode.Open);
			return fs;
		}
		catch (FileNotFoundException e) {
			throw e;
		}
	}

	static ScrolledWindow CreateText(TextBuffer buffer, bool isSource ) {

		ScrolledWindow scrolledWindow = new ScrolledWindow (null, null);
		scrolledWindow.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
		scrolledWindow.ShadowType = ShadowType.In;
		
		TextView textView = new TextView ();
		
		textView.Buffer = buffer;
		textView.Editable = false;
		textView.CursorVisible = false;

		scrolledWindow.Add (textView);

		if (isSource) {
			FontDescription fontDescription = FontDescription.FromString("Courier 12");	
			textView.ModifyFont (fontDescription);
		}
		else {
			// When this was written, monodoc said : This type has 2 members that are marked as unfinished.
			// textView.WrapMode = WrapMode.Word;
			textView.PixelsAboveLines = 2;
			textView.PixelsBelowLines = 2;
		}
                return scrolledWindow;
        }
                                                                                                                             
        static TreeView CreateTree () {
                TreeView treeView = new TreeView ();
                return treeView;
        }
                                                                                                                             
	static void WindowDelete (object o, DeleteEventArgs args)
		{
			Application.Quit ();
			args.RetVal = true;
		}
	}
}

--=-Ip9wPCXi2HrLFMxMPLkf
Content-Disposition: attachment; filename=DemoMenus.cs
Content-Type: application/octet-stream; name=DemoMenus.cs
Content-Transfer-Encoding: 7bit

//
// TestMenus.cs
//
// Author: Duncan Mak  (duncan@ximian.com)
//
// Copyright (C) 2002, Duncan Mak, Ximian Inc.
//

// TODO : window withd is not exactly equal
//        point on the right side

using System;

using Gtk;
using GtkSharp;

namespace WidgetViewer {
	public class TestMenus {
	static void Main (string []args)
		{
			// For testing
			Application.Init ();
			// For testing	
			Gtk.Window window = new Window ("Menus");
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);
			
			AccelGroup accel_group = new AccelGroup ();
			window.AddAccelGroup (accel_group);

			VBox box1 = new VBox (false, 0);
			window.Add (box1);

			MenuBar menubar = new MenuBar ();
			box1.PackStart (menubar, false, false, 0);

			Menu menu = Create_Menu (2, true);

			MenuItem menuitem = new MenuItem ("test\nline2");
			menuitem.Submenu = menu;
			menubar.Append (menuitem);

 			MenuItem menuitem1 = new MenuItem ("foo");
 			menuitem1.Submenu = Create_Menu (3, true);
 			menubar.Append (menuitem1);

			menuitem = new MenuItem ("bar");
			menuitem.Submenu = Create_Menu (4, true);
			menuitem.RightJustified = true;
			menubar.Append (menuitem);
			
			menubar = new MenuBar ();
			box1.PackStart (menubar, false, true, 0);
			
			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);
			
			menu = Create_Menu (1, false);
			menu.AccelGroup = accel_group;

			menu.Append (new SeparatorMenuItem ());

			menuitem = new CheckMenuItem ("Accelerate Me");
			menu.Append (menuitem);
			menuitem.AddAccelerator ("activate", accel_group, 0xFFBE, 0, AccelFlags.Visible);
			
			menuitem = new CheckMenuItem ("Accelerator locked");
			menu.Append (menuitem);
			menuitem.AddAccelerator ("activate", accel_group, 0xFFBF, 0, AccelFlags.Visible | AccelFlags.Locked);

			menuitem = new CheckMenuItem ("Accelerator Frozen");
			menu.Append (menuitem);
			menuitem.AddAccelerator ("activate", accel_group, 0xFFBF, 0, AccelFlags.Visible);
			menuitem.AddAccelerator ("activate", accel_group, 0xFFC0, 0, AccelFlags.Visible);
			
			OptionMenu option_menu = new OptionMenu ();
			option_menu.Menu = menu;
			option_menu.SetHistory (3);
			box2.PackStart (option_menu, true, true, 0);
			
			box1.PackStart (new HSeparator (), false, false, 0);
			
			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, true, 0);
			
			Button close_button = new Button ("close");
			close_button.Clicked += new EventHandler (Close_Button);
			box2.PackStart (close_button, true, true, 0);
			
			close_button.CanDefault = true;
			close_button.GrabDefault ();

			// For testing
			window.ShowAll ();
			Application.Run ();
			// For testing
		}			

		static Menu Create_Menu (int depth, bool tearoff)
		{
			if (depth < 1)
				return null;

			Menu menu = new Menu ();
			MenuItem menuitem = null;
			string label = null;
			GLib.SList group = new GLib.SList (IntPtr.Zero);

			if (tearoff) {
				menuitem = new TearoffMenuItem ();
				menu.Append (menuitem);
				menuitem.Show ();
			}

			for (int i = 0, j = 1; i < 5; i++, j++) {

				label = String.Format ("item {0} - {1}", depth, j);
				menuitem = RadioMenuItem.NewWithLabel (group, label);
				group = ((RadioMenuItem) menuitem).Group;
				menuitem = new MenuItem (label);
				menu.Append (menuitem);
				
				if (i == 3)
					menuitem.Sensitive = false;
				
				Menu child = Create_Menu ((depth - 1), true);

				if (child != null)
					menuitem.Submenu = child;
			}

			return menu;
		}

		static void Close_Button (object o, EventArgs args)
		{
			Application.Quit ();
		}
 	        static void WindowDelete (object o, DeleteEventArgs args)
		{
			Application.Quit ();
			args.RetVal = true;
		}


	}
}

--=-Ip9wPCXi2HrLFMxMPLkf
Content-Disposition: attachment; filename=DemoPanes.cs
Content-Type: application/octet-stream; name=DemoPanes.cs
Content-Transfer-Encoding: 7bit

//
// DemoPanes.cs
//
// Author: Daniel Kornhauser <dkor@alum.mit.edu>
//
// Copyright (C) 2002, Daniel Kornhauser, Ximian Inc.
//



// TODO: - embed in gtk-demo


using System;

using Gtk;
using GtkSharp;

namespace WidgetViewer {
	public class DemoPanes {

		static Gtk.HPaned hpaned = null;
		static Gtk.VPaned vpaned = null;

	static void Main (string []args)
		{
			// For testing
			Application.Init ();
			// For testing	
			Gtk.Window window = new Window ("Panes");
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);
			window.BorderWidth = 0;

			Gtk.VBox vbox = new Gtk.VBox (false, 0);
			window.Add (vbox);

			vpaned = new Gtk.VPaned ();
			vbox.PackStart (vpaned, true, true, 0);
			vpaned.BorderWidth = 5;

		        hpaned = new Gtk.HPaned ();
			vpaned.Add1 (hpaned);

			Gtk.Frame frame = new Gtk.Frame (null);
			frame.ShadowType = ShadowType.In;
			frame.SetSizeRequest(60, 60);
			hpaned.Add1 (frame);

			Gtk.Button button = new Gtk.Button("_Hi there");
			frame.Add (button);

			frame = new Gtk.Frame (null);
			frame.ShadowType = ShadowType.In;
			frame.SetSizeRequest(80, 60);
			hpaned.Add2 (frame);

			frame = new Gtk.Frame (null);
			frame.ShadowType = ShadowType.In;
			frame.SetSizeRequest(80, 60);
			vpaned.Add2 (frame);

			vbox.PackStart(CreatePanedOptions(hpaned,
						       "Horizontal", 
						       "Left", 
						       "Right"));

			vbox.PackStart(CreatePanedOptions(vpaned,
						       "Vorizontal", 
						       "Top", 
						       "Botton"));

			/* Now create toggle buttons to control sizing */

			// For testing
			window.ShowAll ();
			Application.Run ();
			// For testing
		}			

	static Gtk.Frame CreatePanedOptions(Gtk.Paned panned, string frame_label ,
			string label1, string label2)
		{
			Gtk.Frame frame = new Gtk.Frame (frame_label);
			frame.BorderWidth = 4;

			Gtk.Table table = new Gtk.Table (3, 2, true);
			frame.Add (table);

			Gtk.Label label = new Gtk.Label (label1);
			table.Attach (label, 0, 1, 0, 1);
			
			Gtk.CheckButton check_button = new Gtk.CheckButton ("_Resize");
			table.Attach(check_button, 0, 1, 1, 2);
			check_button.Toggled += new EventHandler(ToggleResize);

			check_button = new Gtk.CheckButton ("_Shrink");
			table.Attach(check_button, 0, 1, 2, 3);
			check_button.Active = true;
			check_button.Toggled += new EventHandler(ToggleShrink);

			label = new Gtk.Label (label2);
			table.Attach (label, 0, 2, 0, 1);
			
			check_button = new Gtk.CheckButton ("_Resize");
			table.Attach(check_button, 1, 2, 1, 2);
			check_button.Active = true;
			check_button.Toggled += new EventHandler(ToggleResize);

			check_button = new Gtk.CheckButton ("_Shrink");
			table.Attach(check_button, 1, 2, 2, 3);
			check_button.Active = true;
			check_button.Toggled += new EventHandler(ToggleResize);

		return frame;

		}

 	        static void ToggleResize    (object o, EventArgs args)
		{
			// STUCK
			Console.WriteLine("ToggleResize");
			Console.WriteLine(o);
			Console.WriteLine(args);
		}

 	        static void ToggleShrink (object o, EventArgs args)
		{
			Console.WriteLine("ToggleShrink");
		}

 	        static void WindowDelete (object o, DeleteEventArgs args)
		{
			Application.Quit ();
			args.RetVal = true;
		}


	}
}

--=-Ip9wPCXi2HrLFMxMPLkf
Content-Disposition: attachment; filename=DemoSizeGroup.cs
Content-Type: application/octet-stream; name=DemoSizeGroup.cs
Content-Transfer-Encoding: 7bit

//
// DemoSizeGroup.cs
//
// Author: Duncan Mak  (duncan@ximian.com)
//
// Copyright (C) 2002, Duncan Mak, Ximian Inc.
//

using System;

using Gtk;
using GtkSharp;

namespace GtkDemo {
	public class TestSizeGroup {

		static Dialog window = null;
		static SizeGroup size_group = null;

		public static Gtk.Window Create ()
		{
			window = new Dialog ();
			window.Title = "Sized groups";
			window.Resizable = false;
			
			VBox vbox = new VBox (false, 5);
			window.VBox.PackStart (vbox, true, true, 0);
			vbox.BorderWidth = 5;

			size_group = new SizeGroup (SizeGroupMode.Horizontal);

			Frame frame = new Frame ("Color Options");
			vbox.PackStart (frame, true, true, 0);

			Table table = new Table (2, 2, false);
			table.BorderWidth = 5;
			table.RowSpacing = 5;
			table.ColumnSpacing = 10;
			frame.Add (table);

			string [] colors = {"Red", "Green", "Blue", };
			string [] dashes = {"Solid", "Dashed", "Dotted", };
			string [] ends = {"Square", "Round", "Arrow", };

			Add_Row (table, 0, size_group, "_Foreground", colors);
			Add_Row (table, 1, size_group, "_Background", colors);

			frame = new Frame ("Line Options");
			vbox.PackStart (frame, false, false, 0);

			table = new Table (2, 2, false);
			table.BorderWidth = 5;
			table.RowSpacing = 5;
			table.ColSpacings = 10;
			frame.Add (table);

			Add_Row (table, 0, size_group, "_Dashing", dashes);
			Add_Row (table, 1, size_group, "_Line ends", ends);

			CheckButton check_button = new CheckButton ("_Enable grouping");
			vbox.PackStart (check_button, false, false, 0);
			check_button.Active = true;
			check_button.Toggled += new EventHandler (Button_Toggle_Cb);

			Button close_button = Button.NewFromStock (Stock.Close);
			close_button.Clicked += new EventHandler (Close_Button);
			window.ActionArea.PackStart (close_button, false, false, 0);
			
			window.ShowAll ();
			return window;
		}

		static OptionMenu Create_OptionMenu (string [] strings)
		{
			Menu menu = new Menu ();

			MenuItem menu_item = null;

			foreach (string str in strings) {
				menu_item = new MenuItem (str);
				menu_item.Show ();
				menu.Append (menu_item);
			}

			OptionMenu option_menu = new OptionMenu ();
			option_menu.Menu = menu;

			return option_menu;
		}

		static void Add_Row (Table table, uint row, SizeGroup size_group,
				     string label_text, string [] options)
		{
			Label label = Label.NewWithMnemonic (label_text);
			label.SetAlignment (0, 1);

			table.Attach (label,
				      0, 1, row, row + 1,
				      AttachOptions.Expand, AttachOptions.Fill,
				      0, 0);

			OptionMenu option_menu = Create_OptionMenu (options);

			size_group.AddWidget (option_menu);
			table.Attach (option_menu,
				      1, 2, row, row + 1,
				      AttachOptions.Expand, AttachOptions.Expand,
				      0, 0);
		}

		static void Button_Toggle_Cb (object o, EventArgs args)
		{
			Toggle_Grouping ((ToggleButton) o, size_group);
		}

		static void Toggle_Grouping (ToggleButton check_button,
					     SizeGroup size_group)
		{
			SizeGroupMode mode;

			if (check_button.Active)
				mode = SizeGroupMode.Horizontal;
			else
				mode = SizeGroupMode.None;

			size_group.Mode = mode;
		}

		static void Close_Button (object o, EventArgs args)
		{
			window.Destroy ();
		}
	}
}

--=-Ip9wPCXi2HrLFMxMPLkf
Content-Disposition: attachment; filename=DemoStockBrowser.cs
Content-Type: application/octet-stream; name=DemoStockBrowser.cs
Content-Transfer-Encoding: 7bit

//
// StockBrowser.cs, port of stock_browser.c from gtk-demo
//
// Author: Daniel Kornhauser <dkor@media.mit.edu>
//
// (C) 2003 Ximian, Inc.
 

using System;

using Gtk;
using Gdk;
using GtkSharp;

namespace GtkDemo{
	
	public class ButtonBox 
	{
	static void Main (string [] args)
		{
			// For testing
			Application.Init ();
			// For testing	
			Gtk.Window window = new Gtk.Window ("Images");
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);
			window.BorderWidth = 8;

			Gtk.HBox hbox = new Gtk.HBox (false, 8);
			window.Add (hbox);

			Gtk.ScrolledWindow scrooledWindow = new Gtk.ScrolledWindow (null, null);
			scrooledWindow.SetPolicy(Gtk.PolicyType.Never, Gtk.PolicyType.Automatic);
			hbox.PackStart(scrooledWindow, false, false, 0);
			
 			// For testing
			window.ShowAll ();
			Application.Run ();
			// For testing
		}	

	static Gtk.TreeModel CreateModel ()
		{
			Gtk.TreeModel store = new Gtk.ListStore(2,Gtk.StockItem.Info, typeof(string));
			// STUCK
		}
		
  	static void WindowDelete (object o, DeleteEventArgs args)
	{
		Application.Quit ();
		args.RetVal = true;
	}


	}
}

--=-Ip9wPCXi2HrLFMxMPLkf
Content-Disposition: attachment; filename=DemoTextView.cs
Content-Type: application/octet-stream; name=DemoTextView.cs
Content-Transfer-Encoding: 7bit

//
// DemoTextView.cs, port of textview.c form gtk-demo
//
// Author: Daniel Kornhauser <dkor@alum.mit.edu>
//
// (C) 2003 Ximian, Inc.

/* Text Widget
 *
 * The GtkTextView widget displays a GtkTextBuffer. One GtkTextBuffer
 * can be displayed by multiple GtkTextViews. This demo has two views
 * displaying a single buffer, and shows off the widget's text
 * formatting features.
 *
 */

// TODO: - embed in gtk-demo


using System;
using System.IO;

using Gtk;
using Gdk;
using GtkSharp;

namespace GtkDemo {
	public class DemoTextView
	{
	static void Main (string []args)
		{
			// For testing
			Application.Init ();
			// For testing	
			Gtk.Window window = new Gtk.Window ("TextView");
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);
			window.SetDefaultSize(450,450);
			window.BorderWidth = 0;

			Gtk.VPaned vpaned = new Gtk.VPaned ();
			vpaned.BorderWidth = 5;
			window.Add (vpaned);

			/* For convenience, we just use the autocreated buffer from
			 * the first text view; you could also create the buffer
			 * by itself with gtk_text_buffer_new(), then later create
			 * a view widget.
			 */

			Gtk.TextView view1 = new Gtk.TextView ();
			Gtk.TextBuffer buffer = view1.Buffer;
			Gtk.TextView view2 = new Gtk.TextView(buffer);

			Gtk.ScrolledWindow scrolledWindow = new  Gtk.ScrolledWindow(null, null);
			scrolledWindow.SetPolicy (Gtk.PolicyType.Automatic, Gtk.PolicyType.Automatic);
			vpaned.Add1 (scrolledWindow);
			scrolledWindow.Add (view1);

			scrolledWindow = new  Gtk.ScrolledWindow(null, null);
			scrolledWindow.SetPolicy (Gtk.PolicyType.Automatic, Gtk.PolicyType.Automatic);
			vpaned.Add2 (scrolledWindow);
			scrolledWindow.Add (view2);

			CreateTags(buffer);
			InsertText(buffer);

			AttachWidgets(view1);
			AttachWidgets(view2);

		}

	static void AttachWidgets (Gtk.TextView textview)
		{
		}

	static void CreateTags (Gtk.TextBuffer buffer)
		{
		/* Create a bunch of tags. Note that it's also possible to
		 * create tags with gtk_text_tag_new() then add them to the
		 * tag table for the buffer, gtk_text_buffer_create_tag() is
		 * just a convenience function. Also note that you don't have
		 * to give tags a name; pass NULL for the name to create an
		 * anonymous tag.
		 *
		 * In any real app, another useful optimization would be to create
		 * a GtkTextTagTable in advance, and reuse the same tag table for
		 * all the buffers with the same tag set, instead of creating
		 * new copies of the same tags for every buffer.
		 *
		 * Tags are assigned default priorities in order of addition to the
		 * tag table.	 That is, tags created later that affect the same text
		 * property affected by an earlier tag will override the earlier
		 * tag.  You can modify tag priorities with
		 * gtk_text_tag_set_priority().
		 */
			// STUCK
			// buffer.CreateTag("italic", "style", Pango.Style.Italic, null);

		}  


	static void InsertText (Gtk.TextBuffer buffer)
		{
		}

  	static void WindowDelete (object o, DeleteEventArgs args)
		{
			Application.Quit ();
			args.RetVal = true;
		}

	}
}


--=-Ip9wPCXi2HrLFMxMPLkf
Content-Disposition: attachment; filename=DemoTreeStore.cs
Content-Type: application/octet-stream; name=DemoTreeStore.cs
Content-Transfer-Encoding: 7bit

//
// DemoTreeItem.cs, port of tree_store.c from gtk-demo
//
// Author: Daniel Kornhauser <dkor@alum.mit.edu>
//
// Copyright (C) 2003, Ximian Inc.


/* Tree View/Tree Store
 *
 * The GtkTreeStore is used to store data in tree form, to be
 * used later on by a GtkTreeView to display it. This demo builds
 * a simple GtkTreeStore and displays it. If you're new to the
 * GtkTreeView widgets and associates, look into the GtkListStore
 * example first.
 *
 */


// TODO: - embed in gtk-demo
//       - correct mymodel hack, shouldn't have to do casting in C# ?
//         there should be a cleaner way to do it

using System;
using System.Drawing;

using System.Collections;

using Gtk;
using GtkSharp;

namespace GtkDemo 
{

	public class ApplicationWindow
	{

		static TreeModel model;
	static void Main (string [] args)
		{
			// For testing
			Application.Init ();
			// For testing
			/* create window, etc */
			Gtk.Window window = new Gtk.Window ("Color Selection");
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);

			VBox vbox = new VBox (false, 8);
			vbox.BorderWidth = 8;
			window.Add(vbox);

			vbox.PackStart(
				new Label("Jonathan's Holiday Card Planning Sheet"),
				false, false, 0);

			ScrolledWindow scrolledWindow = new ScrolledWindow (null, null);
			scrolledWindow.ShadowType = ShadowType.EtchedIn;
			scrolledWindow.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
			vbox.PackStart(scrolledWindow, true, true, 0);

			/* create model*/
			model = CreateModel();

			
			// For testing
			window.ShowAll ();
			Application.Run ();
			// For testing
		}

	static void WindowDelete (object o, DeleteEventArgs args)
		{
			Application.Quit ();
			args.RetVal = true;
		}

	static TreeModel CreateModel ()
		{
			TreeIter iter = new TreeIter();
			/* create tree store */
			TreeStore mymodel = new TreeStore (
				typeof(string),
				typeof(bool),
				typeof(bool),
				typeof(bool),
				typeof(bool), 
				typeof(bool),
                                typeof(bool), 
				typeof(bool));	
			/* add data to the tree store */
			foreach (MyTreeItem month in toplevel){
				mymodel.Append(out iter);
				///////////////STUCK
					Console.WriteLine (month.Label);
					foreach (MyTreeItem hollyday in month.Children){
						Console.WriteLine (hollyday.Label);
					}
			}


			TreeModel model = (TreeModel) mymodel;


			return model;
		}
		/* tree data */
	static MyTreeItem[] january = 
	{
		new MyTreeItem ("New Years Day", true, true, true, true, false, true, null ),
		new MyTreeItem ("Presidential Inauguration", false, true, false, true, false, false, null ),
		new MyTreeItem ("Martin Luther King Jr. day", false, true, false, true, false, false, null )		
	};

		static MyTreeItem[] february =
		{
			new MyTreeItem ( "Presidents' Day", false, true, false, true, false, false, null ),
			new MyTreeItem ( "Groundhog Day", false, false, false, false, false, false, null ),
			new MyTreeItem ( "Valentine's Day", false, false, false, false, true, true, null )			
		};

		static MyTreeItem[] march =
		{
			new MyTreeItem ( "National Tree Planting Day", false, false, false, false, false, false, null ),
			new MyTreeItem ( "St Patrick's Day", false, false, false, false, false, true, null )			
		};
		static MyTreeItem[] april =
		{
			new MyTreeItem ( "April Fools' Day", false, false, false, false, false, true, null ),
			new MyTreeItem ( "Army Day", false, false, false, false, false, false, null ),
			new MyTreeItem ( "Earth Day", false, false, false, false, false, true, null ),
			new MyTreeItem ( "Administrative Professionals' Day", false, false, false, false, false, false, null )			
		};

		static MyTreeItem[] may =
		{
			new MyTreeItem ( "Nurses' Day", false, false, false, false, false, false, null ),
			new MyTreeItem ( "National Day of Prayer", false, false, false, false, false, false, null ),
			new MyTreeItem ( "Mothers' Day", false, false, false, false, false, true, null ),
			new MyTreeItem ( "Armed Forces Day", false, false, false, false, false, false, null ),
			new MyTreeItem ( "Memorial Day", true, true, true, true, false, true, null )			
		};

		static MyTreeItem[] june =
		{
			new MyTreeItem ( "June Fathers' Day", false, false, false, false, false, true, null ),
			new MyTreeItem ( "Juneteenth (Liberation of Slaves)", false, false, false, false, false, false, null ),
			new MyTreeItem ( "Flag Day", false, true, false, true, false, false, null )			
		};

		static MyTreeItem[] july =
		{
			new MyTreeItem ( "Parents' Day", false, false, false, false, false, true, null ),
			new MyTreeItem ( "Independence Day", false, true, false, true, false, false, null )			
		};

		static MyTreeItem[] august =
		{
			new MyTreeItem ( "Air Force Day", false, false, false, false, false, false, null ),
			new MyTreeItem ( "Coast Guard Day", false, false, false, false, false, false, null ),
			new MyTreeItem ( "Friendship Day", false, false, false, false, false, false, null )			
		};

		static MyTreeItem[] september =
		{
			new MyTreeItem ( "Grandparents' Day", false, false, false, false, false, true, null ),
			new MyTreeItem ( "Citizenship Day or Constitution Day", false, false, false, false, false, false, null ),
			new MyTreeItem ( "Labor Day", true, true, true, true, false, true, null )			
		};

		static MyTreeItem[] october =
		{
			new MyTreeItem ( "National Children's Day", false, false, false, false, false, false, null ),
			new MyTreeItem ( "Bosses' Day", false, false, false, false, false, false, null ),
			new MyTreeItem ( "Sweetest Day", false, false, false, false, false, false, null ),
			new MyTreeItem ( "Mother-in-Law's Day", false, false, false, false, false, false, null ),
			new MyTreeItem ( "Navy Day", false, false, false, false, false, false, null ),
			new MyTreeItem ( "Columbus Day", false, true, false, true, false, false, null ),
			new MyTreeItem ( "Halloween", false, false, false, false, false, true, null )
		};

		static MyTreeItem[] november =
		{
			new MyTreeItem ( "Marine Corps Day", false, false, false, false, false, false, null ),
			new MyTreeItem ( "Veterans' Day", true, true, true, true, false, true, null ),
			new MyTreeItem ( "Thanksgiving", false, true, false, true, false, false, null )
		};

		static MyTreeItem[] december =
		{
			new MyTreeItem ( "Pearl Harbor Remembrance Day", false, false, false, false, false, false, null ),
			new MyTreeItem ( "Christmas", true, true, true, true, false, true, null ),
			new MyTreeItem ( "Kwanzaa", false, false, false, false, false, false, null )
		};


		static MyTreeItem[] toplevel =
		{
			new MyTreeItem ("January", false, false, false, false, false, false, january),
			new MyTreeItem ("February", false, false, false, false, false, false, february),
			new MyTreeItem ("March", false, false, false, false, false, false, march),
			new MyTreeItem ("April", false, false, false, false, false, false, april),
			new MyTreeItem ("May", false, false, false, false, false, false, may),
			new MyTreeItem ("June", false, false, false, false, false, false, june),
			new MyTreeItem ("July", false, false, false, false, false, false, july),
			new MyTreeItem ("August", false, false, false, false, false, false, august),
			new MyTreeItem ("September", false, false, false, false, false, false, september),
			new MyTreeItem ("October", false, false, false, false, false, false, october),
			new MyTreeItem ("November", false, false, false, false, false, false, november),
			new MyTreeItem ("December", false, false, false, false, false, false, december)
		};
		
		/* TreeItem structure */
		/* report bug array mismach declaration ... */
		public class MyTreeItem
		{
			public string          Label;
			public bool            Alex;
			public bool            Havoc;
			public bool            Tim;
			public bool            Owen;
			public bool            Dave;
			public bool            World_holiday; /* shared by the European hackers */
			public MyTreeItem[]      Children;                                  
		
			public MyTreeItem(	
				string      label,
				bool        alex,
				bool        havoc,
				bool        tim,
				bool        owen,
				bool        dave,
				bool        world_holiday,
			MyTreeItem[]  children)
		{
			Label =          label;
			Alex  =     	 alex;     
			Havoc =     	 havoc;	     
			Tim   =     	 tim;     
			Owen  =     	 owen;     
			Dave  =      	 dave;	     
			World_holiday =  world_holiday;
			Children =       children;
		}
		
	}
		/* columns */
		public enum Column
		{
			HolidayName,
			Alex,
			Havoc,
			Tim,
			Owen,
			Dave,
			Visible,
			World,
			Num,
		}

	}

}






--=-Ip9wPCXi2HrLFMxMPLkf
Content-Disposition: attachment; filename=erase_me.cs
Content-Type: application/octet-stream; name=erase_me.cs
Content-Transfer-Encoding: 7bit


static MyTreeItem[] february =
{
	new MyTreeItem ( "Presidents' Day", false, true, false, true, false, false, null ),
	new MyTreeItem ( "Groundhog Day", false, false, false, false, false, false, null ),
	new MyTreeItem ( "Valentine's Day", false, false, false, false, true, true, null ),
	null
};

static MyTreeItem[] march =
{
	new MyTreeItem ( "National Tree Planting Day", false, false, false, false, false, false, null ),
	new MyTreeItem ( "St Patrick's Day", false, false, false, false, false, true, null ),
	null
};
static MyTreeItem[] april =
{
	new MyTreeItem ( "April Fools' Day", false, false, false, false, false, true, null ),
	new MyTreeItem ( "Army Day", false, false, false, false, false, false, null ),
	new MyTreeItem ( "Earth Day", false, false, false, false, false, true, null ),
	new MyTreeItem ( "Administrative Professionals' Day", false, false, false, false, false, false, null ),
	null
};

static MyTreeItem[] may =
{
	new MyTreeItem ( "Nurses' Day", false, false, false, false, false, false, null ),
	new MyTreeItem ( "National Day of Prayer", false, false, false, false, false, false, null ),
	new MyTreeItem ( "Mothers' Day", false, false, false, false, false, true, null ),
	new MyTreeItem ( "Armed Forces Day", false, false, false, false, false, false, null ),
	new MyTreeItem ( "Memorial Day", true, true, true, true, false, true, null ),
	null
};

static MyTreeItem[] june =
{
	new MyTreeItem ( "June Fathers' Day", false, false, false, false, false, true, null ),
	new MyTreeItem ( "Juneteenth (Liberation of Slaves)", false, false, false, false, false, false, null ),
	new MyTreeItem ( "Flag Day", false, true, false, true, false, false, null ),
	null
};

static MyTreeItem[] july =
{
	new MyTreeItem ( "Parents' Day", false, false, false, false, false, true, null ),
	new MyTreeItem ( "Independence Day", false, true, false, true, false, false, null ),
	null
};

static MyTreeItem[] august =
{
	new MyTreeItem ( "Air Force Day", false, false, false, false, false, false, null ),
	new MyTreeItem ( "Coast Guard Day", false, false, false, false, false, false, null ),
	new MyTreeItem ( "Friendship Day", false, false, false, false, false, false, null ),
	null
};

static MyTreeItem[] september =
{
	new MyTreeItem ( "Grandparents' Day", false, false, false, false, false, true, null ),
	new MyTreeItem ( "Citizenship Day or Constitution Day", false, false, false, false, false, false, null ),
	new MyTreeItem ( "Labor Day", true, true, true, true, false, true, null ),
	null
};

static MyTreeItem[] october =
{
	new MyTreeItem ( "National Children's Day", false, false, false, false, false, false, null ),
	new MyTreeItem ( "Bosses' Day", false, false, false, false, false, false, null ),
	new MyTreeItem ( "Sweetest Day", false, false, false, false, false, false, null ),
	new MyTreeItem ( "Mother-in-Law's Day", false, false, false, false, false, false, null ),
	new MyTreeItem ( "Navy Day", false, false, false, false, false, false, null ),
	new MyTreeItem ( "Columbus Day", false, true, false, true, false, false, null ),
	new MyTreeItem ( "Halloween", false, false, false, false, false, true, null ),
	null
};

static MyTreeItem[] november =
{
	new MyTreeItem ( "Marine Corps Day", false, false, false, false, false, false, null ),
	new MyTreeItem ( "Veterans' Day", true, true, true, true, false, true, null ),
	new MyTreeItem ( "Thanksgiving", false, true, false, true, false, false, null ),
	null
};

static MyTreeItem[] december =
{
	new MyTreeItem ( "Pearl Harbor Remembrance Day", false, false, false, false, false, false, null ),
	new MyTreeItem ( "Christmas", true, true, true, true, false, true, null ),
	new MyTreeItem ( "Kwanzaa", false, false, false, false, false, false, null ),
	null
};


static MyTreeItem[] toplevel =
{
	new MyTreeItem ("January", false, false, false, false, false, false, january),
	new MyTreeItem ("February", false, false, false, false, false, false, february),
	new MyTreeItem ("March", false, false, false, false, false, false, march),
	new MyTreeItem ("April", false, false, false, false, false, false, april),
	new MyTreeItem ("May", false, false, false, false, false, false, may),
	new MyTreeItem ("June", false, false, false, false, false, false, june),
	new MyTreeItem ("July", false, false, false, false, false, false, july),
	new MyTreeItem ("August", false, false, false, false, false, false, august),
	new MyTreeItem ("September", false, false, false, false, false, false, september),
	new MyTreeItem ("October", false, false, false, false, false, false, october),
	new MyTreeItem ("November", false, false, false, false, false, false, november),
	new MyTreeItem ("December", false, false, false, false, false, false, december),
	null
};

--=-Ip9wPCXi2HrLFMxMPLkf--