public static Rect GetDropDownRect(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
		{
			if (locationPriorityOrder == null)
			{
				locationPriorityOrder = new PopupLocationHelper.PopupLocation[]
				{
					PopupLocationHelper.PopupLocation.Below,
					PopupLocationHelper.PopupLocation.Above
				};
			}
			List<Rect> list = new List<Rect>();
			PopupLocationHelper.PopupLocation[] array = locationPriorityOrder;
			for (int i = 0; i < array.Length; i++)
			{
				switch (array[i])
				{
				case PopupLocationHelper.PopupLocation.Below:
				{
					Rect rect;
					if (PopupLocationHelper.PopupBelow(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
					{
						return rect;
					}
					list.Add(rect);
					break;
				}
				case PopupLocationHelper.PopupLocation.Above:
				{
					Rect rect;
					if (PopupLocationHelper.PopupAbove(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
					{
						return rect;
					}
					list.Add(rect);
					break;
				}
				case PopupLocationHelper.PopupLocation.Left:
				{
					Rect rect;
					if (PopupLocationHelper.PopupLeft(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
					{
						return rect;
					}
					list.Add(rect);
					break;
				}
				case PopupLocationHelper.PopupLocation.Right:
				{
					Rect rect;
					if (PopupLocationHelper.PopupRight(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
					{
						return rect;
					}
					list.Add(rect);
					break;
				}
				}
			}
			return PopupLocationHelper.GetLargestRect(list);
		}
 internal static void Show(Rect activatorRect, PopupWindowContent windowContent, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
 {
   if (!PopupWindowWithoutFocus.ShouldShowWindow(activatorRect))
     return;
   if ((Object) PopupWindowWithoutFocus.s_PopupWindowWithoutFocus == (Object) null)
     PopupWindowWithoutFocus.s_PopupWindowWithoutFocus = ScriptableObject.CreateInstance<PopupWindowWithoutFocus>();
   PopupWindowWithoutFocus.s_PopupWindowWithoutFocus.Init(activatorRect, windowContent, locationPriorityOrder);
 }
Beispiel #3
0
 private void Init(Rect activatorRect, PopupWindowContent windowContent, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
 {
     this.m_WindowContent = windowContent;
     this.m_WindowContent.editorWindow = this;
     this.m_WindowContent.OnOpen();
     this.m_ActivatorRect = GUIUtility.GUIToScreenRect(activatorRect);
     base.ShowAsDropDown(this.m_ActivatorRect, this.m_WindowContent.GetWindowSize(), locationPriorityOrder);
 }
 internal static void Show(Rect activatorRect, PopupWindowContent windowContent, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
 {
   if (!PopupWindow.ShouldShowWindow(activatorRect))
     return;
   PopupWindow instance = ScriptableObject.CreateInstance<PopupWindow>();
   if ((Object) instance != (Object) null)
     instance.Init(activatorRect, windowContent, locationPriorityOrder);
   GUIUtility.ExitGUI();
 }
 private void Init(Rect activatorRect, PopupWindowContent windowContent, PopupLocationHelper.PopupLocation[] locationPriorityOrder, ShowMode showMode)
 {
     base.hideFlags = HideFlags.DontSave;
     base.wantsMouseMove = true;
     this.m_WindowContent = windowContent;
     this.m_WindowContent.editorWindow = this;
     this.m_WindowContent.OnOpen();
     this.m_ActivatorRect = GUIUtility.GUIToScreenRect(activatorRect);
     base.ShowAsDropDown(this.m_ActivatorRect, this.m_WindowContent.GetWindowSize(), locationPriorityOrder, showMode);
 }
Beispiel #6
0
        public static Rect GetDropDownRect(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
        {
            if (locationPriorityOrder == null)
            {
                locationPriorityOrder = new PopupLocationHelper.PopupLocation[2]
                {
                    PopupLocationHelper.PopupLocation.Below,
                    PopupLocationHelper.PopupLocation.Above
                }
            }
            ;
            List <Rect> rects = new List <Rect>();
            Rect        resultRect;

            foreach (int num in locationPriorityOrder)
            {
                switch (num)
                {
                case 0:
                    if (PopupLocationHelper.PopupBelow(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
                    {
                        return(resultRect);
                    }
                    rects.Add(resultRect);
                    break;

                case 1:
                    if (PopupLocationHelper.PopupAbove(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
                    {
                        return(resultRect);
                    }
                    rects.Add(resultRect);
                    break;

                case 2:
                    if (PopupLocationHelper.PopupLeft(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
                    {
                        return(resultRect);
                    }
                    rects.Add(resultRect);
                    break;

                case 3:
                    if (PopupLocationHelper.PopupRight(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
                    {
                        return(resultRect);
                    }
                    rects.Add(resultRect);
                    break;
                }
            }
            return(PopupLocationHelper.GetLargestRect(rects));
        }
 private void Init(Rect activatorRect, PopupWindowContent windowContent, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
 {
   this.m_WindowContent = windowContent;
   this.m_WindowContent.editorWindow = (EditorWindow) this;
   this.m_ActivatorRect = GUIUtility.GUIToScreenRect(activatorRect);
   this.m_LastWantedSize = windowContent.GetWindowSize();
   this.m_LocationPriorityOrder = locationPriorityOrder;
   Vector2 vector2 = windowContent.GetWindowSize() + new Vector2(this.m_BorderWidth * 2f, this.m_BorderWidth * 2f);
   this.position = PopupLocationHelper.GetDropDownRect(this.m_ActivatorRect, vector2, vector2, (ContainerWindow) null, this.m_LocationPriorityOrder);
   this.ShowPopup();
   this.Repaint();
 }
Beispiel #8
0
 internal static void Show(Rect activatorRect, PopupWindowContent windowContent, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
 {
     if (ShouldShowWindow(activatorRect))
     {
         PopupWindow window = ScriptableObject.CreateInstance<PopupWindow>();
         if (window != null)
         {
             window.Init(activatorRect, windowContent, locationPriorityOrder);
         }
         GUIUtility.ExitGUI();
     }
 }
        private void Init(Rect activatorRect, PopupWindowContent windowContent, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
        {
            this.m_WindowContent = windowContent;
            this.m_WindowContent.editorWindow = (EditorWindow)this;
            this.m_ActivatorRect         = GUIUtility.GUIToScreenRect(activatorRect);
            this.m_LastWantedSize        = windowContent.GetWindowSize();
            this.m_LocationPriorityOrder = locationPriorityOrder;
            Vector2 vector2 = windowContent.GetWindowSize() + new Vector2(this.m_BorderWidth * 2f, this.m_BorderWidth * 2f);

            this.position = PopupLocationHelper.GetDropDownRect(this.m_ActivatorRect, vector2, vector2, (ContainerWindow)null, this.m_LocationPriorityOrder);
            this.ShowPopup();
            this.Repaint();
        }
Beispiel #10
0
        private void FitWindowToContent()
        {
            Vector2 wantedSize = m_WindowContent.GetWindowSize();

            if (m_LastWantedSize != wantedSize)
            {
                m_LastWantedSize = wantedSize;
                Vector2 windowSize = wantedSize + new Vector2(2 * m_BorderWidth, 2 * m_BorderWidth);
                Rect    screenRect = PopupLocationHelper.GetDropDownRect(m_ActivatorRect, windowSize, windowSize, null, m_LocationPriorityOrder);
                m_Pos   = screenRect;
                minSize = maxSize = new Vector2(screenRect.width, screenRect.height);
            }
        }
Beispiel #11
0
        void Init(Rect activatorRect, PopupWindowContent windowContent, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
        {
            m_WindowContent = windowContent;
            m_WindowContent.editorWindow = this;
            m_ActivatorRect         = GUIUtility.GUIToScreenRect(activatorRect);
            m_LastWantedSize        = windowContent.GetWindowSize();
            m_LocationPriorityOrder = locationPriorityOrder;

            Vector2 windowSize = windowContent.GetWindowSize() + new Vector2(m_BorderWidth * 2, m_BorderWidth * 2);

            position = PopupLocationHelper.GetDropDownRect(m_ActivatorRect, windowSize, windowSize, null, m_LocationPriorityOrder);
            ShowPopup();
            Repaint();
        }
        private static bool PopupLeft(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, out Rect resultRect)
        {
            Rect  rect = new Rect(buttonRect.x - maxSize.x, buttonRect.y, maxSize.x, maxSize.y);
            float num  = 0f;

            rect.xMin   -= num;
            rect.height += PopupLocationHelper.k_SpaceFromBottom;
            rect         = PopupLocationHelper.FitRect(rect, popupContainerWindow);
            float num2  = Mathf.Max(buttonRect.x - rect.x - num, 0f);
            float width = Mathf.Min(num2, maxSize.x);

            resultRect = new Rect(rect.x, rect.y, width, rect.height - PopupLocationHelper.k_SpaceFromBottom);
            return(num2 >= minSize.x);
        }
Beispiel #13
0
        private static bool PopupRight(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, out Rect resultRect)
        {
            Rect  rect1 = new Rect(buttonRect.xMax, buttonRect.y, maxSize.x, maxSize.y);
            float num   = 0.0f;

            rect1.xMax   += num;
            rect1.height += PopupLocationHelper.k_SpaceFromBottom;
            Rect  rect2 = PopupLocationHelper.FitRect(rect1, popupContainerWindow);
            float a     = Mathf.Max(rect2.xMax - buttonRect.xMax - num, 0.0f);
            float width = Mathf.Min(a, maxSize.x);

            resultRect = new Rect(rect2.x, rect2.y, width, rect2.height - PopupLocationHelper.k_SpaceFromBottom);
            return((double)a >= (double)minSize.x);
        }
        private void FitWindowToContent()
        {
            Vector2 windowSize = this.m_WindowContent.GetWindowSize();

            if (this.m_LastWantedSize != windowSize)
            {
                this.m_LastWantedSize = windowSize;
                Vector2 vector       = windowSize + new Vector2(2f * this.m_BorderWidth, 2f * this.m_BorderWidth);
                Rect    dropDownRect = PopupLocationHelper.GetDropDownRect(this.m_ActivatorRect, vector, vector, null, this.m_LocationPriorityOrder);
                this.m_Pos = dropDownRect;
                Vector2 vector2 = new Vector2(dropDownRect.width, dropDownRect.height);
                base.maxSize = vector2;
                base.minSize = vector2;
            }
        }
        private static bool PopupBelow(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, out Rect resultRect)
        {
            Rect rect = new Rect(buttonRect.x, buttonRect.yMax, maxSize.x, maxSize.y);

            rect.height += PopupLocationHelper.k_SpaceFromBottom;
            rect         = PopupLocationHelper.FitRect(rect, popupContainerWindow);
            float num = Mathf.Max(rect.yMax - buttonRect.yMax - PopupLocationHelper.k_SpaceFromBottom, 0f);

            if (num >= minSize.y)
            {
                float height = Mathf.Min(num, maxSize.y);
                resultRect = new Rect(rect.x, buttonRect.yMax, rect.width, height);
                return(true);
            }
            resultRect = new Rect(rect.x, buttonRect.yMax, rect.width, num);
            return(false);
        }
Beispiel #16
0
        private static bool PopupAbove(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, out Rect resultRect)
        {
            Rect  rect1 = new Rect(buttonRect.x, buttonRect.y - maxSize.y, maxSize.x, maxSize.y);
            float num1  = 0.0f;

            rect1.yMin -= num1;
            Rect  rect2 = PopupLocationHelper.FitRect(rect1, popupContainerWindow);
            float num2  = Mathf.Max(buttonRect.y - rect2.y - num1, 0.0f);

            if ((double)num2 >= (double)minSize.y)
            {
                float height = Mathf.Min(num2, maxSize.y);
                resultRect = new Rect(rect2.x, buttonRect.y - height, rect2.width, height);
                return(true);
            }
            resultRect = new Rect(rect2.x, buttonRect.y - num2, rect2.width, num2);
            return(false);
        }
        private static bool PopupAbove(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, out Rect resultRect)
        {
            Rect  rect = new Rect(buttonRect.x, buttonRect.y - maxSize.y, maxSize.x, maxSize.y);
            float num  = 0f;

            rect.yMin -= num;
            rect       = PopupLocationHelper.FitRect(rect, popupContainerWindow);
            float num2 = Mathf.Max(buttonRect.y - rect.y - num, 0f);

            if (num2 >= minSize.y)
            {
                float num3 = Mathf.Min(num2, maxSize.y);
                resultRect = new Rect(rect.x, buttonRect.y - num3, rect.width, num3);
                return(true);
            }
            resultRect = new Rect(rect.x, buttonRect.y - num2, rect.width, num2);
            return(false);
        }
 public static Rect GetDropDownRect(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
 {
   if (locationPriorityOrder == null)
     locationPriorityOrder = new PopupLocationHelper.PopupLocation[2]
     {
       PopupLocationHelper.PopupLocation.Below,
       PopupLocationHelper.PopupLocation.Above
     };
   List<Rect> rects = new List<Rect>();
   Rect resultRect;
   foreach (int num in locationPriorityOrder)
   {
     switch (num)
     {
       case 0:
         if (PopupLocationHelper.PopupBelow(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
           return resultRect;
         rects.Add(resultRect);
         break;
       case 1:
         if (PopupLocationHelper.PopupAbove(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
           return resultRect;
         rects.Add(resultRect);
         break;
       case 2:
         if (PopupLocationHelper.PopupLeft(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
           return resultRect;
         rects.Add(resultRect);
         break;
       case 3:
         if (PopupLocationHelper.PopupRight(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
           return resultRect;
         rects.Add(resultRect);
         break;
     }
   }
   return PopupLocationHelper.GetLargestRect(rects);
 }
 internal Rect GetDropDownRect(Rect buttonRect, Vector2 minSize, Vector2 maxSize)
 {
     return(PopupLocationHelper.GetDropDownRect(buttonRect, minSize, maxSize, this));
 }
 internal Rect GetDropDownRect(Rect buttonRect, Vector2 minSize, Vector2 maxSize, PopupLocation[] locationPriorityOrder)
 {
     return(PopupLocationHelper.GetDropDownRect(buttonRect, minSize, maxSize, this, locationPriorityOrder));
 }
        public static Rect GetDropDownRect(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
        {
            if (locationPriorityOrder == null)
            {
                locationPriorityOrder = new PopupLocationHelper.PopupLocation[]
                {
                    PopupLocationHelper.PopupLocation.Below,
                    PopupLocationHelper.PopupLocation.Above
                };
            }
            List <Rect> list = new List <Rect>();

            PopupLocationHelper.PopupLocation[] array = locationPriorityOrder;
            for (int i = 0; i < array.Length; i++)
            {
                switch (array[i])
                {
                case PopupLocationHelper.PopupLocation.Below:
                {
                    Rect rect;
                    if (PopupLocationHelper.PopupBelow(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
                    {
                        return(rect);
                    }
                    list.Add(rect);
                    break;
                }

                case PopupLocationHelper.PopupLocation.Above:
                {
                    Rect rect;
                    if (PopupLocationHelper.PopupAbove(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
                    {
                        return(rect);
                    }
                    list.Add(rect);
                    break;
                }

                case PopupLocationHelper.PopupLocation.Left:
                {
                    Rect rect;
                    if (PopupLocationHelper.PopupLeft(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
                    {
                        return(rect);
                    }
                    list.Add(rect);
                    break;
                }

                case PopupLocationHelper.PopupLocation.Right:
                {
                    Rect rect;
                    if (PopupLocationHelper.PopupRight(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
                    {
                        return(rect);
                    }
                    list.Add(rect);
                    break;
                }
                }
            }
            return(PopupLocationHelper.GetLargestRect(list));
        }
 public static Rect GetDropDownRect(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow)
 {
     return(PopupLocationHelper.GetDropDownRect(buttonRect, minSize, maxSize, popupContainerWindow, null));
 }
 private void Init(Rect activatorRect, PopupWindowContent windowContent, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
 {
     this.Init(activatorRect, windowContent, locationPriorityOrder, ShowMode.PopupMenu);
 }
 internal static void Show(Rect activatorRect, PopupWindowContent windowContent, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
 {
     Show(activatorRect, windowContent, locationPriorityOrder, ShowMode.PopupMenu);
 }
 internal Rect GetDropDownRect(Rect buttonRect, Vector2 minSize, Vector2 maxSize, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
 {
     return PopupLocationHelper.GetDropDownRect(buttonRect, minSize, maxSize, this, locationPriorityOrder);
 }