Redirection for KryptonContextMenuItem state values.
Inheritance: Storage
コード例 #1
0
        /// <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);
        }
コード例 #2
0
 /// <summary>
 /// Initialize a new instance of the PaletteContextMenuItemStateHighlight class.
 /// </summary>
 /// <param name="redirect">Redirector for inheriting values.</param>
 public PaletteContextMenuItemStateHighlight(PaletteContextMenuItemStateRedirect redirect)
     : this(redirect.ItemHighlight, redirect.ItemSplit)
 {
 }
コード例 #3
0
 /// <summary>
 /// Initialize a new instance of the PaletteContextMenuItemStateChecked class.
 /// </summary>
 /// <param name="redirect">Redirector for inheriting values.</param>
 public PaletteContextMenuItemStateChecked(PaletteContextMenuItemStateRedirect redirect)
     : this(redirect.ItemImage)
 {
 }
コード例 #4
0
 /// <summary>
 /// Initialize a new instance of the PaletteContextMenuItemState class.
 /// </summary>
 /// <param name="redirect">Redirector for inheriting values.</param>
 public PaletteContextMenuItemState(PaletteContextMenuItemStateRedirect redirect)
     : this(redirect.ItemHighlight, redirect.ItemImage,
            redirect.ItemShortcutText, redirect.ItemSplit,
            redirect.ItemTextStandard, redirect.ItemTextAlternate)
 {
 }
コード例 #5
0
 /// <summary>
 /// Initialize a new instance of the PaletteContextMenuItemState class.
 /// </summary>
 /// <param name="redirect">Redirector for inheriting values.</param>
 public PaletteContextMenuItemState(PaletteContextMenuItemStateRedirect redirect)
     : this(redirect.ItemHighlight, redirect.ItemImage,
            redirect.ItemShortcutText, redirect.ItemSplit,
            redirect.ItemTextStandard, redirect.ItemTextAlternate)
 {
 }
コード例 #6
0
 /// <summary>
 /// Initialize a new instance of the PaletteContextMenuItemStateChecked class.
 /// </summary>
 /// <param name="redirect">Redirector for inheriting values.</param>
 public PaletteContextMenuItemStateChecked(PaletteContextMenuItemStateRedirect redirect)
     : this(redirect.ItemImage)
 {
 }
コード例 #7
0
 /// <summary>
 /// Initialize a new instance of the PaletteContextMenuItemStateHighlight class.
 /// </summary>
 /// <param name="redirect">Redirector for inheriting values.</param>
 public PaletteContextMenuItemStateHighlight(PaletteContextMenuItemStateRedirect redirect)
     : this(redirect.ItemHighlight, redirect.ItemSplit)
 {
 }
コード例 #8
0
        /// <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);
        }