public HeaderPartDrawer GetNextSelectableHeaderPartRight([CanBeNull] HeaderPartDrawer current) { if (current == null) { #if DEV_MODE && DEBUG_GET_NEXT UnityEngine.Debug.Log("HeaderParts.GetNextRight(current=" + StringUtils.Null + "): " + FirstSelectable + " (FirstSelectable)"); #endif return(FirstSelectable); } int currentIndex = parts.IndexOf(current); for (int n = currentIndex - 1; n >= 0; n--) { var part = parts[n]; if (part.Selectable) { #if DEV_MODE && DEBUG_GET_NEXT UnityEngine.Debug.Log("HeaderParts.GetNextRight(current=" + current + "): " + part + " (currentIndex - " + (currentIndex - n) + ")"); #endif return(part); } } #if DEV_MODE && DEBUG_GET_NEXT UnityEngine.Debug.Log("HeaderParts.GetNextRight(current=" + current + "): " + StringUtils.Null); #endif return(null); }
public static HeaderPartDrawer Create(HeaderPart headerPart, bool drawSelectionRect, bool drawMouseoverRect, [CanBeNull] Texture drawTexture, string tooltip, OnHeaderPartClicked onPartClicked, OnHeaderPartClicked onPartRightClicked = null, bool selectable = true) { HeaderPartDrawer result; if (!Pool.TryGet(out result)) { result = new HeaderPartDrawer(); } result.Setup(headerPart, drawSelectionRect, drawMouseoverRect, drawTexture, tooltip, onPartClicked, onPartRightClicked, selectable); return(result); }
public static HeaderPartDrawer Create(HeaderPart headerPart, bool drawSelectionRect, bool drawMouseoverRect, string tooltip, OnHeaderPartClicked onPartClicked, OnHeaderPartClicked onPartRightClicked = null, bool selectable = true, CalculatePosition overrideCalculatePosition = null) { HeaderPartDrawer result; if (!Pool.TryGet(out result)) { result = new HeaderPartDrawer(); } result.Setup(headerPart, drawSelectionRect, drawMouseoverRect, tooltip, onPartClicked, onPartRightClicked, selectable, overrideCalculatePosition); return(result); }
public HeaderPartDrawer GetNextSelectableHeaderPartRight([CanBeNull] HeaderPartDrawer current) { if (current == null) { return(FirstSelectable); } int currentIndex = parts.IndexOf(current); for (int n = currentIndex - 1; n >= 0; n++) { var part = parts[n]; if (part.Selectable) { return(part); } } return(null); }
/// <inheritdoc /> protected override void DoBuildHeaderToolbar() { base.DoBuildHeaderToolbar(); var graphics = inspector.Preferences.graphics; var toggleLocalSpaceButton = HeaderPartDrawer.Create((HeaderPart)TransformHeaderPart.ToggleLocalSpaceButton, true, true, UsingLocalSpace ? graphics.LocalSpaceIcon : graphics.WorldSpaceIcon, UsingLocalSpace ? "Display transform values in world space." : "Displayed transform values in local space relative to parent.", OnToggleLocalSpaceIconClicked); InsertHeaderPart(4, toggleLocalSpaceButton); var toggleSnappingButton = HeaderPartDrawer.Create((HeaderPart)TransformHeaderPart.ToggleSnapToGridButton, true, true, UsingSnapping ? graphics.SnappingOnIcon : graphics.SnappingOffIcon, UsingSnapping ? "Hide snapping controls for transform values." : "Show snapping controls for transform values.", OnToggleSnapToGridIconClicked); #if UNITY_2019_3_OR_NEWER if (!UsingSnapping) { var guiColor = GUI.color; guiColor.a = 0.5f; toggleSnappingButton.SetGUIColor(guiColor); } #endif InsertHeaderPart(5, toggleSnappingButton); }
public HeaderPartDrawer GetNextSelectableHeaderPartLeft([CanBeNull] HeaderPartDrawer current) { int count = parts.Count; if (current == null) { return(LastSelectable); } int currentIndex = parts.IndexOf(current); for (int n = currentIndex + 1; n < count; n++) { var part = parts[n]; if (part.Selectable) { return(part); } } return(null); }
public static HeaderPartDrawer Create([NotNull] Texture icon, [NotNull] OnHeaderPartClicked onPartClicked, string tooltip = "", bool selectable = true) { Debug.Assert(icon != null); Debug.Assert(onPartClicked != null); HeaderPartDrawer result; if (!Pool.TryGet(out result)) { result = new HeaderPartDrawer(); } NthCustomHeaderButton++; if (NthCustomHeaderButton >= 10) { NthCustomHeaderButton = 0; } var headerPart = (HeaderPart)(NthCustomHeaderButton + ((int)HeaderPart.CustomHeaderButton1)); result.Setup(headerPart, true, true, icon, tooltip, onPartClicked, onPartClicked, selectable); return(result); }
public void Insert(int index, HeaderPartDrawer button) { parts.Insert(index, button); }
public void Add(HeaderPartDrawer button) { parts.Add(button); }