Example #1
0
        /// <summary>
        /// Initialize a new instance of the ContextMenuProvider class.
        /// </summary>
        /// <param name="viewManager">View manager used to organize keyboard events.</param>
        /// <param name="menuCollection">Top level set of menu items.</param>
        /// <param name="viewColumns">Stack used for adding new columns.</param>
        /// <param name="palette">Local palette setting to use initially.</param>
        /// <param name="paletteMode">Palette mode setting to use initially.</param>
        /// <param name="redirector">Redirector used for obtaining palette values.</param>
        /// <param name="needPaintDelegate">Delegate used to when paint changes occur.</param>
        public AppButtonMenuProvider(ViewContextMenuManager viewManager,
                                     KryptonContextMenuItemCollection menuCollection,
                                     ViewLayoutStack viewColumns,
                                     IPalette palette,
                                     PaletteMode paletteMode,
                                     PaletteRedirect redirector,
                                     NeedPaintHandler needPaintDelegate)
        {
            // Store incoming state
            _viewManager       = viewManager;
            _menuCollection    = menuCollection;
            _viewColumns       = viewColumns;
            _palette           = palette;
            _paletteMode       = paletteMode;
            _redirector        = redirector;
            _needPaintDelegate = needPaintDelegate;

            // Create all other state
            _parent           = null;
            _enabled          = true;
            _canCloseMenu     = true;
            _showHorz         = KryptonContextMenuPositionH.After;
            _showVert         = KryptonContextMenuPositionV.Top;
            _stateCommon      = new PaletteContextMenuRedirect(redirector, needPaintDelegate);
            _stateNormal      = new PaletteContextMenuItemState(_stateCommon);
            _stateDisabled    = new PaletteContextMenuItemState(_stateCommon);
            _stateHighlight   = new PaletteContextMenuItemStateHighlight(_stateCommon);
            _stateChecked     = new PaletteContextMenuItemStateChecked(_stateCommon);
            _redirectorImages = new PaletteRedirectContextMenu(redirector, new ContextMenuImages(needPaintDelegate));
        }
        /// <summary>
        /// Initialize a new instance of the ContextMenuProvider class.
        /// </summary>
        /// <param name="viewManager">View manager used to organize keyboard events.</param>
        /// <param name="menuCollection">Top level set of menu items.</param>
        /// <param name="viewColumns">Stack used for adding new columns.</param>
        /// <param name="palette">Local palette setting to use initially.</param>
        /// <param name="paletteMode">Palette mode setting to use initially.</param>
        /// <param name="redirector">Redirector used for obtaining palette values.</param>
        /// <param name="needPaintDelegate">Delegate used to when paint changes occur.</param>
        public AppButtonMenuProvider(ViewContextMenuManager viewManager,
                                     KryptonContextMenuItemCollection menuCollection,
                                     ViewLayoutStack viewColumns,
                                     IPalette palette,
                                     PaletteMode paletteMode,
                                     PaletteRedirect redirector,
                                     NeedPaintHandler needPaintDelegate)
        {
            // Store incoming state
            _viewManager = viewManager;
            _menuCollection = menuCollection;
            _viewColumns = viewColumns;
            _palette = palette;
            _paletteMode = paletteMode;
            _redirector = redirector;
            _needPaintDelegate = needPaintDelegate;

            // Create all other state
            _parent = null;
            _enabled = true;
            _canCloseMenu = true;
            _showHorz = KryptonContextMenuPositionH.After;
            _showVert = KryptonContextMenuPositionV.Top;
            _stateCommon = new PaletteContextMenuRedirect(redirector, needPaintDelegate);
            _stateNormal = new PaletteContextMenuItemState(_stateCommon);
            _stateDisabled = new PaletteContextMenuItemState(_stateCommon);
            _stateHighlight = new PaletteContextMenuItemStateHighlight(_stateCommon);
            _stateChecked = new PaletteContextMenuItemStateChecked(_stateCommon);
            _redirectorImages = new PaletteRedirectContextMenu(redirector, new ContextMenuImages(needPaintDelegate));
        }
        /// <summary>
        /// Initialize a new instance of the KryptonContextMenuItems class.
        /// </summary>
        /// <param name="children">Array of initial child items.</param>
        public KryptonContextMenuItems(KryptonContextMenuItemBase[] children)
        {
            // Default fields
            _standardStyle = true;
            _imageColumn = true;
            _items = new KryptonContextMenuItemCollection();

            // Add any initial set of item
            if (children != null)
                _items.AddRange(children);

            // Create the redirector that can get values from the krypton context menu
            _redirectImageColumn = new PaletteRedirectDouble();

            // Create the column image storage for overriding specific values
            _stateNormal = new PaletteDoubleRedirect(_redirectImageColumn,
                                                     PaletteBackStyle.ContextMenuItemImageColumn,
                                                     PaletteBorderStyle.ContextMenuItemImageColumn);
        }
        /// <summary>
        /// Initialize a new instance of the KryptonContextMenuItems class.
        /// </summary>
        /// <param name="children">Array of initial child items.</param>
        public KryptonContextMenuItems(KryptonContextMenuItemBase[] children)
        {
            // Default fields
            _standardStyle = true;
            _imageColumn   = true;
            Items          = new KryptonContextMenuItemCollection();

            // Add any initial set of item
            if (children != null)
            {
                Items.AddRange(children);
            }

            // Create the redirector that can get values from the krypton context menu
            _redirectImageColumn = new PaletteRedirectDouble();

            // Create the column image storage for overriding specific values
            StateNormal = new PaletteDoubleRedirect(_redirectImageColumn,
                                                    PaletteBackStyle.ContextMenuItemImageColumn,
                                                    PaletteBorderStyle.ContextMenuItemImageColumn);
        }