Beispiel #1
0
 public float GetAbsY()
 {
     if (_parent != null)
     {
         return(_parent.GetAbsY() + _position.Y);
     }
     else
     {
         return(_position.Y);
     }
 }
Beispiel #2
0
        void mouse_MouseButtonPressed(MouseButtons buttons)
        {
            SetActiveControl(GetControlByPosition(_controls, null, 0, 0, (int)mouseX, (int)mouseY));

            if (_activeControl != null)
            {
                _activeControl.OnMouseDown(buttons, mouseX - _activeControl.GetAbsX(), mouseY - _activeControl.GetAbsY());
            }

            _downControl  = _activeControl;
            _downButtons |= buttons;
        }
Beispiel #3
0
        void mouse_MouseButtonReleased(MouseButtons buttons)
        {
            Control c = GetControlByPosition(_controls, null, 0, 0, (int)mouseX, (int)mouseY);

            if (_downControl != null)
            {
                _downControl.OnMouseUp(buttons, mouseX - _downControl.GetAbsX(), mouseY - _downControl.GetAbsY());

                if (_downControl == c && (_downButtons & buttons) != 0)
                {
                    _downControl.OnClick(_downButtons & buttons, mouseX - _downControl.GetAbsX(), mouseY - _downControl.GetAbsY());
                }
            }

            _downButtons &= ~buttons;
        }