2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using Gtk;
|
|
|
|
|
|
|
|
namespace GtkDemo
|
|
|
|
{
|
2004-08-07 17:06:29 +00:00
|
|
|
public class DemoButtonBox : Gtk.Window
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
{
|
2004-08-07 17:06:29 +00:00
|
|
|
public DemoButtonBox () : base ("Button Boxes")
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
{
|
2004-08-07 17:06:29 +00:00
|
|
|
this.DeleteEvent += new DeleteEventHandler (WindowDelete);
|
|
|
|
this.BorderWidth = 10;
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
|
|
|
|
// Add Vertical Box
|
|
|
|
VBox mainVbox = new VBox (false,0);
|
2004-08-07 17:06:29 +00:00
|
|
|
this.Add (mainVbox);
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
|
|
|
|
// Add Horizontal Frame
|
|
|
|
Frame horizontalFrame = new Frame ("Horizontal Button Boxes");
|
|
|
|
mainVbox.PackStart (horizontalFrame);
|
|
|
|
VBox vbox = new VBox (false, 0) ;
|
|
|
|
vbox.BorderWidth = 10;
|
|
|
|
horizontalFrame.Add (vbox);
|
|
|
|
|
|
|
|
// Pack Buttons
|
|
|
|
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));
|
|
|
|
|
|
|
|
// Add Vertical Frame
|
|
|
|
Frame verticalFrame = new Frame ("Vertical Button Boxes");
|
|
|
|
mainVbox.PackStart (verticalFrame);
|
|
|
|
HBox hbox = new HBox (false, 0);
|
|
|
|
hbox.BorderWidth = 10;
|
|
|
|
verticalFrame.Add (hbox);
|
|
|
|
|
|
|
|
// Pack Buttons
|
|
|
|
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));
|
|
|
|
|
2004-08-07 17:06:29 +00:00
|
|
|
this.ShowAll ();
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Create a Button Box with the specified parameters
|
|
|
|
private Frame CreateButtonBox (bool horizontal, string title, int spacing, int childW , int childH , ButtonBoxStyle layout)
|
|
|
|
{
|
|
|
|
Frame frame = new Frame (title);
|
|
|
|
Gtk.ButtonBox bbox ;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2003-11-20 01:07:35 +00:00
|
|
|
Button buttonOk = new Button (Stock.Ok);
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
bbox.Add (buttonOk);
|
2003-11-20 01:07:35 +00:00
|
|
|
Button buttonCancel = new Button (Stock.Cancel);
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
bbox.Add (buttonCancel);
|
2003-11-20 01:07:35 +00:00
|
|
|
Button buttonHelp = new Button (Stock.Help);
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
bbox.Add (buttonHelp);
|
|
|
|
|
|
|
|
return frame;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void WindowDelete (object o, DeleteEventArgs args)
|
|
|
|
{
|
2004-08-07 17:06:29 +00:00
|
|
|
this.Hide ();
|
|
|
|
this.Destroy ();
|
|
|
|
args.RetVal = true;
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|