//destroy everything but our tray icon, main window, and our notification bubble private void DestroyMostlyEverything() { if (hbox != null) { hbox.Destroy(); } if (vbox != null) { vbox.Destroy(); } if (newi != null) { newi.Destroy(); } if (menuBar != null) { menuBar.Destroy(); } if (filemenu != null) { filemenu.Destroy(); } if (file != null) { file.Destroy(); } if (sep != null) { sep.Destroy(); } if (exit != null) { exit.Destroy(); } if (uploadButton != null) { uploadButton.Destroy(); } if (toCropBox != null) { toCropBox.Destroy(); } if (agr != null) { agr.Dispose(); } }
private void UpdateAllFuelBalance() { if (allBalanceVBox != null) { allBalanceVBox.Destroy(); } allBalanceVBox = new VBox(); var itemHBox = new HBox(); var itemVoxLeft = new VBox(); var itemVoxRight = new VBox(); foreach (var item in ViewModel.AllFuelsBalance) { itemVoxLeft.Add(new Label { LabelProp = $"{item.Key.Name}:", Xalign = 0 }); itemVoxRight.Add(new Label { LabelProp = $"{item.Value.ToString(" 0.##")} л.", Xalign = 0 }); } itemHBox.Add(itemVoxLeft); itemHBox.Add(itemVoxRight); allBalanceVBox.Add(itemHBox); allBalanceVBox.ShowAll(); vboxAllBalance.Add(allBalanceVBox); }
public void Clear() { if (contentBox != null) { contentBox.Destroy(); } noContentLabel = new Label(); noContentLabel.Text = noContentMessage; noContentLabel.Xalign = 0F; noContentLabel.Justify = Justification.Left; noContentLabel.SetPadding(6, 6); addButton = new Button(); addButton.Label = addMessage; // addButton.Relief = ReliefStyle.None; addButton.Clicked += delegate { OnCreateNew(EventArgs.Empty); }; contentBox = new VBox(); contentBox.PackStart(this.noContentLabel, true, true, 6); var hbox = new HBox(); hbox.PackStart(addButton, false, false, 0); contentBox.PackEnd(hbox, false, false, 0); PackStart(contentBox, true, true, 6); ShowAll(); }
public GeneralTextEditorPanelWidget() : base("EditorBindings.glade", "GeneralTextEditorPanel") { encodingBox.Destroy(); // this is a really dirty way of hiding encodingBox, but Hide() doesn't work enableCodeCompletionCheckBox.Active = TextEditorProperties.EnableCodeCompletion; enableAutoCorrectionCheckBox.Active = TextEditorProperties.EnableAutoCorrection; enableFoldingCheckBox.Active = TextEditorProperties.EnableFolding; showClassMethodCheckBox.Active = TextEditorProperties.ShowClassBrowser; switch (TextEditorProperties.FontType) { case EditorFontType.DefaultMonospace: use_monospace.Active = true; fontNameDisplayTextBox.Sensitive = false; break; case EditorFontType.DefaultSans: use_sans.Active = true; fontNameDisplayTextBox.Sensitive = false; break; default: use_cust.Active = true; fontNameDisplayTextBox.FontName = TextEditorProperties.FontName; fontNameDisplayTextBox.Sensitive = true; break; } use_monospace.Toggled += new EventHandler(ItemToggled); use_sans.Toggled += new EventHandler(ItemToggled); use_cust.Toggled += new EventHandler(ItemToggled); // encVBox.TextWithMnemonic = StringParserService.Parse( // "${res:Dialog.Options.IDEOptions.TextEditor.General.FontGroupBox.FileEncodingLabel}"); // Menu m = new Menu (); // foreach (String name in CharacterEncodings.Names) { // m.Append (new MenuItem (name)); // } // textEncodingComboBox.Menu = m; // int i = 0; // try { // Console.WriteLine("Getting encoding Property"); // i = CharacterEncodings.GetEncodingIndex( // (Int32)((Properties) CustomizationObject).Get("Encoding", encoding)); // } catch { // Console.WriteLine("Getting encoding Default"); // i = CharacterEncodings.GetEncodingIndex(encoding); // } // selectedIndex = i; // encoding = CharacterEncodings.GetEncodingByIndex(i).CodePage; // textEncodingComboBox.Changed += new EventHandler (OnOptionChanged); }
public bool CloseWindow(bool force, bool fromMenu, int pageNum) { bool wasActive = workbench.ActiveWorkbenchWindow == this; WorkbenchWindowEventArgs args = new WorkbenchWindowEventArgs(force, wasActive); args.Cancel = false; OnClosing(args); if (args.Cancel) { return(false); } if (fromMenu == true) { workbench.RemoveTab(tabControl.PageNum(this)); } else { workbench.RemoveTab(pageNum); } OnClosed(args); content.ContentNameChanged -= new EventHandler(SetTitleEvent); content.DirtyChanged -= new EventHandler(SetTitleEvent); content.BeforeSave -= new EventHandler(BeforeSave); content.ContentChanged -= new EventHandler(OnContentChanged); content.WorkbenchWindow = null; if (subViewContents != null) { foreach (IAttachableViewContent sv in subViewContents) { subViewNotebook.Remove(sv.Control); sv.Dispose(); } this.subViewContents = null; subViewNotebook.Remove(content.Control); } DetachFromPathedDocument(); content.Dispose(); box.Destroy(); this.subViewToolbar = null; this.separatorItem = null; this.content = null; this.subViewNotebook = null; this.tabControl = null; tabLabel.Destroy(); this.tabLabel = null; this.tabPage = null; Destroy(); return(true); }
public override void Dispose() { Clear(); if (box != null) { box.Dispose(); box.Destroy(); } base.Dispose(); }
/// <summary>Main widget destroyed handler</summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainWidgetDestroyed(object sender, EventArgs e) { topBox.Destroy(); SummaryCheckBox.MainWidget.Destroy(); WarningCheckBox.MainWidget.Destroy(); ErrorCheckBox.MainWidget.Destroy(); middleBox.Destroy(); SimulationDropDown.MainWidget.Destroy(); mainControl.Destroy(); HtmlView.MainWidget.Destroy(); mainWidget.Destroyed -= MainWidgetDestroyed; owner = null; }
/// <summary>Main widget destroyed handler</summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainWidgetDestroyed(object sender, EventArgs e) { try { btnJumpToSimLog.Clicked -= OnJumpToSimulationLog; topBox.Destroy(); SummaryCheckBox.MainWidget.Destroy(); WarningCheckBox.MainWidget.Destroy(); ErrorCheckBox.MainWidget.Destroy(); middleBox.Destroy(); SimulationDropDown.MainWidget.Destroy(); mainControl.Destroy(); ((ViewBase)SummaryDisplay).MainWidget.Destroy(); mainWidget.Destroyed -= MainWidgetDestroyed; owner = null; } catch (Exception err) { ShowError(err); } }
private void UpdateSubdivisionFuelBalance() { if (subdivisionsBalanceVBox != null) { subdivisionsBalanceVBox.Destroy(); } subdivisionsBalanceVBox = new VBox(); foreach (var cashSubdivision in ViewModel.SubdivisionsFuelsBalance) { if (!cashSubdivision.Value.Any()) { continue; } subdivisionsBalanceVBox.Add(new Label("")); subdivisionsBalanceVBox.Add(new Label { LabelProp = cashSubdivision.Key.Name, Xalign = 0 }); var itemHBox = new HBox(); var itemVoxLeft = new VBox(); var itemVoxRight = new VBox(); foreach (var item in cashSubdivision.Value) { itemVoxLeft.Add(new Label { LabelProp = $"{item.Key.Name}:", Xalign = 0 }); itemVoxRight.Add(new Label { LabelProp = $"{item.Value.ToString("0.##")} л.", Xalign = 0 }); } itemHBox.Add(itemVoxLeft); itemHBox.Add(itemVoxRight); subdivisionsBalanceVBox.Add(itemHBox); } subdivisionsBalanceVBox.ShowAll(); vboxSubdivisionsBalance.Add(subdivisionsBalanceVBox); }
public void SetTurret(string selectedStr) { GtkHelpers.FlushAllDeferredEvents(); Destroyed += TurretEditLayout_Destroyed; if (null != Layout) { Layout.Hide(); Layout.Destroy(); Layout = null; FireRateField = null; DPSfield = null; } Turrets = LevelManager.GetTurrets(); for (int i = 0; i < Turrets.Count; i++) { if (Turrets[i].Name == selectedStr) { Turret = Turrets[i]; } } Layout = new VBox(false, 0); AddWithViewport(Layout); HBox field = GtkHelpers.TextEntryField("Turret Name", Turret.Name, Name_Changed, true); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.TextEntryField("Asset", Turret.Asset, Asset_Changed, true); Layout.PackStart(field, false, false, 0); field.Show(); FireRateField = GtkHelpers.TextEntryField("Fire Rate", Turret.FireRate.ToString(), FireRate_Changed, true, GtkHelpers.ValueType.Float); Layout.PackStart(FireRateField, false, false, 0); FireRateField.Show(); field = GtkHelpers.TextEntryField("Range", Turret.Range.ToString(), Range_Changed, true, GtkHelpers.ValueType.Float); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.TextEntryField("Cost", Turret.Cost.ToString(), Cost_Changed, true, GtkHelpers.ValueType.Float); Layout.PackStart(field, false, false, 0); field.Show(); List <Projectile> projectiles = LevelManager.GetProjectiles(); ProjectileNames = new List <string>(); int currIndex = 0; for (int i = 0; i < projectiles.Count; i++) { ProjectileNames.Add(projectiles[i].Name); if (projectiles[i].Name == Turret.Projectile) { currIndex = i; } } field = GtkHelpers.ComboBox("Projectile", ProjectileNames.ToArray(), currIndex, Projectile_Changed, true); Layout.PackStart(field, false, false, 0); field.Show(); DPSfield = GtkHelpers.TextEntryField("Damage per Sec", Turret.Cost.ToString(), DPS_Changed, true, GtkHelpers.ValueType.Float); Layout.PackStart(DPSfield, false, false, 0); DPSfield.Show(); RecalculateDPS(); Show(); ShowAll(); }
private void Populate() { bool categorised = PropertySort == System.Windows.Forms.PropertySort.Categorized; if (currentObject != null) { properties = selectedTab.GetProperties(currentObject); } else { properties = new PropertyDescriptorCollection(new PropertyDescriptor[0] { }); } //kill existing table if (expanderBox != null) { expanderBox.Destroy(); expanderBox = null; } Rows.Clear(); //transcribe browsable properties ArrayList sorted = new ArrayList(); foreach (PropertyDescriptor descriptor in properties) { if (descriptor.IsBrowsable) { sorted.Add(descriptor); } } //expands to fill empty space EventBox bottomWidget = new EventBox(); bottomWidget.ModifyBg(StateType.Normal, new Gdk.Color(0xff, 0xff, 0xff)); bottomWidget.CanFocus = true; bottomWidget.ButtonPressEvent += on_bottomWidget_ButtonPressEvent; expanderBox = new VBox(); //how are we displaying it? if (!categorised) { sorted.Sort(new SortByName()); table = BuildTable(sorted); expanderBox.PackStart(table, false, false, 0); } else { sorted.Sort(new SortByCat()); ArrayList tabList = new ArrayList(); string oldCat = ""; int oldIndex = 0; Expander catHead = null; for (int i = 0; i < sorted.Count; i++) { PropertyDescriptor pd = (PropertyDescriptor)sorted[i]; //Create category header if (pd.Category != oldCat) { if (catHead != null) { Table t = BuildTable(sorted.GetRange(oldIndex, i - oldIndex)); catHead.Add(t); } catHead = new Expander("<b>" + pd.Category + "</b>"); ((Label)catHead.LabelWidget).UseMarkup = true; catHead.Expanded = true; expanderBox.PackStart(catHead, false, false, 0); oldCat = pd.Category; oldIndex = i; } } if (catHead != null) { Table t = BuildTable(sorted.GetRange(oldIndex, sorted.Count - oldIndex)); catHead.Add(t); } //TODO: Find better way of getting all tables same size, maybe resizable int maxwidth = 1; foreach (GridRow pgr in Rows) { int width = pgr.propertyNameLabel.SizeRequest().Width; if (width > maxwidth) { maxwidth = width; } } foreach (GridRow pgr in Rows) { pgr.propertyNameLabel.WidthRequest = maxwidth; } } expanderBox.PackStart(bottomWidget, true, true, 1); scrolledWindow.AddWithViewport(expanderBox); expanderBox.ShowAll(); }
public void SetLevel(LevelDescription desc) { GtkHelpers.FlushAllDeferredEvents(); Destroyed += LevelAnalysisLayout_Destroyed; if (null != Layout) { Layout.Hide(); Layout.Destroy(); Layout = null; SaveSolutionColumn = null; LoadSolutionColumn = null; } LevelDesc = desc; LoadAndValidateLevelDesc(); Solution = LevelManager.ReadLevelSolution(desc.Name); if (null == Solution) { Solution = new LevelSolution(); Solution.AssumedHandMissileFrequency = HandMissileFreqency; Solution.AssumedHandMissileAvgDamagePct = HandMissileDamantPctAverage; } TurretSelections = new Dictionary <int, int>(); RecalculateAllStats(); Layout = new VBox(false, 0); AddWithViewport(Layout); HBox field = GtkHelpers.ReadOnlyTextField("Level Name", desc.Name); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.ReadOnlyTextField("Lives", desc.Lives.ToString()); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.ReadOnlyTextField("Starting Coins", desc.StartingCoins.ToString()); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.TextEntryField("Hand Missile Frequency (sec)", HandMissileFreqency.ToString(), AssumedFireRatePerSecChanged_Changed, true, GtkHelpers.ValueType.Float); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.TextEntryField("Hand Missile Average Accuracy Handicap", HandMissileDamantPctAverage.ToString(), AssumedHandMissileAccuracyHandicap_Changed, true, GtkHelpers.ValueType.Float); Layout.PackStart(field, false, false, 0); field.Show(); WavesTree = new TreeView(); Layout.PackStart(WavesTree, false, false, 0); WavesTree.Show(); WavesTree.ButtonReleaseEvent += WavesTree_ButtonReleaseEvent; List <EnemyDescription> enemies = LevelManager.GetEnemies(); ComboBoxText comboBox = new ComboBoxText(); foreach (EnemyDescription enemy in enemies) { comboBox.AppendText(enemy.Name); } comboBox.Active = 0; TreeViewColumn enemyCoumn = new TreeViewColumn(); TreeViewColumn countColumn = new TreeViewColumn(); TreeViewColumn difficultyColumn = new TreeViewColumn(); TreeViewColumn singleEnemyColumn = new TreeViewColumn(); TreeViewColumn maxHPPSColumn = new TreeViewColumn(); TreeViewColumn maxDPSColumn = new TreeViewColumn(); TreeViewColumn simColumn = new TreeViewColumn(); TreeViewColumn turretCostVsMaxCoin = new TreeViewColumn(); TreeViewColumn issuesColumn = new TreeViewColumn(); CellRendererText textCellRenderer = new CellRendererText(); textCellRenderer.Editable = false; enemyCoumn.PackStart(textCellRenderer, true); enemyCoumn.Title = "Enemy"; enemyCoumn.AddAttribute(textCellRenderer, "text", 1); WavesTree.AppendColumn(enemyCoumn); countColumn.PackStart(textCellRenderer, true); countColumn.Title = "Count"; countColumn.AddAttribute(textCellRenderer, "text", 2); WavesTree.AppendColumn(countColumn); difficultyColumn.PackStart(textCellRenderer, true); difficultyColumn.Title = "Difficulty Multiplier"; difficultyColumn.AddAttribute(textCellRenderer, "text", 3); WavesTree.AppendColumn(difficultyColumn); // // Add column: Max damage that can be dished to a single enemy given turret coverage + enemy speed // singleEnemyColumn.PackStart(textCellRenderer, true); singleEnemyColumn.Title = "Single Enemy Damage"; singleEnemyColumn.AddAttribute(textCellRenderer, "text", 4); WavesTree.AppendColumn(singleEnemyColumn); // // Add column: Max hit points of the wave // maxHPPSColumn.PackStart(textCellRenderer, true); maxHPPSColumn.Title = "Max Hitpoints/s"; maxHPPSColumn.AddAttribute(textCellRenderer, "text", 5); WavesTree.AppendColumn(maxHPPSColumn); // // Add column: Max damage of all the turrets combined firing at full capacity // maxDPSColumn.PackStart(textCellRenderer, true); maxDPSColumn.Title = "Max DPS overall"; maxDPSColumn.AddAttribute(textCellRenderer, "text", 6); WavesTree.AppendColumn(maxDPSColumn); // // Add column: Simulated damage / kills // simColumn.PackStart(textCellRenderer, true); simColumn.Title = "Sim damage/kills"; simColumn.AddAttribute(textCellRenderer, "text", 7); WavesTree.AppendColumn(simColumn); // // Add column: Max coin earned by start of wave // turretCostVsMaxCoin.PackStart(textCellRenderer, true); turretCostVsMaxCoin.Title = "Coin Need/Avail"; turretCostVsMaxCoin.AddAttribute(textCellRenderer, "text", 8); WavesTree.AppendColumn(turretCostVsMaxCoin); // // Solution save/load // SaveSolutionColumn = new TreeViewColumn(); LoadSolutionColumn = new TreeViewColumn();; SaveSolutionColumn.PackStart(textCellRenderer, true); SaveSolutionColumn.Title = "Save Solution"; SaveSolutionColumn.AddAttribute(textCellRenderer, "text", 9); WavesTree.AppendColumn(SaveSolutionColumn); LoadSolutionColumn.PackStart(textCellRenderer, true); LoadSolutionColumn.Title = "Load Solution"; LoadSolutionColumn.AddAttribute(textCellRenderer, "text", 10); WavesTree.AppendColumn(LoadSolutionColumn); // // Add column: Issues // issuesColumn.PackStart(textCellRenderer, true); issuesColumn.Title = "Issues"; issuesColumn.AddAttribute(textCellRenderer, "markup", 11); WavesTree.AppendColumn(issuesColumn); WavesModel = new ListStore(typeof(int), typeof(string), typeof(int), typeof(float), typeof(float), typeof(float), typeof(float), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string)); WavesTree.Model = WavesModel; WavesTree.Selection.Mode = SelectionMode.Single; PopulateTreeWithWaves(desc); Table map = GetFieldTable(desc); Layout.PackStart(map, false, true, 0); map.Show(); // // Allowed turrets // field = new HBox(true, 10); Layout.PackStart(field, true, false, 0); field.Show(); AllowedTurretTree = new TreeView(); TreeViewColumn availCol = new TreeViewColumn(); TreeViewColumn allowedCol = new TreeViewColumn(); allowedCol.PackStart(textCellRenderer, true); allowedCol.Title = "Allowed Turrets"; allowedCol.AddAttribute(textCellRenderer, "text", 1); AllowedTurretTree.AppendColumn(allowedCol); AllowedTurretModel = new ListStore(typeof(int), typeof(string)); AllowedTurretTree.Model = AllowedTurretModel; AllowedTurretTree.Selection.Mode = SelectionMode.Multiple; field.PackEnd(AllowedTurretTree, true, true, 0); AllowedTurretTree.Show(); PopulateTurretTrees(desc); Show(); ShowAll(); }
public void SetLevel(LevelDescription desc) { GtkHelpers.FlushAllDeferredEvents(); Destroyed += LevelEditLayout_Destroyed; if (null != Layout) { Layout.Hide(); Layout.Destroy(); Layout = null; } LevelDesc = desc; Layout = new VBox(false, 0); AddWithViewport(Layout); HBox field = GtkHelpers.TextEntryField("Level Name", desc.Name, Name_Changed, true); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.TextEntryField("Lives", desc.Lives.ToString(), Lives_Changed, true, GtkHelpers.ValueType.Int); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.ComboBox("Width", LayoutOptions, (desc.FieldWidth / 5 - 1), Width_Changed, true); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.ComboBox("Depth", LayoutOptions, (desc.FieldDepth / 5 - 1), Depth_Changed, true); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.TextEntryField("Starting Coins", desc.StartingCoins.ToString(), StartingCoins_Changed, true, GtkHelpers.ValueType.Int); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.TextEntryField("Description Heading", desc.DescriptionHeading, DescriptionHeading_Changed); Layout.PackStart(field, false, false, 0); field.Show(); field = GtkHelpers.TextEntryField("Description Body", desc.DescriptionBody, DescriptionBody_Changed); Layout.PackStart(field, false, false, 0); field.Show(); WavesTree = new TreeView(); Layout.PackStart(WavesTree, false, false, 0); WavesTree.Show(); List <EnemyDescription> enemies = LevelManager.GetEnemies(); ComboBoxText comboBox = new ComboBoxText(); foreach (EnemyDescription enemy in enemies) { comboBox.AppendText(enemy.Name); } comboBox.Active = 0; TreeViewColumn enemyCoumn = new TreeViewColumn(); TreeViewColumn countColumn = new TreeViewColumn(); TreeViewColumn difficultyColumn = new TreeViewColumn(); TreeViewColumn descriptionBodyColumn = new TreeViewColumn(); CellRendererCombo comboCellRenderer = new CellRendererCombo(); comboCellRenderer.Editable = true; comboCellRenderer.Edited += ComboCellRenderer_Edited; comboCellRenderer.TextColumn = 0; comboCellRenderer.HasEntry = false; CellRendererText countCellRenderer = new CellRendererText(); countCellRenderer.Editable = true; countCellRenderer.Edited += CountCell_Edited; CellRendererText difficultyCellRenderer = new CellRendererText(); difficultyCellRenderer.Editable = true; difficultyCellRenderer.Edited += DifficultyCell_Edited; CellRendererText descriptionbodyRenderer = new CellRendererText(); descriptionbodyRenderer.Editable = true; descriptionbodyRenderer.Edited += DescriptionbodyRenderer_Edited; enemyCoumn.PackStart(comboCellRenderer, true); enemyCoumn.Title = "Enemy"; enemyCoumn.AddAttribute(comboCellRenderer, "text", 1); WavesTree.AppendColumn(enemyCoumn); countColumn.PackStart(countCellRenderer, true); countColumn.Title = "Count"; countColumn.AddAttribute(countCellRenderer, "text", 2); WavesTree.AppendColumn(countColumn); difficultyColumn.PackStart(difficultyCellRenderer, true); difficultyColumn.Title = "Difficulty Multiplier"; difficultyColumn.AddAttribute(difficultyCellRenderer, "text", 3); WavesTree.AppendColumn(difficultyColumn); descriptionBodyColumn.PackStart(descriptionbodyRenderer, true); descriptionBodyColumn.Title = "Description Body"; descriptionBodyColumn.AddAttribute(difficultyCellRenderer, "text", 4); WavesTree.AppendColumn(descriptionBodyColumn); // // Add column: Max damage that can be dished to a single enemy given turret coverage + enemy speed // // // Add column: Max hit points of the wave // // // Add column: Max hit points of all the turrets combined firing at full capacity // // // Add column: Given all the factors, theoretical headroom of DPS // WavesModel = new ListStore(typeof(int), typeof(string), typeof(int), typeof(float), typeof(string)); WavesTree.Model = WavesModel; WavesTree.Selection.Mode = SelectionMode.Single; PopulateTreeWithWaves(desc); field = new HBox(false, 5); Layout.PackStart(field, false, false, 0); field.Show(); Button b = new Button("+"); b.Clicked += NewWave_Clicked; b.Show(); field.PackStart(b, false, false, 0); b = new Button("-"); b.Clicked += RemoveWave_Clicked; b.Show(); field.PackStart(b, false, false, 0); Table map = GetFieldTable(desc); Layout.PackStart(map, false, true, 0); map.Show(); ErrorEntry = new Entry(); ErrorEntry.IsEditable = false; ErrorEntry.Text = "No issues"; Layout.PackStart(ErrorEntry, false, false, 10); ErrorEntry.Show(); ValidateDescriptionAndReportIssues(); // // Allowed turrets // field = new HBox(true, 10); Layout.PackStart(field, true, false, 0); field.Show(); AvailTurretTree = new TreeView(); AllowedTurretTree = new TreeView(); TreeViewColumn availCol = new TreeViewColumn(); TreeViewColumn allowedCol = new TreeViewColumn(); CellRendererText availCellrenderer = new CellRendererText(); availCellrenderer.Editable = false; CellRendererText allowedCellRenderer = new CellRendererText(); allowedCellRenderer.Editable = false; availCol.PackStart(availCellrenderer, true); availCol.Title = "Not allowed turrets"; availCol.AddAttribute(availCellrenderer, "text", 1); AvailTurretTree.AppendColumn(availCol); allowedCol.PackStart(allowedCellRenderer, true); allowedCol.Title = "Allowed Turrets"; allowedCol.AddAttribute(allowedCellRenderer, "text", 1); AllowedTurretTree.AppendColumn(allowedCol); AvailTurretModel = new ListStore(typeof(int), typeof(string)); AvailTurretTree.Model = AvailTurretModel; AvailTurretTree.Selection.Mode = SelectionMode.Multiple; AllowedTurretModel = new ListStore(typeof(int), typeof(string)); AllowedTurretTree.Model = AllowedTurretModel; AllowedTurretTree.Selection.Mode = SelectionMode.Multiple; field.PackStart(AvailTurretTree, true, true, 0); AvailTurretTree.Show(); VBox turretButtons = new VBox(true, 0); field.PackStart(turretButtons, true, true, 0); turretButtons.Show(); b = new Button(">>"); turretButtons.PackStart(b, false, false, 0); b.Clicked += AddAllTurrets_Clicked; b.Show(); b = new Button(">"); turretButtons.PackStart(b, false, false, 0); b.Clicked += AddSelectedTurrets_Clicked; b.Show(); b = new Button("<"); turretButtons.PackStart(b, false, false, 0); b.Clicked += RemoveSelectedTurrets_Clicked; b.Show(); b = new Button("<<"); turretButtons.PackStart(b, false, false, 0); b.Clicked += RemoveAllTurrets_Clicked; b.Show(); field.PackEnd(AllowedTurretTree, true, true, 0); AllowedTurretTree.Show(); PopulateTurretTrees(desc); Show(); ShowAll(); }
protected void OnButtonPickDatePeriodClicked(object sender, EventArgs e) { #region Widget creation Window parentWin = (Window)Toplevel; var selectDate = new Gtk.Dialog("Укажите период", parentWin, DialogFlags.DestroyWithParent); selectDate.Modal = true; selectDate.AddButton("Отмена", ResponseType.Cancel); selectDate.AddButton("Ok", ResponseType.Ok); periodSummary = new Label(); selectDate.VBox.Add(periodSummary); HBox hbox = new HBox(true, 6); var startVbox = new VBox(false, 3); var endVbox = new VBox(false, 3); StartDateCalendar = new Calendar(); StartDateCalendar.DisplayOptions = DisplayOptions; StartDateCalendar.DaySelected += StartDateCalendar_DaySelected; StartDateCalendar.MonthChanged += StartDateCalendar_MonthChanged; StartDateCalendar.Day = 0; StartDateCalendar_MonthChanged(null, null); EndDateCalendar = new Calendar(); EndDateCalendar.DisplayOptions = DisplayOptions; EndDateCalendar.DaySelected += EndDateCalendar_DaySelected; EndDateCalendar.MonthChanged += EndDateCalendar_MonthChanged; EndDateCalendar.Day = 0; EndDateCalendar_MonthChanged(null, null); if (CalendarFontSize.HasValue) { var desc = new FontDescription { AbsoluteSize = CalendarFontSize.Value * 1000 }; StartDateCalendar.ModifyFont(desc); EndDateCalendar.ModifyFont(desc); } StartDateEntry = new DatePicker(); StartDateEntry.DateChanged += StartDateEntry_DateChanged; EndDateEntry = new DatePicker(); EndDateEntry.DateChanged += EndDateEntry_DateChanged; startVbox.Add(StartDateCalendar); startVbox.Add(StartDateEntry); endVbox.Add(EndDateCalendar); endVbox.Add(EndDateEntry); hbox.Add(startVbox); hbox.Add(endVbox); selectDate.VBox.Add(hbox); selectDate.ShowAll(); StartDateEntry.HideCalendarButton = true; EndDateEntry.HideCalendarButton = true; if (SetCurrentDateByDefault && !StartDateOrNull.HasValue && !EndDateOrNull.HasValue) { StartDateEntry.DateOrNull = DateTime.Today.Date; EndDateEntry.DateOrNull = DateTime.Today.Date.AddHours(23).AddMinutes(59).AddSeconds(59); } else { StartDateEntry.DateOrNull = StartDateOrNull; EndDateEntry.DateOrNull = EndDateOrNull; } #endregion int response = selectDate.Run(); if (response == (int)ResponseType.Ok) { startDate = StartDateEntry.DateOrNull; endDate = EndDateEntry.DateOrNull; OnStartDateChanged(); OnEndDateChanged(); OnPeriodChanged(); OnPeriodChangedByUser(); } #region Destroy EndDateCalendar.Destroy(); StartDateCalendar.Destroy(); StartDateEntry.Destroy(); EndDateEntry.Destroy(); startVbox.Destroy(); endVbox.Destroy(); hbox.Destroy(); selectDate.Destroy(); #endregion }
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 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(); }