/// <summary> /// Initialize a new instance of the KryptonPaletteContextMenu class. /// </summary> /// <param name="redirect">Redirector to inherit values from.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> internal KryptonPaletteContextMenu(PaletteRedirect redirect, NeedPaintHandler needPaint) { // Create the storage objects _stateCommon = new PaletteContextMenuRedirect(redirect, needPaint); _stateNormal = new PaletteContextMenuItemState(_stateCommon); _stateDisabled = new PaletteContextMenuItemState(_stateCommon); _stateHighlight = new PaletteContextMenuItemStateHighlight(_stateCommon); _stateChecked = new PaletteContextMenuItemStateChecked(_stateCommon); }
/// <summary> /// Initialize a new instance of the ContextMenuProvider class. /// </summary> /// <param name="provider">Original provider.</param> /// <param name="needPaintDelegate">Delegate for requesting paint changes.</param> /// <param name="viewManager">Reference to view manager.</param> /// <param name="viewColumns">Columns view element.</param> public ContextMenuProvider(IContextMenuProvider provider, ViewContextMenuManager viewManager, ViewLayoutStack viewColumns, NeedPaintHandler needPaintDelegate) { _parent = provider; _enabled = provider.ProviderEnabled; _canCloseMenu = provider.ProviderCanCloseMenu; _viewManager = viewManager; _viewColumns = viewColumns; _stateCommon = provider.ProviderStateCommon; _stateDisabled = provider.ProviderStateDisabled; _stateNormal = provider.ProviderStateNormal; _stateHighlight = provider.ProviderStateHighlight; _stateChecked = provider.ProviderStateChecked; _redirectorImages = provider.ProviderImages; _palette = provider.ProviderPalette; _paletteMode = provider.ProviderPaletteMode; _redirector = provider.ProviderRedirector; _needPaintDelegate = needPaintDelegate; _showHorz = provider.ProviderShowHorz; _showVert = provider.ProviderShowVert; }
/// <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(); }
/// <summary> /// Initialize a new instance of the KryptonContextMenuItem class. /// </summary> /// <param name="initialText">Initial text string.</param> /// <param name="initialImage">Initial image.</param> /// <param name="clickHandler">Click handler.</param> /// <param name="shortcut">Shortcut key combination.</param> public KryptonContextMenuItem(string initialText, Image initialImage, EventHandler clickHandler, Keys shortcut) { // Initial values _text = initialText; _image = initialImage; // Initial click handler if (clickHandler != null) { Click += clickHandler; } // Default fields _enabled = true; _autoClose = true; _splitSubMenu = false; _checkOnClick = false; _showShortcutKeys = true; _largeKryptonCommandImage = false; _extraText = string.Empty; _imageTransparentColor = Color.Empty; _shortcutKeys = shortcut; _shortcutKeyDisplayString = string.Empty; _checkState = CheckState.Unchecked; _items = new KryptonContextMenuCollection(); // Create the common storage for palette override values _stateRedirect = new PaletteContextMenuItemStateRedirect(); _stateNormal = new PaletteContextMenuItemState(_stateRedirect); _stateDisabled = new PaletteContextMenuItemState(_stateRedirect); _stateHighlight = new PaletteContextMenuItemStateHighlight(_stateRedirect); _stateChecked = new PaletteContextMenuItemStateChecked(_stateRedirect); }