public RibbonDropDownRenderEventArgs( Graphics g, RibbonDropDown dropDown ) { Graphics = g; DropDown = dropDown; }
/// <summary> /// Feeds mouse Wheel. If applied on a IScrollableItem it's sended to it /// </summary> /// <param name="e"></param> /// <returns>True if handled. False otherwise</returns> internal static bool FeedMouseWheel(MouseEventArgs e) { RibbonDropDown dd = LastPopup as RibbonDropDown; if (dd != null) { foreach (RibbonItem item in dd.Items) { if (dd.RectangleToScreen(item.Bounds).Contains(e.Location)) { IScrollableRibbonItem sc = item as IScrollableRibbonItem; if (sc != null) { if (e.Delta < 0) { sc.ScrollDown(); } else { sc.ScrollUp(); } return(true); } } } } return(false); }
private void DropDown_Closed(object sender, EventArgs e) { _dropDownVisible = false; _dropdown = null; RemoveHandlers(); }
/// <summary> /// Closes the DropDown if opened /// </summary> public void CloseDropDown() { if (_dropDown != null) { RibbonDropDown.DismissTo(_dropDown); } SetDropDownVisible(false); }
/// <summary> /// Selects the item when in a dropdown, in design mode /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RibbonItem_Click(object sender, EventArgs e) { RibbonDropDown dd = Canvas as RibbonDropDown; if (dd != null && dd.SelectionService != null) { dd.SelectionService.SetSelectedComponents( new Component[] { this }, System.ComponentModel.Design.SelectionTypes.Primary); } }
/// <summary> /// Closes the DropDown if opened /// </summary> public void CloseDropDown() { if (DropDown != null) { RibbonPopupManager.Dismiss(DropDown, RibbonPopupManager.DismissReason.NewPopup); RemoveHandlers(); _dropDown = null; } SetDropDownVisible(false); }
/// <summary> /// Shows the DropDown /// </summary> public void ShowDropDown() { OnDropDownShowing(EventArgs.Empty); AssignHandlers(); RibbonDropDown dd = new RibbonDropDown(this, DropDownItems, Owner); dd.ShowSizingGrip = DropDownResizable; dd.Closed += new EventHandler(DropDown_Closed); dd.Show(Owner.PointToScreen(new Point(TextBoxBounds.Left, Bounds.Bottom))); }
public void HideDropDown() { if (_dropdown != null && !_dropdown.IsDisposed) { _dropdown.Close(); } RemoveHandlers(); _dropDownVisible = false; _dropdown = null; }
/// <summary> /// Feeds mouse Wheel. If applied on a IScrollableItem it's sended to it /// </summary> /// <param name="e"></param> /// <returns>True if handled. False otherwise</returns> internal static bool FeedMouseWheel(MouseEventArgs e) { RibbonDropDown dd = LastPopup as RibbonDropDown; if (dd != null) { WinApi.POINT pos; if (WinApi.GetCursorPos(out pos)) { foreach (RibbonItem item in dd.Items) { if (dd.RectangleToScreen(item.Bounds).Contains(pos.x, pos.y)) //if (dd.RectangleToScreen(item.Bounds).Contains(e.Location)) { IScrollableRibbonItem sc = item as IScrollableRibbonItem; if (sc != null) { if (e.Delta < 0) { sc.ScrollDown(); } else { sc.ScrollUp(); } return(true); } } } } } //kevin carbis - added scrollbar support to dropdowns so we need to feed the mouse wheel to the //actual dropdown item if it was not intended for a child item. if (dd != null) { if (e.Delta < 0) { dd.ScrollDown(); } else { dd.ScrollUp(); } return(true); } return(false); }
/// <summary> /// Shows the DropDown /// </summary> public void ShowDropDown() { OnDropDownShowing(EventArgs.Empty); AssignHandlers(); if (_dropdown == null || _dropdown.IsDisposed) { _dropdown = new RibbonDropDown(this, DropDownItems, Owner); _dropdown.ShowSizingGrip = DropDownResizable; _dropdown.Closed += new EventHandler(DropDown_Closed); } _dropdown.Show(Owner.PointToScreen(new Point(TextBoxBounds.Left, Bounds.Bottom))); _dropDownVisible = true; }
/// <summary> /// Shows the DropDown /// </summary> public virtual void ShowDropDown() { if (!_DropDownVisible) { AssignHandlers(); OnDropDownShowing(EventArgs.Empty); RibbonDropDown dd = new RibbonDropDown(this, DropDownItems, Owner); dd.DropDownMaxHeight = _dropDownMaxHeight; dd.ShowSizingGrip = DropDownResizable; dd.DrawIconsBar = _iconsBar; dd.Closed += new EventHandler(DropDown_Closed); Point location = OnGetDropDownMenuLocation(); dd.Show(location); _DropDownVisible = true; } }
/// <summary> /// Shows the drop down items of the button, as if the dropdown part has been clicked /// </summary> public void ShowDropDown() { if (Style == RibbonButtonStyle.Normal || DropDownItems.Count == 0) { CloseDropDown(); return; } if (Style == RibbonButtonStyle.DropDown) { SetPressed(true); } else { _dropDownPressed = true; } OnDropDownShowing(EventArgs.Empty); _dropDown = new RibbonDropDown(this, DropDownItems, Owner); _dropDown.Closed += new EventHandler(_dropDown_Closed); _dropDown.ShowSizingGrip = DropDownResizable; RibbonDropDown canvasdd = Canvas as RibbonDropDown; Point location = Point.Empty; if (canvasdd != null) { location = Canvas.PointToScreen(new Point(Bounds.Right, Bounds.Top)); _dropDown.PreviousDropDown = Canvas as RibbonDropDown; canvasdd.NextDropDown = _dropDown; } else { location = Canvas.PointToScreen(new Point(Bounds.Left, Bounds.Bottom)); } SetDropDownVisible(true); _dropDown.SelectionService = GetService(typeof(ISelectionService)) as ISelectionService; _dropDown.Show(location); }
/// <summary> /// Shows the drop down items of the button, as if the dropdown part has been clicked /// </summary> public void ShowDropDown() { if (DropDownItems.Count == 0) { SetPressed(false); return; } IgnoreDeactivation(); _dropDown = new RibbonDropDown(this, DropDownItems, Owner); //_dropDown.FormClosed += new FormClosedEventHandler(dropDown_FormClosed); //_dropDown.StartPosition = FormStartPosition.Manual; _dropDown.ShowSizingGrip = true; Point location = Canvas.PointToScreen(new Point(Bounds.Left, Bounds.Top)); SetDropDownVisible(true); _dropDown.Show(location); }
/// <summary> /// Closes all the dropdowns before the specified dropDown /// </summary> /// <param name="dropDown"></param> internal static void DismissTo(RibbonDropDown dropDown) { if (dropDown == null) { throw new ArgumentNullException("dropDown"); } for (int i = registeredDds.Count - 1; i >= 0; i--) { if (i >= registeredDds.Count) { break; } if (registeredDds[i].Equals(dropDown)) { break; } else { registeredDds[i].Close(); } } }
private static void RegisterDropDown(RibbonDropDown dropDown) { registeredDds.Add(dropDown); }
/// <summary> /// Creates the DropDown menu /// </summary> protected virtual void CreateDropDown() { _dropDown = new RibbonDropDown(this, DropDownItems, Owner); }
private static void UnregisterDropDown(RibbonDropDown dropDown) { registeredDds.Remove(dropDown); }
/// <summary> /// Closes all the dropdowns before the specified dropDown /// </summary> /// <param name="dropDown"></param> internal static void DismissTo(RibbonDropDown dropDown) { if (dropDown == null) throw new ArgumentNullException("dropDown"); for (int i = registeredDds.Count - 1; i >= 0; i--) { if (i >= registeredDds.Count) { break; } if (registeredDds[i].Equals(dropDown)) { break; } else { registeredDds[i].Close(); } } }
void AddDropDownItem(RibbonDropDown dd, string label) { var item = Factory.CreateRibbonDropDownItem(); item.Label = label; dd.Items.Add(item); }
/// <summary> /// Shows the DropDown /// </summary> public virtual void ShowDropDown() { if (!_DropDownVisible) { //foreach (RibbonItem item in DropDownItems) //{ // if (item == _selectedItem) // item.Checked = true; // else // item.Checked = false; //} OnDropDownShowing(EventArgs.Empty); AssignHandlers(); RibbonDropDown dd = new RibbonDropDown(this, DropDownItems, Owner); dd.ShowSizingGrip = DropDownResizable; dd.DrawIconsBar = _iconsBar; dd.Closed += new EventHandler(DropDown_Closed); dd.Show(Owner.PointToScreen(new Point(TextBoxBounds.Left, Bounds.Bottom))); _DropDownVisible = true; } }