Ejemplo n.º 1
0
 public void ComponentCtor(IUIElement owner, ButtonEventDispatcher ownerEventDispatcher)
 {
     _owner = (IUIInteractiveElement) owner;
     ownerEventDispatcher.OnLeftButtonPress.Add(this);
     ownerEventDispatcher.OnLeftButtonRelease.Add(this);
     ownerEventDispatcher.OnMouseScroll.Add(this);
 }
Ejemplo n.º 2
0
 public void ComponentCtor(IUIElement owner, ButtonEventDispatcher ownerEventDispatcher)
 {
     _owner = (IUIInteractiveElement) owner;
     _Enabled = true;
     _isMoving = false;
     ownerEventDispatcher.OnLeftButtonPress.Add(this);
     ownerEventDispatcher.OnLeftButtonRelease.Add(this);
     ownerEventDispatcher.OnMouseMovement.Add(this);
 }
Ejemplo n.º 3
0
 void ClampChildElements(IUIInteractiveElement owner, ref int x, ref int y, int oldX, int oldY)
 {
     if (x > BoundingBox.X + BoundingBox.Width || x < BoundingBox.X){
         x = oldX;
     }
     if (y > BoundingBox.Y + BoundingBox.Height || y < BoundingBox.Y){
         y = oldY;
     }
 }
Ejemplo n.º 4
0
        public void ComponentCtor(IUIElement owner, ButtonEventDispatcher ownerEventDispatcher){
            _owner = (IUIInteractiveElement) owner;

            //event stuff
            if (owner.DoesComponentExist<DraggableComponent>()){
                var dcomponent = _owner.GetComponent<DraggableComponent>();
                dcomponent.DragMovementDispatcher += OnOwnerDrag;
            }
            switch (_highlightTrigger){
                case HighlightTrigger.MouseEntryExit:
                    ownerEventDispatcher.OnMouseMovement.Add(this);
                    break;
                case HighlightTrigger.MousePressRelease:
                    ownerEventDispatcher.OnLeftButtonPress.Add(this);
                    ownerEventDispatcher.OnLeftButtonRelease.Add(this);
                    break;
                case HighlightTrigger.InvalidTrigger:
                    throw new Exception("invalid highlight trigger");
            }

            //create sprite
            _highlightSprite = new Sprite2D(_highlightTexture, (int) _owner.X, (int) _owner.Y, (int) _owner.Width, (int) _owner.Height, _owner.Depth - 0.01f, 0);
        }
Ejemplo n.º 5
0
 void ClampHandleMovement(IUIInteractiveElement owner, ref int x, ref int y, int oldX, int oldY)
 {
     var button = (Button) owner;
     float dx = x - oldX;
     float dy = y - oldY;
     InternalMovementClamp(ref dx, ref dy, button);
     x = (int) dx + oldX;
     y = (int) dy + oldY;
 }