Example #1
0
 protected override void OnClosing(ToolStripDropDownClosingEventArgs e)
 {
     Control hostControl = GetHostedControl();
     if (hostControl != null)
         hostControl.SizeChanged -= HostControlSizeChanged;
     base.OnClosing(e);
 }
        protected override void OnClosing(ToolStripDropDownClosingEventArgs e)
        {
            if (_cancelNextAttemptedClose && e.CloseReason == ToolStripDropDownCloseReason.ItemClicked)
            {
                e.Cancel = true;
                _cancelNextAttemptedClose = false;
                return;
            }

            base.OnClosing(e);
        }
        private void DropDown_Closing(object sender, ToolStripDropDownClosingEventArgs e)
        {
            if (e.CloseReason != ToolStripDropDownCloseReason.AppClicked)
            {
                return ;
            }

            Rectangle dropDownButtonBoundsClient = DropDownButtonBounds; // Relative to the ToolStripSplitButton
            dropDownButtonBoundsClient.Offset(Bounds.Location); // Relative to the parent of the ToolStripSplitButton
            Rectangle dropDownButtonBoundsScreen = GetCurrentParent().RectangleToScreen(dropDownButtonBoundsClient); // Relative to the screen

            if (dropDownButtonBoundsScreen.Contains(Control.MousePosition))
            {
                e.Cancel = true;
            }
        }
 protected override void OnClosing(ToolStripDropDownClosingEventArgs e)
 {
     if ((e.CloseReason == ToolStripDropDownCloseReason.AppFocusChange) && this._cancelClose)
     {
         this._cancelClose = false;
         e.Cancel = true;
     }
     else if ((e.CloseReason == ToolStripDropDownCloseReason.AppFocusChange) || (e.CloseReason == ToolStripDropDownCloseReason.AppClicked))
     {
         IntPtr activeWindow = System.Design.UnsafeNativeMethods.GetActiveWindow();
         if ((base.Handle == activeWindow) && (e.CloseReason == ToolStripDropDownCloseReason.AppClicked))
         {
             e.Cancel = false;
         }
         else if (WindowOwnsWindow(base.Handle, activeWindow))
         {
             e.Cancel = true;
         }
         else if ((this._mainParentWindow != null) && !WindowOwnsWindow(this._mainParentWindow.Handle, activeWindow))
         {
             if (this.IsWindowEnabled(this._mainParentWindow.Handle))
             {
                 e.Cancel = false;
             }
             else
             {
                 e.Cancel = true;
             }
             base.OnClosing(e);
             return;
         }
         IntPtr windowLong = System.Design.UnsafeNativeMethods.GetWindowLong(new HandleRef(this, activeWindow), -8);
         if (!this.IsWindowEnabled(windowLong))
         {
             e.Cancel = true;
         }
     }
     base.OnClosing(e);
 }
Example #5
0
 private void Toggle_menu_on_closing(object sender, ToolStripDropDownClosingEventArgs e) {
     e.Cancel = e.CloseReason == ToolStripDropDownCloseReason.ItemClicked;
     if ( e.Cancel)
         util.postpone(update_toggles,1);
 }
Example #6
0
 // Avoid the menu closing after clicking an item
 private void menuClosing(object sender, ToolStripDropDownClosingEventArgs e)
 {
     if (e.CloseReason == ToolStripDropDownCloseReason.ItemClicked)
         e.Cancel = true;
 }
Example #7
0
 private void contextMenuStripWaveform_Closing(object sender, ToolStripDropDownClosingEventArgs e)
 {
     _lastWaveformMenuCloseTicks = DateTime.Now.Ticks;
 }
Example #8
0
        private void ContextMenuStrip_Closing(object sender, ToolStripDropDownClosingEventArgs e)
        {
            var cms = sender as ContextMenuStrip;
            if (cms != null)
            {
                cms.Closing -= ContextMenuStrip_Closing;
            }

            SetButtonDrawState();

            if (e.CloseReason == ToolStripDropDownCloseReason.AppClicked)
            {
                m_skipNextOpen = (m_dropDownRectangle.Contains(PointToClient(Cursor.Position)));
            }
        }
 private void OnPopupClosing(object sender, ToolStripDropDownClosingEventArgs e)
 {
     if (e.CloseReason == ToolStripDropDownCloseReason.AppClicked) {
         Point pos = PointToClient(Control.MousePosition);
         if (pos.X > 0 && pos.Y > 0 && pos.X < this.Width && pos.Y < this.Height)
             _cancelNextOpen = true;
     }
     this.btDrop.Image = _img_dropdown;
 }
Example #10
0
        private void contextMenu_Closing(object sender, ToolStripDropDownClosingEventArgs e)
        {
            if(fCancelClosing) {
                e.Cancel = true;
                fCancelClosing = false;
            }
            else {
                if(fRootReordered) {
                    fRootReordered = false;

                    List<int> lst = new List<int>();
                    for(int i = 0; i < contextMenu.Items.Count; i++) {
                        if(lst.Count == ITEMTYPE_COUNT)
                            break;

                        ToolStripItem item = contextMenu.Items[i];

                        if(item is TitleMenuItem) {
                            if(item == tmiGroup || item == tmiLabel_Group) {
                                lst.Add(ITEMINDEX_GROUP);
                                continue;
                            }
                            if(item == tmiHistory || item == tmiLabel_History) {
                                lst.Add(ITEMINDEX_RECENTTAB);
                                continue;
                            }
                            if(item == tmiUserApp || item == tmiLabel_UserApp) {
                                lst.Add(ITEMINDEX_APPLAUNCHER);
                                continue;
                            }
                            if(item == tmiRecentFile || item == tmiLabel_RecentFile) {
                                lst.Add(ITEMINDEX_RECENTFILE);
                                continue;
                            }
                        }
                    }
                    if(lst.Count < 4) {
                        foreach(int t in lstItemOrder) {
                            if(!lst.Contains(t)) {
                                lst.Add(t);
                            }
                        }
                    }

                    lstItemOrder.Clear();
                    foreach(int t in lst) {
                        lstItemOrder.Add(t);
                    }

                    SaveSetting();
                }
            }
        }
Example #11
0
 private void tvContextMenu_Closing(object sender, ToolStripDropDownClosingEventArgs e)
 {
     try
     {
         ContextMenuClosing();
     }
     catch (Exception ex)
     {
         Base.HandleException(ex);
     }
 }
Example #12
0
 private void filterOutToolStripMenuItem_Closing(object sender, ToolStripDropDownClosingEventArgs e)
 {
     if (e.CloseReason == ToolStripDropDownCloseReason.ItemClicked)
     {
         e.Cancel = true;
     }
 }
Example #13
0
 /// <summary>
 /// Handles the Closing event of the ToolStripDropDown
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ToolStripDropDown_Closing(object sender, ToolStripDropDownClosingEventArgs e)
 {
     OnClosing(e);
 }
        protected override void SetVisibleCore(bool visible)
        {
            if (this.Visible == visible)
            {
                return;
            }

            if (visible)
            {
                // TODO: Move here the code from Show().
                if (currentMenu != null)
                {
                    this.is_visible = true;
                }
                else
                {
                    base.SetVisibleCore(visible);
                }
            }
            else
            {
                // Give users a chance to cancel the close
                ToolStripDropDownClosingEventArgs e = new ToolStripDropDownClosingEventArgs(closeReason);
                this.OnClosing(e);

                if (e.Cancel)
                {
                    return;
                }

                // Don't actually close if AutoClose == true unless explicitly called
                if (!this.auto_close && closeReason != ToolStripDropDownCloseReason.CloseCalled)
                {
                    return;
                }

                // Detach from the tracker
                ToolStripManager.AppClicked     -= new EventHandler(ToolStripMenuTracker_AppClicked);;
                ToolStripManager.AppFocusChange -= new EventHandler(ToolStripMenuTracker_AppFocusChange);

                // Owner MenuItem needs to be told to redraw (it's no longer selected)
                if (owner_item != null)
                {
                    owner_item.Invalidate();
                }

                // Recursive hide all child dropdowns
                foreach (ToolStripItem tsi in this.Items)
                {
                    tsi.Dismiss(closeReason);
                }

                // Hide this dropdown
                if (this.currentMenu != null)
                {
                    this.currentMenu.CancelTracking();
                    this.is_visible = false;
                }
                else
                {
                    base.SetVisibleCore(visible);
                }

                this.OnClosed(new ToolStripDropDownClosedEventArgs(closeReason));
            }
        }
Example #15
0
 void m_dropDown_Closing(object sender, ToolStripDropDownClosingEventArgs e)
 {
     m_lastHideTime = DateTime.Now;
 }
Example #16
0
 protected override void OnClosing(ToolStripDropDownClosingEventArgs e)
 {
     _popupControl.RegionChanged -= new EventHandler(PopupControlRegionChanged);
     base.OnClosing(e);
 }
 private void OnOverflowDropDownClosing(object sender, ToolStripDropDownClosingEventArgs e)
 {
     e.Cancel = e.CloseReason == ToolStripDropDownCloseReason.ItemClicked;
 }
Example #18
0
 private void splitButtonBackupSettings_Closing(object sender, ToolStripDropDownClosingEventArgs e)
 {
     if (e.CloseReason == ToolStripDropDownCloseReason.ItemClicked) e.Cancel = true;
 }
Example #19
0
 /// <summary>
 /// Handles the Closing event of the ToolStripDropDown
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ToolStripDropDown_Closing(object sender, ToolStripDropDownClosingEventArgs e)
 {
     OnClosing(e);
 }
 private static void MenuClosing(object sender, ToolStripDropDownClosingEventArgs e)
 {
     _menu.Items[3].Enabled = true;
 }
Example #21
0
 /// <summary>
 /// Raises the <see cref="Closing"/> event
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnClosing(ToolStripDropDownClosingEventArgs e)
 {
     if (Closing != null)
     {
         Closing(this, e);
     }
 }
Example #22
0
 private void ContextMenuStrip_Closing(object sender, ToolStripDropDownClosingEventArgs e)
 {
     foreach (var item in ContextMenuStrip.Items)
     {
         var moonItem = item as Moonlight.WindowsForms.StateControls.MoonToolStripMenuItem;
         if (moonItem != null)
         {
             moonItem.OnContextMenuStripClosing();
         }
     }
 }
Example #23
0
 private void contextMenuRecord_Closing(object sender, ToolStripDropDownClosingEventArgs e)
 {
     this.contextMenuRecordCopyTo.DropDownItems.Clear();
     foreach (var item in this.contextMenuRecordAddMaster.DropDownItems.OfType<ToolStripButton>().Where(x => !x.Equals(this.browseToolStripMenuItem)).ToArray())
     {
         this.contextMenuRecordAddMaster.DropDownItems.Remove(item);
     }
 }
        void SplitMenuStrip_Closing(object sender, ToolStripDropDownClosingEventArgs e)
        {
            isSplitMenuVisible = false;

            SetButtonDrawState();

            if (e.CloseReason == ToolStripDropDownCloseReason.AppClicked)
            {
                skipNextOpen = (dropDownRectangle.Contains(this.PointToClient(Cursor.Position))) && Control.MouseButtons == MouseButtons.Left;
            }
        }
Example #25
0
 private void contextMenuStrip_keywordList_Closing(object sender, ToolStripDropDownClosingEventArgs e)
 {
 }
Example #26
0
		private void MainFormContextMenu_Closing(object sender, ToolStripDropDownClosingEventArgs e)
		{
			if (!_wasPaused)
			{
				UnpauseEmulator();
			}
		}
Example #27
0
        void ContextMenuStrip_Closing(object sender, ToolStripDropDownClosingEventArgs e)
        {
            ContextMenuStrip cms = sender as ContextMenuStrip;
            if (cms != null) {
                cms.Closing -= new ToolStripDropDownClosingEventHandler(ContextMenuStrip_Closing);
            }

            SetButtonDrawState();

            if (e.CloseReason == ToolStripDropDownCloseReason.AppClicked) {
                skipNextOpen = (dropDownRectangle.Contains(this.PointToClient(Cursor.Position)));
            }
        }
 protected override void OnClosing(ToolStripDropDownClosingEventArgs e)
 {
     _popupControl.RegionChanged -= new EventHandler(PopupControlRegionChanged);
     base.OnClosing(e);
 }
 private void contextMenu_Closing(object sender, ToolStripDropDownClosingEventArgs e) {
     if(CancelClosing) {
         e.Cancel = true;
         CancelClosing = false;
     }
     else {
         List<int> list = new List<int>();
         for(int i = 0; i < contextMenu.Items.Count; i++) {
             if(list.Count == Order_Root.Length) {
                 break;
             }
             ToolStripItem item = contextMenu.Items[i];
             if(item is TitleMenuItem) {
                 if((item == groupsMenuItem) || (item == labelGroupTitle)) {
                     list.Add(0);
                 }
                 else if((item == historyMenuItem) || (item == labelHistoryTitle)) {
                     list.Add(1);
                 }
                 else if((item == userAppsMenuItem) || (item == labelUserAppTitle)) {
                     list.Add(2);
                 }
                 else if((item == recentFileMenuItem) || (item == labelRecentFileTitle)) {
                     list.Add(3);
                 }
             }
         }
         for(int j = 0; j < 3; j++) {
             if(j < list.Count) {
                 Order_Root[j] = (byte)list[j];
             }
             else {
                 Order_Root[j] = 15;
             }
         }
         SaveSetting();
     }
 }
Example #30
0
 private void cmenSeries_Closing(object sender, ToolStripDropDownClosingEventArgs e)
 {
     if (e.CloseReason != ToolStripDropDownCloseReason.ItemClicked)
         treeSeries.SelectedNode = selnode;
 }
Example #31
0
 private void contextMenuNode_Closing(object sender, ToolStripDropDownClosingEventArgs e)
 {
     var hoverItem = this.contextMenuNode.GetItemAt(this.contextMenuNode.PointToClient(Cursor.Position));
     if (e.CloseReason == ToolStripDropDownCloseReason.ItemClicked && this.nodeContextView.GetModelItem(hoverItem) == this.nodeContextItemLockHide)
         e.Cancel = true;
 }
Example #32
0
 private void ColumnSelectMenu_Closing(object sender, ToolStripDropDownClosingEventArgs e)
 {
     e.Cancel = this.contextMenuStaysOpen && e.CloseReason == ToolStripDropDownCloseReason.ItemClicked;
     this.contextMenuStaysOpen = false;
 }
Example #33
0
 private void DontCloseMe(object sender, ToolStripDropDownClosingEventArgs e)
 {
     if (e.CloseReason == ToolStripDropDownCloseReason.ItemClicked ||
         e.CloseReason == ToolStripDropDownCloseReason.Keyboard)
         e.Cancel = true;
 }