1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 // Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
23 // Peter Bartok pbartok@novell.com
29 using System.Collections;
30 using System.ComponentModel;
33 namespace System.Windows.Forms {
34 [DesignTimeVisible(false)]
36 public sealed class MdiClient : Control {
37 #region Local Variables
38 private int mdi_created;
40 #endregion // Local Variables
42 #region Public Classes
43 public new class ControlCollection : Control.ControlCollection {
46 public ControlCollection(MdiClient owner) : base(owner) {
48 controls = new ArrayList ();
51 public override void Add(Control value) {
52 if ((value is Form) == false || !(((Form)value).IsMdiChild)) {
53 throw new ArgumentException("Form must be MdiChild");
56 SetChildIndex (value, 0); // always insert at front
57 // newest member is the active one
58 owner.ActiveMdiChild = (Form) value;
61 public override void Remove(Control value) {
65 #endregion // Public Classes
67 #region Public Constructors
69 BackColor = SystemColors.AppWorkspace;
70 Dock = DockStyle.Fill;
71 SetStyle (ControlStyles.Selectable, false);
73 #endregion // Public Constructors
75 protected override Control.ControlCollection CreateControlsInstance ()
77 return new MdiClient.ControlCollection (this);
80 protected override void WndProc(ref Message m) {
82 switch ((Msg) m.Msg) {
84 Console.WriteLine ("ignoring paint");
91 #region Public Instance Properties
93 public override System.Drawing.Image BackgroundImage {
95 return base.BackgroundImage;
98 base.BackgroundImage = value;
102 public Form[] MdiChildren {
106 children = new Form[Controls.Count];
107 Controls.CopyTo(children, 0);
112 #endregion // Public Instance Properties
114 #region Protected Instance Properties
115 protected override CreateParams CreateParams {
117 return base.CreateParams;
120 #endregion // Protected Instance Properties
122 #region Public Instance Methods
123 public void LayoutMdi(MdiLayout value) {
124 throw new NotImplementedException();
126 #endregion // Public Instance Methods
128 #region Protected Instance Methods
129 #endregion // Protected Instance Methods
131 internal int ChildrenCreated {
132 get { return mdi_created; }
133 set { mdi_created = value; }
136 internal Form ActiveMdiChild {
137 get { return active; }
138 set { active = value; }