コード例 #1
0
        /// <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)
        {
            _showHorz = KryptonContextMenuPositionH.Left;
            _showVert = KryptonContextMenuPositionV.Below;

            _enabled           = enabled;
            _viewManager       = viewManager;
            _viewColumns       = viewColumns;
            _stateCommon       = stateCommon;
            _stateDisabled     = stateDisabled;
            _stateNormal       = stateNormal;
            _stateHighlight    = stateHighlight;
            _stateChecked      = stateChecked;
            _redirectorImages  = redirectorImages;
            _palette           = palette;
            _paletteMode       = paletteMode;
            _redirector        = redirector;
            _needPaintDelegate = needPaintDelegate;
        }
コード例 #2
0
 /// <summary>
 /// Initialize a new instance of the ViewLayoutMenuSepGap class.
 /// </summary>
 /// <param name="stateCommon">Source of palette values.</param>
 /// <param name="standardStyle">Draw items with standard or alternate style.</param>
 public ViewLayoutMenuSepGap(PaletteContextMenuRedirect stateCommon,
                             bool standardStyle)
     : base(0)
 {
     _stateCommon   = stateCommon;
     _standardStyle = standardStyle;
 }
コード例 #3
0
 /// <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);
 }
コード例 #4
0
 /// <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;
 }
コード例 #5
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();
        }
コード例 #6
0
 /// <summary>
 /// Initialize a new instance of the PaletteContextMenuItemStateHighlight class.
 /// </summary>
 /// <param name="redirect">Redirector for inheriting values.</param>
 public PaletteContextMenuItemStateHighlight(PaletteContextMenuRedirect redirect)
     : this(redirect.ItemHighlight, redirect.ItemSplit)
 {
 }
コード例 #7
0
 /// <summary>
 /// Initialize a new instance of the PaletteContextMenuItemState class.
 /// </summary>
 /// <param name="redirect">Redirector for inheriting values.</param>
 public PaletteContextMenuItemState(PaletteContextMenuRedirect redirect)
     : this(redirect.ItemHighlight, redirect.ItemImage,
            redirect.ItemShortcutTextRedirect, redirect.ItemSplit,
            redirect.ItemTextStandardRedirect, redirect.ItemTextAlternateRedirect)
 {
 }
コード例 #8
0
 /// <summary>
 /// Initialize a new instance of the PaletteContextMenuItemStateChecked class.
 /// </summary>
 /// <param name="redirect">Redirector for inheriting values.</param>
 public PaletteContextMenuItemStateChecked(PaletteContextMenuRedirect redirect)
     : this(redirect.ItemImage)
 {
 }