/// ------------------------------------------------------------------------------------ /// <summary> /// Handles clicks on the drop-down portion of a popup button (i.e. a click on the /// arrow portion of a two-segmented toolbar button). /// </summary> /// ------------------------------------------------------------------------------------ private void HandleToolBarItemDropDownOpened(object sender, EventArgs e) { ToolStripDropDownItem item = sender as ToolStripDropDownItem; if (m_msgMediator == null || item == null) return; string message = GetItemsCommandMessage(item); if (!string.IsNullOrEmpty(message)) { ToolBarPopupInfo popupInfo = new ToolBarPopupInfo(item.Name); if (m_msgMediator.SendMessage("DropDown" + message, popupInfo)) { if (popupInfo.Control != null && item.DropDown is CustomDropDown) ((CustomDropDown)item.DropDown).AddControl(popupInfo.Control); } } CallUpdateHandlersForCollection(item.DropDownItems); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Handles clicks on the drop-down portion of a popup button (i.e. a click on the /// arrow portion of a two-segmented toolbar button). /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// ------------------------------------------------------------------------------------ private void HandleItemsPopup(object sender, EventArgs e) { ButtonItem item = sender as ButtonItem; if (item == null || m_msgMediator == null) return; string message = GetItemsCommandMessage(item); if (message != string.Empty) { ToolBarPopupInfo popupInfo = new ToolBarPopupInfo(item.Name); if (m_msgMediator.SendMessage("DropDown" + message, popupInfo)) { if (popupInfo.Control == null) return; // Load the returned control into the container provided by the popup item. PopupContainerControl container = item.PopupContainerControl as PopupContainerControl; container.Controls.Add(popupInfo.Control); popupInfo.Control.Location = container.ClientRectangle.Location; container.ClientSize = popupInfo.Control.Size; } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="popupInfo"></param> /// <param name="singleAction"></param> /// <param name="multipleActions"></param> /// <param name="cancel"></param> /// ------------------------------------------------------------------------------------ protected virtual void InitializeUndoRedoDropDown(ToolBarPopupInfo popupInfo, string singleAction, string multipleActions, string cancel) { m_UndoRedoDropDown = new UndoRedoDropDown(singleAction, multipleActions, cancel); popupInfo.Control = m_UndoRedoDropDown; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Override this so we know when the UndoRedoDropdown is shown and closed /// </summary> /// <param name="popupInfo"></param> /// <param name="singleAction"></param> /// <param name="multipleActions"></param> /// <param name="cancel"></param> /// ------------------------------------------------------------------------------------ protected override void InitializeUndoRedoDropDown(ToolBarPopupInfo popupInfo, string singleAction, string multipleActions, string cancel) { base.InitializeUndoRedoDropDown(popupInfo, singleAction, multipleActions, cancel); m_UndoRedoDropDown.VisibleChanged += new EventHandler(m_UndoRedoDropDown_VisibleChanged); m_UndoRedoDropDown.HandleDestroyed += new EventHandler(m_UndoRedoDropDown_HandleDestroyed); }