* TextBoxBase.cs: Use the new SuspendRecalc/ResumeRecalc methods
[mono-project.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / ToolStripSeparator.cs
blob09ce2e683c0e89d2ccd889460953edc8d1865df4
1 //
2 // ToolStripSeparator.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)
28 #if NET_2_0
30 using System.Drawing;
31 using System.ComponentModel;
32 using System.Windows.Forms.Design;
34 namespace System.Windows.Forms
36 [ToolStripItemDesignerAvailability (ToolStripItemDesignerAvailability.ToolStrip | ToolStripItemDesignerAvailability.ContextMenuStrip)]
37 public class ToolStripSeparator : ToolStripItem
39 public ToolStripSeparator () : base ()
43 #region Public Properties
44 [Browsable (false)]
45 [EditorBrowsable (EditorBrowsableState.Never)]
46 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
47 public new bool AutoToolTip {
48 get { return base.AutoToolTip; }
49 set { base.AutoToolTip = value; }
52 [Browsable (false)]
53 [EditorBrowsable (EditorBrowsableState.Never)]
54 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
55 public override Image BackgroundImage {
56 get { return base.BackgroundImage; }
57 set { base.BackgroundImage = value; }
60 [Browsable (false)]
61 [EditorBrowsable (EditorBrowsableState.Never)]
62 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
63 public override ImageLayout BackgroundImageLayout {
64 get { return base.BackgroundImageLayout; }
65 set { base.BackgroundImageLayout = value; }
68 public override bool CanSelect { get { return false; } }
70 [Browsable (false)]
71 [EditorBrowsable (EditorBrowsableState.Never)]
72 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
73 public new ToolStripItemDisplayStyle DisplayStyle {
74 get { return base.DisplayStyle; }
75 set { base.DisplayStyle = value; }
78 [Browsable (false)]
79 [EditorBrowsable (EditorBrowsableState.Never)]
80 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
81 public new bool DoubleClickEnabled {
82 get { return base.DoubleClickEnabled; }
83 set { base.DoubleClickEnabled = value; }
86 [Browsable (false)]
87 [EditorBrowsable (EditorBrowsableState.Never)]
88 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
89 public override bool Enabled {
90 get { return base.Enabled; }
91 set { base.Enabled = value; }
94 [Browsable (false)]
95 [EditorBrowsable (EditorBrowsableState.Never)]
96 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
97 public override Font Font {
98 get { return base.Font; }
99 set { base.Font = value; }
102 [Browsable (false)]
103 [EditorBrowsable (EditorBrowsableState.Never)]
104 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
105 public override Image Image {
106 get { return base.Image; }
107 set { base.Image = value; }
110 [Browsable (false)]
111 [EditorBrowsable (EditorBrowsableState.Never)]
112 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
113 public new ContentAlignment ImageAlign {
114 get { return base.ImageAlign; }
115 set { base.ImageAlign = value; }
118 [Browsable (false)]
119 [EditorBrowsable (EditorBrowsableState.Never)]
120 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
121 [RefreshProperties (RefreshProperties.Repaint)]
122 public new int ImageIndex {
123 get { return base.ImageIndex; }
124 set { base.ImageIndex = value; }
127 [Browsable (false)]
128 [EditorBrowsable (EditorBrowsableState.Never)]
129 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
130 public new ToolStripItemImageScaling ImageScaling {
131 get { return base.ImageScaling; }
132 set { base.ImageScaling = value; }
135 [Browsable (false)]
136 [EditorBrowsable (EditorBrowsableState.Never)]
137 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
138 public new Color ImageTransparentColor {
139 get { return base.ImageTransparentColor; }
140 set { base.ImageTransparentColor = value; }
143 [Browsable (false)]
144 [EditorBrowsable (EditorBrowsableState.Never)]
145 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
146 public override string Text {
147 get { return base.Text; }
148 set { base.Text = value; }
151 [Browsable (false)]
152 [EditorBrowsable (EditorBrowsableState.Never)]
153 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
154 public new ContentAlignment TextAlign {
155 get { return base.TextAlign; }
156 set { base.TextAlign = value; }
159 [Browsable (false)]
160 [EditorBrowsable (EditorBrowsableState.Never)]
161 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
162 public new TextImageRelation TextImageRelation {
163 get { return base.TextImageRelation; }
164 set { base.TextImageRelation = value; }
167 [Browsable (false)]
168 [EditorBrowsable (EditorBrowsableState.Never)]
169 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
170 public new string ToolTipText {
171 get { return base.ToolTipText; }
172 set { base.ToolTipText = value; }
174 #endregion
176 #region Protected Properties
177 protected internal override Padding DefaultMargin { get { return new Padding(); } }
178 protected override Size DefaultSize { get { return new Size(6, 6); } }
179 #endregion
181 #region Public Methods
182 public override Size GetPreferredSize (Size constrainingSize)
184 return new Size(6, 6);
186 #endregion
188 #region Protected Methods
189 [EditorBrowsable (EditorBrowsableState.Advanced)]
190 protected override AccessibleObject CreateAccessibilityInstance ()
192 ToolStripItemAccessibleObject ao = new ToolStripItemAccessibleObject (this);
194 ao.default_action = "Press";
195 ao.role = AccessibleRole.Separator;
196 ao.state = AccessibleStates.None;
198 return ao;
201 [EditorBrowsable (EditorBrowsableState.Never)]
202 protected override void OnFontChanged (EventArgs e)
204 base.OnFontChanged (e);
207 protected override void OnPaint (PaintEventArgs e)
209 base.OnPaint (e);
211 if (this.Owner != null)
213 if (this.IsOnDropDown)
214 this.Owner.Renderer.DrawSeparator (new ToolStripSeparatorRenderEventArgs (e.Graphics, this, this.Owner.Orientation == Orientation.Horizontal ? false : true));
215 else
216 this.Owner.Renderer.DrawSeparator (new ToolStripSeparatorRenderEventArgs (e.Graphics, this, this.Owner.Orientation == Orientation.Horizontal ? true : false));
220 protected internal override void SetBounds (Rectangle bounds)
222 base.SetBounds (bounds);
224 #endregion
226 #region Public Events
227 [Browsable (false)]
228 [EditorBrowsable (EditorBrowsableState.Never)]
229 public new event EventHandler DisplayStyleChanged {
230 add { base.DisplayStyleChanged += value; }
231 remove { base.DisplayStyleChanged -= value; }
234 [Browsable (false)]
235 [EditorBrowsable (EditorBrowsableState.Never)]
236 public new event EventHandler EnabledChanged {
237 add { base.EnabledChanged += value; }
238 remove { base.EnabledChanged -= value; }
241 [Browsable (false)]
242 [EditorBrowsable (EditorBrowsableState.Never)]
243 public new event EventHandler TextChanged {
244 add { base.TextChanged += value; }
245 remove { base.TextChanged -= value; }
247 #endregion
250 #endif