public void Update()
        {
            if (!Visible)
            {
                return;
            }
            if (_draggable.HitTest().IsHit)
            {
                var delta = _draggable.GetMoveDelta();
                _draggable.InvalidateDelta();
                var x = ((int)(CleanRect.X - delta.X)).Clamp(0, _mBoxWindow.Width - CleanRect.Width);
                var y = ((int)(CleanRect.Y - delta.Y)).Clamp(0, _mBoxWindow.Height - CleanRect.Height);
                X = x;
                Y = y;
                _draggable.SetRect(_mBoxCaptionBarRect);
                IsDirty = true;
                return;
            }

            if (_buttonNo.HitTest().IsHit)
            {
                IsDirty = true;
            }
            else if (_buttonYes.HitTest().IsHit)
            {
                IsDirty = true;
            }
        }
Example #2
0
        public void Update()
        {
            if (_lastHitTest != null)
            {
                if (MouseManager.IsDown(MouseButton.Left))
                {
                    var test = _lastHitTest.HitTest();
                    if (test.IsHit)
                    {
                        return;
                    }
                    _lastHitTest = null;
                }

                _lastHitTest = null;
            }

            if (_draggable.HitTest().IsHit)
            {
                var delta = _draggable.GetMoveDelta();
                _draggable.InvalidateDelta();
                var x = ((int)(CleanRect.X - delta.X)).Clamp(0, _mainWindow.Width - CleanRect.Width);
                var y = ((int)(CleanRect.Y - delta.Y)).Clamp(0, _mainWindow.Height - CleanRect.Height);
                X = x;
                Y = y;
                _draggable.SetRect(new Rectangle(_captionBarRect.Left, _captionBarRect.Top, _captionBarRect.Width - Ui.CaptionHeight - BorderSize, _captionBarRect.Height));
                SetRect(new Rectangle(X, Y, Width, Height));
                IsDirty = true;
                return;
            }

            _ = _closeButton.HitTest();


            for (var i = _controls.Count - 1; i > -1; i--)
            {
                var test = _controls[i].HitTest();
                if (!test.IsHit)
                {
                    continue;
                }
                _lastHitTest = test.Control;
                return;
            }
        }