Пример #1
0
    void OnGUI()
    {
        if (!Valid)
        {
            return;
        }

        if (!Visible)
        {
            return;
        }

        GUI.color = new Color(1.0f, 1.0f, 1.0f, 1.0f);

        windowRect = GUI.Window(View.windowId, windowRect, windowFunction, View.URL);

        // bring to front, popup is always front
        View.BringToFront();

        // Handle keyboard input
        Event e = Event.current;

        if (GUIUtility.keyboardControl == 0)
        {
            if (e.isKey)
            {
                View.ProcessKey(e);
            }
        }

        if (e.isKey)
        {
            if (e.keyCode == KeyCode.Tab || e.character == '\t')
            {
                e.Use();
            }
        }

        if (Width != _currentWidth || Height != _currentHeight)
        {
            View.Height = Height;
            View.Width  = Width;

            // can be clamped so set back
            _currentHeight = Height = View.Height;
            _currentWidth  = Width = View.Width;

            windowRect.width  = Width + 8;
            windowRect.height = Height + 8;
        }
    }