Beispiel #1
0
        void IHandleMouseButtonPressed.OnMousePressed(object sender, MouseButtonEventArgs args)
        {
            if (args.Handled || _controlLayers.Count == 0) return;

            if (args.Button != MouseButton.Left && args.Button != MouseButton.Right)
                return; // Not a button press we're interested in

            // Set first control inactive by default
            First.IsActive = false;

            // Now try to set an active control
            for (var node = _controlLayers.First; node != null; node = node.Next) {
                if (node.Value.ScreenSpace.Contains(args.Position)) {
                    SetNewFocus(node.Value);
                    args.Handled = true;
                    break;
                }
            }
        }
Beispiel #2
0
        void IHandleMouseButtonReleased.OnMouseReleased(object sender, MouseButtonEventArgs args)
        {
            //Reasons we might not care
            if (args.Handled || _controlLayers.Count == 0 || !First.IsActive) return;

            if (First.State != ControlState.Idle) {
                First.State = ControlState.Idle;
            } else if (args.Button == MouseButton.Left) {
                args.Handled = First.ProcessIntent(ControlIntent.Released, args.Position);
            } else if (args.Button == MouseButton.Right) {
                args.Handled = First.ProcessIntent(ControlIntent.AltReleased, args.Position);
            }
        }
Beispiel #3
0
        void IHandleMouseButtonHeld.OnMouseHeld(object sender, MouseButtonEventArgs args)
        {
            if (args.Handled || _controlLayers.Count == 0) return;

            if (First.IsActive) {
                switch (args.Button) {
                    case MouseButton.Left:
                        args.Handled = First.ProcessIntent(ControlIntent.Held, args.Position);
                        break;

                    case MouseButton.Right:
                        args.Handled = First.ProcessIntent(ControlIntent.AltHeld, args.Position);
                        break;
                }
            } else {
                //(this as IMouseHandler).OnPressed(args);
            }
        }