Пример #1
0
        public virtual bool OnMouseDown(DxWindow window, DxControl ctl, MouseEventArgs args, Point pt)
        {
            if (Childs != null)
            {
                for (var i = Childs.Count - 1; i >= 0; i--)
                {
                    if (Childs[i].OnMouseDown(window, Childs[i], args, pt))
                    {
                        return(true);
                    }
                }
            }

            if (!IntersectTest(pt.X, pt.Y))
            {
                return(false);
            }
            if (!IsMouseOver)
            {
                return(false);
            }

            for (var i = window.DrawOnTopList.Count - 1; i >= 0; i--)
            {
                if (window.DrawOnTopList[i].IntersectTest(pt.X, pt.Y))
                {
                    return(false);
                }
            }

            IsMouseDown = true;
            MouseDown?.Invoke(ctl, args, pt);

            return(true);
        }
Пример #2
0
        public override bool OnMouseWheel(DxWindow window, DxControl ctl, MouseEventArgs args, SharpDX.Point pt)
        {
            if (!IntersectTest(pt.X, pt.Y))
            {
                return(false);
            }
            if (!IsMouseOver)
            {
                return(false);
            }

            if (args.Delta > 0) // up
            {
                if (_currentPosition > 0)
                {
                    _currentPosition--;
                }
            }
            else
            {
                if (_currentPosition < Items.Count - _maxItemsVisible)
                {
                    _currentPosition++;
                }
            }

            return(false);
        }
Пример #3
0
        public override bool OnMouseMove(DxWindow window, DxControl ctl, MouseEventArgs args, SharpDX.Point pt)
        {
            if (!IntersectTest(pt.X, pt.Y))
            {
                OnMouseLeave(window, ctl, args, pt);
                _currentHighlightItem = -1;

                return(false);
            }

            OnMouseEnter(window, ctl, args, pt);

            var f = false;

            for (var i = 0; i < (Items.Count > _maxItemsVisible ? _maxItemsVisible : Items.Count) && !f; i++)
            {
                if (pt.X < Rect.X + 4 || pt.X > Rect.X + Rect.Width - 17 || pt.Y < Rect.Y + 21 + i * 21 || pt.Y > Rect.Y + 21 + i * 21 + 21)
                {
                    continue;
                }

                _currentHighlightItem = i;
                f = true;
            }

            if (!f)
            {
                _currentHighlightItem = -1;
            }

            return(true);
        }
Пример #4
0
        public virtual bool OnMouseWheel(DxWindow window, DxControl ctl, MouseEventArgs args, Point pt)
        {
            if (Childs != null)
            {
                for (var i = Childs.Count - 1; i >= 0; i--)
                {
                    if (Childs[i].OnMouseWheel(window, Childs[i], args, pt))
                    {
                        return(true);
                    }
                }
            }

            if (!IntersectTest(pt.X, pt.Y))
            {
                return(false);
            }
            if (!IsMouseOver)
            {
                return(false);
            }

            MouseWheel?.Invoke(ctl, args, pt);

            return(true);
        }
Пример #5
0
 public virtual void OnMouseLeave(DxWindow window, DxControl ctl, MouseEventArgs args, Point pt)
 {
     if (!IsMouseOver)
     {
         return;
     }
     IsMouseOver = false;
     IsMouseDown = false;
     MouseLeave?.Invoke(ctl, args, pt);
 }
Пример #6
0
        public virtual void OnMouseEnter(DxWindow window, DxControl ctl, MouseEventArgs args, Point pt)
        {
            if (IsMouseOver)
            {
                return;
            }

            IsMouseOver = true;
            MouseEnter?.Invoke(ctl, args, pt);
        }
Пример #7
0
        public override bool OnMouseMove(DxWindow window, DxControl ctl, MouseEventArgs args, Point pt)
        {
            for (var i = DrawOnTopList.Count - 1; i >= 0; i--)
            {
                if (DrawOnTopList[i].OnMouseMove(window, DrawOnTopList[i], args, pt))
                {
                    return(true);
                }
            }

            return(base.OnMouseMove(window, ctl, args, pt));
        }
Пример #8
0
        public virtual bool OnMouseMove(DxWindow window, DxControl ctl, MouseEventArgs args, Point pt)
        {
            if (ClipToBonds && !IntersectTest(pt.X, pt.Y))
            {
                RecursiveMouseLeave(window, ctl, args, pt);

                return(false);
            }

            var f = false;

            if (Childs != null)
            {
                for (var i = Childs.Count - 1; i >= 0; i--)
                {
                    if (!f)
                    {
                        if (Childs[i].OnMouseMove(window, Childs[i], args, pt))
                        {
                            f = true;
                            OnMouseLeave(window, ctl, args, pt);
                        }
                    }
                    else
                    {
                        Childs[i].OnMouseLeave(window, ctl, args, pt);
                    }
                }
            }

            if (f)
            {
                return(true);
            }

            if (!ClipToBonds && !IntersectTest(pt.X, pt.Y))
            {
                OnMouseLeave(window, ctl, args, pt);

                return(false);
            }

            MouseMove?.Invoke(ctl, args, pt);
            OnMouseEnter(window, ctl, args, pt);

            return(true);
        }
Пример #9
0
 public override void RemoveChild(DxControl ctl)
 {
 }
Пример #10
0
 public override void AddChild(DxControl ctl)
 {
 }
Пример #11
0
        public override bool OnMouseDown(DxWindow window, DxControl ctl, MouseEventArgs args, SharpDX.Point pt)
        {
            if (!IntersectTest(pt.X, pt.Y) || !IsMouseOver)
            {
                if (Active)
                {
                    TopMost = false;
                    window.DrawOnTopList.Remove(this);
                }

                Active = false;
                return(false);
            }


            var oldActive = Active;

            if (pt.X >= Rect.X && pt.X <= Rect.X + Rect.Width && pt.Y >= Rect.Y && pt.Y <= Rect.Y + 21)
            {
                Active = !Active;
            }


            if (Active)
            {
                if (oldActive == false)
                {
                    _currentPosition = 0;
                }

                if (_currentHighlightItem != -1)
                {
                    if (MultiSelect)
                    {
                        if (SelectedIndexes.Contains(_currentHighlightItem + _currentPosition))
                        {
                            SelectedIndexes.Remove(_currentHighlightItem + _currentPosition);
                        }
                        else
                        {
                            SelectedIndexes.Add(_currentHighlightItem + _currentPosition);
                        }
                    }
                    else
                    {
                        SelectedIndexes.Clear();
                        SelectedIndexes.Add(_currentHighlightItem + _currentPosition);
                    }
                }

                if (!MultiSelect)
                {
                    if (oldActive)
                    {
                        Active = false;
                    }
                }
            }

            TopMost = Active;

            if (Active && !oldActive)
            {
                window.DrawOnTopList.Add(this);
            }
            else if (!Active && oldActive)
            {
                window.DrawOnTopList.Remove(this);
            }


            return(true);
        }
Пример #12
0
 public virtual bool OnKeyUp(DxWindow window, DxControl ctl, KeyEventArgs args)
 {
     KeyUp?.Invoke(ctl, args);
     return(true);
 }