2002-05-03 Mike Kestner <mkestner@speakeasy.net>

* sample/makefile.win32 : add the Menu sample
	* sample/Menu.cs : A menu and box packing sample.

svn path=/trunk/gtk-sharp/; revision=4243
This commit is contained in:
Mike Kestner 2002-05-03 00:56:08 +00:00
parent 9d0184d61c
commit 5c9dfb1523
3 changed files with 63 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2002-05-03 Mike Kestner <mkestner@speakeasy.net>
* sample/makefile.win32 : add the Menu sample
* sample/Menu.cs : A menu and box packing sample.
2002-05-02 Mike Kestner <mkestner@speakeasy.net>
* generator/ObjectGen.cs : Add support for .custom files.

57
sample/Menu.cs Executable file
View File

@ -0,0 +1,57 @@
// Menus.cs : Menu testing sample app
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//
// <c> 2002 Mike Kestner
namespace GtkSharp.Samples {
using System;
using System.Drawing;
using Gtk;
using GtkSharp;
public class MenuApp {
public static void Main (string[] args)
{
Application.Init();
Window win = new Window ("Menu Sample App");
win.DeleteEvent += new EventHandler (delete_cb);
win.DefaultSize = new Size(200, 150);
VBox box = new VBox (false, 2);
MenuBar mb = new MenuBar ();
Menu file_menu = new Menu ();
MenuItem exit_item = new MenuItem("Exit");
exit_item.Activate += new EventHandler (exit_cb);
file_menu.Append (exit_item);
MenuItem file_item = new MenuItem("File");
file_item.SetSubmenu (file_menu);
mb.Append (file_item);
box.PackStart(mb, false, false, 0);
Button btn = new Button ("Yep, that's a menu");
box.PackStart(btn, true, true, 0);
win.EmitAdd (box);
win.ShowAll ();
Application.Run ();
}
static void delete_cb (object o, EventArgs args)
{
SignalArgs sa = (SignalArgs) args;
Application.Quit ();
sa.RetVal = true;
}
static void exit_cb (object o, EventArgs args)
{
Application.Quit ();
}
}
}

View File

@ -3,4 +3,5 @@ all: windows
windows:
$(CSC) /unsafe /out:gtk-hello-world.exe /r:../glib/glib-sharp.dll /r:../gtk/gtk-sharp.dll /r:../gdk/gdk-sharp.dll HelloWorld.cs
$(CSC) /unsafe /out:button.exe /r:../glib/glib-sharp.dll /r:../gtk/gtk-sharp.dll ButtonApp.cs
$(CSC) /unsafe /out:menu.exe /r:../glib/glib-sharp.dll /r:../gtk/gtk-sharp.dll Menu.cs