mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 03:51:19 -10:00
* ActiveDesignerEventArgs.cs: Fixed property access * CheckoutException.cs * CommandID.cs * ComponentChangedEventArgs.cs * ComponentChangingEventArgs.cs * ComponentEventArgs.cs * ComponentRenameEventArgs.cs * DesignerEventArgs.cs: Implemented * StandardCommands.cs * StandardToolWindows.cs: Implemented and removed unneeded MonoTODOs * DesignerCollection.cs * DesignerVerbCollection.cs: Collections implemented * DesignerTransaction.cs * DesignerVerb.cs: Implemented * MenuCommand.cs: Most members implemented * IDesignerHost.cs: Completed interface * IInheritanceService.cs: Hopefully fixed interface * ITypeResolutionService.cs: Completed interface * ISelectionService.cs: Completed interface * DesigntimeLicenseContext.cs: Added member, implemented * DesigntimeLicenseContextSerializer.cs: Added private constructor, removed unneeded members * SelectionTypes.cs * HelpContextType.cs * HelpKeywordType.cs: Hopefully fixed enums * ServiceContainer.cs: implementation added svn path=/trunk/mcs/; revision=15867
128 lines
2.6 KiB
C#
128 lines
2.6 KiB
C#
//
|
|
// System.ComponentModel.Design.MenuCommand.cs
|
|
//
|
|
// Authors:
|
|
// Alejandro Sánchez Acosta <[email protected]>
|
|
// Andreas Nahr ([email protected])
|
|
//
|
|
// (C) Alejandro Sánchez Acosta
|
|
// (C) 2003 Andreas Nahr
|
|
//
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace System.ComponentModel.Design
|
|
{
|
|
[ComVisible(true)]
|
|
public class MenuCommand
|
|
{
|
|
|
|
private EventHandler handler;
|
|
private CommandID command;
|
|
private bool ischecked = false;
|
|
private bool enabled = true;
|
|
private bool issupported = true;
|
|
private bool visible = true;
|
|
|
|
public MenuCommand (EventHandler handler, CommandID command)
|
|
{
|
|
this.handler = handler;
|
|
this.command = command;
|
|
}
|
|
|
|
public virtual bool Checked {
|
|
get {
|
|
return ischecked;
|
|
}
|
|
set {
|
|
if (ischecked != value) {
|
|
ischecked = value;
|
|
OnCommandChanged (EventArgs.Empty);
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual CommandID CommandID {
|
|
get {
|
|
return command;
|
|
}
|
|
}
|
|
|
|
public virtual bool Enabled {
|
|
get {
|
|
return enabled;
|
|
}
|
|
set {
|
|
if (enabled != value)
|
|
{
|
|
enabled = value;
|
|
OnCommandChanged (EventArgs.Empty);
|
|
}
|
|
}
|
|
}
|
|
|
|
[MonoTODO]
|
|
public virtual int OleStatus {
|
|
get {
|
|
// This is calcualted from the other properties, but the docs to not tell how
|
|
// Default seems to be "3", but changes with diffentent set properties
|
|
return 3;
|
|
}
|
|
}
|
|
|
|
public virtual bool Supported {
|
|
get {
|
|
return issupported;
|
|
}
|
|
|
|
set {
|
|
issupported = value;
|
|
}
|
|
}
|
|
|
|
public virtual bool Visible {
|
|
get {
|
|
return visible;
|
|
}
|
|
|
|
set {
|
|
visible = value;
|
|
}
|
|
}
|
|
|
|
public virtual void Invoke()
|
|
{
|
|
// FIXME Not sure if this invocation is what should be done here
|
|
if (handler != null)
|
|
handler (this, EventArgs.Empty);
|
|
}
|
|
|
|
protected virtual void OnCommandChanged (EventArgs e)
|
|
{
|
|
if (CommandChanged != null)
|
|
CommandChanged (this, e);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
// MS runtime produces a NullReferenceException here if CommandID property == null
|
|
// which I guess isn't a good idea (throwing exceptions in ToStrings???) - bug in MS??
|
|
string commandpart = string.Empty;
|
|
if (command != null)
|
|
commandpart = command.ToString ();
|
|
commandpart = string.Concat (commandpart, " : ");
|
|
if (this.Supported)
|
|
commandpart = string.Concat (commandpart, "Supported");
|
|
if (this.Enabled)
|
|
commandpart = string.Concat (commandpart, "|Enabled");
|
|
if (this.Visible)
|
|
commandpart = string.Concat (commandpart, "|Visible");
|
|
if (this.Checked)
|
|
commandpart = string.Concat (commandpart, "|Checked");
|
|
return commandpart;
|
|
}
|
|
|
|
public event EventHandler CommandChanged;
|
|
}
|
|
}
|