public float GetAbsY() { if (_parent != null) { return(_parent.GetAbsY() + _position.Y); } else { return(_position.Y); } }
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; }
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; }