2006-11-30 Jonathan Pobst <monkey@jpobst.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / ToolStripContainer.cs
1 //
2 // ToolStripContainer.cs
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining
5 // a copy of this software and associated documentation files (the
6 // "Software"), to deal in the Software without restriction, including
7 // without limitation the rights to use, copy, modify, merge, publish,
8 // distribute, sublicense, and/or sell copies of the Software, and to
9 // permit persons to whom the Software is furnished to do so, subject to
10 // the following conditions:
11 // 
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
14 // 
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 //
23 // Copyright (c) 2006 Jonathan Pobst
24 //
25 // Authors:
26 //      Jonathan Pobst (monkey@jpobst.com)
27 //
28
29 #if NET_2_0
30 using System;
31 using System.Drawing;
32 using System.ComponentModel;
33 using System.Runtime.InteropServices;
34
35 namespace System.Windows.Forms
36 {
37         [ComVisible (true)]
38         [ClassInterface (ClassInterfaceType.AutoDispatch)]
39         public class ToolStripContainer : ContainerControl
40         {
41                 private ToolStripPanel bottom_panel;
42                 private ToolStripContentPanel content_panel;
43                 private ToolStripPanel left_panel;
44                 private ToolStripPanel right_panel;
45                 private ToolStripPanel top_panel;
46
47                 #region Public Constructors
48                 public ToolStripContainer () : base ()
49                 {
50                         this.top_panel = new ToolStripPanel ();
51                         this.top_panel.Dock = DockStyle.Top;
52                         this.top_panel.Height = 0;
53                         this.Controls.Add (top_panel);
54
55                         this.bottom_panel = new ToolStripPanel ();
56                         this.bottom_panel.Dock = DockStyle.Bottom;
57                         this.top_panel.Height = 0;
58                         this.Controls.Add (bottom_panel);
59
60                         this.left_panel = new ToolStripPanel ();
61                         this.left_panel.Dock = DockStyle.Left;
62                         this.left_panel.Width = 0;
63                         this.Controls.Add (left_panel);
64
65                         this.right_panel = new ToolStripPanel ();
66                         this.right_panel.Dock = DockStyle.Right;
67                         this.right_panel.Width = 0;
68                         this.Controls.Add (right_panel);
69
70                         content_panel = new ToolStripContentPanel ();
71                         content_panel.Dock = DockStyle.Fill;
72                         this.Controls.Add (content_panel);
73                 }
74                 #endregion
75
76                 #region Public Properties
77                 [Browsable (false)]
78                 public override bool AutoScroll {
79                         get { return base.AutoScroll; }
80                         set { base.AutoScroll = value; }
81                 }
82
83                 [Browsable (false)]
84                 public Size AutoScrollMargin {
85                         get { return base.AutoScrollMargin; }
86                         set { base.AutoScrollMargin = value; }
87                 }
88
89                 [Browsable (false)]
90                 public Size AutoScrollMinSize {
91                         get { return base.AutoScrollMinSize; }
92                         set { base.AutoScrollMinSize = value; }
93                 }
94                 
95                 [Browsable (false)]
96                 public Color BackColor {
97                         get { return base.BackColor; }
98                         set { base.BackColor = value; }
99                 }
100                 
101                 [Browsable (false)]
102                 public Image BackgroundImage {
103                         get { return base.BackgroundImage; }
104                         set { base.BackgroundImage = value; }
105                 }
106                 
107                 [Localizable (false)]
108                 public ToolStripPanel BottomToolStripPanel {
109                         get { return this.bottom_panel; }
110                 }
111
112                 [DefaultValue (true)]
113                 public bool BottomToolStripPanelVisible {
114                         get { return this.bottom_panel.Visible; }
115                         set { this.bottom_panel.Visible = value; }
116                 }
117
118                 [Browsable (false)]
119                 public bool CausesValidation {
120                         get { return base.CausesValidation; }
121                         set { base.CausesValidation = value; }
122                 }
123
124                 [Localizable (false)]
125                 public ToolStripContentPanel ContentPanel {
126                         get { return this.content_panel; }
127                 }
128                 
129                 [Browsable (false)]
130                 public ControlCollection Controls {
131                         get { return base.Controls; }
132                 }
133                 
134                 [Browsable (false)]
135                 public override Cursor Cursor {
136                         get { return base.Cursor; }
137                         set { base.Cursor = value; }
138                 }
139                 
140                 [Browsable (false)]
141                 public Color ForeColor {
142                         get { return base.ForeColor; }
143                         set { base.ForeColor = value; }
144                 }
145                 
146                 [Localizable (false)]
147                 public ToolStripPanel LeftToolStripPanel {
148                         get { return this.left_panel; }
149                 }
150
151                 [DefaultValue (true)]
152                 public bool LeftToolStripPanelVisible {
153                         get { return this.left_panel.Visible; }
154                         set { this.left_panel.Visible = value; }
155                 }
156
157                 [Localizable (false)]
158                 public ToolStripPanel RightToolStripPanel {
159                         get { return this.right_panel; }
160                 }
161
162                 [DefaultValue (true)]
163                 public bool RightToolStripPanelVisible {
164                         get { return this.right_panel.Visible; }
165                         set { this.right_panel.Visible = value; }
166                 }
167         
168                 [Localizable (false)]
169                 public ToolStripPanel TopToolStripPanel {
170                         get { return this.top_panel; }
171                 }
172
173                 [DefaultValue (true)]
174                 public bool TopToolStripPanelVisible {
175                         get { return this.top_panel.Visible; }
176                         set { this.top_panel.Visible = value; }
177                 }
178                 #endregion
179
180                 #region Protected Properties
181                 protected override Size DefaultSize {
182                         get { return new Size (150, 175); }
183                 }
184                 #endregion
185
186                 #region Protected Methods
187                 protected override ControlCollection CreateControlsInstance ()
188                 {
189                         return base.CreateControlsInstance ();
190                 }
191
192                 protected override void OnSizeChanged (EventArgs e)
193                 {
194                         base.OnSizeChanged (e);
195                 }
196                 #endregion
197
198                 #region Public Events
199                 [Browsable (false)]
200                 public event EventHandler BackColorChanged;
201                 [Browsable (false)]
202                 public event EventHandler BackgroundImageChanged;
203                 [Browsable (false)]
204                 public event EventHandler BackgroundImageLayoutChanged;
205                 [Browsable (false)]
206                 public event EventHandler CausesValidationChanged;
207                 [Browsable (false)]
208                 public event EventHandler ContextMenuStripChanged;
209                 [Browsable (false)]
210                 public event EventHandler CursorChanged;
211                 [Browsable (false)]
212                 public event EventHandler ForeColorChanged;
213                 #endregion
214         }
215 }
216 #endif