/// <summary>
        /// Initialize a new instance of the PaletteRedirectContextMenu class.
        /// </summary>
        /// <param name="target">Initial palette target for redirection.</param>
        /// <param name="images">Reference to source of context menu images.</param>
        public PaletteRedirectContextMenu(IPalette target,
                                          ContextMenuImages images)
            : base(target)
        {
            Debug.Assert(images != null);

            // Remember incoming target
            _images = images;
        }
Exemplo n.º 2
0
        /// <summary>
        ///  Initialize a new instance of the KryptonContextMenu class.
        /// </summary>
        public KryptonContextMenu()
        {
            // Setup the need paint delegate
            _needPaintDelegate = new NeedPaintHandler(OnNeedPaint);

            // Set default settings
            _localPalette     = null;
            _paletteMode      = PaletteMode.Global;
            _images           = new ContextMenuImages(_needPaintDelegate);
            _redirector       = new PaletteRedirect(null);
            _redirectorImages = new PaletteRedirectContextMenu(_redirector, _images);
            _enabled          = true;

            // Create the palette storage
            _stateCommon    = new PaletteContextMenuRedirect(_redirector, _needPaintDelegate);
            _stateNormal    = new PaletteContextMenuItemState(_stateCommon);
            _stateDisabled  = new PaletteContextMenuItemState(_stateCommon);
            _stateHighlight = new PaletteContextMenuItemStateHighlight(_stateCommon);
            _stateChecked   = new PaletteContextMenuItemStateChecked(_stateCommon);

            // Create the top level collection for menu items
            _items = new KryptonContextMenuCollection();
        }