Class used to implement content for a popup window.

        internal new static void Show(Rect activatorRect, PopupWindowContent windowContent, PopupLocation[] locationPriorityOrder)
        {
            if (windowContent == null)
            {
                throw new System.ArgumentNullException(nameof(windowContent));
            }

            if (s_PopupWindowWithoutFocus != null)
            {
                s_PopupWindowWithoutFocus.CloseContent();
            }

            if (ShouldShowWindow(activatorRect))
            {
                if (s_PopupWindowWithoutFocus == null)
                {
                    s_PopupWindowWithoutFocus = CreateInstance <PopupWindowWithoutFocus>();
                }

                s_PopupWindowWithoutFocus.Init(activatorRect, windowContent, locationPriorityOrder, ShowMode.PopupMenu, false);
            }
            else
            {
                windowContent.OnClose();
            }
        }
Example #2
0
        // Shown on top of any previous windows
        internal static void Show(Rect activatorRect, PopupWindowContent windowContent, PopupLocation[] locationPriorityOrder, ShowMode showMode)
        {
            // If we already have a popup window showing this type of content, then just close
            // the existing one.
            var existingWindows = Resources.FindObjectsOfTypeAll(typeof(PopupWindow));

            if (existingWindows != null && existingWindows.Length > 0)
            {
                var existingPopup = existingWindows[0] as PopupWindow;
                if (existingPopup != null && existingPopup.m_WindowContent != null && windowContent != null)
                {
                    if (existingPopup.m_WindowContent.GetType() == windowContent.GetType())
                    {
                        existingPopup.CloseWindow();
                        return;
                    }
                }
            }

            if (ShouldShowWindow(activatorRect))
            {
                PopupWindow win = CreateInstance <PopupWindow>();
                if (win != null)
                {
                    win.Init(activatorRect, windowContent, locationPriorityOrder, showMode, true);
                }
                if (Event.current != null)
                {
                    EditorGUIUtility.ExitGUI(); // Needed to prevent GUILayout errors on OSX
                }
            }
        }
Example #3
0
 // Change to private protected once available in C#.
 internal void CloseContent()
 {
     if (m_WindowContent != null)
     {
         m_WindowContent.OnClose();
     }
     m_WindowContent = null;
 }
Example #4
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 (!PopupWindowWithoutFocus.ShouldShowWindow(activatorRect))
     return;
   if ((Object) PopupWindowWithoutFocus.s_PopupWindowWithoutFocus == (Object) null)
     PopupWindowWithoutFocus.s_PopupWindowWithoutFocus = ScriptableObject.CreateInstance<PopupWindowWithoutFocus>();
   PopupWindowWithoutFocus.s_PopupWindowWithoutFocus.Init(activatorRect, windowContent, locationPriorityOrder);
 }
Example #6
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();
 }
Example #8
0
 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);
 }
Example #9
0
 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);
 }
 internal static void Show(Rect activatorRect, PopupWindowContent windowContent, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
 {
     if (PopupWindowWithoutFocus.ShouldShowWindow(activatorRect))
     {
         if (PopupWindowWithoutFocus.s_PopupWindowWithoutFocus == null)
         {
             PopupWindowWithoutFocus.s_PopupWindowWithoutFocus = ScriptableObject.CreateInstance <PopupWindowWithoutFocus>();
         }
         PopupWindowWithoutFocus.s_PopupWindowWithoutFocus.Init(activatorRect, windowContent, locationPriorityOrder);
     }
 }
Example #11
0
 internal static void Show(Rect activatorRect, PopupWindowContent windowContent,
     TooltipLocation[] locationPriorityOrder)
 {
     if (ShouldShowWindow(activatorRect))
     {
         var isInstance = _sEditorWindowWithoutFocus == null;
         if (isInstance)
             _sEditorWindowWithoutFocus = CreateInstance<TooltipServiceWindow>();
         _sEditorWindowWithoutFocus.Init(activatorRect, windowContent, locationPriorityOrder);
     }
 }
        internal new static void Show(Rect activatorRect, PopupWindowContent windowContent, PopupLocation[] locationPriorityOrder)
        {
            if (ShouldShowWindow(activatorRect))
            {
                if (s_PopupWindowWithoutFocus == null)
                {
                    s_PopupWindowWithoutFocus = CreateInstance <PopupWindowWithoutFocus>();
                }

                s_PopupWindowWithoutFocus.Init(activatorRect, windowContent, locationPriorityOrder, ShowMode.PopupMenu, false);
            }
        }
Example #13
0
 // Shown on top of any previous windows
 internal static void Show(Rect activatorRect, PopupWindowContent windowContent, PopupLocation[] locationPriorityOrder, ShowMode showMode)
 {
     if (ShouldShowWindow(activatorRect))
     {
         PopupWindow win = CreateInstance <PopupWindow>();
         if (win != null)
         {
             win.Init(activatorRect, windowContent, locationPriorityOrder, showMode, true);
         }
         EditorGUIUtility.ExitGUI(); // Needed to prevent GUILayout errors on OSX
     }
 }
Example #14
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();
     }
 }
Example #15
0
 internal static void Show(Rect activatorRect, PopupWindowContent windowContent, PopupLocationHelper.PopupLocation[] locationPriorityOrder, ShowMode showMode)
 {
     if (PopupWindow.ShouldShowWindow(activatorRect))
     {
         PopupWindow popupWindow = ScriptableObject.CreateInstance <PopupWindow>();
         if (popupWindow != null)
         {
             popupWindow.Init(activatorRect, windowContent, locationPriorityOrder, showMode);
         }
         GUIUtility.ExitGUI();
     }
 }
Example #16
0
 internal void Init(Rect activatorRect, PopupWindowContent windowContent, PopupLocation[] locationPriorityOrder, ShowMode showMode, bool giveFocus)
 {
     hideFlags       = HideFlags.DontSave;
     wantsMouseMove  = true;
     m_WindowContent = windowContent;
     m_WindowContent.editorWindow = this;
     m_WindowContent.OnOpen();
     m_ActivatorRect         = GUIUtility.GUIToScreenRect(activatorRect);
     m_LastWantedSize        = Vector2.zero;
     m_LocationPriorityOrder = locationPriorityOrder;
     ShowAsDropDown(m_ActivatorRect, m_WindowContent.GetWindowSize(), locationPriorityOrder, showMode, giveFocus);
 }
 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();
 }
        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();
        }
Example #19
0
        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();
        }
Example #20
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();
        }
Example #21
0
 public static void Show(Rect activatorRect, PopupWindowContent windowContent)
 {
     Show(activatorRect, windowContent, null);
 }
Example #22
0
 private void Init(Rect activatorRect, PopupWindowContent windowContent, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
 {
     this.Init(activatorRect, windowContent, locationPriorityOrder, ShowMode.PopupMenu);
 }
 public static void Show(Rect activatorRect, PopupWindowContent windowContent)
 {
     PopupWindowWithoutFocus.Show(activatorRect, windowContent, (PopupLocationHelper.PopupLocation[])null);
 }
		public static void Show(Rect activatorRect, PopupWindowContent windowContent)
		{
			PopupWindowWithoutFocus.Show(activatorRect, windowContent, null);
		}
 public static void Show(Rect activatorRect, PopupWindowContent windowContent)
 {
   PopupWindowWithoutFocus.Show(activatorRect, windowContent, (PopupLocationHelper.PopupLocation[]) null);
 }
 public static void Show(Rect activatorRect, PopupWindowContent windowContent)
 {
     Show(activatorRect, windowContent, null);
 }
Example #27
0
 private void Init(Rect activatorRect, PopupWindowContent windowContent, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
 {
     this.Init(activatorRect, windowContent, locationPriorityOrder, ShowMode.PopupMenu);
 }
Example #28
0
 internal static void Show(Rect activatorRect, PopupWindowContent windowContent, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
 {
     Show(activatorRect, windowContent, locationPriorityOrder, ShowMode.PopupMenu);
 }
Example #29
0
 internal static void Show(Rect activatorRect, PopupWindowContent windowContent, PopupLocation[] locationPriorityOrder)
 {
     Show(activatorRect, windowContent, locationPriorityOrder, ShowMode.PopupMenu);
 }
Example #30
0
        private void Init(Rect activatorRect, PopupWindowContent windowContent,
            TooltipLocation[] locationPriorityOrder)
        {
            m_WindowContent = windowContent;
            m_WindowContent.GetType()
                .GetProperty("editorWindow")
                .GetSetMethod(true)
                .Invoke(m_WindowContent, new object[] {this});
            m_ActivatorRect = GUIToScreenRect(activatorRect);
            m_LastWantedSize = windowContent.GetWindowSize();
            m_LocationPriorityOrder = locationPriorityOrder;
            Vector2 size = windowContent.GetWindowSize() + new Vector2(m_BorderWidth*2f, m_BorderWidth*2f);
            var rect = TooltipLocationHelper.GetDropDownRect(m_ActivatorRect, size, size, null,
                m_LocationPriorityOrder);

            minSize = size;
            maxSize = size;
            position = rect;
            ShowPopup();
            Repaint();
        }
 public static void Show(Rect activatorRect, PopupWindowContent windowContent)
 {
     PopupWindowWithoutFocus.Show(activatorRect, windowContent, null);
 }