implement most of it
svn path=/trunk/gtk-sharp/; revision=19600
This commit is contained in:
parent
2a638aa84e
commit
39b871d786
1 changed files with 53 additions and 4 deletions
|
@ -28,17 +28,31 @@ namespace GtkDemo
|
|||
public DemoApplicationWindow ()
|
||||
{
|
||||
window = new Gtk.Window ("Demo Application Window");
|
||||
window.SetDefaultSize (400, 300);
|
||||
window.DeleteEvent += new DeleteEventHandler (WindowDelete);
|
||||
|
||||
Table table = new Table (1, 4, false);
|
||||
window.Add (table);
|
||||
VBox vbox = new VBox (false, 0);
|
||||
window.Add (vbox);
|
||||
|
||||
// Create the menubar
|
||||
|
||||
AccelGroup accelGroup = new AccelGroup ();
|
||||
window.AddAccelGroup (accelGroup);
|
||||
|
||||
//ItemFactory itemFactory = new ItemFactory ((uint) typeof (MenuBar),"<main>", accelGroup);
|
||||
MenuBar menubar = CreateMenu ();
|
||||
vbox.PackStart (menubar, false, false, 0);
|
||||
|
||||
Toolbar toolbar = CreateToolbar ();
|
||||
vbox.PackStart (toolbar, false, false, 0);
|
||||
|
||||
TextView textview = new TextView ();
|
||||
vbox.PackStart (textview, true, true, 0);
|
||||
|
||||
Statusbar statusbar = new Statusbar ();
|
||||
statusbar.Push (1, "Cursor at row 0 column 0 - 0 chars in document");
|
||||
vbox.PackStart (statusbar, false, false, 0);
|
||||
|
||||
//ItemFactory itemFactory = new ItemFactory (typeof (MenuBar),"<main>", accelGroup);
|
||||
|
||||
// static ItemFactoryEntry items[] = { new ItemFactoryEntry ("/_File", null, 0, 0, "<Branch>" )};
|
||||
|
||||
|
@ -53,6 +67,41 @@ namespace GtkDemo
|
|||
window.ShowAll ();
|
||||
}
|
||||
|
||||
private MenuBar CreateMenu ()
|
||||
{
|
||||
MenuBar menubar = new MenuBar ();
|
||||
MenuItem file = new MenuItem ("File");
|
||||
menubar.Append (file);
|
||||
return menubar;
|
||||
}
|
||||
|
||||
private Toolbar CreateToolbar ()
|
||||
{
|
||||
Toolbar toolbar = new Toolbar ();
|
||||
|
||||
Button open = Button.NewFromStock (Stock.Open);
|
||||
open.Clicked += new EventHandler (OnToolbarClicked);
|
||||
toolbar.AppendWidget (open, "Open", "Open");
|
||||
|
||||
Button quit = Button.NewFromStock (Stock.Quit);
|
||||
quit.Clicked += new EventHandler (OnToolbarClicked);
|
||||
toolbar.AppendWidget (quit, "Quit", "Quit");
|
||||
|
||||
Button gtk = new Button ("Gtk#");
|
||||
gtk.Clicked += new EventHandler (OnToolbarClicked);
|
||||
toolbar.AppendWidget (gtk, "Gtk#", "Gtk#");
|
||||
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
private void OnToolbarClicked (object o, EventArgs args)
|
||||
{
|
||||
MessageDialog md = new MessageDialog (window, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Close, "You selected a toolbar button.");
|
||||
md.Run ();
|
||||
md.Hide ();
|
||||
md.Dispose ();
|
||||
}
|
||||
|
||||
private void WindowDelete (object o, DeleteEventArgs args)
|
||||
{
|
||||
window.Hide ();
|
||||
|
|
Loading…
Reference in a new issue