public override void Initialize(NodeBuilder[] builders, TreePadOption[] options, string menuPath) { base.Initialize(builders, options, menuPath); testChangedHandler = (EventHandler)DispatchService.GuiDispatch(new EventHandler(OnDetailsTestChanged)); testService.TestSuiteChanged += (EventHandler)DispatchService.GuiDispatch(new EventHandler(OnTestSuiteChanged)); paned = new VPaned(); VBox vbox = new VBox(); DockItemToolbar topToolbar = Window.GetToolbar(PositionType.Top); buttonRunAll = new Button(new Gtk.Image(Gtk.Stock.GoUp, IconSize.Menu)); buttonRunAll.Clicked += new EventHandler(OnRunAllClicked); buttonRunAll.Sensitive = true; buttonRunAll.TooltipText = GettextCatalog.GetString("Run all tests"); topToolbar.Add(buttonRunAll); buttonRun = new Button(new Gtk.Image(Gtk.Stock.Execute, IconSize.Menu)); buttonRun.Clicked += new EventHandler(OnRunClicked); buttonRun.Sensitive = true; buttonRun.TooltipText = GettextCatalog.GetString("Run test"); topToolbar.Add(buttonRun); buttonStop = new Button(new Gtk.Image(Gtk.Stock.Stop, IconSize.Menu)); buttonStop.Clicked += new EventHandler(OnStopClicked); buttonStop.Sensitive = false; buttonStop.TooltipText = GettextCatalog.GetString("Cancel running test"); topToolbar.Add(buttonStop); topToolbar.ShowAll(); vbox.PackEnd(base.Control, true, true, 0); vbox.FocusChain = new Gtk.Widget [] { base.Control }; paned.Pack1(vbox, true, true); detailsPad = new VBox(); EventBox eb = new EventBox(); HBox header = new HBox(); eb.Add(header); detailLabel = new HeaderLabel(); detailLabel.Padding = 6; Button hb = new Button(new Gtk.Image("gtk-close", IconSize.SmallToolbar)); hb.Relief = ReliefStyle.None; hb.Clicked += new EventHandler(OnCloseDetails); header.PackEnd(hb, false, false, 0); hb = new Button(new Gtk.Image("gtk-go-back", IconSize.SmallToolbar)); hb.Relief = ReliefStyle.None; hb.Clicked += new EventHandler(OnGoBackTest); header.PackEnd(hb, false, false, 0); header.Add(detailLabel); Gdk.Color hcol = eb.Style.Background(StateType.Normal); hcol.Red = (ushort)(((double)hcol.Red) * 0.9); hcol.Green = (ushort)(((double)hcol.Green) * 0.9); hcol.Blue = (ushort)(((double)hcol.Blue) * 0.9); // eb.ModifyBg (StateType.Normal, hcol); detailsPad.PackStart(eb, false, false, 0); VPaned panedDetails = new VPaned(); panedDetails.BorderWidth = 3; VBox boxPaned1 = new VBox(); chart = new TestChart(); chart.ButtonPressEvent += OnChartButtonPress; chart.SelectionChanged += new EventHandler(OnChartDateChanged); chart.HeightRequest = 50; Toolbar toolbar = new Toolbar(); toolbar.IconSize = IconSize.SmallToolbar; toolbar.ToolbarStyle = ToolbarStyle.Icons; toolbar.ShowArrow = false; ToolButton but = new ToolButton("gtk-zoom-in"); but.Clicked += new EventHandler(OnZoomIn); toolbar.Insert(but, -1); but = new ToolButton("gtk-zoom-out"); but.Clicked += new EventHandler(OnZoomOut); toolbar.Insert(but, -1); but = new ToolButton("gtk-go-back"); but.Clicked += new EventHandler(OnChartBack); toolbar.Insert(but, -1); but = new ToolButton("gtk-go-forward"); but.Clicked += new EventHandler(OnChartForward); toolbar.Insert(but, -1); but = new ToolButton("gtk-goto-last"); but.Clicked += new EventHandler(OnChartLast); toolbar.Insert(but, -1); boxPaned1.PackStart(toolbar, false, false, 0); boxPaned1.PackStart(chart, true, true, 0); panedDetails.Pack1(boxPaned1, false, false); // Detailed test information -------- infoBook = new ButtonNotebook(); infoBook.PageLoadRequired += new EventHandler(OnPageLoadRequired); // Info - Group summary Frame tf = new Frame(); ScrolledWindow sw = new ScrolledWindow(); detailsTree = new TreeView(); detailsTree.HeadersVisible = true; detailsTree.RulesHint = true; detailsStore = new ListStore(typeof(object), typeof(string), typeof(string), typeof(string), typeof(string)); CellRendererText trtest = new CellRendererText(); CellRendererText tr; TreeViewColumn col3 = new TreeViewColumn(); col3.Expand = false; // col3.Alignment = 0.5f; col3.Widget = new Gtk.Image(CircleImage.Success); col3.Widget.Show(); tr = new CellRendererText(); // tr.Xalign = 0.5f; col3.PackStart(tr, false); col3.AddAttribute(tr, "markup", 2); detailsTree.AppendColumn(col3); TreeViewColumn col4 = new TreeViewColumn(); col4.Expand = false; // col4.Alignment = 0.5f; col4.Widget = new Gtk.Image(CircleImage.Failure); col4.Widget.Show(); tr = new CellRendererText(); // tr.Xalign = 0.5f; col4.PackStart(tr, false); col4.AddAttribute(tr, "markup", 3); detailsTree.AppendColumn(col4); TreeViewColumn col5 = new TreeViewColumn(); col5.Expand = false; // col5.Alignment = 0.5f; col5.Widget = new Gtk.Image(CircleImage.NotRun); col5.Widget.Show(); tr = new CellRendererText(); // tr.Xalign = 0.5f; col5.PackStart(tr, false); col5.AddAttribute(tr, "markup", 4); detailsTree.AppendColumn(col5); TreeViewColumn col1 = new TreeViewColumn(); // col1.Resizable = true; // col1.Expand = true; col1.Title = "Test"; col1.PackStart(trtest, true); col1.AddAttribute(trtest, "markup", 1); detailsTree.AppendColumn(col1); detailsTree.Model = detailsStore; sw.Add(detailsTree); tf.Add(sw); tf.ShowAll(); TestSummaryPage = infoBook.AddPage(GettextCatalog.GetString("Summary"), tf); // Info - Regressions list tf = new Frame(); sw = new ScrolledWindow(); tf.Add(sw); regressionTree = new TreeView(); regressionTree.HeadersVisible = false; regressionTree.RulesHint = true; regressionStore = new ListStore(typeof(object), typeof(string), typeof(Pixbuf)); CellRendererText trtest2 = new CellRendererText(); var pr = new CellRendererPixbuf(); TreeViewColumn col = new TreeViewColumn(); col.PackStart(pr, false); col.AddAttribute(pr, "pixbuf", 2); col.PackStart(trtest2, false); col.AddAttribute(trtest2, "markup", 1); regressionTree.AppendColumn(col); regressionTree.Model = regressionStore; sw.Add(regressionTree); tf.ShowAll(); TestRegressionsPage = infoBook.AddPage(GettextCatalog.GetString("Regressions"), tf); // Info - Failed tests list tf = new Frame(); sw = new ScrolledWindow(); tf.Add(sw); failedTree = new TreeView(); failedTree.HeadersVisible = false; failedTree.RulesHint = true; failedStore = new ListStore(typeof(object), typeof(string), typeof(Pixbuf)); trtest2 = new CellRendererText(); pr = new CellRendererPixbuf(); col = new TreeViewColumn(); col.PackStart(pr, false); col.AddAttribute(pr, "pixbuf", 2); col.PackStart(trtest2, false); col.AddAttribute(trtest2, "markup", 1); failedTree.AppendColumn(col); failedTree.Model = failedStore; sw.Add(failedTree); tf.ShowAll(); TestFailuresPage = infoBook.AddPage(GettextCatalog.GetString("Failed tests"), tf); // Info - results tf = new Frame(); sw = new ScrolledWindow(); tf.Add(sw); resultView = new TextView(); resultView.Editable = false; sw.Add(resultView); tf.ShowAll(); TestResultPage = infoBook.AddPage(GettextCatalog.GetString("Result"), tf); // Info - Output tf = new Frame(); sw = new ScrolledWindow(); tf.Add(sw); outputView = new TextView(); outputView.Editable = false; sw.Add(outputView); tf.ShowAll(); TestOutputPage = infoBook.AddPage(GettextCatalog.GetString("Output"), tf); panedDetails.Pack2(infoBook, true, true); detailsPad.PackStart(panedDetails, true, true, 0); paned.Pack2(detailsPad, true, true); paned.ShowAll(); infoBook.HidePage(TestResultPage); infoBook.HidePage(TestOutputPage); infoBook.HidePage(TestSummaryPage); infoBook.HidePage(TestRegressionsPage); infoBook.HidePage(TestFailuresPage); detailsPad.Sensitive = false; detailsPad.Hide(); detailsTree.RowActivated += new Gtk.RowActivatedHandler(OnTestActivated); regressionTree.RowActivated += new Gtk.RowActivatedHandler(OnRegressionTestActivated); failedTree.RowActivated += new Gtk.RowActivatedHandler(OnFailedTestActivated); foreach (UnitTest t in testService.RootTests) { TreeView.AddChild(t); } }
void OnCloseDetails(object sender, EventArgs args) { detailsPad.Hide(); }
public void SetEnemy(string selectedStr) { GtkHelpers.FlushAllDeferredEvents(); Destroyed += EnemyEditLayout_Destroyed; if (null != Layout) { Layout.Hide(); Layout.Destroy(); Layout = null; } Enemies = LevelManager.GetEnemies(); Enemy = null; for (int i = 0; i < Enemies.Count; i++) { if (Enemies[i].Name == selectedStr) { Enemy = Enemies[i]; } } if (Enemy == null) { throw new Exception("Could not find Enemy " + selectedStr); } Layout = new VBox(false, 0); AddWithViewport(Layout); HBox field = GtkHelpers.TextEntryField("Enemy Name", Enemy.Name, Name_Changed, true); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.TextEntryField("Asset", Enemy.Asset, Asset_Changed, true); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.TextEntryField("Hit Points", Enemy.HitPoints.ToString(), HitPoints_Changed, true, GtkHelpers.ValueType.Int); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.TextEntryField("Movement Speed", Enemy.MovementSpeed.ToString(), MovementSpeed_Changed, true, GtkHelpers.ValueType.Float); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.TextEntryField("Spawn Rate", Enemy.SpawnRate.ToString(), SpawnRate_Changed, true, GtkHelpers.ValueType.Float); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.TextEntryField("Coins", Enemy.Coins.ToString(), Coins_Changed, true, GtkHelpers.ValueType.Float); Layout.PackStart(field, false, false, 0); field.Show(); Show(); ShowAll(); }
public PListEditorSection() { AddWithViewport(content); ShowAll(); content.Hide(); }
public void SetProjectile(string selectedStr) { GtkHelpers.FlushAllDeferredEvents(); Destroyed += ProjectileEditLayout_Destroyed; if (null != Layout) { Layout.Hide(); Layout.Destroy(); Layout = null; } Projectiles = LevelManager.GetProjectiles(); Projectile = null; for (int i = 0; i < Projectiles.Count; i++) { if (Projectiles[i].Name == selectedStr) { Projectile = Projectiles[i]; } } if (Projectile == null) { throw new Exception("Could not find Projectile " + selectedStr); } Layout = new VBox(false, 0); AddWithViewport(Layout); HBox field = GtkHelpers.TextEntryField("Projectile Name", Projectile.Name, Name_Changed, true); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.TextEntryField("Asset", Projectile.Asset, Asset_Changed, true); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.TextEntryField("Impact Asset", Projectile.ImpactAsset, ImpactAsset_Changed, true); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.TextEntryField("AirSpeed", Projectile.AirSpeed.ToString(), AirSpeed_Changed, true, GtkHelpers.ValueType.Float); Layout.PackStart(field, false, false, 0); field.Show(); EffectsTree = new TreeView(); Layout.PackStart(EffectsTree, false, false, 0); EffectsTree.Show(); ComboBoxText comboBox = new ComboBoxText(); foreach (string name in Enum.GetNames(typeof(ProjectileEffectType))) { comboBox.AppendText(name); } comboBox.Active = 0; TreeViewColumn typeCoumn = new TreeViewColumn(); TreeViewColumn impactColumn = new TreeViewColumn(); TreeViewColumn durationColumn = new TreeViewColumn(); TreeViewColumn radiusColumn = new TreeViewColumn(); CellRendererText durationCellRenderer = new CellRendererText(); durationCellRenderer.Editable = true; durationCellRenderer.Edited += DurationCell_Edited; CellRendererText impactCellRenderer = new CellRendererText(); impactCellRenderer.Editable = true; impactCellRenderer.Edited += ImpactCell_Edited; CellRendererText radiusCellRenderer = new CellRendererText(); radiusCellRenderer.Editable = true; radiusCellRenderer.Edited += RadiusCellRenderer_Edited; CellRendererCombo comboCellRenderer = new CellRendererCombo(); comboCellRenderer.Editable = true; comboCellRenderer.Edited += ComboCellRenderer_Edited; comboCellRenderer.TextColumn = 0; comboCellRenderer.HasEntry = false; typeCoumn.PackStart(comboCellRenderer, true); typeCoumn.Title = "Type"; typeCoumn.AddAttribute(comboCellRenderer, "text", 1); EffectsTree.AppendColumn(typeCoumn); durationColumn.PackStart(durationCellRenderer, true); durationColumn.Title = "Duration"; durationColumn.AddAttribute(durationCellRenderer, "text", 2); EffectsTree.AppendColumn(durationColumn); impactColumn.PackStart(impactCellRenderer, true); impactColumn.Title = "Impact"; impactColumn.AddAttribute(impactCellRenderer, "text", 3); EffectsTree.AppendColumn(impactColumn); radiusColumn.PackStart(radiusCellRenderer, true); radiusColumn.Title = "Radius"; radiusColumn.AddAttribute(radiusCellRenderer, "text", 4); EffectsTree.AppendColumn(radiusColumn); EffectsModel = new ListStore(typeof(int), typeof(string), typeof(float), typeof(float), typeof(float)); EffectsTree.Model = EffectsModel; EffectsTree.Selection.Mode = SelectionMode.Single; PopulateTreeWithEffects(); field = new HBox(false, 5); Layout.PackStart(field, false, false, 0); field.Show(); Button b = new Button("+"); b.Clicked += NewEffect_Clicked; b.Show(); field.PackStart(b, false, false, 0); b = new Button("-"); b.Clicked += RemoveEffect_Clicked; b.Show(); field.PackStart(b, false, false, 0); Show(); ShowAll(); }