BaseDropRender.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Numerics;
  5. using System.Text;
  6. namespace Veldrid.Common.Plot
  7. {
  8. public abstract class BaseDropRender : BaseRender, IDropRender
  9. {
  10. public event EventHandler<PointF> MouseDown;
  11. public event EventHandler<PointF> MouseUp;
  12. public event EventHandler<PointF> Dragged;
  13. public event EventHandler<IDropRender> SelectionChanged;
  14. public event EventHandler MouseLeave;
  15. private protected bool selected;
  16. protected BaseDropRender(IVeldridContent control) : base(control)
  17. {
  18. }
  19. protected virtual void ActiveMouseDown(object sender, PointF point) => MouseDown?.Invoke(sender, point);
  20. protected virtual void ActiveMouseUp(object sender, PointF point) => MouseUp?.Invoke(sender, point);
  21. protected virtual void ActiveDragged(object sender, PointF point) => Dragged?.Invoke(sender, point);
  22. protected virtual void ActiveSelectionChanged(object sender, IDropRender render) => SelectionChanged?.Invoke(sender, render);
  23. internal virtual void OnMouseMove(PointF point, ref bool handle)
  24. {
  25. }
  26. internal virtual void OnMouseDown(PointF point, ref bool handle)
  27. {
  28. }
  29. internal virtual void OnMouseUp(PointF point, ref bool handle)
  30. {
  31. }
  32. internal virtual void OnMouseLeave(ref bool handle)
  33. {
  34. }
  35. bool IDropRender.Selected { get => selected; set => selected =value; }
  36. void IDropRender.OnDragged(PointF position)=>this.ActiveDragged(this,position);
  37. void IDropRender.OnMouseDown(PointF point, ref bool handle)=>this.OnMouseDown(point, ref handle);
  38. void IDropRender.OnMouseMove(PointF point, ref bool handle)=>this.OnMouseMove(point, ref handle);
  39. void IDropRender.OnMouseUp(PointF point, ref bool handle)=>this.OnMouseUp(point, ref handle);
  40. void IDropRender.OnMouseLeave(ref bool handle)=>this.OnMouseLeave(ref handle);
  41. }
  42. }