ShowPopup() private method

private ShowPopup ( ) : void
return void
        void Setup(string tooltip, Rect rect)
        {
            m_hoverRect    = rect;
            m_tooltip.text = tooltip;

            // Calculate size and position tooltip view
            m_Style = EditorStyles.tooltip;

            m_Style.wordWrap = false;
            m_optimalSize    = m_Style.CalcSize(m_tooltip);

            if (m_optimalSize.x > MAX_WIDTH)
            {
                m_Style.wordWrap = true;
                m_optimalSize.x  = MAX_WIDTH;
                m_optimalSize.y  = m_Style.CalcHeight(m_tooltip, MAX_WIDTH);
            }

            m_tooltipContainer.position = new Rect(
                Mathf.Floor(m_hoverRect.x + (m_hoverRect.width / 2) - (m_optimalSize.x / 2)),
                Mathf.Floor(m_hoverRect.y + (m_hoverRect.height) + 10.0f),
                m_optimalSize.x, m_optimalSize.y);

            position = new Rect(0, 0, m_optimalSize.x, m_optimalSize.y);

            m_tooltipContainer.ShowPopup();
            m_tooltipContainer.SetAlpha(1.0f);
            s_guiView.mouseRayInvisible = true;

            RepaintImmediately(); // Force repaint to fix that the tooltip text did sometimes not update (we did not get a new OnGUI if the rect had the same size)
        }
示例#2
0
 public void ShowPopup()
 {
     if (this.m_Parent == null)
     {
         ContainerWindow containerWindow = ScriptableObject.CreateInstance <ContainerWindow>();
         containerWindow.title = this.titleContent.text;
         HostView hostView = ScriptableObject.CreateInstance <HostView>();
         hostView.actualView = this;
         Rect position = this.m_Parent.borderSize.Add(new Rect(this.position.x, this.position.y, this.position.width, this.position.height));
         containerWindow.position = position;
         containerWindow.rootView = hostView;
         this.MakeParentsSettingsMatchMe();
         containerWindow.ShowPopup();
     }
 }
        // Used for popup style windows.
        public void ShowPopup()
        {
            if (m_Parent == null)
            {
                ContainerWindow cw = ScriptableObject.CreateInstance <ContainerWindow>();
                cw.title = titleContent.text;
                HostView host = ScriptableObject.CreateInstance <HostView>();
                host.actualView = this;

                Rect r = m_Parent.borderSize.Add(new Rect(position.x, position.y, position.width, position.height));
                // Order is important here: first set rect of container, then assign main view, then apply various settings, then show.
                // Otherwise the rect won't be set until first resize happens.
                cw.position = r;
                cw.rootView = host;
                MakeParentsSettingsMatchMe();
                cw.ShowPopup();
            }
        }
示例#4
0
        /// <summary>
        ///   <para>Shows an Editor window using popup-style framing.</para>
        /// </summary>
        public void ShowPopup()
        {
            if (!((UnityEngine.Object) this.m_Parent == (UnityEngine.Object)null))
            {
                return;
            }
            ContainerWindow instance1 = ScriptableObject.CreateInstance <ContainerWindow>();

            instance1.title = this.titleContent.text;
            HostView instance2 = ScriptableObject.CreateInstance <HostView>();

            instance2.actualView = this;
            Rect rect = this.m_Parent.borderSize.Add(new Rect(this.position.x, this.position.y, this.position.width, this.position.height));

            instance1.position = rect;
            instance1.mainView = (View)instance2;
            this.MakeParentsSettingsMatchMe();
            instance1.ShowPopup();
        }