コード例 #1
0
        // Used for popup style windows.
        internal void ShowPopupWithMode(ShowMode mode, bool giveFocus)
        {
            if (m_Parent == null)
            {
                ContainerWindow cw = ScriptableObject.CreateInstance <ContainerWindow>();
                cw.title = titleContent.text;
                HostView host = ScriptableObject.CreateInstance <HostView>();
                host.actualView = this; // Among other things, this sets m_Parent to host

                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.ShowPopupWithMode(mode, giveFocus);
            }
        }