/// <summary> /// Initialize a new instance of the ContextMenuProvider class. /// </summary> /// <param name="viewManager">Reference to view manager.</param> /// <param name="viewColumns">Columns view element.</param> /// <param name="palette">Local palette setting to use initially.</param> /// <param name="paletteMode">Palette mode setting to use initially.</param> /// <param name="stateCommon">State used to provide common palette values.</param> /// <param name="stateNormal">State used to provide normal palette values.</param> /// <param name="stateDisabled">State used to provide disabled palette values.</param> /// <param name="stateHighlight">State used to provide highlight palette values.</param> /// <param name="stateChecked">State used to provide checked palette values.</param> /// <param name="redirector">Redirector used for obtaining palette values.</param> /// <param name="redirectorImages">Redirector used for obtaining images.</param> /// <param name="needPaintDelegate">Delegate for requesting paint changes.</param> /// <param name="enabled">Enabled state of the context menu.</param> public ContextMenuProvider(ViewContextMenuManager viewManager, ViewLayoutStack viewColumns, IPalette palette, PaletteMode paletteMode, PaletteContextMenuRedirect stateCommon, PaletteContextMenuItemState stateDisabled, PaletteContextMenuItemState stateNormal, PaletteContextMenuItemStateHighlight stateHighlight, PaletteContextMenuItemStateChecked stateChecked, PaletteRedirect redirector, PaletteRedirectContextMenu redirectorImages, NeedPaintHandler needPaintDelegate, bool enabled) { ProviderShowHorz = KryptonContextMenuPositionH.Left; ProviderShowVert = KryptonContextMenuPositionV.Below; ProviderEnabled = enabled; ProviderViewManager = viewManager; ProviderViewColumns = viewColumns; ProviderStateCommon = stateCommon; ProviderStateDisabled = stateDisabled; ProviderStateNormal = stateNormal; ProviderStateHighlight = stateHighlight; ProviderStateChecked = stateChecked; ProviderImages = redirectorImages; ProviderPalette = palette; ProviderPaletteMode = paletteMode; ProviderRedirector = redirector; ProviderNeedPaintDelegate = needPaintDelegate; }
/// <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 KryptonContextMenu class. /// </summary> public KryptonContextMenu() { // Setup the need paint delegate _needPaintDelegate = OnNeedPaint; // Set default settings Palette = 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); }