// Widgets: [AgRule("Widget", "Form")] static Box FormWidget(Ast n) { Window window = new Window("Questionnaire"); window.SetDefaultSize(300, 600); window.DeleteEvent += (object o, DeleteEventArgs a) => { Application.Quit(); }; VBox contentBox = new VBox(false, 5); ScrolledWindow scroller = new ScrolledWindow(); scroller.AddWithViewport(contentBox); Toolbar toolbar = new Toolbar(); toolbar.ToolbarStyle = ToolbarStyle.Icons; ToolButton open = new ToolButton(Stock.Open); ToolButton save = new ToolButton(Stock.Save); ToolButton quit = new ToolButton(Stock.Quit); open.Clicked += (object o, EventArgs a) => { OpenQuestionnaire(n); }; save.Clicked += (object o, EventArgs a) => { SaveQuestionnaire(n); }; quit.Clicked += (object o, EventArgs a) => { Application.Quit(); }; toolbar.Insert(open, 0); toolbar.Insert(save, 1); toolbar.Insert(quit, 2); VBox windowBox = new VBox(false, 0); windowBox.PackStart(toolbar, false, false, 0); if (!n.IsValid()) { Image warning = new Image(Stock.DialogWarning, IconSize.Dialog); windowBox.PackStart(warning, false, false, 0); } windowBox.PackStart(scroller, true, true, 0); window.Add(windowBox); window.ShowAll(); return(contentBox); }