public virtual void OnPointerLeave(IGuiContext context, GuiPointerEventArgs args)
 {
     if (IsEnabled)
     {
         HoverStyle?.Revert(this);
     }
 }
 public virtual void OnPointerEnter(IGuiContext context, GuiPointerEventArgs args)
 {
     if (IsEnabled)
     {
         HoverStyle?.Apply(this);
     }
 }
Beispiel #3
0
        public override void OnPointerDown(IGuiContext context, GuiPointerEventArgs args)
        {
            base.OnPointerDown(context, args);

            SelectionStart  = FindNearestGlyphIndex(context, args.Position);
            _isCaretVisible = true;
        }
        public override void OnPointerDown(GuiPointerEventArgs args)
        {
            base.OnPointerDown(args);

            SelectionStart  = Text.Length;
            _isCaretVisible = true;
        }
Beispiel #5
0
 public override bool OnPointerLeave(IGuiContext context, GuiPointerEventArgs args)
 {
     if (IsEnabled)
     {
         IsPressed = false;
     }
     return(base.OnPointerLeave(context, args));
 }
Beispiel #6
0
        public override void OnPointerLeave(IGuiContext context, GuiPointerEventArgs args)
        {
            base.OnPointerLeave(context, args);

            if (IsEnabled)
            {
                IsPressed = false;
            }
        }
Beispiel #7
0
 public virtual bool OnPointerLeave(IGuiContext context, GuiPointerEventArgs args)
 {
     if (IsEnabled && _isHovering)
     {
         _isHovering = false;
         HoverStyle?.Revert(this);
     }
     return(true);
 }
        public override void OnPointerEnter(GuiPointerEventArgs args)
        {
            base.OnPointerEnter(args);

            if (IsEnabled && _isPointerDown)
            {
                IsPressed = true;
            }
        }
Beispiel #9
0
        public override bool OnPointerUp(IGuiContext context, GuiPointerEventArgs args)
        {
            if (IsFocused && BoundingRectangle.Contains(args.Position))
            {
                IsChecked = !IsChecked;
            }

            return(base.OnPointerUp(context, args));
        }
Beispiel #10
0
        public override bool OnPointerEnter(IGuiContext context, GuiPointerEventArgs args)
        {
            if (IsEnabled && _isPointerDown)
            {
                IsPressed = true;
            }

            return(base.OnPointerEnter(context, args));
        }
Beispiel #11
0
        public override void OnPointerUp(GuiPointerEventArgs args)
        {
            base.OnPointerUp(args);

            if (IsFocused && BoundingRectangle.Contains(args.Position))
            {
                IsChecked = !IsChecked;
            }
        }
        public override void OnPointerLeave(GuiPointerEventArgs args)
        {
            base.OnPointerLeave(args);

            if (IsEnabled)
            {
                IsPressed = false;
            }
        }
Beispiel #13
0
 public virtual bool OnPointerEnter(IGuiContext context, GuiPointerEventArgs args)
 {
     if (IsEnabled && !_isHovering)
     {
         _isHovering = true;
         HoverStyle?.Apply(this);
     }
     return(true);
 }
        public override void OnPointerDown(GuiPointerEventArgs args)
        {
            base.OnPointerDown(args);

            if (IsEnabled)
            {
                _isPointerDown = true;
                IsPressed      = true;
            }
        }
        public override bool OnPointerDown(IGuiContext context, GuiPointerEventArgs args)
        {
            SelectionStart  = FindNearestGlyphIndex(context, args.Position);
            _isCaretVisible = true;

            _selectionIndexes.Clear();
            _selectionIndexes.Push(SelectionStart);
            _startSelectionBox = Text.Length > 0;

            return(base.OnPointerDown(context, args));
        }
Beispiel #16
0
        public override bool OnPointerUp(IGuiContext context, GuiPointerEventArgs args)
        {
            _isPointerDown = false;

            if (IsPressed)
            {
                IsPressed = false;

                if (BoundingRectangle.Contains(args.Position) && IsEnabled)
                {
                    TriggerClicked();
                }
            }
            return(base.OnPointerUp(context, args));
        }
        public override void OnPointerUp(GuiPointerEventArgs args)
        {
            base.OnPointerUp(args);

            _isPointerDown = false;

            if (IsPressed)
            {
                IsPressed = false;

                if (BoundingRectangle.Contains(args.Position) && IsEnabled)
                {
                    Clicked?.Invoke(this, EventArgs.Empty);
                }
            }
        }
        public override bool OnPointerDown(IGuiContext context, GuiPointerEventArgs args)
        {
            var contentRectangle = GetContentRectangle(context);

            for (var i = FirstIndex; i < Items.Count; i++)
            {
                var itemRectangle = GetItemRectangle(context, i - FirstIndex, contentRectangle);

                if (itemRectangle.Contains(args.Position))
                {
                    SelectedIndex = i;
                    OnItemClicked(context, args);
                    break;
                }
            }

            return(base.OnPointerDown(context, args));
        }
        public override bool OnPointerMove(IGuiContext context, GuiPointerEventArgs args)
        {
            if (_startSelectionBox)
            {
                var selection = FindNearestGlyphIndex(context, args.Position);
                if (selection != _selectionIndexes.Peek())
                {
                    if (_selectionIndexes.Count == 1)
                    {
                        _selectionIndexes.Push(selection);
                    }
                    else if (_selectionIndexes.Last() < _selectionIndexes.Peek())
                    {
                        if (selection > _selectionIndexes.Peek())
                        {
                            _selectionIndexes.Pop();
                        }
                        else
                        {
                            _selectionIndexes.Push(selection);
                        }
                    }
                    else
                    {
                        if (selection < _selectionIndexes.Peek())
                        {
                            _selectionIndexes.Pop();
                        }
                        else
                        {
                            _selectionIndexes.Push(selection);
                        }
                    }
                    SelectionStart = selection;
                }
            }

            return(base.OnPointerMove(context, args));
        }
 public virtual void OnPointerUp(IGuiContext context, GuiPointerEventArgs args)
 {
 }
Beispiel #21
0
 public override bool OnPointerDown(IGuiContext context, GuiPointerEventArgs args)
 {
     IsOpen = !IsOpen;
     return(base.OnPointerDown(context, args));
 }
        public override bool OnPointerUp(IGuiContext context, GuiPointerEventArgs args)
        {
            _startSelectionBox = false;

            return(base.OnPointerUp(context, args));
        }
 protected virtual void OnItemClicked(IGuiContext context, GuiPointerEventArgs args)
 {
 }
Beispiel #24
0
 public virtual bool OnPointerUp(IGuiContext context, GuiPointerEventArgs args)
 {
     return(true);
 }
        public override void OnPointerDown(IGuiContext context, GuiPointerEventArgs args)
        {
            base.OnPointerDown(context, args);

            IsOpen = !IsOpen;
        }
 public virtual void OnPointerUp(GuiPointerEventArgs args)
 {
 }