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
|
|
|
/* Application main window
|
|
|
|
*
|
|
|
|
* Demonstrates a typical application window, with menubar, toolbar, statusbar.
|
|
|
|
*/
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using Gtk;
|
|
|
|
|
2005-04-01 21:08:14 +00:00
|
|
|
namespace GtkDemo
|
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-12-12 22:11:44 +00:00
|
|
|
[Demo ("Application Window", "DemoApplicationWindow.cs")]
|
2004-08-07 17:06:29 +00:00
|
|
|
public class DemoApplicationWindow : 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
|
|
|
Statusbar statusbar;
|
2004-12-03 21:00:33 +00:00
|
|
|
VBox vbox;
|
|
|
|
|
2005-04-01 21:08:14 +00:00
|
|
|
static DemoApplicationWindow ()
|
|
|
|
{
|
|
|
|
// Register our custom toolbar icons, for themability
|
|
|
|
|
|
|
|
Gdk.Pixbuf pixbuf = Gdk.Pixbuf.LoadFromResource ("gtk-logo-rgb.gif");
|
|
|
|
Gdk.Pixbuf transparent = pixbuf.AddAlpha (true, 0xff, 0xff, 0xff);
|
|
|
|
|
|
|
|
IconFactory factory = new IconFactory ();
|
|
|
|
factory.Add ("demo-gtk-logo", new IconSet (transparent));
|
|
|
|
factory.AddDefault ();
|
|
|
|
|
|
|
|
StockManager.Add (new StockItem ("demo-gtk-logo", "_GTK#", 0, 0, null));
|
|
|
|
}
|
|
|
|
|
2004-12-03 21:00:33 +00:00
|
|
|
const string uiInfo =
|
2005-04-01 21:08:14 +00:00
|
|
|
"<ui>" +
|
|
|
|
" <menubar name='MenuBar'>" +
|
|
|
|
" <menu action='FileMenu'>" +
|
|
|
|
" <menuitem action='New'/>" +
|
|
|
|
" <menuitem action='Open'/>" +
|
|
|
|
" <menuitem action='Save'/>" +
|
|
|
|
" <menuitem action='SaveAs'/>" +
|
|
|
|
" <separator/>" +
|
|
|
|
" <menuitem action='Quit'/>" +
|
|
|
|
" </menu>" +
|
|
|
|
" <menu action='PreferencesMenu'>" +
|
|
|
|
" <menu action='ColorMenu'>" +
|
|
|
|
" <menuitem action='Red'/>" +
|
|
|
|
" <menuitem action='Green'/>" +
|
|
|
|
" <menuitem action='Blue'/>" +
|
|
|
|
" </menu>" +
|
|
|
|
" <menu action='ShapeMenu'>" +
|
|
|
|
" <menuitem action='Square'/>" +
|
|
|
|
" <menuitem action='Rectangle'/>" +
|
|
|
|
" <menuitem action='Oval'/>" +
|
|
|
|
" </menu>" +
|
|
|
|
" <menuitem action='Bold'/>" +
|
|
|
|
" </menu>" +
|
|
|
|
" <menu action='HelpMenu'>" +
|
|
|
|
" <menuitem action='About'/>" +
|
|
|
|
" </menu>" +
|
|
|
|
" </menubar>" +
|
|
|
|
" <toolbar name='ToolBar'>" +
|
|
|
|
" <toolitem name='open' action='Open'/>" +
|
|
|
|
" <toolitem name='quit' action='Quit'/>" +
|
|
|
|
" <separator action='Sep1'/>" +
|
|
|
|
" <toolitem name='logo' action='Logo'/>" +
|
|
|
|
" </toolbar>" +
|
|
|
|
"</ui>";
|
|
|
|
|
|
|
|
public DemoApplicationWindow () : base ("Application 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
|
|
|
{
|
2005-04-01 21:08:14 +00:00
|
|
|
SetDefaultSize (200, 200);
|
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-12-03 21:00:33 +00:00
|
|
|
vbox = new VBox (false, 0);
|
2005-04-01 21:08:14 +00:00
|
|
|
Add (vbox);
|
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-12-03 21:00:33 +00:00
|
|
|
AddActions ();
|
|
|
|
|
2004-08-07 17:06:29 +00:00
|
|
|
statusbar = new Statusbar ();
|
|
|
|
UpdateStatus ();
|
2004-12-03 21:00:33 +00:00
|
|
|
vbox.PackEnd (statusbar, false, false, 0);
|
2004-08-07 17:06:29 +00:00
|
|
|
|
2005-04-01 21:08:14 +00:00
|
|
|
ScrolledWindow sw = new ScrolledWindow ();
|
|
|
|
sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
|
|
|
|
sw.ShadowType = ShadowType.In;
|
|
|
|
vbox.PackEnd (sw, true, true, 0);
|
|
|
|
|
2004-12-03 21:00:33 +00:00
|
|
|
TextView textview = new TextView ();
|
2005-04-01 21:08:14 +00:00
|
|
|
textview.Buffer.MarkSet += new MarkSetHandler (MarkSet);
|
|
|
|
sw.Add (textview);
|
|
|
|
|
|
|
|
textview.GrabFocus ();
|
|
|
|
|
|
|
|
ShowAll ();
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Color {
|
|
|
|
Red,
|
|
|
|
Green,
|
|
|
|
Blue
|
|
|
|
}
|
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
|
|
|
|
2005-04-01 21:08:14 +00:00
|
|
|
enum Shape {
|
|
|
|
Square,
|
|
|
|
Rectangle,
|
|
|
|
Oval
|
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-12-03 21:00:33 +00:00
|
|
|
|
|
|
|
void AddActions ()
|
2003-11-03 22:05:06 +00:00
|
|
|
{
|
2004-12-03 21:00:33 +00:00
|
|
|
ActionEntry[] actions = new ActionEntry[]
|
2005-04-01 21:08:14 +00:00
|
|
|
{
|
|
|
|
new ActionEntry ("FileMenu", null, "_File", null, null, null),
|
|
|
|
new ActionEntry ("PreferencesMenu", null, "_Preferences", null, null, null),
|
|
|
|
new ActionEntry ("ColorMenu", null, "_Color", null, null, null),
|
|
|
|
new ActionEntry ("ShapeMenu", null, "_Shape", null, null, null),
|
|
|
|
new ActionEntry ("HelpMenu", null, "_Help", null, null, null),
|
|
|
|
new ActionEntry ("New", Stock.New, "_New", "<control>N", "Create a new file", new EventHandler (ActionActivated)),
|
|
|
|
new ActionEntry ("Open", Stock.Open, "_Open", "<control>O", "Open a file", new EventHandler (ActionActivated)),
|
|
|
|
new ActionEntry ("Save", Stock.Save, "_Save", "<control>S", "Save current file", new EventHandler (ActionActivated)),
|
|
|
|
new ActionEntry ("SaveAs", Stock.SaveAs, "Save _As", null, "Save to a file", new EventHandler (ActionActivated)),
|
|
|
|
new ActionEntry ("Quit", Stock.Quit, "_Quit", "<control>Q", "Quit", new EventHandler (ActionActivated)),
|
|
|
|
new ActionEntry ("About", null, "_About", "<control>A", "About", new EventHandler (ActionActivated)),
|
|
|
|
new ActionEntry ("Logo", "demo-gtk-logo", null, null, "Gtk#", new EventHandler (ActionActivated))
|
|
|
|
};
|
2004-12-03 21:00:33 +00:00
|
|
|
|
|
|
|
ToggleActionEntry[] toggleActions = new ToggleActionEntry[]
|
2005-04-01 21:08:14 +00:00
|
|
|
{
|
|
|
|
new ToggleActionEntry ("Bold", Stock.Bold, "_Bold", "<control>B", "Bold", new EventHandler (ActionActivated), true)
|
|
|
|
};
|
|
|
|
|
|
|
|
RadioActionEntry[] colorActions = new RadioActionEntry[]
|
|
|
|
{
|
|
|
|
new RadioActionEntry ("Red", null, "_Red", "<control>R", "Blood", (int)Color.Red),
|
|
|
|
new RadioActionEntry ("Green", null, "_Green", "<control>G", "Grass", (int)Color.Green),
|
|
|
|
new RadioActionEntry ("Blue", null, "_Blue", "<control>B", "Sky", (int)Color.Blue)
|
|
|
|
};
|
|
|
|
|
|
|
|
RadioActionEntry[] shapeActions = new RadioActionEntry[]
|
|
|
|
{
|
|
|
|
new RadioActionEntry ("Square", null, "_Square", "<control>S", "Square", (int)Shape.Square),
|
|
|
|
new RadioActionEntry ("Rectangle", null, "_Rectangle", "<control>R", "Rectangle", (int)Shape.Rectangle),
|
|
|
|
new RadioActionEntry ("Oval", null, "_Oval", "<control>O", "Egg", (int)Shape.Oval)
|
|
|
|
};
|
|
|
|
|
|
|
|
ActionGroup group = new ActionGroup ("AppWindowActions");
|
2004-12-03 21:00:33 +00:00
|
|
|
group.Add (actions);
|
|
|
|
group.Add (toggleActions);
|
2005-04-01 21:08:14 +00:00
|
|
|
group.Add (colorActions, (int)Color.Red, new ChangedHandler (RadioActionActivated));
|
|
|
|
group.Add (shapeActions, (int)Shape.Square, new ChangedHandler (RadioActionActivated));
|
2004-12-03 21:00:33 +00:00
|
|
|
|
|
|
|
UIManager uim = new UIManager ();
|
2005-04-01 21:08:14 +00:00
|
|
|
uim.InsertActionGroup (group, 0);
|
|
|
|
uim.AddWidget += new AddWidgetHandler (AddWidget);
|
2004-12-03 21:00:33 +00:00
|
|
|
uim.AddUiFromString (uiInfo);
|
2005-04-01 21:08:14 +00:00
|
|
|
|
|
|
|
AddAccelGroup (uim.AccelGroup);
|
2003-11-03 22:05:06 +00:00
|
|
|
}
|
2005-04-01 21:08:14 +00:00
|
|
|
|
|
|
|
private void ActionActivated (object sender, EventArgs a)
|
2003-11-03 22:05:06 +00:00
|
|
|
{
|
2008-02-29 22:22:19 +00:00
|
|
|
Gtk.Action action = sender as Gtk.Action;
|
2005-04-01 21:08:14 +00:00
|
|
|
MessageDialog md;
|
|
|
|
|
|
|
|
md = new MessageDialog (this, DialogFlags.DestroyWithParent,
|
|
|
|
MessageType.Info, ButtonsType.Close,
|
|
|
|
"You activated action: \"{0}\" of type \"{1}\"",
|
|
|
|
action.Name, action.GetType ());
|
|
|
|
md.Run ();
|
|
|
|
md.Destroy ();
|
|
|
|
}
|
2004-12-03 21:00:33 +00:00
|
|
|
|
2005-04-01 21:08:14 +00:00
|
|
|
private void RadioActionActivated (object sender, ChangedArgs args)
|
|
|
|
{
|
|
|
|
RadioAction action = args.Current;
|
|
|
|
MessageDialog md;
|
|
|
|
|
|
|
|
if (action.Active) {
|
|
|
|
md = new MessageDialog (this, DialogFlags.DestroyWithParent,
|
|
|
|
MessageType.Info, ButtonsType.Close,
|
|
|
|
"You activated radio action: \"{0}\" of type \"{1}\".\nCurrent value: {2}",
|
|
|
|
action.Name, action.GetType (),
|
|
|
|
args.Current.Value);
|
2004-08-07 17:06:29 +00:00
|
|
|
md.Run ();
|
2005-04-01 21:08:14 +00:00
|
|
|
md.Destroy ();
|
2004-08-07 17:06:29 +00:00
|
|
|
}
|
2003-11-03 22:05:06 +00:00
|
|
|
}
|
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
|
|
|
|
2005-04-01 21:08:14 +00:00
|
|
|
protected override bool OnDeleteEvent (Gdk.Event evt)
|
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
|
|
|
{
|
2005-04-01 21:08:14 +00:00
|
|
|
Destroy ();
|
|
|
|
return true;
|
2004-08-07 17:06:29 +00:00
|
|
|
}
|
|
|
|
|
2005-04-01 21:08:14 +00:00
|
|
|
protected override bool OnWindowStateEvent (Gdk.EventWindowState evt)
|
|
|
|
{
|
|
|
|
if ((evt.ChangedMask & (Gdk.WindowState.Maximized | Gdk.WindowState.Fullscreen)) != 0)
|
2011-06-13 16:00:08 +00:00
|
|
|
HasResizeGrip = (evt.NewWindowState & (Gdk.WindowState.Maximized | Gdk.WindowState.Fullscreen)) == 0;
|
2005-04-01 21:08:14 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const string fmt = "Cursor at row {0} column {1} - {2} chars in document";
|
|
|
|
int row, column, count = 0;
|
|
|
|
|
|
|
|
void MarkSet (object o, MarkSetArgs args)
|
2004-08-07 17:06:29 +00:00
|
|
|
{
|
|
|
|
TextIter iter = args.Location;
|
|
|
|
row = iter.Line + 1;
|
|
|
|
column = iter.VisibleLineOffset;
|
|
|
|
count = args.Mark.Buffer.CharCount;
|
|
|
|
UpdateStatus ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void UpdateStatus ()
|
|
|
|
{
|
2005-04-01 21:08:14 +00:00
|
|
|
statusbar.Pop (0);
|
|
|
|
statusbar.Push (0, String.Format (fmt, row, column, count));
|
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-12-03 21:00:33 +00:00
|
|
|
|
2005-04-01 21:08:14 +00:00
|
|
|
void AddWidget (object sender, AddWidgetArgs a)
|
2004-12-03 21:00:33 +00:00
|
|
|
{
|
|
|
|
a.Widget.Show ();
|
|
|
|
vbox.PackStart (a.Widget, false, true, 0);
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
}
|