2007-01-10 Jonathan Pobst <jpobst@novell.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                 [EditorBrowsable (EditorBrowsableState.Never)]
79                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
80                 public override bool AutoScroll {
81                         get { return base.AutoScroll; }
82                         set { base.AutoScroll = value; }
83                 }
84
85                 [Browsable (false)]
86                 [EditorBrowsable (EditorBrowsableState.Never)]
87                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
88                 public new Size AutoScrollMargin {
89                         get { return base.AutoScrollMargin; }
90                         set { base.AutoScrollMargin = value; }
91                 }
92
93                 [Browsable (false)]
94                 [EditorBrowsable (EditorBrowsableState.Never)]
95                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
96                 public new Size AutoScrollMinSize {
97                         get { return base.AutoScrollMinSize; }
98                         set { base.AutoScrollMinSize = value; }
99                 }
100                 
101                 [Browsable (false)]
102                 [EditorBrowsable (EditorBrowsableState.Never)]
103                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
104                 public new Color BackColor {
105                         get { return base.BackColor; }
106                         set { base.BackColor = value; }
107                 }
108                 
109                 [Browsable (false)]
110                 [EditorBrowsable (EditorBrowsableState.Never)]
111                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
112                 public new Image BackgroundImage {
113                         get { return base.BackgroundImage; }
114                         set { base.BackgroundImage = value; }
115                 }
116
117                 [Browsable (false)]
118                 [EditorBrowsable (EditorBrowsableState.Never)]
119                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
120                 public override ImageLayout BackgroundImageLayout {
121                         get { return base.BackgroundImageLayout; }
122                         set { base.BackgroundImageLayout = value; }
123                 }
124                 
125                 [Localizable (false)]
126                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
127                 public ToolStripPanel BottomToolStripPanel {
128                         get { return this.bottom_panel; }
129                 }
130
131                 [DefaultValue (true)]
132                 public bool BottomToolStripPanelVisible {
133                         get { return this.bottom_panel.Visible; }
134                         set { this.bottom_panel.Visible = value; }
135                 }
136
137                 [Browsable (false)]
138                 [EditorBrowsable (EditorBrowsableState.Never)]
139                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
140                 public new bool CausesValidation {
141                         get { return base.CausesValidation; }
142                         set { base.CausesValidation = value; }
143                 }
144
145                 [Localizable (false)]
146                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
147                 public ToolStripContentPanel ContentPanel {
148                         get { return this.content_panel; }
149                 }
150
151                 [Browsable (false)]
152                 [EditorBrowsable (EditorBrowsableState.Never)]
153                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
154                 public override ContextMenuStrip ContextMenuStrip {
155                         get { return base.ContextMenuStrip; }
156                         set { base.ContextMenuStrip = value; }
157                 }
158
159                 [EditorBrowsable (EditorBrowsableState.Never)]
160                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
161                 public new ControlCollection Controls {
162                         get { return base.Controls; }
163                 }
164                 
165                 [Browsable (false)]
166                 [EditorBrowsable (EditorBrowsableState.Never)]
167                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
168                 public override Cursor Cursor {
169                         get { return base.Cursor; }
170                         set { base.Cursor = value; }
171                 }
172                 
173                 [Browsable (false)]
174                 [EditorBrowsable (EditorBrowsableState.Never)]
175                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
176                 public new Color ForeColor {
177                         get { return base.ForeColor; }
178                         set { base.ForeColor = value; }
179                 }
180                 
181                 [Localizable (false)]
182                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
183                 public ToolStripPanel LeftToolStripPanel {
184                         get { return this.left_panel; }
185                 }
186
187                 [DefaultValue (true)]
188                 public bool LeftToolStripPanelVisible {
189                         get { return this.left_panel.Visible; }
190                         set { this.left_panel.Visible = value; }
191                 }
192
193                 [Localizable (false)]
194                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
195                 public ToolStripPanel RightToolStripPanel {
196                         get { return this.right_panel; }
197                 }
198
199                 [DefaultValue (true)]
200                 public bool RightToolStripPanelVisible {
201                         get { return this.right_panel.Visible; }
202                         set { this.right_panel.Visible = value; }
203                 }
204         
205                 [Localizable (false)]
206                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
207                 public ToolStripPanel TopToolStripPanel {
208                         get { return this.top_panel; }
209                 }
210
211                 [DefaultValue (true)]
212                 public bool TopToolStripPanelVisible {
213                         get { return this.top_panel.Visible; }
214                         set { this.top_panel.Visible = value; }
215                 }
216                 #endregion
217
218                 #region Protected Properties
219                 protected override Size DefaultSize {
220                         get { return new Size (150, 175); }
221                 }
222                 #endregion
223
224                 #region Protected Methods
225                 [EditorBrowsable (EditorBrowsableState.Never)]
226                 protected override ControlCollection CreateControlsInstance ()
227                 {
228                         return base.CreateControlsInstance ();
229                 }
230
231                 protected override void OnSizeChanged (EventArgs e)
232                 {
233                         base.OnSizeChanged (e);
234                 }
235                 #endregion
236
237                 #region Public Events
238                 [Browsable (false)]
239                 [EditorBrowsable (EditorBrowsableState.Never)]
240                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
241                 public new event EventHandler BackColorChanged {
242                         add { base.BackColorChanged += value; }
243                         remove { base.BackColorChanged -= value; }
244                 }
245
246                 [Browsable (false)]
247                 [EditorBrowsable (EditorBrowsableState.Never)]
248                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
249                 public new event EventHandler BackgroundImageChanged {
250                         add { base.BackgroundImageChanged += value; }
251                         remove { base.BackgroundImageChanged -= value; }
252                 }
253
254                 [Browsable (false)]
255                 [EditorBrowsable (EditorBrowsableState.Never)]
256                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
257                 public new event EventHandler BackgroundImageLayoutChanged {
258                         add { base.BackgroundImageLayoutChanged += value; }
259                         remove { base.BackgroundImageLayoutChanged -= value; }
260                 }
261
262                 [Browsable (false)]
263                 [EditorBrowsable (EditorBrowsableState.Never)]
264                 public new event EventHandler CausesValidationChanged {
265                         add { base.CausesValidationChanged += value; }
266                         remove { base.CausesValidationChanged -= value; }
267                 }
268
269                 [Browsable (false)]
270                 [EditorBrowsable (EditorBrowsableState.Never)]
271                 public new event EventHandler ContextMenuStripChanged {
272                         add { base.ContextMenuStripChanged += value; }
273                         remove { base.ContextMenuStripChanged -= value; }
274                 }
275
276                 [Browsable (false)]
277                 [EditorBrowsable (EditorBrowsableState.Never)]
278                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
279                 public new event EventHandler CursorChanged {
280                         add { base.CursorChanged += value; }
281                         remove { base.CursorChanged -= value; }
282                 }
283
284                 [Browsable (false)]
285                 [EditorBrowsable (EditorBrowsableState.Never)]
286                 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
287                 public new event EventHandler ForeColorChanged {
288                         add { base.ForeColorChanged += value; }
289                         remove { base.ForeColorChanged -= value; }
290                 }
291                 #endregion
292         }
293 }
294 #endif