Example #1
0
        /// <summary>
        /// Initialise a new instance of the KryptonRibbonGroupColorButton class.
        /// </summary>
        public KryptonRibbonGroupColorButton()
        {
            // Default fields
            _enabled                     = true;
            _visible                     = true;
            _checked                     = false;
            _visibleThemes               = true;
            _visibleStandard             = true;
            _visibleRecent               = true;
            _visibleNoColor              = true;
            _visibleMoreColors           = true;
            _autoRecentColors            = true;
            ShortcutKeys                 = Keys.None;
            _imageSmall                  = _defaultButtonImageSmall;
            _imageLarge                  = _defaultButtonImageLarge;
            _textLine1                   = "Color";
            _textLine2                   = string.Empty;
            _keyTip                      = "B";
            _selectedColor               = Color.Red;
            _emptyBorderColor            = Color.DarkGray;
            _selectedRectSmall           = new Rectangle(0, 12, 16, 4);
            _selectedRectLarge           = new Rectangle(2, 26, 28, 4);
            _schemeThemes                = ColorScheme.OfficeThemes;
            _schemeStandard              = ColorScheme.OfficeStandard;
            _buttonType                  = GroupButtonType.Split;
            _itemSizeMax                 = GroupItemSize.Large;
            _itemSizeMin                 = GroupItemSize.Small;
            _itemSizeCurrent             = GroupItemSize.Large;
            ToolTipImageTransparentColor = Color.Empty;
            ToolTipTitle                 = string.Empty;
            ToolTipBody                  = string.Empty;
            ToolTipStyle                 = LabelStyle.SuperTip;
            _maxRecentColors             = 10;
            _recentColors                = new List <Color>();

            // Create the context menu items
            _kryptonContextMenu = new KryptonContextMenu();
            _separatorTheme     = new KryptonContextMenuSeparator();
            _headingTheme       = new KryptonContextMenuHeading("Theme Colors");
            _colorsTheme        = new KryptonContextMenuColorColumns(ColorScheme.OfficeThemes);
            _separatorStandard  = new KryptonContextMenuSeparator();
            _headingStandard    = new KryptonContextMenuHeading("Standard Colors");
            _colorsStandard     = new KryptonContextMenuColorColumns(ColorScheme.OfficeStandard);
            _separatorRecent    = new KryptonContextMenuSeparator();
            _headingRecent      = new KryptonContextMenuHeading("Recent Colors");
            _colorsRecent       = new KryptonContextMenuColorColumns(ColorScheme.None);
            _separatorNoColor   = new KryptonContextMenuSeparator();
            _itemNoColor        = new KryptonContextMenuItem("&No Color", Properties.Resources.ButtonNoColor, OnClickNoColor);
            _itemsNoColor       = new KryptonContextMenuItems();
            _itemsNoColor.Items.Add(_itemNoColor);
            _separatorMoreColors = new KryptonContextMenuSeparator();
            _itemMoreColors      = new KryptonContextMenuItem("&More Colors...", OnClickMoreColors);
            _itemsMoreColors     = new KryptonContextMenuItems();
            _itemsMoreColors.Items.Add(_itemMoreColors);
            _kryptonContextMenu.Items.AddRange(new KryptonContextMenuItemBase[] { _separatorTheme, _headingTheme, _colorsTheme,
                                                                                  _separatorStandard, _headingStandard, _colorsStandard,
                                                                                  _separatorRecent, _headingRecent, _colorsRecent,
                                                                                  _separatorNoColor, _itemsNoColor,
                                                                                  _separatorMoreColors, _itemsMoreColors });
        }
Example #2
0
        private void kryptonDockingManager_ShowWorkspacePageContextMenu(object sender, ContextPageEventArgs e)
        {
            // Create a set of custom menu items
            KryptonContextMenuItems     customItems     = new KryptonContextMenuItems();
            KryptonContextMenuSeparator customSeparator = new KryptonContextMenuSeparator();
            KryptonContextMenuItem      customItem1     = new KryptonContextMenuItem("Custom Item 3", OnCustomMenuItem);
            KryptonContextMenuItem      customItem2     = new KryptonContextMenuItem("Custom Item 4", OnCustomMenuItem);

            customItem1.Tag = e.Page;
            customItem2.Tag = e.Page;
            customItems.Items.AddRange(new KryptonContextMenuItemBase[] { customSeparator, customItem1, customItem2 });

            // Add set of custom items into the provided menu
            e.KryptonContextMenu.Items.Add(customItems);
        }
Example #3
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawMenuSeparator class.
        /// </summary>
        /// <param name="separator">Reference to owning separator entry.</param>
        /// <param name="palette">Palette for obtaining drawing values.</param>
        public ViewDrawMenuSeparator(KryptonContextMenuSeparator separator,
                                     PaletteDoubleRedirect palette)
            : base(separator.StateNormal.Back, separator.StateNormal.Border)
        {
            // Draw the separator by default
            Draw = true;

            // Give the separator object the redirector to use when inheriting values
            separator.SetPaletteRedirect(palette);

            Orientation = separator.Horizontal ? VisualOrientation.Top : VisualOrientation.Left;

            // We need to be big enough to contain 1 pixel square spacer
            Add(new ViewLayoutSeparator(1));
        }
        private void CreateRecentDocumentsView()
        {
            // Do we need to add the recent docs view?
            if (_ribbon.RibbonAppButton.AppButtonShowRecentDocs)
            {
                // Create a dummy vertical menu separator for separating recent documents from menu items
                KryptonContextMenuSeparator dummySep1 = new KryptonContextMenuSeparator
                {
                    Horizontal = false
                };
                _viewColumns.Add(new ViewDrawMenuSeparator(dummySep1, _provider.ProviderStateCommon.Separator));
                _viewColumns.Add(new ViewLayoutSeparator(0, _ribbon.RibbonAppButton.AppButtonMinRecentSize.Height));

                // Use a layout that draws the background color of the recent docs area
                ViewDrawRibbonAppMenuDocs recentDocsBack = new ViewDrawRibbonAppMenuDocs(_ribbon);
                _viewColumns.Add(recentDocsBack);

                // Stack the document entries vertically
                ViewLayoutStack documentStack = new ViewLayoutStack(false);
                recentDocsBack.Add(documentStack);

                // Use fixed width separator to enforce a minimum width to column
                documentStack.Add(new ViewLayoutSeparator(_ribbon.RibbonAppButton.AppButtonMinRecentSize.Width, 0));

                // Add the recent document title
                documentStack.Add(new ViewDrawRibbonRecentDocs(_ribbon));

                // Followed by a horizontal separator
                KryptonContextMenuSeparator dummySep2 = new KryptonContextMenuSeparator();
                documentStack.Add(new ViewDrawMenuSeparator(dummySep2, _provider.ProviderStateCommon.Separator));
                documentStack.Add(new ViewLayoutSeparator(2));

                // Then generate an item per recent document entry
                int index = 1;
                foreach (KryptonRibbonRecentDoc recentDoc in _ribbon.RibbonAppButton.AppButtonRecentDocs)
                {
                    documentStack.Add(new ViewDrawRibbonAppMenuRecentDec(_ribbon, _provider, recentDoc, _ribbon.RibbonAppButton.AppButtonMaxRecentSize.Width, NeedPaintDelegate, index++));
                }

                // Add separator entry which is then used to fill remained space
                documentStack.Add(new ViewLayoutSeparator(1));

                // Update provider with element to use as the fixed size for submenus
                _provider.FixedViewBase = recentDocsBack;
            }
        }
        /// <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);
        }
Example #6
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);
        }
Example #7
0
 public Separator()
 {
     item = new KryptonContextMenuSeparator();
 }