public void OnMainWindowClose(object o, DeleteEventArgs e) { if (mainWindow != null) { int x, y, width, height; mainWindow.GetPosition(out x, out y); mainWindow.GetSize(out width, out height); Gdk.WindowState state = mainWindow.GdkWindow.State; Utility.Configuration.Settings.MainFormMaximized = state == Gdk.WindowState.Maximized; if (state == 0) { Utility.Configuration.Settings.MainFormLocation = new System.Drawing.Point(x, y); Utility.Configuration.Settings.MainFormSize = new System.Drawing.Size(width, height); } // Then save this for the next time. // Is there any easy way to determine whether we've been maximized? } bool canClose = (!queryClose) || (Presenter1.AllowClose() && Presenter2.AllowClose()); if (canClose) { Application.Quit(); } else { e.RetVal = true; // Do this to prevent caller from closing the window. } }
WorkbenchMemento(XmlElement element, IXmlConvertable defaultLayoutMemento) : base() { try { string[] boundstr = element.Attributes["bounds"].InnerText.Split(new char [] { ',' }); bounds = new Rectangle(Int32.Parse(boundstr[0]), Int32.Parse(boundstr[1]), Int32.Parse(boundstr[2]), Int32.Parse(boundstr[3])); } catch { } try { windowstate = (Gdk.WindowState)Enum.Parse(typeof(Gdk.WindowState), element.Attributes["formwindowstate"].InnerText); } catch { } /*if (element.Attributes["defaultformwindowstate"] != null) { defaultwindowstate = (FormWindowState)Enum.Parse(typeof(FormWindowState), element.Attributes["defaultformwindowstate"].InnerText); }*/ try { fullscreen = Boolean.Parse(element.Attributes["fullscreen"].InnerText); } catch { } if (element.FirstChild is XmlElement && defaultLayoutMemento != null) { XmlElement e = (XmlElement) element.FirstChild; this.layoutMemento = (IXmlConvertable) defaultLayoutMemento.FromXmlElement (e); } else { this.layoutMemento = defaultLayoutMemento; } }
void Setup(Gdk.WindowState state) { var stat = _status.Visible; var full = state.HasFlag(Gdk.WindowState.Fullscreen); if (full ^ !stat) { return; } if (full) { _header.Remove(_main_bar); _header.Remove(_source_bar); _main_bar.ResetAfterHeaderBar(); _source_bar.ResetAfterHeaderBar(); _status.Attach(_main_bar, 0, 0, 1, 1); _status.Attach(_source_bar, 2, 0, 1, 1); _status.Show(); } else { _status.Remove(_main_bar); _status.Remove(_source_bar); _status.Hide(); _main_bar.ForHeaderBar(); _source_bar.ForHeaderBar(); _header.PackStart(_main_bar); _header.PackEnd(_source_bar); } }
/// <summary> /// Creates a new instance of the <code>MdiWorkspaceMemento</code>. /// </summary> public WorkbenchMemento() { windowstate = 0; bounds = new Rectangle(0, 0, 640, 480); fullscreen = false; }