public void Update(InputState state, double timeDelta){
            if (IsEnabled){
                if (_highlightTrigger == HighlightTrigger.MousePressRelease && state.AllowLeftButtonInterpretation) {
                    if (_owner.ContainsMouse){
                        if (state.LeftButtonChange){
                            if (state.LeftButtonState == ButtonState.Pressed){
                                //button has been pressed, highlight it
                                ProcHighlight();
                            }
                            else{
                                //button has been released, unhighlight it
                                UnprocHighlight();
                            }
                        }
                    }
                    else{
                        //mouse moved out of the button area, unhighlight
                        UnprocHighlight();
                    }
                }

                if (_highlightTrigger == HighlightTrigger.MouseEntryExit && state.AllowMouseMovementInterpretation){
                    if (_owner.ContainsMouse){
                        ProcHighlight();
                    }
                    else{
                        UnprocHighlight();
                    }
                }
            }
        }
        public void Update()
        {
            //all this crap updates the CurrentInputState to whatever the hell is going on

            //xxx right button stuff isnt implemented
            var newMouseState = Mouse.GetState();
            var newKeyboardState = Keyboard.GetState();

            var newInputState = new InputState();

            newInputState.AllowKeyboardInterpretation = true;
            newInputState.AllowLeftButtonInterpretation = true;
            newInputState.AllowMouseMovementInterpretation = true;
            newInputState.AllowMouseScrollInterpretation = true;
            newInputState.AllowRightButtonInterpretation = true;

            //mouse movement stuff needs to be updated every time, regardless of change
            newInputState.MousePos = new Point();
            newInputState.MousePos.X = newMouseState.X;
            newInputState.MousePos.Y = newMouseState.Y;
            newInputState.LeftButtonState = newMouseState.LeftButton;
            newInputState.RightButtonState = newMouseState.RightButton;
            newInputState.MouseScrollChange = newMouseState.ScrollWheelValue - _prevMouseState.ScrollWheelValue;
            newInputState.KeyboardState = newKeyboardState;

            if (_prevMouseState.X != newMouseState.X || _prevMouseState.Y != newMouseState.Y) {
                newInputState.MouseMoved = true;
            }

            if (_prevMouseState.LeftButton != newMouseState.LeftButton) {
                newInputState.LeftButtonChange = true;

                newInputState.AllowLeftButtonInterpretation = true;
                if (newMouseState.LeftButton == ButtonState.Released) {
                    //check if this qualifies as a click
                    if (_clickTimer.ElapsedMilliseconds < 200) {
                        newInputState.LeftButtonClick = true;
                        _clickTimer.Reset();
                    }
                    else {
                        _clickTimer.Reset();
                        newInputState.LeftButtonClick = false;
                    }
                }
                else { //button was pressed so start the click timer
                    _clickTimer.Start();
                }
            }

            _prevMouseState = newMouseState;

            if (CurrentInputState != null){
                newInputState.PrevState = CurrentInputState;
                CurrentInputState.PrevState = null;
            }
            else{
                newInputState.PrevState = new InputState();
            }
            CurrentInputState = newInputState;
        }
 public void Update(InputState state, double timeDelta)
 {
     if (IsEnabled){
         if (_owner.ContainsMouse)
             state.AllowLeftButtonInterpretation = false;
     }
 }
        public void Update(InputState state, double timeDelta)
        {
            if (IsEnabled){
                //see if object will start moving
                if (!_isMoving &&
                    state.AllowLeftButtonInterpretation &&
                    state.LeftButtonChange &&
                    state.LeftButtonState == ButtonState.Pressed){

                    if (_owner.BoundingBox.Contains(state.MousePos.X, state.MousePos.Y)) {
                        _isMoving = true;
                        ////UIElementCollection.Collection.DisableEntryHandlers = true;
                        _mouseOffset.X = _owner.X - state.MousePos.X;
                        _mouseOffset.Y = _owner.Y - state.MousePos.Y;
                    }
                }

                //see if should stop object from moving
                if (_isMoving &&
                    state.AllowLeftButtonInterpretation &&
                    state.LeftButtonChange &&
                    state.LeftButtonState == ButtonState.Released){

                    _isMoving = false;
                    ////UIElementCollection.Collection.DisableEntryHandlers = false;
                }

                //if moving, apply movement stuff
                if (_isMoving &&
                    state.AllowMouseMovementInterpretation){
                    var oldX = (int)_owner.X;
                    var oldY = (int)_owner.Y;
                    var x = (int)(state.MousePos.X + _mouseOffset.X);
                    var y = (int)(state.MousePos.Y + _mouseOffset.Y);

                    if (DragMovementClamp != null) {
                        DragMovementClamp(_owner, ref x, ref y, oldX, oldY);
                    }

                    //this block checks if a drag clamp is preventing the owner from moving, if thats the case then kill the drag
                    var tempRect = new Rectangle(x - (int)_owner.BoundingBox.Width * 2, y - (int)_owner.BoundingBox.Height * 2, (int)_owner.BoundingBox.Width * 6, (int)_owner.BoundingBox.Height * 6);
                    if (!tempRect.Contains(state.MousePos.X, state.MousePos.Y)) {
                        //_isMoving = false;
                        //_owner.Owner.DisableEntryHandlers = false;
                    }

                    _owner.X = x;
                    _owner.Y = y;

                    if (DragMovementDispatcher != null) {
                        DragMovementDispatcher(_owner, x - oldX, y - oldY);
                    }
                    state.AllowMouseMovementInterpretation = false;
                }
            }
        }
        public void Update(InputState state, double timeDelta) {
            if (IsEnabled){
                if (_fadeTrigger == FadeTrigger.EntryExit){
                    //mouse entry
                    if (state.AllowMouseMovementInterpretation &&
                        _owner.ContainsMouse &&
                        !_owner.ContainedMousePrevisly){

                        _isInTransition = true;
                        _isFadingOut = false;
                        if (FadeStateChangeDispatcher != null){
                            FadeStateChangeDispatcher(FadeState.Visible);
                        }
                    }

                    //mouse exit
                    if (state.AllowMouseMovementInterpretation &&
                        !_owner.ContainsMouse &&
                        _owner.ContainedMousePrevisly){

                        _isInTransition = true;
                        _isFadingOut = true;
                        if (FadeStateChangeDispatcher != null){
                            FadeStateChangeDispatcher(FadeState.Faded);
                        }
                    }
                }


                //now update any fade tweens that are running
                if (_isInTransition){
                    long timeSinceLastUpdate = DateTime.Now.Ticks - _prevUpdateTimeIndex;
                    float step = timeSinceLastUpdate/_fadeDuration;
                    if (_isFadingOut){
                        _owner.Opacity -= step;
                        if (_owner.Opacity < _fadeoutOpacity){
                            _owner.Opacity = _fadeoutOpacity;
                            _isInTransition = false;
                        }
                    }
                    else{
                        _owner.Opacity += step;
                        if (_owner.Opacity > 1){
                            _owner.Opacity = 1;
                            _isInTransition = false;
                        }
                    }
                }
                //xxx change this to time delta
                _prevUpdateTimeIndex = DateTime.Now.Ticks;
            }
        }