diff --git a/Source/Editor/GUI/ContextMenu/ContextMenuButton.cs b/Source/Editor/GUI/ContextMenu/ContextMenuButton.cs index 595dfa76d..8ff118f65 100644 --- a/Source/Editor/GUI/ContextMenu/ContextMenuButton.cs +++ b/Source/Editor/GUI/ContextMenu/ContextMenuButton.cs @@ -40,6 +40,11 @@ namespace FlaxEditor.GUI.ContextMenu /// public string ShortKeys; + /// + /// The text color. + /// + public Color TextColor; + /// /// Item icon (best is 16x16). /// @@ -71,6 +76,7 @@ namespace FlaxEditor.GUI.ContextMenu { Text = text; ShortKeys = shortKeys; + TextColor = Style.Current.Foreground; } /// @@ -122,7 +128,7 @@ namespace FlaxEditor.GUI.ContextMenu var style = Style.Current; var backgroundRect = new Rectangle(-X + 3, 0, Parent.Width - 6, Height); var textRect = new Rectangle(0, 0, Width - 8, Height); - var textColor = Enabled ? style.Foreground : style.ForegroundDisabled; + var textColor = Enabled ? TextColor : style.ForegroundDisabled; // Draw background if (IsMouseOver && Enabled) diff --git a/Source/Editor/GUI/EnumComboBox.cs b/Source/Editor/GUI/EnumComboBox.cs index f327f3e17..5020c28a7 100644 --- a/Source/Editor/GUI/EnumComboBox.cs +++ b/Source/Editor/GUI/EnumComboBox.cs @@ -10,6 +10,7 @@ using FlaxEditor.CustomEditors.Elements; using FlaxEditor.GUI.ContextMenu; using FlaxEditor.Scripting; using FlaxEngine; +using FlaxEngine.GUI; namespace FlaxEditor.GUI { @@ -59,17 +60,24 @@ namespace FlaxEditor.GUI /// public long Value; + /// + /// Marks enum entry as deprecated and should not be used by users anymore (displayed in grey). + /// + public bool IsObsolete; + /// /// Initializes a new instance of the struct. /// /// The name. /// The tooltip. /// The value. - public Entry(string name, long value, string tooltip = null) + /// The deprecated entry flag. + public Entry(string name, long value, string tooltip = null, bool isObsolete = false) { Name = name; Tooltip = tooltip; Value = value; + IsObsolete = isObsolete; } } @@ -280,10 +288,9 @@ namespace FlaxEditor.GUI default: throw new ArgumentOutOfRangeException(nameof(formatMode), formatMode, null); } } - string tooltip = Editor.Instance.CodeDocs.GetTooltip(new ScriptMemberInfo(field), attributes); - - entries.Add(new Entry(name, Convert.ToInt64(field.GetRawConstantValue()), tooltip)); + bool isObsolete = attributes.Any(x => x is ObsoleteAttribute); + entries.Add(new Entry(name, Convert.ToInt64(field.GetRawConstantValue()), tooltip, isObsolete)); } } @@ -291,8 +298,11 @@ namespace FlaxEditor.GUI protected override void OnLayoutMenuButton(ContextMenuButton button, int index, bool construct = false) { base.OnLayoutMenuButton(button, index, construct); + if (IsFlags) button.CloseMenuOnClick = false; + if (index < _entries.Count && _entries[index].IsObsolete) + button.TextColor = Style.Current.ForegroundGrey; } ///