private void Control_MouseDoubleClick(object sender, MouseEventArgs e) { if (IsSupsended || Disposed) { return; } #region Panel if (HittedPanel != null) { HittedPanel.OnDoubleClick(e); } #endregion #region Item if (HittedItem != null) { HittedItem.OnDoubleClick(e); } #endregion #region SubItem if (HittedSubItem != null) { HittedSubItem.OnDoubleClick(e); } #endregion }
private void Control_MouseClick(object sender, MouseEventArgs e) { if (IsSupsended || Disposed) { return; } #region Panel if (HittedPanel != null) { HittedPanel.OnClick(e); } #endregion #region Item //Kevin Carbis - Added _lastMouseDown variable to track if our click originated with this control. //Sometimes when scrolling your mouse moves off the thumb while dragging and your mouseup event //is not the same control that you started with. This omits firing the click event on the control you //eventually release the mouse over if it wasn't the control you started with. if (HittedItem != null && HittedItem == _lastMouseDown) { //Kevin Carbis - this fixes the focus problem with textboxes when a different item is clicked //and the edit box is still visible. This will now close the edit box for the textbox that previously //had the focus. Otherwise the first click on a button would close the textbox and you would have to click twice. //Control.Focus(); if (_ribbon.ActiveTextBox != null) { (_ribbon.ActiveTextBox as RibbonTextBox).EndEdit(); } //foreach (RibbonPanel pnl in HittedItem.OwnerTab.Panels) //{ // foreach (RibbonItem itm in pnl.Items) // { // if (itm is RibbonTextBox && itm != HittedItem) // { // RibbonTextBox txt = (RibbonTextBox)itm; // txt.EndEdit(); // } // } //} HittedItem.OnClick(e); } #endregion #region SubItem if (HittedSubItem != null) { HittedSubItem.OnClick(e); } #endregion }
/// <summary> /// Handles the MouseDown on the control /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Control_MouseDown(object sender, MouseEventArgs e) { if (IsSupsended || Disposed) { return; } HitTest(e.Location); _lastMouseDown = HittedItem; #region Tab Scrolls if (HittedTab != null) { if (HittedTabScrollLeft) { HittedTab.SetScrollLeftPressed(true); Control.Invalidate(HittedTab.ScrollLeftBounds); } if (HittedTabScrollRight) { HittedTab.SetScrollRightPressed(true); Control.Invalidate(HittedTab.ScrollRightBounds); } } #endregion #region Panel if (HittedPanel != null) { HittedPanel.SetPressed(true); HittedPanel.OnMouseDown(e); Control.Invalidate(HittedPanel.Bounds); } #endregion #region Item if (HittedItem != null) { HittedItem.SetPressed(true); HittedItem.OnMouseDown(e); Control.Invalidate(HittedItem.Bounds); } #endregion #region SubItem if (HittedSubItem != null) { HittedSubItem.SetPressed(true); HittedSubItem.OnMouseDown(e); Control.Invalidate(Rectangle.Intersect(HittedItem.Bounds, HittedSubItem.Bounds)); } #endregion }
/// <summary> /// Handles the MouseUp event on the control /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Control_MouseUp(object sender, MouseEventArgs e) { if (IsSupsended || Disposed) { return; } #region Tab Scrolls if (HittedTab != null) { if (HittedTab.ScrollLeftVisible) { HittedTab.SetScrollLeftPressed(false); Control.Invalidate(HittedTab.ScrollLeftBounds); } if (HittedTab.ScrollRightVisible) { HittedTab.SetScrollRightPressed(false); Control.Invalidate(HittedTab.ScrollRightBounds); } } #endregion #region Panel if (HittedPanel != null) { HittedPanel.SetPressed(false); HittedPanel.OnMouseUp(e); Control.Invalidate(HittedPanel.Bounds); } #endregion #region Item if (HittedItem != null) { HittedItem.SetPressed(false); HittedItem.OnMouseUp(e); Control.Invalidate(HittedItem.Bounds); } #endregion #region SubItem if (HittedSubItem != null) { HittedSubItem.SetPressed(false); HittedSubItem.OnMouseUp(e); Control.Invalidate(Rectangle.Intersect(HittedItem.Bounds, HittedSubItem.Bounds)); } #endregion }
/// <summary> /// Handles the MouseMove on the control /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Control_MouseMove(object sender, MouseEventArgs e) { if (IsSupsended || Disposed) { return; } //Console.WriteLine("MouseMove " + Control.Name); HitTest(e.Location); #region Selected ones if (SelectedPanel != null && SelectedPanel != HittedPanel) { SelectedPanel.SetSelected(false); SelectedPanel.OnMouseLeave(e); Control.Invalidate(SelectedPanel.Bounds); } if (SelectedItem != null && SelectedItem != HittedItem) { SelectedItem.SetSelected(false); SelectedItem.OnMouseLeave(e); Control.Invalidate(SelectedItem.Bounds); } if (SelectedSubItem != null && SelectedSubItem != HittedSubItem) { SelectedSubItem.SetSelected(false); SelectedSubItem.OnMouseLeave(e); Control.Invalidate(Rectangle.Intersect(SelectedItem.Bounds, SelectedSubItem.Bounds)); } #endregion #region Tab Scrolls if (HittedTab != null) { if (HittedTab.ScrollLeftVisible) { HittedTab.SetScrollLeftSelected(HittedTabScrollLeft); Control.Invalidate(HittedTab.ScrollLeftBounds); } if (HittedTab.ScrollRightVisible) { HittedTab.SetScrollRightSelected(HittedTabScrollRight); Control.Invalidate(HittedTab.ScrollRightBounds); } } #endregion #region Panel if (HittedPanel != null) { if (HittedPanel == SelectedPanel) { HittedPanel.OnMouseMove(e); } else { HittedPanel.SetSelected(true); HittedPanel.OnMouseEnter(e); Control.Invalidate(HittedPanel.Bounds); } } #endregion #region Item if (HittedItem != null) { if (HittedItem == SelectedItem) { HittedItem.OnMouseMove(e); } else { HittedItem.SetSelected(true); HittedItem.OnMouseEnter(e); Control.Invalidate(HittedItem.Bounds); } } #endregion #region SubItem if (HittedSubItem != null) { if (HittedSubItem == SelectedSubItem) { HittedSubItem.OnMouseMove(e); } else { HittedSubItem.SetSelected(true); HittedSubItem.OnMouseEnter(e); Control.Invalidate(Rectangle.Intersect(HittedItem.Bounds, HittedSubItem.Bounds)); } } #endregion }