using System;
using System.Drawing;
using System.ComponentModel;
+using System.Windows.Forms.Design;
namespace System.Windows.Forms
{
+ [ToolStripItemDesignerAvailability (ToolStripItemDesignerAvailability.MenuStrip | ToolStripItemDesignerAvailability.ContextMenuStrip)]
public class ToolStripMenuItem : ToolStripDropDownItem
{
private CheckState checked_state;
private string shortcut_display_string;
private Keys shortcut_keys = Keys.None;
private bool show_shortcut_keys = true;
+ private Form mdi_client_form;
#region Public Constructors
public ToolStripMenuItem ()
#region Public Properties
[Bindable (true)]
[DefaultValue (false)]
+ [RefreshProperties (RefreshProperties.Repaint)]
public bool Checked {
get {
switch (this.checked_state) {
[Bindable (true)]
[DefaultValue (CheckState.Unchecked)]
- public CheckState CheckState
- {
+ [RefreshProperties (RefreshProperties.Repaint)]
+ public CheckState CheckState {
get { return this.checked_state; }
set
{
set { base.Enabled = value; }
}
+ [Browsable (false)]
+ public bool IsMdiWindowListEntry {
+ get { return this.mdi_client_form != null; }
+ }
+
[MonoTODO ("Renderer doesn't support shortcut keys yet, they will never show.")]
[Localizable (true)]
public bool ShowShortcutKeys {
#region Protected Methods
protected override ToolStripDropDown CreateDefaultDropDown ()
{
- return new ToolStripDropDownMenu ();
+ ToolStripDropDownMenu tsddm = new ToolStripDropDownMenu ();
+ tsddm.OwnerItem = this;
+ return tsddm;
}
protected override void Dispose (bool disposing)
}
}
+ if (this.IsMdiWindowListEntry) {
+ this.mdi_client_form.MdiParent.MdiContainer.ActivateChild (this.mdi_client_form);
+ return;
+ }
+
if (this.check_on_click)
this.Checked = !this.Checked;
protected override void OnMouseDown (MouseEventArgs e)
{
- if (this.HasDropDownItems)
+ if (this.HasDropDownItems && Enabled)
if (!this.DropDown.Visible)
this.ShowDropDown ();
protected override void OnMouseEnter (EventArgs e)
{
- if (this.IsOnDropDown && this.HasDropDownItems)
+ if (this.IsOnDropDown && this.HasDropDownItems && Enabled)
this.ShowDropDown ();
base.OnMouseEnter (e);
protected override void OnMouseUp (MouseEventArgs e)
{
- base.OnMouseUp (e);
+ if (!this.HasDropDownItems && Enabled)
+ base.OnMouseUp (e);
}
protected override void OnOwnerChanged (EventArgs e)
return;
}
}
+
+ protected internal override void SetBounds (Rectangle bounds)
+ {
+ base.SetBounds (bounds);
+ }
#endregion
#region Public Events
remove {Events.RemoveHandler (CheckStateChangedEvent, value); }
}
#endregion
+
+ #region Internal Properties
+ internal Form MdiClientForm {
+ get { return this.mdi_client_form; }
+ set { this.mdi_client_form = value; }
+ }
+ #endregion
}
}
#endif