Esempio n. 1
0
 /// <summary>
 /// Initialise a new instance of the KryptonRibbonGroupClusterButton class.
 /// </summary>
 public KryptonRibbonGroupClusterButton()
 {
     // Default fields
     _enabled                      = true;
     _visible                      = true;
     _checked                      = false;
     _textLine                     = string.Empty;
     _keyTip                       = "B";
     _shortcutKeys                 = Keys.None;
     _itemSizeMax                  = GroupItemSize.Medium;
     _itemSizeMin                  = GroupItemSize.Small;
     _itemSizeCurrent              = GroupItemSize.Medium;
     _imageSmall                   = _defaultButtonImageSmall;
     _buttonType                   = GroupButtonType.Push;
     _contextMenuStrip             = null;
     _kryptonContextMenu           = null;
     _toolTipImageTransparentColor = Color.Empty;
     _toolTipTitle                 = string.Empty;
     _toolTipBody                  = string.Empty;
     _toolTipStyle                 = LabelStyle.SuperTip;
 }
Esempio n. 2
0
        private void ShowContextMenuStrip()
        {
            if (skipNextOpen)
            {
                // we were called because we're closing the context menu strip
                // when clicking the dropdown button.
                skipNextOpen = false;
                return;
            }

            if (KryptonContextMenu != null)
            {
                KryptonContextMenu.Show(FindForm().PointToScreen(Location) + new Size(0, Height));
                KryptonContextMenu.Closed += KryptonContextMenu_Closed;
            }
            else if (ContextMenuStrip != null)
            {
                ContextMenuStrip.Closing += ContextMenuStrip_Closing;
                ContextMenuStrip.Show(this, new Point(0, Height), ToolStripDropDownDirection.BelowRight);
            }
        }
Esempio n. 3
0
        private void OnCellPrimaryHeaderRightClicked(object sender, EventArgs e)
        {
            // Should we apply docking specific change of focus when the primary header is clicked?
            if (ApplyDockingAppearance)
            {
                KryptonWorkspaceCell cell = (KryptonWorkspaceCell)sender;
                if (cell.SelectedPage != null)
                {
                    // Set the focus into the active page
                    cell.SelectedPage.SelectNextControl(cell.SelectedPage, true, true, true, false);

                    // Create and populate a context menu with the drop down set of options
                    KryptonContextMenu      kcm  = new KryptonContextMenu();
                    CancelDropDownEventArgs args = new CancelDropDownEventArgs(kcm, cell.SelectedPage);
                    OnPageDropDownClicked(args);

                    // Do we need to show a context menu
                    if (!args.Cancel && CommonHelper.ValidKryptonContextMenu(args.KryptonContextMenu))
                    {
                        args.KryptonContextMenu.Show(this, Control.MousePosition);
                    }
                }
            }
        }
Esempio n. 4
0
        internal void ShownGalleryDropDown(Rectangle screenRect,
                                           KryptonContextMenuPositionH hPosition,
                                           KryptonContextMenuPositionV vPosition,
                                           EventHandler finishDelegate,
                                           int actualLineItems)
        {
            // First time around create the context menu, otherwise just clear it down
            if (_dropMenu == null)
            {
                _dropMenu = new KryptonContextMenu();
            }

            // Number of line items equals the number actually used
            int lineItems = Math.Max(DropMinItemWidth, Math.Min(DropMaxItemWidth, actualLineItems));

            // If there are no ranges defined, just add a single entry showing all enties
            if (_dropButtonRanges.Count == 0)
            {
                KryptonContextMenuImageSelect imageSelect = new KryptonContextMenuImageSelect();
                imageSelect.ImageList       = ImageList;
                imageSelect.ImageIndexStart = 0;
                imageSelect.ImageIndexEnd   = (ImageList == null ? 0 : ImageList.Images.Count - 1);
                imageSelect.SelectedIndex   = SelectedIndex;
                imageSelect.LineItems       = lineItems;
                _dropMenu.Items.Add(imageSelect);
            }
            else
            {
                foreach (KryptonGalleryRange range in _dropButtonRanges)
                {
                    // If not the first item in the menu, add a separator
                    if (_dropMenu.Items.Count > 0)
                    {
                        _dropMenu.Items.Add(new KryptonContextMenuSeparator());
                    }

                    // Only add a heading if the heading text is not empty
                    if (!string.IsNullOrEmpty(range.Heading))
                    {
                        KryptonContextMenuHeading heading = new KryptonContextMenuHeading();
                        heading.Text = range.Heading;
                        _dropMenu.Items.Add(heading);
                    }

                    // Add the image select for the range
                    KryptonContextMenuImageSelect imageSelect = new KryptonContextMenuImageSelect();
                    imageSelect.ImageList       = ImageList;
                    imageSelect.ImageIndexStart = Math.Max(0, range.ImageIndexStart);
                    imageSelect.ImageIndexEnd   = Math.Min(range.ImageIndexEnd, (ImageList == null ? 0 : ImageList.Images.Count - 1));
                    imageSelect.SelectedIndex   = SelectedIndex;
                    imageSelect.LineItems       = lineItems;
                    _dropMenu.Items.Add(imageSelect);
                }
            }

            // Give event handler a change to modify the menu
            GalleryDropMenuEventArgs args = new GalleryDropMenuEventArgs(_dropMenu);

            OnGalleryDropMenu(args);

            if (!args.Cancel && CommonHelper.ValidKryptonContextMenu(args.KryptonContextMenu))
            {
                // Hook into relevant events of the image select areas
                foreach (KryptonContextMenuItemBase item in _dropMenu.Items)
                {
                    if (item is KryptonContextMenuImageSelect)
                    {
                        KryptonContextMenuImageSelect itemSelect = (KryptonContextMenuImageSelect)item;
                        itemSelect.SelectedIndexChanged += new EventHandler(OnDropImageSelect);
                        itemSelect.TrackingImage        += new EventHandler <ImageSelectEventArgs>(OnDropImageTracking);
                    }
                }

                // Need to know when the menu is dismissed
                args.KryptonContextMenu.Closed += new ToolStripDropDownClosedEventHandler(OnDropMenuClosed);

                // Remember the delegate we need to fire when the menu is dismissed
                _finishDelegate = finishDelegate;

                // Show the menu to the user
                args.KryptonContextMenu.Show(this, screenRect, hPosition, vPosition);
            }
            else
            {
                // Nothing to show, but still need to call the finished delegate?
                finishDelegate?.Invoke(this, EventArgs.Empty);
            }
        }
 /// <summary>
 /// Initialize a new instance of the GalleryDropMenuEventArgs class.
 /// </summary>
 /// <param name="contextMenu">Context menu.</param>
 public GalleryDropMenuEventArgs(KryptonContextMenu contextMenu)
 {
     KryptonContextMenu = contextMenu;
 }
        /// <summary>
        /// Show the context menu for column box
        /// </summary>
        private void ShowColumnBoxContextMenu()
        {
            if (_menuItems == null)
            {
                // Create individual items
                _menuSortAscending  = new KryptonContextMenuItem("SORTASCENDING", new EventHandler(OnSortAscending));
                _menuSortDescending = new KryptonContextMenuItem("SORTDESCENDING", new EventHandler(OnSortDescending));
                _menuUnGroup        = new KryptonContextMenuItem("UNGROUP", new EventHandler(OnUngroup));
                _menuSeparator1     = new KryptonContextMenuSeparator();
                _menuFullExpand     = new KryptonContextMenuItem("FULLEXPAND", new EventHandler(OnFullExpand));
                _menuFullCollapse   = new KryptonContextMenuItem("FULLCOLLAPSE", new EventHandler(OnFullCollapse));
                _menuSeparator2     = new KryptonContextMenuSeparator();
                _menuClearGrouping  = new KryptonContextMenuItem("CLEARGROUPING", new EventHandler(OnClearGrouping));
                _menuHideGroupBox   = new KryptonContextMenuItem("HIDEGROUPBOX", null, new EventHandler(OnHideGroupBox));

                // Add items inside an items collection (apart from separator1 which is only added if required)
                _menuItems = new KryptonContextMenuItems(new KryptonContextMenuItemBase[] { _menuSortAscending,
                                                                                            _menuSortDescending,
                                                                                            _menuUnGroup,
                                                                                            _menuSeparator1,
                                                                                            _menuFullExpand,
                                                                                            _menuFullCollapse,
                                                                                            _menuSeparator2,
                                                                                            _menuClearGrouping,
                                                                                            _menuHideGroupBox });
            }

            // Ensure we have a krypton context menu if not already present
            if (this.KCtxMenu == null)
            {
                KCtxMenu = new KryptonContextMenu();
            }


            // Update the individual menu options
            OutlookGridGroupBoxColumn col = null;

            if (indexselected > -1)
            {
                col = columnsList[indexselected];
            }

            _menuSortAscending.Visible  = col != null;
            _menuSortDescending.Visible = col != null;
            _menuSortAscending.Checked  = col != null && col.SortOrder == SortOrder.Ascending;
            _menuSortDescending.Checked = col != null && col.SortOrder == SortOrder.Descending;
            _menuUnGroup.Visible        = col != null;
            _menuFullExpand.Enabled     = columnsList.Count > 0;
            _menuFullCollapse.Enabled   = columnsList.Count > 0;
            _menuClearGrouping.Enabled  = columnsList.Count > 0;


            _menuSeparator1.Visible = (_menuSortAscending.Visible || _menuSortDescending.Visible || _menuUnGroup.Visible);

            if (!KCtxMenu.Items.Contains(_menuItems))
            {
                KCtxMenu.Items.Add(_menuItems);
            }

            // Show the menu!
            KCtxMenu.Show(this);
        }
 /// <summary>
 /// Initialize a new instance of the ContextActionEventArgs class.
 /// </summary>
 /// <param name="page">Page effected by event.</param>
 /// <param name="index">Index of page in the owning collection.</param>
 /// <param name="action">Close action to take.</param>
 /// <param name="contextMenu">Prepopulated context menu ready for display.</param>
 public ContextActionEventArgs(KryptonPage page,
                               int index,
                               ContextButtonAction action,
                               KryptonContextMenu contextMenu)
     : base(page, index, contextMenu) =>
Esempio n. 8
0
 private void ShowMenu(Control c, KryptonContextMenu kcm)
 {
     kcm.Show(c.RectangleToScreen(c.ClientRectangle),
              (KryptonContextMenuPositionH)Enum.Parse(typeof(KryptonContextMenuPositionH), (string)comboBoxH.SelectedItem),
              (KryptonContextMenuPositionV)Enum.Parse(typeof(KryptonContextMenuPositionV), (string)comboBoxV.SelectedItem));
 }
 /// <summary>
 /// Initialize a new instance of the ContextMenuArgs class.
 /// </summary>
 /// <param name="crumb">Reference to related crumb.</param>
 /// <param name="kcm">KryptonContextMenu that can be customized.</param>
 /// <param name="positionH">Relative horizontal position of the KryptonContextMenu.</param>
 /// <param name="positionV">Relative vertical position of the KryptonContextMenu.</param>
 public BreadCrumbMenuArgs(KryptonBreadCrumbItem crumb,
                           KryptonContextMenu kcm,
                           KryptonContextMenuPositionH positionH,
                           KryptonContextMenuPositionV positionV)
     : base(null, kcm, positionH, positionV) =>
Esempio n. 10
0
 /// <summary>
 /// Initialize a new instance of the ContextMenuArgs class.
 /// </summary>
 /// <param name="cms">Context menu strip that can be customized.</param>
 /// <param name="kcm">KryptonContextMenu that can be customized.</param>
 public ContextMenuArgs(ContextMenuStrip cms,
                        KryptonContextMenu kcm)
 {
     ContextMenuStrip   = cms;
     KryptonContextMenu = kcm;
 }
Esempio n. 11
0
 /// <summary>
 /// Initialize a new instance of the ContextMenuArgs class.
 /// </summary>
 /// <param name="kcm">KryptonContextMenu that can be customized.</param>
 public ContextMenuArgs(KryptonContextMenu kcm)
     : this(null, kcm)
 {
 }
Esempio n. 12
0
 public static void setTabItemContextMenu(KryptonContextMenu menu)
 {
     _tabItemMenu          = menu;
     _tabItemMenu.Opening += _tabItemMenu_Opening;
 }
 /// <summary>
 /// Initialize a new instance of the KryptonContextMenuEventArgs class.
 /// </summary>
 /// <param name="page">Page effected by event.</param>
 /// <param name="index">Index of page in the owning collection.</param>
 /// <param name="contextMenu">Prepopulated context menu ready for display.</param>
 public KryptonContextMenuEventArgs(KryptonPage page,
                                    int index,
                                    KryptonContextMenu contextMenu)
     : base(page, index) =>
 /// <summary>
 /// Initialize a new instance of the ContextMenuArgs class.
 /// </summary>
 /// <param name="kcm">KryptonContextMenu that can be customized.</param>
 /// <param name="positionH">Relative horizontal position of the KryptonContextMenu.</param>
 /// <param name="positionV">Relative vertical position of the KryptonContextMenu.</param>
 public ContextPositionMenuArgs(KryptonContextMenu kcm,
                                KryptonContextMenuPositionH positionH,
                                KryptonContextMenuPositionV positionV)
     : this(null, kcm, positionH, positionV)
 {
 }
Esempio n. 15
0
        //

        public static KryptonContextMenu Create()
        {
            var menu = new KryptonContextMenu();

            return(menu);
        }
Esempio n. 16
0
        /// <summary>
        /// Show the context menu for column box
        /// </summary>
        private void ShowColumnBoxContextMenu()
        {
            if (_menuItems == null)
            {
                // Create individual items
                _menuSortAscending              = new KryptonContextMenuItem(LanguageManager.Instance.GetStringGB("SORTASCENDING"), Properties.Resources.sort_az_ascending2, new EventHandler(OnSortAscending));
                _menuSortDescending             = new KryptonContextMenuItem(LanguageManager.Instance.GetStringGB("SORTDESCENDING"), Properties.Resources.sort_az_descending2, new EventHandler(OnSortDescending));
                _menuSeparator1                 = new KryptonContextMenuSeparator();
                _menuExpand                     = new KryptonContextMenuItem(LanguageManager.Instance.GetStringGB("EXPAND"), Properties.Resources.element_plus_16, new EventHandler(OnGroupExpand));
                _menuCollapse                   = new KryptonContextMenuItem(LanguageManager.Instance.GetStringGB("COLLAPSE"), Properties.Resources.element_minus_16, new EventHandler(OnGroupCollapse));
                _menuUnGroup                    = new KryptonContextMenuItem(LanguageManager.Instance.GetStringGB("UNGROUP"), Properties.Resources.element_delete, new EventHandler(OnUngroup));
                _menuSeparator2                 = new KryptonContextMenuSeparator();
                _menuFullExpand                 = new KryptonContextMenuItem(LanguageManager.Instance.GetStringGB("FULLEXPAND"), Properties.Resources.elements_plus_16, new EventHandler(OnFullExpand));
                _menuFullCollapse               = new KryptonContextMenuItem(LanguageManager.Instance.GetStringGB("FULLCOLLAPSE"), Properties.Resources.elements_minus_16, new EventHandler(OnFullCollapse));
                _menuSeparator3                 = new KryptonContextMenuSeparator();
                _menuClearGrouping              = new KryptonContextMenuItem(LanguageManager.Instance.GetStringGB("CLEARGROUPING"), Properties.Resources.element_selection_delete, new EventHandler(OnClearGrouping));
                _menuHideGroupBox               = new KryptonContextMenuItem(LanguageManager.Instance.GetStringGB("HIDEGROUPBOX"), null, new EventHandler(OnHideGroupBox));
                _menuGroupInterval              = new KryptonContextMenuItem(LanguageManager.Instance.GetStringGB("GROUPINTERVAL"));
                _menuSortBySummary              = new KryptonContextMenuItem(LanguageManager.Instance.GetStringGB("SORTBYSUMMARYCOUNT"), null, new EventHandler(OnSortBySummaryCount));
                _menuSortBySummary.CheckOnClick = true;

                //Group Interval
                KryptonContextMenuItems _GroupIntervalItems;
                KryptonContextMenuItem  it = null;
                string[] names             = Enum.GetNames(typeof(OutlookGridDateTimeGroup.DateInterval));
                KryptonContextMenuItemBase[] arrayOptions = new KryptonContextMenuItemBase[names.Length];
                for (int i = 0; i < names.Length; i++)
                {
                    it              = new KryptonContextMenuItem(LanguageManager.Instance.GetStringGB(names[i]));
                    it.Tag          = names[i];
                    it.Click       += OnGroupIntervalClick;
                    arrayOptions[i] = it;
                }
                _GroupIntervalItems = new KryptonContextMenuItems(arrayOptions);
                _menuGroupInterval.Items.Add(_GroupIntervalItems);

                // Add items inside an items collection (apart from separator1 which is only added if required)
                _menuItems = new KryptonContextMenuItems(new KryptonContextMenuItemBase[] { _menuSortAscending,
                                                                                            _menuSortDescending,
                                                                                            _menuSortBySummary,
                                                                                            _menuSeparator1,
                                                                                            _menuGroupInterval,
                                                                                            _menuExpand,
                                                                                            _menuCollapse,
                                                                                            _menuUnGroup,
                                                                                            _menuSeparator2,
                                                                                            _menuFullExpand,
                                                                                            _menuFullCollapse,
                                                                                            _menuSeparator3,
                                                                                            _menuClearGrouping,
                                                                                            _menuHideGroupBox });
            }

            // Ensure we have a krypton context menu if not already present
            if (this.KCtxMenu == null)
            {
                KCtxMenu = new KryptonContextMenu();
            }


            // Update the individual menu options
            OutlookGridGroupBoxColumn col = null;

            if (indexselected > -1)
            {
                col = columnsList[indexselected];
            }

            _menuSortAscending.Visible  = col != null;
            _menuSortDescending.Visible = col != null;
            _menuSortAscending.Checked  = col != null && col.SortDirection == SortOrder.Ascending;
            _menuSortDescending.Checked = col != null && col.SortDirection == SortOrder.Descending;
            _menuSortBySummary.Visible  = col != null;
            _menuSortBySummary.Checked  = col != null && col.SortBySummaryCount;
            _menuExpand.Visible         = col != null;
            _menuCollapse.Visible       = col != null;
            _menuGroupInterval.Visible  = col != null && col.GroupingType == typeof(OutlookGridDateTimeGroup).Name;
            if (_menuGroupInterval.Visible)
            {
                foreach (KryptonContextMenuItem item in ((KryptonContextMenuItems)_menuGroupInterval.Items[0]).Items)
                {
                    item.Checked = item.Tag.ToString() == col.GroupInterval;
                }
            }
            _menuUnGroup.Visible       = col != null;
            _menuFullExpand.Enabled    = columnsList.Count > 0;
            _menuFullCollapse.Enabled  = columnsList.Count > 0;
            _menuClearGrouping.Enabled = columnsList.Count > 0;

            _menuSeparator1.Visible = (_menuSortAscending.Visible || _menuSortDescending.Visible);
            _menuSeparator2.Visible = (_menuExpand.Visible || _menuCollapse.Visible || _menuUnGroup.Visible);
            _menuSeparator3.Visible = (_menuFullExpand.Visible || _menuFullCollapse.Visible);

            if (!KCtxMenu.Items.Contains(_menuItems))
            {
                KCtxMenu.Items.Add(_menuItems);
            }

            // Show the menu!
            KCtxMenu.Show(this);
        }
 /// <summary>
 /// Initialize a new instance of the ShowContextMenuArgs class.
 /// </summary>
 /// <param name="page">Page effected by event.</param>
 /// <param name="index">Index of page in the owning collection.</param>
 public ShowContextMenuArgs(KryptonPage page, int index)
     : base(page, index)
 {
     _cms = page.ContextMenuStrip;
     _kcm = page.KryptonContextMenu;
 }
 /// <summary>
 /// Initialize a new instance of the CancelDropDownEventArgs class.
 /// </summary>
 /// <param name="contextMenu">Reference to associated context menu.</param>
 /// <param name="page">Reference to the associated page.</param>
 public CancelDropDownEventArgs(KryptonContextMenu contextMenu, KryptonPage page)
     : base(false)
 {
     KryptonContextMenu = contextMenu;
     Page = page;
 }
Esempio n. 19
0
 /// <summary>
 /// Initialize a new instance of the DateTimePickerCloseArgs class.
 /// </summary>
 /// <param name="kcm">KryptonContextMenu that can be examined.</param>
 public DateTimePickerCloseArgs(KryptonContextMenu kcm) => KryptonContextMenu = kcm;