IUIHandler OnMouseDown(MouseDownNotification mn)
        {
            if (FPickPath.Any())
            {
                //focus
                foreach (var elem in FFocusedElements)
                {
                    elem.Unfocus();
                }

                FFocusedElements.Clear();

                var last = FPickPath.LastOrDefault();

                if (last != null)
                {
                    FFocusedElements.Add(last);
                    last.Focus();
                }

                OnSelectionDown(mn);

                return(FDefaultHandler);
            }
            else //marquee selection when no element hit
            {
                return(SetupSelectionHandler());
            }
        }
        void OnSelectionDown(MouseDownNotification mn)
        {
            //selection
            if (!mn.CtrlKey)
            {
                foreach (var elem in FSelectedElements)
                {
                    elem.Deselect();
                }

                FSelectedElements.Clear();
            }

            var last = FPickPath.LastOrDefault();

            if (last != null)
            {
                if (!last.GetSelected())
                {
                    FSelectedElements.Add(last);
                    last.Select();
                }
                else
                {
                    last.Deselect();
                    FSelectedElements.Remove(last);
                }
            }
        }
Exemple #3
0
 public IMouseHandler MouseDown(MouseDownNotification arg)
 {
     if (this.onMouseDown != null)
     {
         return(this.onMouseDown(this, arg));
     }
     return(null);
 }
Exemple #4
0
 /// <summary>
 /// Creates a handler which will call the given action as long as the mouse moves.
 /// Use together with OnDragStart and EndWith in order to setup proper initialization and finalization code.
 /// </summary>
 public static IMouseHandler Select(MouseDownNotification initial, Action <MouseMoveNotification, RectangleF> selector)
 {
     return(Handler.WhileMove((c, move) =>
     {
         var marquee = GetMarquee(move.Position, initial.Position);
         selector(move, marquee);
         return c;
     }));
 }
        IUIHandler OnMouseDown(MouseDownNotification mn)
        {
            var activeLast = FController.GetFocusedElements().LastOrDefault();

            if (activeLast != null)
            {
                ActiveElement = activeLast;
            }

            return(this);
        }
Exemple #6
0
 public IMouseHandler MouseDown(MouseDownNotification arg)
 {
     if (Handler != null)
     {
         Handler = Handler.MouseDown(arg);
     }
     if (Handler == null)
     {
         return(this.continuation(arg));
     }
     return(this);
 }
Exemple #7
0
 public IMouseHandler MouseDown(MouseDownNotification arg)
 {
     if (Left != null)
     {
         Left = Left.MouseDown(arg);
     }
     if (Right != null)
     {
         Right = Right.MouseDown(arg);
     }
     return(ThisIfLeftAndRightIsNotNull());
 }
Exemple #8
0
        public void Evaluate(int spreadMax)
        {
            var binCount = BinSizePin.IOObject.Length;

            FSubjects.ResizeAndDispose(binCount);
            MouseOut.ResizeAndDismiss(binCount, slice => new Mouse(FSubjects[slice]));
            for (int bin = 0; bin < binCount; bin++)
            {
                var subject           = FSubjects[bin];
                var notificationCount = EventTypeIn[bin].SliceCount;
                for (int i = 0; i < notificationCount; i++)
                {
                    var position = PositionIn[bin][i].ToMousePoint();
                    MouseNotification notification;
                    switch (EventTypeIn[bin][i])
                    {
                    case MouseNotificationKind.MouseDown:
                        notification = new MouseDownNotification(position, MouseExtensions.ClientArea, GetMouseButtons(bin, i));
                        break;

                    case MouseNotificationKind.MouseUp:
                        notification = new MouseUpNotification(position, MouseExtensions.ClientArea, GetMouseButtons(bin, i));
                        break;

                    case MouseNotificationKind.MouseMove:
                        notification = new MouseMoveNotification(position, MouseExtensions.ClientArea);
                        break;

                    case MouseNotificationKind.MouseWheel:
                        notification = new MouseWheelNotification(position, MouseExtensions.ClientArea, MouseWheelIn[bin][i]);
                        break;

                    case MouseNotificationKind.MouseClick:
                        notification = new MouseClickNotification(position, MouseExtensions.ClientArea, GetMouseButtons(bin, i), Math.Max(ClickCountIn[bin][i], 1));
                        break;

                    default:
                        throw new NotImplementedException();
                    }
                    if (notification != null)
                    {
                        subject.OnNext(notification);
                    }
                }
            }
        }
Exemple #9
0
 public IMouseKeyboardHandler MouseDown(MouseDownNotification arg)
 {
     return(FHandler.MouseDown(arg) ? this : null);
 }