コード例 #1
0
ファイル: Popup.cs プロジェクト: alexcmd/OpenTKGUI
        public override void Update(GUIControlContext Context, double Time)
        {
            base.Update(Context, Time);
            MouseState ms = Context.MouseState;

            // Shown on right click.
            if (this._ShowOnRightClick && ms != null && ms.HasReleasedButton(MouseButton.Right))
            {
                this._CallAtMouse = true;
            }

            // Set up call on mouse
            if (this._CallAtMouse)
            {
                if (ms != null)
                {
                    this._Callpoint = ms.Position;
                }
                this._CallAtMouse = false;
            }

            // Call up popup, if needed
            if (this._Callpoint != null && this._Items != null)
            {
                Point cp = this._Callpoint.Value;

                LayerContainer container;
                Point layeroffset;
                if (Context.FindAncestor<LayerContainer>(out container, out layeroffset))
                {
                    Popup.Call(container, cp - layeroffset, this._Items, this._Style);
                }

                this._Callpoint = null;
            }
        }