//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 RefreshToolbar(HBox newToolbar) { _toolbar.Destroy(); _toolbar = newToolbar; _headerContainer.Add(_toolbar); _toolbar.ShowAll(); }
/// <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; }
protected void OnButtonPickDatePeriodClicked(object sender, EventArgs e) { #region Widget creation Window parentWin = (Window)Toplevel; var selectDate = new 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); StartDateCalendar = new Calendar(); StartDateCalendar.DisplayOptions = DisplayOptions; StartDateCalendar.Date = StartDateOrNull ?? DateTime.Today; StartDateCalendar.DaySelected += StartDateCalendar_DaySelected; EndDateCalendar = new Calendar(); EndDateCalendar.DisplayOptions = DisplayOptions; EndDateCalendar.Date = EndDateOrNull ?? DateTime.Today; EndDateCalendar.DaySelected += EndDateCalendar_DaySelected; hbox.Add(StartDateCalendar); hbox.Add(EndDateCalendar); selectDate.VBox.Add(hbox); selectDate.ShowAll(); #endregion int response = selectDate.Run(); if (response == (int)ResponseType.Ok) { startDate = StartDateCalendar.GetDate(); endDate = EndDateCalendar.GetDate(); OnStartDateChanged(); OnEndDateChanged(); OnPeriodChanged(); OnPeriodChangedByUser(); } #region Destroy EndDateCalendar.Destroy(); StartDateCalendar.Destroy(); hbox.Destroy(); selectDate.Destroy(); #endregion }
private void AddTab(Widget widget, string name) { notebook.Add(widget); HBox hbox = new HBox(); hbox.PackStart(new Label(name)); Button close = new Button("×"); // Set this up with an image or whatever. close.Relief = ReliefStyle.None; close.FocusOnClick = false; close.Clicked += delegate { hbox.Destroy(); widget.Destroy(); }; hbox.PackStart(close); hbox.ShowAll(); notebook.SetTabLabel(widget, hbox); }
public override void Dispose() { if (this.widget != null) { this.widget.Destroy(); this.widget = null; } if (leftwatcher != null) { leftwatcher.Dispose(); leftwatcher = null; } if (rightwatcher != null) { rightwatcher.Dispose(); rightwatcher = null; } 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) { 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 AddWidgetsAndShow(EditorMode editorMode) { /* Set a handler for delete_event that immediately * exits GTK. */ DeleteEvent += delete_event; if (null != TopLevelHBox) { TopLevelHBox.Hide(); TopLevelHBox.Destroy(); TopLevelHBox = null; } CurrentMode = editorMode; EditorWidget = null; switch (editorMode) { case EditorMode.Level: EditorWidget = new LevelEditLayout(); ((LevelEditLayout)EditorWidget).TreeRefreshNeeded += TreeRefreshNeeded_Event; break; case EditorMode.Turret: EditorWidget = new TurretEditLayout(); ((TurretEditLayout)EditorWidget).TreeRefreshNeeded += TreeRefreshNeeded_Event; break; case EditorMode.Enemy: EditorWidget = new EnemyEditLayout(); ((EnemyEditLayout)EditorWidget).TreeRefreshNeeded += TreeRefreshNeeded_Event; break; case EditorMode.Projectile: EditorWidget = new ProjectileEditLayout(); ((ProjectileEditLayout)EditorWidget).TreeRefreshNeeded += TreeRefreshNeeded_Event; break; case EditorMode.Analysis: EditorWidget = new LevelAnalysisLayout(); ((LevelAnalysisLayout)EditorWidget).TreeRefreshNeeded += TreeRefreshNeeded_Event; break; } TopLevelHBox = new HBox(false, 0); Add(TopLevelHBox); TopLevelHBox.Show(); // // Lefthand column // VBox vbox = new VBox(false, 0); TopLevelHBox.PackStart(vbox, false, true, 5); vbox.SetSizeRequest(100, -1); vbox.Show(); Button addLevelButton = new Button("+"); addLevelButton.Clicked += AddButton_Clicked; vbox.PackStart(addLevelButton, false, false, 5); addLevelButton.Show(); Button removeLevelButton = new Button("-"); removeLevelButton.Clicked += RemoveButton_Clicked; vbox.PackStart(removeLevelButton, false, false, 5); removeLevelButton.Show(); tree = new TreeView(); vbox.PackStart(tree, true, true, 0); // Create a column for the artist name TreeViewColumn levelColumn = new TreeViewColumn(); CellRendererText levelCellRenderer = new CellRendererText(); levelColumn.PackStart(levelCellRenderer, true); levelColumn.AddAttribute(levelCellRenderer, "text", 0); tree.AppendColumn(levelColumn); ListModel = new ListStore(typeof(string)); tree.Model = ListModel; tree.Selection.Mode = SelectionMode.Single; tree.Selection.Changed += TreeSelection_Changed; switch (editorMode) { case EditorMode.Level: levelColumn.Title = "Levels"; PopulateTreeWithLevels(); break; case EditorMode.Turret: levelColumn.Title = "Turrets"; PopulateTreeWithTurrets(); break; case EditorMode.Enemy: levelColumn.Title = "Enemies"; PopulateTreeWithEnemies(); break; case EditorMode.Projectile: levelColumn.Title = "Projectiles"; PopulateTreeWithProjectilees(); break; case EditorMode.Analysis: levelColumn.Title = "Analysis"; PopulateTreeWithLevels(); break; } tree.Show(); // // Righthand column // vbox = new VBox(false, 0); TopLevelHBox.PackStart(vbox, true, true, 5); vbox.Show(); HBox modeHbox = new HBox(true, 0); vbox.PackStart(modeHbox, false, true, 0); modeHbox.Show(); Button modeButton = new Button("Level"); modeButton.Show(); modeButton.Clicked += level_clicked_event; modeHbox.PackStart(modeButton, false, false, 5); modeButton = new Button("Turret"); modeButton.Show(); modeButton.Clicked += turret_clicked_event; modeHbox.PackStart(modeButton, false, false, 5); modeButton = new Button("Enemy"); modeButton.Show(); modeButton.Clicked += enemy_clicked_event; modeHbox.PackStart(modeButton, false, false, 5); modeButton = new Button("Projectile"); modeButton.Show(); modeButton.Clicked += projectile_clicked_event; modeHbox.PackStart(modeButton, false, false, 5); modeButton = new Button("Analysis"); modeButton.Show(); modeButton.Clicked += analysis_clicked_event; modeHbox.PackStart(modeButton, false, false, 5); vbox.PackStart(EditorWidget, true, true, 5); EditorWidget.Show(); ShowAll(); LevelManager.WriteAssetDirectory(); }
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 }