2 // ToolStripSeparator.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)
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
45 [EditorBrowsable (EditorBrowsableState
.Never
)]
46 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
47 public new bool AutoToolTip
{
48 get { return base.AutoToolTip; }
49 set { base.AutoToolTip = value; }
53 [EditorBrowsable (EditorBrowsableState
.Never
)]
54 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
55 public override Image BackgroundImage
{
56 get { return base.BackgroundImage; }
57 set { base.BackgroundImage = value; }
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; }
}
71 [EditorBrowsable (EditorBrowsableState
.Never
)]
72 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
73 public new ToolStripItemDisplayStyle DisplayStyle
{
74 get { return base.DisplayStyle; }
75 set { base.DisplayStyle = value; }
79 [EditorBrowsable (EditorBrowsableState
.Never
)]
80 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
81 public new bool DoubleClickEnabled
{
82 get { return base.DoubleClickEnabled; }
83 set { base.DoubleClickEnabled = value; }
87 [EditorBrowsable (EditorBrowsableState
.Never
)]
88 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
89 public override bool Enabled
{
90 get { return base.Enabled; }
91 set { base.Enabled = value; }
95 [EditorBrowsable (EditorBrowsableState
.Never
)]
96 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
97 public override Font Font
{
98 get { return base.Font; }
99 set { base.Font = value; }
103 [EditorBrowsable (EditorBrowsableState
.Never
)]
104 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
105 public override Image Image
{
106 get { return base.Image; }
107 set { base.Image = value; }
111 [EditorBrowsable (EditorBrowsableState
.Never
)]
112 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
113 public new ContentAlignment ImageAlign
{
114 get { return base.ImageAlign; }
115 set { base.ImageAlign = value; }
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; }
128 [EditorBrowsable (EditorBrowsableState
.Never
)]
129 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
130 public new string ImageKey
{
131 get { return base.ImageKey; }
132 set { base.ImageKey = value; }
136 [EditorBrowsable (EditorBrowsableState
.Never
)]
137 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
138 public new ToolStripItemImageScaling ImageScaling
{
139 get { return base.ImageScaling; }
140 set { base.ImageScaling = value; }
144 [EditorBrowsable (EditorBrowsableState
.Never
)]
145 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
146 public new Color ImageTransparentColor
{
147 get { return base.ImageTransparentColor; }
148 set { base.ImageTransparentColor = value; }
152 [EditorBrowsable (EditorBrowsableState
.Never
)]
153 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
154 public new bool RightToLeftAutoMirrorImage
{
155 get { return base.RightToLeftAutoMirrorImage; }
156 set { base.RightToLeftAutoMirrorImage = value; }
160 [EditorBrowsable (EditorBrowsableState
.Never
)]
161 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
162 public override string Text
{
163 get { return base.Text; }
164 set { base.Text = value; }
168 [EditorBrowsable (EditorBrowsableState
.Never
)]
169 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
170 public new ContentAlignment TextAlign
{
171 get { return base.TextAlign; }
172 set { base.TextAlign = value; }
176 [EditorBrowsable (EditorBrowsableState
.Never
)]
177 [DefaultValue (ToolStripTextDirection
.Horizontal
)]
178 public override ToolStripTextDirection TextDirection
{
179 get { return base.TextDirection; }
180 set { base.TextDirection = value; }
184 [EditorBrowsable (EditorBrowsableState
.Never
)]
185 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
186 public new TextImageRelation TextImageRelation
{
187 get { return base.TextImageRelation; }
188 set { base.TextImageRelation = value; }
192 [EditorBrowsable (EditorBrowsableState
.Never
)]
193 [DesignerSerializationVisibility (DesignerSerializationVisibility
.Hidden
)]
194 public new string ToolTipText
{
195 get { return base.ToolTipText; }
196 set { base.ToolTipText = value; }
200 #region Protected Properties
201 protected internal override Padding DefaultMargin { get { return new Padding(); }
}
202 protected override Size DefaultSize { get { return new Size(6, 6); }
}
205 #region Public Methods
206 public override Size
GetPreferredSize (Size constrainingSize
)
208 return new Size(6, 6);
212 #region Protected Methods
213 [EditorBrowsable (EditorBrowsableState
.Advanced
)]
214 protected override AccessibleObject
CreateAccessibilityInstance ()
216 ToolStripItemAccessibleObject ao
= new ToolStripItemAccessibleObject (this);
218 ao
.default_action
= "Press";
219 ao
.role
= AccessibleRole
.Separator
;
220 ao
.state
= AccessibleStates
.None
;
225 [EditorBrowsable (EditorBrowsableState
.Never
)]
226 protected override void OnFontChanged (EventArgs e
)
228 base.OnFontChanged (e
);
231 protected override void OnPaint (PaintEventArgs e
)
235 if (this.Owner
!= null)
237 if (this.IsOnDropDown
)
238 this.Owner
.Renderer
.DrawSeparator (new ToolStripSeparatorRenderEventArgs (e
.Graphics
, this, this.Owner
.Orientation
== Orientation
.Horizontal
? false : true));
240 this.Owner
.Renderer
.DrawSeparator (new ToolStripSeparatorRenderEventArgs (e
.Graphics
, this, this.Owner
.Orientation
== Orientation
.Horizontal
? true : false));
244 protected internal override void SetBounds (Rectangle rect
)
246 base.SetBounds (rect
);
250 #region Public Events
252 [EditorBrowsable (EditorBrowsableState
.Never
)]
253 public new event EventHandler DisplayStyleChanged
{
254 add { base.DisplayStyleChanged += value; }
255 remove { base.DisplayStyleChanged -= value; }
259 [EditorBrowsable (EditorBrowsableState
.Never
)]
260 public new event EventHandler EnabledChanged
{
261 add { base.EnabledChanged += value; }
262 remove { base.EnabledChanged -= value; }
266 [EditorBrowsable (EditorBrowsableState
.Never
)]
267 public new event EventHandler TextChanged
{
268 add { base.TextChanged += value; }
269 remove { base.TextChanged -= value; }
273 #region Internal Method/Properties
274 internal override ToolStripTextDirection DefaultTextDirection { get { return ToolStripTextDirection.Horizontal; }
}