protected void _mainWidget_Destroyed(object sender, EventArgs e) { memo.MemoChange -= this.TextUpdate; if (keyPressObject != null) { (keyPressObject as HtmlElement).KeyPress -= OnKeyPress; } frame1.ExposeEvent -= OnWidgetExpose; hbox1.Realized -= Hbox1_Realized; if ((browser as TWWebBrowserIE) != null) { if (vbox2.Toplevel is Window) { (vbox2.Toplevel as Window).SetFocus -= MainWindow_SetFocus; } frame1.Unrealized -= Frame1_Unrealized; (browser as TWWebBrowserIE).socket.UnmapEvent -= (browser as TWWebBrowserIE).Socket_UnmapEvent; } if (browser != null) { browser.Dispose(); } if (popupWindow != null) { popupWindow.Destroy(); } memo.MainWidget.Destroy(); memo = null; _mainWidget.Destroyed -= _mainWidget_Destroyed; _owner = null; }
/// <summary> /// Constructor /// </summary> public HTMLView(ViewBase owner) : base(owner) { Builder builder = MasterView.BuilderFromResource("ApsimNG.Resources.Glade.HTMLView.glade"); vpaned1 = (VPaned)builder.GetObject("vpaned1"); vbox2 = (VBox)builder.GetObject("vbox2"); frame1 = (Frame)builder.GetObject("frame1"); hbox1 = (HBox)builder.GetObject("hbox1"); _mainWidget = vpaned1; // Handle a temporary browser created when we want to export a map. if (owner == null) { popupWindow = new Gtk.Window(Gtk.WindowType.Popup); popupWindow.SetSizeRequest(500, 500); // Move the window offscreen; the user doesn't need to see it. // This works with IE, but not with WebKit // Not yet tested on OSX if (ProcessUtilities.CurrentOS.IsWindows) { popupWindow.Move(-10000, -10000); } popupWindow.Add(MainWidget); popupWindow.ShowAll(); while (Gtk.Application.EventsPending()) { Gtk.Application.RunIteration(); } } memo = new MemoView(this); hbox1.PackStart(memo.MainWidget, true, true, 0); vpaned1.PositionSet = true; vpaned1.Position = 200; hbox1.Visible = false; hbox1.NoShowAll = true; memo.ReadOnly = false; memo.WordWrap = true; memo.MemoChange += this.TextUpdate; vpaned1.ShowAll(); frame1.ExposeEvent += OnWidgetExpose; hbox1.Realized += Hbox1_Realized; _mainWidget.Destroyed += _mainWidget_Destroyed; }
/// <summary> /// Constructor /// </summary> public HTMLView(ViewBase owner) : base(owner) { Glade.XML gxml = new Glade.XML("ApsimNG.Resources.Glade.HTMLView.glade", "vpaned1"); gxml.Autoconnect(this); _mainWidget = vpaned1; // Handle a temporary browser created when we want to export a map. if (owner == null) { popupWin = new Gtk.Window(Gtk.WindowType.Popup); popupWin.SetSizeRequest(500, 500); // Move the window offscreen; the user doesn't need to see it. // This works with IE, but not with WebKit // Not yet tested on OSX if (ProcessUtilities.CurrentOS.IsWindows) popupWin.Move(-10000, -10000); popupWin.Add(MainWidget); popupWin.ShowAll(); while (Gtk.Application.EventsPending()) Gtk.Application.RunIteration(); } memoView1 = new MemoView(this); hbox1.PackStart(memoView1.MainWidget, true, true, 0); vpaned1.PositionSet = true; vpaned1.Position = 200; hbox1.Visible = false; hbox1.NoShowAll = true; memoView1.ReadOnly = false; memoView1.MemoChange += this.TextUpdate; vpaned1.ShowAll(); frame1.ExposeEvent += OnWidgetExpose; hbox1.Realized += Hbox1_Realized; _mainWidget.Destroyed += _mainWidget_Destroyed; }