Esempio n. 1
0
        /// <summary>
        /// Raises the Click event
        /// </summary>
        /// <param name="e">Event data</param>
        public virtual void OnClick(EventArgs e)
        {
            try
            {
                if (!Enabled)
                {
                    return;
                }

                if (ClosesDropDownAt(Canvas.PointToClient(Cursor.Position)))
                {
                    DeactivateToolTip(_TT);
                    RibbonPopupManager.Dismiss(RibbonPopupManager.DismissReason.ItemClicked);
                }

                SetSelected(false);

                if (Click != null)
                {
                    Click(this, e);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Raises the MouseDown event
        /// </summary>
        /// <param name="e">Event data</param>
        public virtual void OnMouseDown(MouseEventArgs e)
        {
            if (!Enabled)
            {
                return;
            }

            if (MouseDown != null)
            {
                MouseDown(this, e);
            }

            RibbonPopup pop = Canvas as RibbonPopup;

            if (pop != null)
            {
                if (ClosesDropDownAt(e.Location))
                {
                    RibbonPopupManager.Dismiss(RibbonPopupManager.DismissReason.ItemClicked);
                }

                OnClick(EventArgs.Empty);
            }

            SetPressed(true);
        }
Esempio n. 3
0
 private void _keyboardHook_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Escape)
     {
         RibbonPopupManager.Dismiss(RibbonPopupManager.DismissReason.EscapePressed);
     }
 }
Esempio n. 4
0
 protected override void OnKeyDown(KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Escape)
     {
         RibbonPopupManager.Dismiss(RibbonPopupManager.DismissReason.EscapePressed);
     }
     base.OnKeyDown(e);
 }
Esempio n. 5
0
        /// <summary>
        /// Closes the DropDown if opened
        /// </summary>
        public void CloseDropDown()
        {
            if (DropDown != null)
            {
                RibbonPopupManager.Dismiss(DropDown, RibbonPopupManager.DismissReason.NewPopup);
            }

            SetDropDownVisible(false);
        }
Esempio n. 6
0
        /// <summary>
        /// Removes all helper controls placed by any reason.
        /// Contol's visibility is set to false before removed.
        /// </summary>
        private void RemoveHelperControls()
        {
            RibbonPopupManager.Dismiss(RibbonPopupManager.DismissReason.AppClicked);

            while (Controls.Count > 0)
            {
                Control ctl = Controls[0];

                ctl.Visible = false;

                Controls.Remove(ctl);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Raises the Click event
        /// </summary>
        /// <param name="e">Event data</param>
        public virtual void OnClick(EventArgs e)
        {
            if (!Enabled)
            {
                return;
            }

            if (ClosesDropDownAt(Canvas.PointToClient(Cursor.Position)))
            {
                RibbonPopupManager.Dismiss(RibbonPopupManager.DismissReason.ItemClicked);
            }

            SetSelected(false);

            if (Click != null)
            {
                Click(this, e);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Raises the Click event
        /// </summary>
        /// <param name="e">Event data</param>
        public virtual void OnClick(EventArgs e)
        {
            if (!Enabled)
            {
                return;
            }

            if (Click != null)
            {
                Click(this, e);
            }

            RibbonPopup pop = Canvas as RibbonPopup;

            if (pop != null)
            {
                if (ClosesDropDownAt(Cursor.Position))
                {
                    RibbonPopupManager.Dismiss(RibbonPopupManager.DismissReason.ItemClicked);
                }
            }
        }