public bool OnMouseDown(System.Windows.Forms.MouseEventArgs e) { bool handled = false; // if we aren't active do nothing. if ((!m_visible) || (!m_enabled)) { return(false); } for (int index = 0; index < m_ChildWidgets.Count; index++) { IWidget currentWidget = m_ChildWidgets[index] as IWidget; if (currentWidget != null && currentWidget is IInteractive) { IInteractive currentInteractive = m_ChildWidgets[index] as IInteractive; handled = currentInteractive.OnMouseDown(e); if (handled) { return(handled); } } } return(handled); }
public bool OnMouseDown(System.Windows.Forms.MouseEventArgs e) { bool handled = false; if (m_visible) { // if we're in the client area and lmb if (e.X >= this.AbsoluteLocation.X && e.X <= this.AbsoluteLocation.X + ClientSize.Width && e.Y >= this.AbsoluteLocation.Y && e.Y <= this.AbsoluteLocation.Y + NODE_HEIGHT) { m_isMouseDown = true; handled = true; } else { m_isMouseDown = false; } } // if mouse didn't come down on us, let the children try as we should be inside the top form client area if (!handled) { for (int i = 0; i < m_subNodes.Count; i++) { if (m_subNodes[i] is IInteractive) { IInteractive currentInteractive = m_subNodes[i] as IInteractive; handled = currentInteractive.OnMouseDown(e); } // if anyone has handled this, we're done if (handled) { continue; } } } return(handled); }
public bool OnMouseDown(System.Windows.Forms.MouseEventArgs e) { for (int index = 0; index < m_ChildWidgets.Count; index++) { IWidget currentWidget = m_ChildWidgets[index] as IWidget; if (currentWidget != null && currentWidget is IInteractive) { IInteractive currentInteractive = m_ChildWidgets[index] as IInteractive; bool handled = currentInteractive.OnMouseDown(e); if (handled) { return(handled); } } } return(false); }
/// <summary> /// Mouse down event handler. /// </summary> /// <param name="e">Event args</param> /// <returns>If this widget handled this event</returns> public bool OnMouseDown(System.Windows.Forms.MouseEventArgs e) { // Whether or not the event was handled bool handled = false; // Whether or not we're in the form bool inClientArea = false; // if we aren't active do nothing. if ((!this.m_visible) || (!this.m_enabled)) { return(false); } int widgetTop = this.Top; int widgetBottom = this.Bottom; int widgetLeft = this.Left; int widgetRight = this.Right; // if we're in the client area bring to front if (e.X >= widgetLeft && e.X <= widgetRight && e.Y >= widgetTop && e.Y <= widgetBottom) { if (this.m_parentWidget != null) { this.m_parentWidget.ChildWidgets.BringToFront(this); } inClientArea = true; } // if its the left mouse button check for UI actions (resize, drags, etc) if (e.Button == System.Windows.Forms.MouseButtons.Left) { #region header dbl click // Check for header double click (if its shown) if (this.HeaderEnabled && e.X >= this.m_location.X && e.X <= this.AbsoluteLocation.X + this.m_size.Width && e.Y >= this.AbsoluteLocation.Y && e.Y <= this.AbsoluteLocation.Y + this.m_currHeaderHeight) { if (DateTime.Now > this.m_LastClickTime.AddSeconds(0.5)) { handled = true; } else { this.m_renderBody = !this.m_renderBody; } this.m_LastClickTime = DateTime.Now; } #endregion } // Store the current position this.m_LastMousePosition = new Point(e.X, e.Y); // If we aren't handling this then let the children try if they are rendered if (!handled && inClientArea && this.m_renderBody) { for (int i = 0; i < this.m_ChildWidgets.Count; i++) { if (!handled) { if (this.m_ChildWidgets[i] is IInteractive) { IInteractive currentInteractive = this.m_ChildWidgets[i] as IInteractive; handled = currentInteractive.OnMouseDown(e); } } } } // If we resized or inside the form then consider it handled anyway. if (inClientArea) { handled = true; } return(handled); }
public bool OnMouseDown(MouseEventArgs e) { bool handled = false; bool inClientArea = false; if (e.X >= m_Location.X && e.X <= m_Location.X + m_Size.Width && e.Y >= m_Location.Y && e.Y <= m_Location.Y + m_Size.Height) { m_ParentWidget.ChildWidgets.BringToFront(this); inClientArea = true; } if (e.X > AbsoluteLocation.X - resizeBuffer && e.X < AbsoluteLocation.X + resizeBuffer && e.Y > AbsoluteLocation.Y - resizeBuffer && e.Y < AbsoluteLocation.Y + resizeBuffer) { isResizingUL = true; } else if (e.X > AbsoluteLocation.X - resizeBuffer + ClientSize.Width && e.X < AbsoluteLocation.X + resizeBuffer + ClientSize.Width && e.Y > AbsoluteLocation.Y - resizeBuffer && e.Y < AbsoluteLocation.Y + resizeBuffer) { isResizingUR = true; } else if (e.X > AbsoluteLocation.X - resizeBuffer && e.X < AbsoluteLocation.X + resizeBuffer && e.Y > AbsoluteLocation.Y - resizeBuffer + ClientSize.Height && e.Y < AbsoluteLocation.Y + resizeBuffer + ClientSize.Height) { isResizingLL = true; } else if (e.X > AbsoluteLocation.X - resizeBuffer + ClientSize.Width && e.X < AbsoluteLocation.X + resizeBuffer + ClientSize.Width && e.Y > AbsoluteLocation.Y - resizeBuffer + ClientSize.Height && e.Y < AbsoluteLocation.Y + resizeBuffer + ClientSize.Height) { isResizingLR = true; } else if (e.X > AbsoluteLocation.X - resizeBuffer && e.X < AbsoluteLocation.X + resizeBuffer && e.Y > AbsoluteLocation.Y - resizeBuffer && e.Y < AbsoluteLocation.Y + resizeBuffer + ClientSize.Height) { isResizingLeft = true; } else if (e.X > AbsoluteLocation.X - resizeBuffer + ClientSize.Width && e.X < AbsoluteLocation.X + resizeBuffer + ClientSize.Width && e.Y > AbsoluteLocation.Y - resizeBuffer && e.Y < AbsoluteLocation.Y + resizeBuffer + ClientSize.Height) { isResizingRight = true; } else if (e.X > AbsoluteLocation.X - resizeBuffer && e.X < AbsoluteLocation.X + resizeBuffer + ClientSize.Width && e.Y > AbsoluteLocation.Y - resizeBuffer && e.Y < AbsoluteLocation.Y + resizeBuffer) { isResizingTop = true; } else if (e.X > AbsoluteLocation.X - resizeBuffer && e.X < AbsoluteLocation.X + resizeBuffer + ClientSize.Width && e.Y > AbsoluteLocation.Y - resizeBuffer + ClientSize.Height && e.Y < AbsoluteLocation.Y + resizeBuffer + ClientSize.Height) { isResizingBottom = true; } else if (e.X >= m_Location.X && e.X <= AbsoluteLocation.X + ClientSize.Width && e.Y >= AbsoluteLocation.Y && e.Y <= AbsoluteLocation.Y + m_HeaderHeight) { m_IsDragging = true; handled = true; } m_LastMousePosition = new Point(e.X, e.Y); if (!handled) { for (int i = 0; i < m_ChildWidgets.Count; i++) { if (!handled) { if (m_ChildWidgets[i] is IInteractive) { IInteractive currentInteractive = m_ChildWidgets[i] as IInteractive; handled = currentInteractive.OnMouseDown(e); } } } } if (!handled && inClientArea) { handled = true; } return(handled); }