2 // ToolStripContainer.cs
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:
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
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
26 // Jonathan Pobst (monkey@jpobst.com)
32 using System.ComponentModel;
33 using System.Runtime.InteropServices;
35 namespace System.Windows.Forms
38 [ClassInterface (ClassInterfaceType.AutoDispatch)]
39 public class ToolStripContainer : ContainerControl
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;
47 #region Public Constructors
48 public ToolStripContainer () : base ()
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);
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);
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);
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);
70 content_panel = new ToolStripContentPanel ();
71 content_panel.Dock = DockStyle.Fill;
72 this.Controls.Add (content_panel);
76 #region Public Properties
78 public override bool AutoScroll {
79 get { return base.AutoScroll; }
80 set { base.AutoScroll = value; }
84 public Size AutoScrollMargin {
85 get { return base.AutoScrollMargin; }
86 set { base.AutoScrollMargin = value; }
90 public Size AutoScrollMinSize {
91 get { return base.AutoScrollMinSize; }
92 set { base.AutoScrollMinSize = value; }
96 public Color BackColor {
97 get { return base.BackColor; }
98 set { base.BackColor = value; }
102 public Image BackgroundImage {
103 get { return base.BackgroundImage; }
104 set { base.BackgroundImage = value; }
107 [Localizable (false)]
108 public ToolStripPanel BottomToolStripPanel {
109 get { return this.bottom_panel; }
112 [DefaultValue (true)]
113 public bool BottomToolStripPanelVisible {
114 get { return this.bottom_panel.Visible; }
115 set { this.bottom_panel.Visible = value; }
119 public bool CausesValidation {
120 get { return base.CausesValidation; }
121 set { base.CausesValidation = value; }
124 [Localizable (false)]
125 public ToolStripContentPanel ContentPanel {
126 get { return this.content_panel; }
130 public ControlCollection Controls {
131 get { return base.Controls; }
135 public override Cursor Cursor {
136 get { return base.Cursor; }
137 set { base.Cursor = value; }
141 public Color ForeColor {
142 get { return base.ForeColor; }
143 set { base.ForeColor = value; }
146 [Localizable (false)]
147 public ToolStripPanel LeftToolStripPanel {
148 get { return this.left_panel; }
151 [DefaultValue (true)]
152 public bool LeftToolStripPanelVisible {
153 get { return this.left_panel.Visible; }
154 set { this.left_panel.Visible = value; }
157 [Localizable (false)]
158 public ToolStripPanel RightToolStripPanel {
159 get { return this.right_panel; }
162 [DefaultValue (true)]
163 public bool RightToolStripPanelVisible {
164 get { return this.right_panel.Visible; }
165 set { this.right_panel.Visible = value; }
168 [Localizable (false)]
169 public ToolStripPanel TopToolStripPanel {
170 get { return this.top_panel; }
173 [DefaultValue (true)]
174 public bool TopToolStripPanelVisible {
175 get { return this.top_panel.Visible; }
176 set { this.top_panel.Visible = value; }
180 #region Protected Properties
181 protected override Size DefaultSize {
182 get { return new Size (150, 175); }
186 #region Protected Methods
187 protected override ControlCollection CreateControlsInstance ()
189 return base.CreateControlsInstance ();
192 protected override void OnSizeChanged (EventArgs e)
194 base.OnSizeChanged (e);
198 #region Public Events
200 public event EventHandler BackColorChanged;
202 public event EventHandler BackgroundImageChanged;
204 public event EventHandler BackgroundImageLayoutChanged;
206 public event EventHandler CausesValidationChanged;
208 public event EventHandler ContextMenuStripChanged;
210 public event EventHandler CursorChanged;
212 public event EventHandler ForeColorChanged;