0:   //  MainWindowState.cs
1:   //  Copyright (C) 2001 Mike Krueger
2:   //
3:   //  This program is free software; you can redistribute it and/or modify
4:   //  it under the terms of the GNU General Public License as published by
5:   //  the Free Software Foundation; either version 2 of the License, or
6:   //  (at your option) any later version.
7:   //
8:   //  This program is distributed in the hope that it will be useful,
9:   //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10:   //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11:   //  GNU General Public License for more details.
12:   //
13:   //  You should have received a copy of the GNU General Public License
14:   //  along with this program; if not, write to the Free Software
15:   //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16:  
17:   using System;
18:   using System.Drawing;
19:   using System.Windows.Forms;
20:   using System.Xml;
21:  
22:   using SharpDevelop.Tool.Data;
23:  
24:   namespace SharpDevelop.Gui {
25:       
26:       /// <summary>
27:       /// This class contains the state of the mainwindow, it is used to load/save the
28:       /// state of the mainwindow in the options file.
29:       /// </summary>
30:       public class MainWindowState : IXmlConvertable
31:       {
32:           FormWindowState windowstate;
33:           Rectangle       bounds;
34:           bool            fullscreen;
35:           
36:           public FormWindowState WindowState {
37:               get {
38:                   return windowstate;
39:               }
40:           }
41:           
42:           public Rectangle Bounds {
43:               get {
44:                   return bounds;
45:               }
46:           }
47:           
48:           public bool FullScreen {
49:               get {
50:                   return fullscreen;
51:               }
52:           }
53:           
54:           public MainWindowState()
55:           {
56:               windowstate FormWindowState.Maximized;
57:               bounds      new Rectangle(00640480);
58:               fullscreen  false;
59:           }
60:           
61:           public MainWindowState(XmlElement element)
62:           {
63:               string[] boundstr element.InnerText.Split(new char [] {'|'});
64:               
65:               bounds new Rectangle (Int32.Parse(boundstr[0]),
66:                                       Int32.Parse(boundstr[1]),
67:                                       Int32.Parse(boundstr[2]),
68:                                       Int32.Parse(boundstr[3]));
69:               
70:               windowstate = (FormWindowState)Enum.Parse(typeof(FormWindowState), element.Attributes["STATE"].InnerText);
71:               fullscreen  Boolean.Parse(element.Attributes["FULLSCREEN"].InnerText);
72:           }
73:           
74:           public MainWindowState(MainWindow mainwindow)
75:           {
76:               windowstate   mainwindow.WindowState;
77:               mainwindow.WindowState FormWindowState.Normal;
78:               bounds        mainwindow.Bounds;
79:               fullscreen    mainwindow.FullScreen;
80:           }
81:           
82:           public object     FromXmlElement(XmlElement element)
83:           {
84:               return new MainWindowState(element);
85:           }
86:           
87:           public XmlElement ToXmlElement(XmlDocument doc)
88:           {
89:               XmlElement element doc.CreateElement("WINDOWSTATE");
90:               
91:               element.InnerText bounds.X     "|" +
92:                                   bounds.Y     "|" +
93:                                   bounds.Width "|" +
94:                                   bounds.Height;
95:               
96:               XmlAttribute stateattr doc.CreateAttribute("STATE");
97:               stateattr.InnerText windowstate.ToString();
98:               
99:               XmlAttribute fullscreenattr doc.CreateAttribute("FULLSCREEN");
100:               fullscreenattr.InnerText fullscreen.ToString();
101:               
102:               element.Attributes.Append(fullscreenattr);
103:               element.Attributes.Append(stateattr);
104:               
105:               return element;
106:           }
107:       }
108:   }

This page was automatically generated by SharpDevelop.