In System.Windows.Forms:
[mono-project.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / ToolStripContainer.cs
blobeb0740412b97436bdc98b513938ae82a40ca4e99
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.
23 // Copyright (c) 2006 Jonathan Pobst
25 // Authors:
26 // Jonathan Pobst (monkey@jpobst.com)
29 #if NET_2_0
30 using System;
31 using System.Drawing;
32 using System.ComponentModel;
33 using System.Runtime.InteropServices;
35 namespace System.Windows.Forms
37 [ComVisible (true)]
38 [ClassInterface (ClassInterfaceType.AutoDispatch)]
39 [Designer ("System.Windows.Forms.Design.ToolStripContainerDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
40 public class ToolStripContainer : ContainerControl
42 private ToolStripPanel bottom_panel;
43 private ToolStripContentPanel content_panel;
44 private ToolStripPanel left_panel;
45 private ToolStripPanel right_panel;
46 private ToolStripPanel top_panel;
48 #region Public Constructors
49 public ToolStripContainer () : base ()
51 SetStyle (ControlStyles.SupportsTransparentBackColor, true);
52 SetStyle (ControlStyles.ResizeRedraw, true);
54 content_panel = new ToolStripContentPanel ();
55 content_panel.Dock = DockStyle.Fill;
56 this.Controls.Add (content_panel);
58 this.top_panel = new ToolStripPanel ();
59 this.top_panel.Dock = DockStyle.Top;
60 this.top_panel.Height = 0;
61 this.Controls.Add (top_panel);
63 this.bottom_panel = new ToolStripPanel ();
64 this.bottom_panel.Dock = DockStyle.Bottom;
65 this.bottom_panel.Height = 0;
66 this.Controls.Add (bottom_panel);
68 this.left_panel = new ToolStripPanel ();
69 this.left_panel.Dock = DockStyle.Left;
70 this.left_panel.Width = 0;
71 this.Controls.Add (left_panel);
73 this.right_panel = new ToolStripPanel ();
74 this.right_panel.Dock = DockStyle.Right;
75 this.right_panel.Width = 0;
76 this.Controls.Add (right_panel);
78 #endregion
80 #region Public Properties
81 [Browsable (false)]
82 [EditorBrowsable (EditorBrowsableState.Never)]
83 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
84 public override bool AutoScroll {
85 get { return base.AutoScroll; }
86 set { base.AutoScroll = value; }
89 [Browsable (false)]
90 [EditorBrowsable (EditorBrowsableState.Never)]
91 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
92 public new Size AutoScrollMargin {
93 get { return base.AutoScrollMargin; }
94 set { base.AutoScrollMargin = value; }
97 [Browsable (false)]
98 [EditorBrowsable (EditorBrowsableState.Never)]
99 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
100 public new Size AutoScrollMinSize {
101 get { return base.AutoScrollMinSize; }
102 set { base.AutoScrollMinSize = value; }
105 [Browsable (false)]
106 [EditorBrowsable (EditorBrowsableState.Never)]
107 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
108 public new Color BackColor {
109 get { return base.BackColor; }
110 set { base.BackColor = value; }
113 [Browsable (false)]
114 [EditorBrowsable (EditorBrowsableState.Never)]
115 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
116 public new Image BackgroundImage {
117 get { return base.BackgroundImage; }
118 set { base.BackgroundImage = value; }
121 [Browsable (false)]
122 [EditorBrowsable (EditorBrowsableState.Never)]
123 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
124 public override ImageLayout BackgroundImageLayout {
125 get { return base.BackgroundImageLayout; }
126 set { base.BackgroundImageLayout = value; }
129 [Localizable (false)]
130 [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
131 public ToolStripPanel BottomToolStripPanel {
132 get { return this.bottom_panel; }
135 [DefaultValue (true)]
136 public bool BottomToolStripPanelVisible {
137 get { return this.bottom_panel.Visible; }
138 set { this.bottom_panel.Visible = value; }
141 [Browsable (false)]
142 [EditorBrowsable (EditorBrowsableState.Never)]
143 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
144 public new bool CausesValidation {
145 get { return base.CausesValidation; }
146 set { base.CausesValidation = value; }
149 [Localizable (false)]
150 [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
151 public ToolStripContentPanel ContentPanel {
152 get { return this.content_panel; }
155 [Browsable (false)]
156 [EditorBrowsable (EditorBrowsableState.Never)]
157 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
158 public new ContextMenuStrip ContextMenuStrip {
159 get { return base.ContextMenuStrip; }
160 set { base.ContextMenuStrip = value; }
163 [EditorBrowsable (EditorBrowsableState.Never)]
164 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
165 public new ControlCollection Controls {
166 get { return base.Controls; }
169 [Browsable (false)]
170 [EditorBrowsable (EditorBrowsableState.Never)]
171 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
172 public override Cursor Cursor {
173 get { return base.Cursor; }
174 set { base.Cursor = value; }
177 [Browsable (false)]
178 [EditorBrowsable (EditorBrowsableState.Never)]
179 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
180 public new Color ForeColor {
181 get { return base.ForeColor; }
182 set { base.ForeColor = value; }
185 [Localizable (false)]
186 [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
187 public ToolStripPanel LeftToolStripPanel {
188 get { return this.left_panel; }
191 [DefaultValue (true)]
192 public bool LeftToolStripPanelVisible {
193 get { return this.left_panel.Visible; }
194 set { this.left_panel.Visible = value; }
197 [Localizable (false)]
198 [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
199 public ToolStripPanel RightToolStripPanel {
200 get { return this.right_panel; }
203 [DefaultValue (true)]
204 public bool RightToolStripPanelVisible {
205 get { return this.right_panel.Visible; }
206 set { this.right_panel.Visible = value; }
209 [Localizable (false)]
210 [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
211 public ToolStripPanel TopToolStripPanel {
212 get { return this.top_panel; }
215 [DefaultValue (true)]
216 public bool TopToolStripPanelVisible {
217 get { return this.top_panel.Visible; }
218 set { this.top_panel.Visible = value; }
220 #endregion
222 #region Protected Properties
223 protected override Size DefaultSize {
224 get { return new Size (150, 175); }
226 #endregion
228 #region Protected Methods
229 [EditorBrowsable (EditorBrowsableState.Advanced)]
230 protected override ControlCollection CreateControlsInstance ()
232 return new ToolStripContainerTypedControlCollection (this);
235 protected override void OnRightToLeftChanged (EventArgs e)
237 base.OnRightToLeftChanged (e);
240 protected override void OnSizeChanged (EventArgs e)
242 base.OnSizeChanged (e);
244 #endregion
246 #region Public Events
247 [Browsable (false)]
248 [EditorBrowsable (EditorBrowsableState.Never)]
249 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
250 public new event EventHandler BackColorChanged {
251 add { base.BackColorChanged += value; }
252 remove { base.BackColorChanged -= value; }
255 [Browsable (false)]
256 [EditorBrowsable (EditorBrowsableState.Never)]
257 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
258 public new event EventHandler BackgroundImageChanged {
259 add { base.BackgroundImageChanged += value; }
260 remove { base.BackgroundImageChanged -= value; }
263 [Browsable (false)]
264 [EditorBrowsable (EditorBrowsableState.Never)]
265 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
266 public new event EventHandler BackgroundImageLayoutChanged {
267 add { base.BackgroundImageLayoutChanged += value; }
268 remove { base.BackgroundImageLayoutChanged -= value; }
271 [Browsable (false)]
272 [EditorBrowsable (EditorBrowsableState.Never)]
273 public new event EventHandler CausesValidationChanged {
274 add { base.CausesValidationChanged += value; }
275 remove { base.CausesValidationChanged -= value; }
278 [Browsable (false)]
279 [EditorBrowsable (EditorBrowsableState.Never)]
280 public new event EventHandler ContextMenuStripChanged {
281 add { base.ContextMenuStripChanged += value; }
282 remove { base.ContextMenuStripChanged -= value; }
285 [Browsable (false)]
286 [EditorBrowsable (EditorBrowsableState.Never)]
287 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
288 public new event EventHandler CursorChanged {
289 add { base.CursorChanged += value; }
290 remove { base.CursorChanged -= value; }
293 [Browsable (false)]
294 [EditorBrowsable (EditorBrowsableState.Never)]
295 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
296 public new event EventHandler ForeColorChanged {
297 add { base.ForeColorChanged += value; }
298 remove { base.ForeColorChanged -= value; }
300 #endregion
302 #region Private Class : ToolStripContainerTypedControlCollection
303 private class ToolStripContainerTypedControlCollection : ControlCollection
305 public ToolStripContainerTypedControlCollection (Control owner) : base (owner)
309 #endregion
312 #endif