Ejemplo n.º 1
0
        public void Pressed(Point start)
        {
            this.pressedHandledBy = null;

            foreach (var el in this.elements.Where(e => e.Bounds.Contains(start)))
            {
                this.pressedHandledBy = el.Pressed(start.ClientTo(el.Location));
                if (this.pressedHandledBy != null)
                {
                    break;
                }
            }
            if (this.pressedHandledBy == null && this.PressedHandler != null)
            {
                this.pressedHandledBy = this.PressedHandler(start);
            }
        }
Ejemplo n.º 2
0
        private void DoubleTap(Point p)
        {
            var handled = false;

            foreach (var el in this.elements.Where(e => e.Bounds.Contains(p)))
            {
                if (el.DoubleTap(p.ClientTo(el.Location)))
                {
                    handled = true;
                    break;
                }
            }
            if (!handled && this.DoubleTapHandler != null)
            {
                this.DoubleTapHandler(p);
            }
        }
Ejemplo n.º 3
0
        public void Pan(Point from, Point to, bool done)
        {
            var handled = false;

            foreach (var el in this.elements.Where(e => e.Bounds.Contains(this.gestures.GestureStartPoint)))
            {
                if (el.Pan(from.ClientTo(el.Location), to.ClientTo(el.Location), done, this.gestures.GestureStartPoint.ClientTo(el.Location)))
                {
                    handled = true;
                    break;
                }
            }
            if (!handled && this.PanHandler != null)
            {
                this.PanHandler(from, to, done, this.gestures.GestureStartPoint);
            }
        }
Ejemplo n.º 4
0
        public void Flick(Point from, Point to, int millisecs)
        {
            var handled = false;

            foreach (var el in this.elements.Where(e => e.Bounds.Contains(this.gestures.GestureStartPoint)))
            {
                if (el.Flick(from.ClientTo(el.Location), to.ClientTo(el.Location), millisecs, this.gestures.GestureStartPoint.ClientTo(el.Location)))
                {
                    handled = true;
                    break;
                }
            }
            if (!handled && this.FlickHandler != null)
            {
                this.FlickHandler(from, to, millisecs, this.gestures.GestureStartPoint);
            }
        }
Ejemplo n.º 5
0
 private void Tap(Point p)
 {
     this.Invoke(
         new Action(() =>
     {
         if (this.pressedHandledBy != null && FleuxSettings.HapticFeedbackMode == FleuxSettings.HapticOptions.Tap)
         {
             FleuxApplication.Led.Vibrate();
         }
         var handled = false;
         foreach (var el in this.elements.Where(e => e.Bounds.Contains(p)))
         {
             if (el.Tap(p.ClientTo(el.Location)))
             {
                 handled = true;
                 break;
             }
         }
         if (!handled && this.TapHandler != null)
         {
             handled = this.TapHandler(p);
         }
     }));
 }
Ejemplo n.º 6
0
 private void Tap(Point p)
 {
     this.Invoke(
             new Action(() =>
             {
                 if (this.pressedHandledBy != null && FleuxSettings.HapticFeedbackMode == FleuxSettings.HapticOptions.Tap)
                 {
                     FleuxApplication.Led.Vibrate();
                 }
                 var handled = false;
                 foreach (var el in this.elements.Where(e => e.Bounds.Contains(p)))
                 {
                     if (el.Tap(p.ClientTo(el.Location)))
                     {
                         handled = true;
                         break;
                     }
                 }
                 if (!handled && this.TapHandler != null)
                 {
                     handled = this.TapHandler(p);
                 }
             }));
 }
Ejemplo n.º 7
0
 private void Hold(Point p)
 {
     var handled = false;
     foreach (var el in this.elements.Where(e => e.Bounds.Contains(p)))
     {
         if (el.Hold(p.ClientTo(el.Location)))
         {
             handled = true;
             break;
         }
     }
     if (!handled && this.HoldHandler != null)
     {
         this.HoldHandler(p);
     }
 }
Ejemplo n.º 8
0
        public void Pressed(Point start)
        {
            this.pressedHandledBy = null;

            foreach (var el in this.elements.Where(e => e.Bounds.Contains(start)))
            {
                this.pressedHandledBy = el.Pressed(start.ClientTo(el.Location));
                if (this.pressedHandledBy != null)
                {
                    break;
                }
            }
            if (this.pressedHandledBy == null && this.PressedHandler != null)
            {
                this.pressedHandledBy = this.PressedHandler(start);
            }
        }
Ejemplo n.º 9
0
 public void Pan(Point from, Point to, bool done)
 {
     var handled = false;
     foreach (var el in this.elements.Where(e => e.Bounds.Contains(this.gestures.GestureStartPoint)))
     {
         if (el.Pan(from.ClientTo(el.Location), to.ClientTo(el.Location), done, this.gestures.GestureStartPoint.ClientTo(el.Location)))
         {
             handled = true;
             break;
         }
     }
     if (!handled && this.PanHandler != null)
     {
         this.PanHandler(from, to, done, this.gestures.GestureStartPoint);
     }
 }
Ejemplo n.º 10
0
 public void Flick(Point from, Point to, int millisecs)
 {
     var handled = false;
     foreach (var el in this.elements.Where(e => e.Bounds.Contains(this.gestures.GestureStartPoint)))
     {
         if (el.Flick(from.ClientTo(el.Location), to.ClientTo(el.Location), millisecs, this.gestures.GestureStartPoint.ClientTo(el.Location)))
         {
             handled = true;
             break;
         }
     }
     if (!handled && this.FlickHandler != null)
     {
         this.FlickHandler(from, to, millisecs, this.gestures.GestureStartPoint);
     }
 }
Ejemplo n.º 11
0
 private void DoubleTap(Point p)
 {
     var handled = false;
     foreach (var el in this.elements.Where(e => e.Bounds.Contains(p)).ToArray())
     {
         if (el.DoubleTap(p.ClientTo(el.Location)))
         {
             handled = true;
             break;
         }
     }
     if (!handled && this.DoubleTapHandler != null)
     {
         this.DoubleTapHandler(p);
     }
 }
Ejemplo n.º 12
0
 public static Point ClientTo(this Point p1, Point p2)
 {
     return(p1.ClientTo(p2.X, p2.Y));
 }