Пример #1
0
        public override void onMouseDown(object sender, MouseButtonEventArgs e)
        {
            base.onMouseDown(sender, e);

            Rectangle cursInScreenCoord = ScreenCoordinates(cursor + Slot.Position);

            if (cursInScreenCoord.ContainsOrIsEqual(e.Position))
            {
                holdCursor = true;
            }
            else if (_orientation == Orientation.Horizontal)
            {
                if (e.Position.X < cursInScreenCoord.Left)
                {
                    Value -= LargeIncrement;
                }
                else
                {
                    Value += LargeIncrement;
                }
            }
            else
            {
                if (e.Position.Y < cursInScreenCoord.Top)
                {
                    Value -= LargeIncrement;
                }
                else
                {
                    Value += LargeIncrement;
                }
            }
        }
Пример #2
0
        public Rectangles SmallerContainedRects(Rectangle r)
        {
            Rectangles tmp = new Rectangles();

            foreach (Rectangle rInList in list)
            {
                if (r.ContainsOrIsEqual(rInList) && rInList.Size < r.Size)
                {
                    tmp.list.Add(rInList);
                }
            }

            return(tmp);
        }
Пример #3
0
        public Rectangles containedOrEqualRects(Rectangle r)
        {
            Rectangles tmp = new Rectangles();

            foreach (Rectangle rInList in list)
            {
                if (r.ContainsOrIsEqual(rInList))                // && rInList.Size <= r.Size)
                {
                    tmp.list.Add(rInList);
                }
            }

            return(tmp);
        }
Пример #4
0
        void getFocusedChild(Point lm)
        {
            Rectangle cb = ClientRectangle;

            childrenRWLock.EnterReadLock();
            foreach (GraphicObject c in Children)
            {
                Rectangle bounds = c.Slot + cb.Position;
                if (!bounds.ContainsOrIsEqual(lm))
                {
                    continue;
                }
                rIn          = bounds;
                focusedChild = c;
                break;
            }
            childrenRWLock.ExitReadLock();
        }
Пример #5
0
        public override void onMouseDown(object sender, MouseButtonEventArgs e)
        {
            base.onMouseDown(sender, e);
            mouseDownInit      = ScreenPointToLocal(e.Position);
            mouseDownInitValue = Value;
            Rectangle cursInScreenCoord = ScreenCoordinates(cursor + Slot.Position);

            if (cursInScreenCoord.ContainsOrIsEqual(e.Position))
            {
//				Rectangle r = ClientRectangle;
//				if (r.Width - _cursorSize > 0) {
//					double unit = (Maximum - Minimum) / (double)(r.Width - _cursorSize);
//					mouseDownInit += new Point ((int)(Value / unit), (int)(Value / unit));
//				}
                holdCursor = true;
            }
            else if (_orientation == Orientation.Horizontal)
            {
                if (e.Position.X < cursInScreenCoord.Left)
                {
                    Value -= LargeIncrement;
                }
                else
                {
                    Value += LargeIncrement;
                }
            }
            else
            {
                if (e.Position.Y < cursInScreenCoord.Top)
                {
                    Value -= LargeIncrement;
                }
                else
                {
                    Value += LargeIncrement;
                }
            }
        }
Пример #6
0
        public override bool PointIsIn(ref Point m)
        {
            if (!(Visible & IsEnabled) || IsDragged)
            {
                return(false);
            }
            if (!Parent.PointIsIn(ref m))
            {
                return(false);
            }
            m -= (Parent.getSlot().Position + Parent.ClientRectangle.Position);
            Rectangle r = Slot;

            if (Width == Measure.Stretched)
            {
                r.Inflate(0, 5);
            }
            else
            {
                r.Inflate(5, 0);
            }
            return(r.ContainsOrIsEqual(m));
        }
Пример #7
0
        public override void onMouseMove(object sender, MouseMoveEventArgs e)
        {
            if (IsDropTarget)
            {
                DockWindow dw = IFace.DragAndDropOperation.DragSource as DockWindow;
                if (dw.IsDocked)
                {
                    base.onMouseMove(sender, e);
                    return;
                }

                Alignment curDockPos = dw.DockingPosition;
                dw.DockingPosition = Alignment.Undefined;

                Rectangle cb = ClientRectangle;
                Point     lm = ScreenPointToLocal(e.Position);

                if (Children.Count == 0)
                {
                    Rectangle r = cb;
                    r.Inflate(r.Width / -5, r.Height / -5);
                    if (r.ContainsOrIsEqual(lm))
                    {
                        dw.DockingPosition = Alignment.Center;
                    }
                }
                else
                {
                    rIn = cb;

                    if (Orientation == Orientation.Horizontal || Children.Count == 1)
                    {
                        if (lm.Y > cb.Top + cb.Height / 3 && lm.Y < cb.Bottom - cb.Height / 3)
                        {
                            if (lm.X < cb.Left + cb.Width / 3)
                            {
                                dw.DockingPosition = Alignment.Left;
                            }
                            else if (lm.X > cb.Right - cb.Width / 3)
                            {
                                dw.DockingPosition = Alignment.Right;
                            }
                        }
                        else
                        {
                            getFocusedChild(lm);
                            if (focusedChild != null)
                            {
                                if (lm.Y < rIn.Top + rIn.Height / 3)
                                {
                                    dw.DockingPosition = Alignment.Top;
                                }
                                else if (lm.Y > rIn.Bottom - rIn.Height / 3)
                                {
                                    dw.DockingPosition = Alignment.Bottom;
                                }
                            }
                        }
                    }
                    if (Orientation == Orientation.Vertical || Children.Count == 1)
                    {
                        if (lm.X > cb.Left + cb.Width / 3 && lm.X < cb.Right - cb.Width / 3)
                        {
                            if (lm.Y < cb.Top + cb.Height / 3)
                            {
                                dw.DockingPosition = Alignment.Top;
                            }
                            else if (lm.Y > cb.Bottom - cb.Height / 3)
                            {
                                dw.DockingPosition = Alignment.Bottom;
                            }
                        }
                        else
                        {
                            getFocusedChild(lm);
                            if (focusedChild != null)
                            {
                                if (lm.X < rIn.Left + rIn.Width / 3)
                                {
                                    dw.DockingPosition = Alignment.Left;
                                }
                                else if (lm.X > rIn.Right - rIn.Width / 3)
                                {
                                    dw.DockingPosition = Alignment.Right;
                                }
                            }
                        }
                    }
                }

                if (curDockPos != dw.DockingPosition)
                {
                    RegisterForGraphicUpdate();
                }
            }
            base.onMouseMove(sender, e);
        }