8b85bf647a
* generator/ClassBase.cs : make MarshalType virtual. * generator/Parameters.cs : add Parameter class and Indexer. * generator/Signal.cs : Now use Parameters. (GetHandlerName): New abstraction of name handling. (GenerateDecls): use GetHandlerName. (GenComments): make private. (GenHandler): New. Generate custom event handlers and args. (Generate): use GenHandler. Pass args type to SignalHandler. * generate/SignalHandler.cs : store args type. Generate handler dependent args and use MulticastDelegate.DynamicInvoke. * generate/StructGen.cs : override MarshalType. * glib/SignalCallback.cs : store a MulticastDelegate and args type * sample/*.cs : use new DeleteEventHandler svn path=/trunk/gtk-sharp/; revision=5834
57 lines
1.2 KiB
C#
Executable file
57 lines
1.2 KiB
C#
Executable file
// 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 DeleteEventHandler (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.Activated += new EventHandler (exit_cb);
|
|
file_menu.Append (exit_item);
|
|
MenuItem file_item = new MenuItem("File");
|
|
file_item.Submenu = 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.Add (box);
|
|
win.ShowAll ();
|
|
|
|
Application.Run ();
|
|
}
|
|
|
|
static void delete_cb (object o, DeleteEventArgs args)
|
|
{
|
|
SignalArgs sa = (SignalArgs) args;
|
|
Application.Quit ();
|
|
sa.RetVal = true;
|
|
}
|
|
|
|
static void exit_cb (object o, EventArgs args)
|
|
{
|
|
Application.Quit ();
|
|
}
|
|
}
|
|
}
|
|
|