static void SetItemValues (NSMenuItem item, CommandInfo info) { item.SetTitleWithMnemonic (GetCleanCommandText (info)); item.Enabled = !IsGloballyDisabled && info.Enabled; item.Hidden = !info.Visible; SetAccel (item, info.AccelKey); if (info.Checked) { item.State = NSCellStateValue.On; } else if (info.CheckedInconsistent) { item.State = NSCellStateValue.Mixed; } else { item.State = NSCellStateValue.Off; } }
void SetItemValues (NSMenuItem item, CommandInfo info, bool disabledVisible) { item.SetTitleWithMnemonic (GetCleanCommandText (info)); if (!string.IsNullOrEmpty (info.Description) && item.ToolTip != info.Description) item.ToolTip = info.Description; bool enabled = info.Enabled && (!IsGloballyDisabled || commandSource == CommandSource.ContextMenu); bool visible = info.Visible && (disabledVisible || info.Enabled); item.Enabled = enabled; item.Hidden = !visible; SetAccel (item, info.AccelKey); if (info.Checked) { item.State = NSCellStateValue.On; } else if (info.CheckedInconsistent) { item.State = NSCellStateValue.Mixed; } else { item.State = NSCellStateValue.Off; } }