protected override void OnMouseDown(MouseCallbackEventArgs e) { var currentObject = GetObject(); if (currentObject != null) { e.Cancel = true; OnMouseClick?.Invoke(this, new MouseControllerEventArgs(currentObject)); } base.OnMouseDown(e); }
protected override void OnMouseMove(MouseCallbackEventArgs e) { e.View.ActiveViewport.GetFrustumLine(e.ViewportPoint.X, e.ViewportPoint.Y, out _frustrum); var currentObject = GetObject(); if (currentObject != _lastObject) { e.Cancel = true; OnChange?.Invoke(this, new MouseControllerEventArgs(currentObject)); } _lastObject = currentObject; base.OnMouseMove(e); }
protected virtual void OnMouseUp(MouseCallbackEventArgs e) { }
private static int OnMouseCallbackFromCPP(IntPtr pRhinoView, int which_callback, int which_button, int x, int y) { int rc = 0; const int callbackMouseDown = 0; const int callbackMouseUp = 1; const int callbackMouseMove = 2; const int callbackMouseDoubleClick = 3; const int callbackMouseEnter = 4; const int callbackMouseLeave = 5; const int callbackMouseHover = 6; if (m_enabled_list.Count > 0) { MouseCallbackEventArgs e = new MouseCallbackEventArgs(pRhinoView, which_button, x, y); for (int i = 0; i < m_enabled_list.Count; i++) { switch (which_callback) { case callbackMouseDown: m_enabled_list[i].OnMouseDown(e); break; case callbackMouseMove: m_enabled_list[i].OnMouseMove(e); break; case callbackMouseUp: m_enabled_list[i].OnMouseUp(e); break; case callbackMouseDoubleClick: m_enabled_list[i].OnMouseDoubleClick(e); break; case callbackMouseEnter: m_enabled_list[i].OnMouseEnter(e.View); break; case callbackMouseLeave: m_enabled_list[i].OnMouseLeave(e.View); break; case callbackMouseHover: m_enabled_list[i].OnMouseHover(e.View); break; } rc = e.Cancel ? 1 : 0; if (1 == rc) break; } } return rc; }
void MouseLeaveHandler(object sender, MouseCallbackEventArgs e) { OnMouseLeave(e); }
void MouseHoverHandler(object sender, MouseCallbackEventArgs e) { OnMouseHover(e); }
void BeginMouseDblClkHandler(object sender, MouseCallbackEventArgs e) { OnMouseDoubleClick(e); }
void EndMouseUpHandler(object sender, MouseCallbackEventArgs e) { OnEndMouseUp(e); }
protected virtual void OnMouseHover(MouseCallbackEventArgs e) { }
protected virtual void OnMouseLeave(MouseCallbackEventArgs e) { }
protected virtual void OnMouseDoubleClick(MouseCallbackEventArgs e) { }
/// <summary> /// Called at the end of handling of a mouse up event in Rhino. /// All of the default Rhino mouse down functionality has already been /// executed unless a MouseCallback has set Cancel to true for the event arguments. /// You can tell if this is the case by inspecting the Cancel property in /// the event arguments parameter. /// Base class implementation of this function does nothing /// </summary> /// <param name="e"></param> protected virtual void OnEndMouseUp(MouseCallbackEventArgs e) { }
/// <summary> /// Called at the beginning of handling of a mouse down event in Rhino. /// If you don't want the default Rhino functionality to be run, then set /// Cancel to true on the passed in event arguments /// Base class implementation of this function does nothing /// </summary> /// <param name="e"></param> protected virtual void OnMouseDown(MouseCallbackEventArgs e) { }
private static int OnMouseCallbackFromCPP(IntPtr pRhinoView, int which_callback, int which_button, int x, int y) { int rc = 0; const int callbackMouseDown = 0; const int callbackMouseUp = 1; const int callbackMouseMove = 2; const int callbackMouseDoubleClick = 3; const int callbackMouseEnter = 4; const int callbackMouseLeave = 5; const int callbackMouseHover = 6; if (m_enabled_list.Count > 0) { MouseCallbackEventArgs e = new MouseCallbackEventArgs(pRhinoView, which_button, x, y); try { for (int i = 0; i < m_enabled_list.Count; i++) { switch (which_callback) { case callbackMouseDown: m_enabled_list[i].OnMouseDown(e); break; case callbackMouseMove: m_enabled_list[i].OnMouseMove(e); break; case callbackMouseUp: m_enabled_list[i].OnMouseUp(e); break; case callbackMouseDoubleClick: m_enabled_list[i].OnMouseDoubleClick(e); break; case callbackMouseEnter: m_enabled_list[i].OnMouseEnter(e.View); break; case callbackMouseLeave: m_enabled_list[i].OnMouseLeave(e.View); break; case callbackMouseHover: m_enabled_list[i].OnMouseHover(e.View); break; } rc = e.Cancel ? 1 : 0; if (1 == rc) { break; } } } catch (Exception ex) { Runtime.HostUtils.ExceptionReport(ex); rc = 0; } } return(rc); }
protected override void OnMouseUp(MouseCallbackEventArgs e) { OnMouseRelease?.Invoke(this, new MouseControllerEventArgs(GetObject())); base.OnMouseUp(e); }
protected override void OnMouseDown(Rhino.UI.MouseCallbackEventArgs e) { lastMove = System.DateTime.Now; base.OnMouseDown(e); }
void BeginMouseUpHandler(object sender, MouseCallbackEventArgs e) { OnMouseUp(e); }