protected override void OnDrawMenuItem(Rect rect, Rect labelRect) { if (Event.current.type == EventType.Repaint) { { labelRect.width -= 10; float widthOfMemberName = SirenixGUIStyles.Label.CalcSize(GUIHelper.TempContent(this.Name)).x; float widthOfTypeName = SirenixGUIStyles.RightAlignedGreyMiniLabel.CalcSize(GUIHelper.TempContent(this.typeName)).x; GUI.Label( labelRect .SetX(Mathf.Max(labelRect.xMin + widthOfMemberName, labelRect.xMax - widthOfTypeName)) .SetXMax(labelRect.xMax), this.typeName, this.IsSelected ? SirenixGUIStyles.LeftAlignedWhiteMiniLabel : SirenixGUIStyles.LeftAlignedGreyMiniLabel); } rect.x += IconSpacing; rect.x += IconSpacing; rect = rect.AlignLeft(IconSize); rect = rect.AlignMiddle(IconSize); DrawTheIcon(rect, this.info.Info.HasAll(SerializationFlags.SerializedByOdin), this.info.OdinMessageType); rect.x += IconSpacing * 2 + IconSize; DrawTheIcon(rect, this.info.Info.HasAll(SerializationFlags.SerializedByUnity), this.info.UnityMessageType); } }
protected override void OnDrawMenuItem(Rect rect, Rect labelRect) { labelRect.x -= 16; this.instance.Enabled = GUI.Toggle(labelRect.AlignMiddle(18).AlignLeft(16), this.instance.Enabled, GUIContent.none); // Toggle selection when pressing space. if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Space) { var selection = this.MenuTree.Selection .Select(x => x.ObjectInstance) .OfType <SomeCustomClass>(); if (selection.Any()) { var enabled = !selection.FirstOrDefault().Enabled; selection.ForEach(x => x.Enabled = enabled); Event.current.Use(); } } }