/// <summary> /// Occurs on a styles or mouse down event. /// </summary> public virtual void OnDown(PointEventArgs e) { if (enabled) { IsDown = true; } }
public override void OnMove(PointEventArgs p) { if (downControl != null) { downControl.OnMove(this.TranslatePoint(downControl, p)); } }
private int IndexFromPoint(PointEventArgs e) { int index = 0; if (Text.Length > 0) { using (Graphics g = CreateGraphics()) { if (g != null) { Rectangle r = ClientRectangle; r.Inflate(ScaleX(-3), 0); int left = r.Left; int x = e.X; for (int i = 1; i <= Text.Length; i++) { string s = Text.Substring(0, i); int w = (int)g.MeasureString(s, Font).Width; if ((w + left) >= x) { break; } index++; } } } } index = EnsureStartSel(index); return(index); }
private PointEventArgs TranslatePoint(FluidControl c, PointEventArgs p) { p.X -= c.Bounds.X; p.Y -= c.Bounds.Y; //PointEventArgs e = new PointEventArgs(p.Gesture, p.X - c.Bounds.X, p.Y - c.Bounds.Y); return(p); }
public override void OnMove(PointEventArgs e) { if (!gestureCanceled && Enabled) { IsDown = ClientRectangle.Contains(e.X, e.Y); } }
public override void OnRelease(PointEventArgs p) { base.OnRelease(p); if (downControl != null) { downControl.OnRelease(TranslatePoint(downControl, p)); } }
public override void OnUp(PointEventArgs p) { if (downControl != null) { downControl.OnUp(TranslatePoint(downControl, p)); } downControl = null; }
public override bool OnClick(PointEventArgs p) { base.OnClick(p); if (downControl != null) { downControl.OnClick(TranslatePoint(downControl, p)); } return(true); }
/// <summary> /// Occurs on a styles or mouse up event. /// </summary> public virtual void OnUp(PointEventArgs e) { canClick = IsDown; IsDown = false; //if (Parent == null) //{ // if (isDown && !clicked) OnClick(e); //} }
/// <summary> /// Occurs when the control is clicked. /// </summary> public virtual bool OnClick(PointEventArgs e) { if (canClick && enabled) { if (ClientRectangle.Contains(e.X, e.Y)) { IsDown = false; PerformClick(); } } return(false); }
/// <summary> /// Scroll the container with finger, stylus or mouse. /// </summary> /// <param name="pressed">The position when the container was first touched.</param> /// <param name="moving">The position while moving.</param> protected virtual void Scroll(PointEventArgs pressed, Point moving) { if (CanShowScrollbar) { StopFadeTimer(); ShowScrollBar = true; int deltaY = (int)((moving.Y - pressed.Y)); int deltaX = (int)((moving.X - pressed.X)); lastDeltaY = downTop - deltaY - TopOffset; int vt = downTop - (int)(deltaY / ScaleFactor.Height); SetTopOffset(vt); } }
public override bool OnClick(PointEventArgs p) { if (!Enabled) { return(false); } if (downControl != null) { return(downControl.OnClick(TranslatePoint(downControl, p))); } base.OnClick(p); return(false); }
public override void OnUp(PointEventArgs e) { base.OnUp(e); int tickDelta = Environment.TickCount - lastTick; IsMoving = false; EnsureValidPosition(); if (IsDown) { OnClick(touchdPosition); } IsDown = false; }
public override void OnDown(PointEventArgs e) { base.OnDown(e); int index = IndexFromPoint(e); downIndex = index; if (index == startSel) { Select(0, Text.Length); } else { Select(index, 0); } }
public override void OnMove(PointEventArgs e) { base.OnMove(e); int index = IndexFromPoint(e); if (index != downIndex) { int idx0 = Math.Min(index, downIndex); int idx1 = Math.Max(index, downIndex); int selCount = idx1 - idx0; int startSel = idx0; if (this.selCount != selCount || this.startSel != startSel) { Select(startSel, selCount); } } }
protected override void OnMouseDown(MouseEventArgs e) { if (control == null) { return; } lastTick = startTick = Environment.TickCount; lastGesture = Gesture.None; Point p = new Point(e.X, e.Y); startPoint = lastGesturePoint = p; PointEventArgs pe = TranslatePoint(p.X, p.Y); IsDown = true; control.OnDown(pe); IsDown = false; keyInputHelperControl.Focus(); }
public override void OnMove(PointEventArgs e) { SizeF factor = ScaleFactor; int deltaY = e.Y - touchdPosition.Y; int deltaX = e.X - touchdPosition.X; lastDeltaX = deltaX; lastTick = Environment.TickCount; int threshold = (int)(ScrollContainer.MinMovePixelDistance * factor.Height); if ((isMoving || Math.Abs(deltaY) >= threshold) && CanScroll) { if (!isMoving) { touchdPosition = e; } IsMoving = true; Scroll(touchdPosition, new Point(e.X, e.Y)); } }
public override void OnDown(PointEventArgs p) { base.OnDown(p); FluidControl control = ControlFromPoint(p.X, p.Y); downControl = control; if (control != null) { PointEventArgs p2 = TranslatePoint(control, p); control.OnDown(p2); } if (control != null && control.Selectable) { selectedControl = control; } else if (control == null) { selectedControl = null; } }
public override void OnDown(PointEventArgs e) { ///stop the count down to hide the scrollbar, but do not necassarily show the scrollbar: StopFadeTimer(); touchdPosition.X = e.X; touchdPosition.Y = e.Y; if (enableScroll) { pressedGesture = Gesture.None; bool isAutoScrolling = IsAutoScrolling; StopAutoScroll(); lastDeltaY = 0; lastDeltaX = 0; lastTick = Environment.TickCount; downTop = TopOffset; CanScroll = true; IsMoving = false; IsDown = !isAutoScrolling; } }
protected override void OnMouseUp(MouseEventArgs e) { if (control == null) { return; } int duration = Environment.TickCount - lastTick; PointEventArgs p = TranslatePoint(e.X, e.Y); control.OnUp(p); // note that p might change it's value, therefore it is set again: p = TranslatePoint(e.X, e.Y); bool gestured = PerformUpGesture(e); if (!gestured) { if (duration < ClickThreshold) { control.OnClick(p); } } }
public override void OnDown(PointEventArgs p) { if (!Enabled) { return; } base.OnDown(p); FluidControl control = ControlFromPoint(p.X, p.Y); if (control != null && !control.Active) { control = null; } downControl = control; selectedControl = control; if (control != null) { PointEventArgs pointEventArgs = TranslatePoint(control, p); if (control.Active) { control.OnDown(pointEventArgs); } } }
public override void OnRelease(PointEventArgs p) { base.OnRelease(p); if (downControl != null) downControl.OnRelease(this.TranslatePoint(downControl, p)); }
private PointEventArgs TranslatePoint(FluidControl c, PointEventArgs p) { p.X -= c.Bounds.X; p.Y -= c.Bounds.Y; //PointEventArgs e = new PointEventArgs(p.Gesture, p.X - c.Bounds.X, p.Y - c.Bounds.Y); return p; }
public override void OnMove(PointEventArgs e) { if (!gestureCanceled && Enabled) IsDown = ClientRectangle.Contains(e.X, e.Y); }
public override void OnDown(PointEventArgs e) { canClick = !this.IsAutoScrolling; base.OnDown(e); if (!canClick) return; templateIndex = -1; downPoint.X = e.X; downPoint.Y = e.Y; int index = GetItemIndexUnderDisplayY(e.Y); if (index >= 0) OnTemplateEvent(index, e, TemplateEvent.Down); int selectedItemIndex = SelectedItemIndex; if (JogSelect) { selectedItemIndex = CheckJogSelect(e); } if (pressed) SelectedItemIndex = selectedItemIndex; else { int hoverIndex = index; if (hoverIndex == selectedItemIndex) Pressed = true; else HoveredItemIndex = hoverIndex; } downIndex = hoveredItemIndex; if (ItemSelect == SelectMode.Down && hoveredItemIndex >= 0) SelectedItemIndex = hoveredItemIndex; }
/// <summary> /// Occurs on stylus, mouse or finger move events. /// </summary> public virtual void OnMove(PointEventArgs e) { }
/// <summary> /// Occurs when the control is released to be in down mode but the mouse, style or finger still presses on the display. /// </summary> /// <param name="e"></param> public virtual void OnRelease(PointEventArgs e) { IsDown = false; }
public override void OnMove(PointEventArgs p) { if (downControl != null) downControl.OnMove(this.TranslatePoint(downControl, p)); }
/// <summary> /// Occurs on stylus, mouse or finger move events. /// </summary> public virtual void OnMove(PointEventArgs e) { }
private PointEventArgs TranslatePoint(FluidTemplate c, PointEventArgs p) { p.X -= c.Bounds.X; p.Y -= c.Bounds.Y; return p; }
public override void OnMove(PointEventArgs e) { base.OnMove(e); int index = IndexFromPoint(e); if (index != downIndex) { int idx0 = Math.Min(index, downIndex); int idx1 = Math.Max(index, downIndex); int selCount = idx1 - idx0; int startSel = idx0; if (this.selCount != selCount || this.startSel != startSel) { Select(startSel, selCount); } } }
public override void OnUp(PointEventArgs e) { ScrollBarVisible = false; base.OnUp(e); if (templateIndex >= 0) OnTemplateEvent(templateIndex, e, TemplateEvent.Up); Pressed = false; HoveredItemIndex = -1; }
public override void OnRelease(PointEventArgs p) { if (templateIndex >= 0) OnTemplateEvent(templateIndex, p, TemplateEvent.Release); Pressed = false; HoveredItemIndex = -1; }
public override void OnMove(PointEventArgs e) { base.OnMove(e); if (templateIndex >= 0) OnTemplateEvent(templateIndex, e, TemplateEvent.Move); }
private int CheckJogSelect(PointEventArgs e) { const int fuzzyHeight = 18; int index = SelectedItemIndex; if (CanShowScrollbar) { if (index >= 0) { Rectangle itemBounds = GetItemBounds(index); int fuzzy = (int)(Math.Max(fuzzyHeight, itemHeight / 2) * ScaleFactor.Height); int y = e.Y - fuzzy; Rectangle pressedArea = new Rectangle(itemBounds.Left, y, itemBounds.Width, 2 * fuzzy); Pressed = pressedArea.IntersectsWith(itemBounds); if (Pressed) { index = GetItemIndexUnderDisplayY(e.Y); if (index >= 0) SelectedItemIndex = index; } } else Pressed = false; } else { index = GetItemIndexUnderDisplayY(e.Y); if (index >= 0) SelectedItemIndex = index; Pressed = true; } return index; }
/// <summary> /// Scroll the container with finger, stylus or mouse. /// </summary> /// <param name="pressed">The position when the container was first touched.</param> /// <param name="moving">The position while moving.</param> protected virtual void Scroll(PointEventArgs pressed, Point moving) { if (CanShowScrollbar) { StopFadeTimer(); ShowScrollBar = true; int deltaY = (int)((moving.Y - pressed.Y)); int deltaX = (int)((moving.X - pressed.X)); lastDeltaY = downTop - deltaY - TopOffset; int vt = downTop - (int)(deltaY / ScaleFactor.Height); SetTopOffset(vt); } }
public override bool OnClick(PointEventArgs p) { base.OnClick(p); return(true); }
private PointEventArgs TranslatePoint(FluidControl c, PointEventArgs p) { p.X -= c.Bounds.X; p.Y -= c.Bounds.Y; return(p); }
/// <summary> /// Occurs when the control is released to be in down mode but the mouse, style or finger still presses on the display. /// </summary> /// <param name="e"></param> public virtual void OnRelease(PointEventArgs e) { IsDown = false; }
public override void OnUp(PointEventArgs e) { base.OnUp(e); int tickDelta = Environment.TickCount - lastTick; IsMoving = false; EnsureValidPosition(); if (IsDown) { OnClick(touchdPosition); } IsDown = false; }
/// <summary> /// Occurs on a styles or mouse down event. /// </summary> public virtual void OnDown(PointEventArgs e) { if (enabled) IsDown = true; }
/// <summary> /// Occurs when the control is clicked. /// </summary> public virtual bool OnClick(PointEventArgs e) { if (canClick && enabled) { if (ClientRectangle.Contains(e.X, e.Y)) { IsDown = false; PerformClick(); } } return false; }
public override void OnDown(PointEventArgs p) { base.OnDown(p); Invalidate(); }
public override bool OnClick(PointEventArgs p) { base.OnClick(p); if (downControl != null) downControl.OnClick(TranslatePoint(downControl, p)); return true; }
public override bool OnClick(PointEventArgs e) { base.OnClick(e); return true; }
/// <summary> /// Occurs on a touch panel click. /// </summary> /// <param name="mousePosition"></param> public override bool OnClick(PointEventArgs p) { if (!canClick || !CanClick) return false; if (templateIndex >= 0) { if (OnTemplateEvent(templateIndex, p, TemplateEvent.Click)) return true; } bool result = false; //if (ItemSelect == SelectMode.Up) { if (downIndex >= 0) SelectedItemIndex = downIndex; bool criteria = !JogSelect; if (!criteria) criteria = Pressed && selectedItemIndex >= 0; if (criteria && SelectedItemIndex >= 0) OnItemClick(SelectedItemIndex); result = true; } base.OnClick(p); return result; }
public override void OnMove(PointEventArgs e) { SizeF factor = ScaleFactor; int deltaY = e.Y - touchdPosition.Y; int deltaX = e.X - touchdPosition.X; lastDeltaX = deltaX; lastTick = Environment.TickCount; int threshold = (int)(ScrollContainer.MinMovePixelDistance * factor.Height); if ((isMoving || Math.Abs(deltaY) >= threshold) && CanScroll) { if (!isMoving) touchdPosition = e; IsMoving = true; Scroll(touchdPosition, new Point(e.X, e.Y)); } }
public override void OnDown(PointEventArgs e) { ///stop the count down to hide the scrollbar, but do not necassarily show the scrollbar: StopFadeTimer(); touchdPosition.X = e.X; touchdPosition.Y = e.Y; if (enableScroll) { pressedGesture = Gesture.None; bool isAutoScrolling = IsAutoScrolling; StopAutoScroll(); lastDeltaY = 0; lastDeltaX = 0; lastTick = Environment.TickCount; downTop = TopOffset; CanScroll = true; IsMoving = false; IsDown = !isAutoScrolling; } }
public override void OnDown(PointEventArgs p) { base.OnDown(p); FluidControl control = ControlFromPoint(p.X, p.Y); downControl = control; if (control != null) { PointEventArgs p2 = TranslatePoint(control, p); control.OnDown(p2); } if (control != null && control.Selectable) { selectedControl = control; } else if (control == null) { selectedControl = null; } }
public override void OnDown(PointEventArgs p) { base.OnDown(p); Invalidate(); }
public override void OnUp(PointEventArgs p) { if (downControl != null) downControl.OnUp(TranslatePoint(downControl, p)); downControl = null; }
/// <summary> /// Occurs on a styles or mouse up event. /// </summary> public virtual void OnUp(PointEventArgs e) { canClick = IsDown; IsDown = false; //if (Parent == null) //{ // if (isDown && !clicked) OnClick(e); //} }
public override void OnDown(PointEventArgs e) { base.OnDown(e); int index = IndexFromPoint(e); downIndex = index; if (index == startSel) { Select(0, Text.Length); } else { Select(index, 0); } }
protected override void Scroll(PointEventArgs p, Point moving) { //LeaveNestedControl(); <-- not necassary! if (pressed && JogSelect) { SelectInMove(moving); } else { base.Scroll(p, moving); } }
private int IndexFromPoint(PointEventArgs e) { int index = 0; if (Text.Length > 0) { using (Graphics g = CreateGraphics()) { if (g != null) { Rectangle r = ClientRectangle; r.Inflate(ScaleX(-3), 0); int left = r.Left; int x = e.X; for (int i = 1; i <= Text.Length; i++) { string s = Text.Substring(0, i); int w = (int)g.MeasureString(s, Font).Width; if ((w + left) >= x) break; index++; } } } } index = EnsureStartSel(index); return index; }
public override void OnDown(PointEventArgs p) { if (!Enabled) return; base.OnDown(p); FluidControl control = ControlFromPoint(p.X, p.Y); if (control != null && !control.Active) control = null; downControl = control; selectedControl = control; if (control != null) { PointEventArgs pointEventArgs = TranslatePoint(control, p); if (control.Active) control.OnDown(pointEventArgs); } }