Пример #1
0
        /// <summary>
        /// Initialize a new instance of the PaletteDoubleMetric class.
        /// </summary>
        /// <param name="inherit">Source for palette defaulted values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteDoubleMetric(PaletteDoubleMetricRedirect inherit,
                                   NeedPaintHandler needPaint)
            : base(inherit, needPaint)
        {
            Debug.Assert(inherit != null);

            // Remember inheritance for metric values
            _inherit = inherit;
        }
 /// <summary>
 /// Initialize a new instance of the PaletteContextMenuItemState class.
 /// </summary>
 /// <param name="redirectItemHighlight">Redirector for ItemHighlight.</param>
 /// <param name="redirectItemImage">Redirector for ItemImage.</param>
 /// <param name="redirectItemShortcutText">Redirector for ItemShortcutText.</param>
 /// <param name="redirectItemSplit">Redirector for ItemSplit.</param>
 /// <param name="redirectItemTextAlternate">Redirector for ItemTextStandard.</param>
 /// <param name="redirectItemTextStandard">Redirector for ItemTextAlternate.</param>
 public PaletteContextMenuItemState(PaletteDoubleMetricRedirect redirectItemHighlight,
                                    PaletteTripleJustImageRedirect redirectItemImage,
                                    PaletteContentInheritRedirect redirectItemShortcutText,
                                    PaletteDoubleRedirect redirectItemSplit,
                                    PaletteContentInheritRedirect redirectItemTextStandard,
                                    PaletteContentInheritRedirect redirectItemTextAlternate)
 {
     ItemHighlight     = new PaletteDoubleMetric(redirectItemHighlight);
     ItemImage         = new PaletteTripleJustImage(redirectItemImage);
     ItemShortcutText  = new PaletteContentJustShortText(redirectItemShortcutText);
     ItemSplit         = new PaletteDouble(redirectItemSplit);
     ItemTextStandard  = new PaletteContentJustText(redirectItemTextStandard);
     ItemTextAlternate = new PaletteContentJustText(redirectItemTextAlternate);
 }
Пример #3
0
        /// <summary>
        /// Initialize a new instance of the ViewLayoutMenuItemsPile class.
        /// </summary>
        /// <param name="provider">Provider of context menu values.</param>
        /// <param name="items">Reference to the owning collection.</param>
        /// <param name="standardStyle">Draw items with standard or alternate style.</param>
        /// <param name="imageColumn">Draw an image background for the item images.</param>
        public ViewLayoutMenuItemsPile(IContextMenuProvider provider,
                                       KryptonContextMenuItems items,
                                       bool standardStyle,
                                       bool imageColumn)
        {
            // Cache access to the highlight item palette
            _paletteItemHighlight = provider.ProviderStateCommon.ItemHighlight;

            // Create and place an image column inside a docker so it appears on the left side
            _imageColumn = new ViewDrawMenuImageColumn(items, provider.ProviderStateCommon.ItemImageColumn);
            ViewLayoutDocker imageDocker = new ViewLayoutDocker
            {
                { _imageColumn, ViewDockStyle.Left }
            };

            // Only show the image column when in a standard collection of items
            imageDocker.Visible = imageColumn;

            // Create a vertical stack that contains each individual menu item
            ItemStack = new ViewLayoutStack(false)
            {
                FillLastChild = false
            };

            // Use a docker with the item stack as the fill
            ViewLayoutDocker stackDocker = new ViewLayoutDocker
            {
                { ItemStack, ViewDockStyle.Fill }
            };

            // Grab the padding for around the item stack
            Padding itemsPadding = _paletteItemHighlight.GetMetricPadding(PaletteState.Normal, PaletteMetricPadding.ContextMenuItemsCollection);

            stackDocker.Add(new ViewLayoutSeparator(itemsPadding.Left), ViewDockStyle.Left);
            stackDocker.Add(new ViewLayoutSeparator(itemsPadding.Right), ViewDockStyle.Right);
            stackDocker.Add(new ViewLayoutSeparator(itemsPadding.Top), ViewDockStyle.Top);
            stackDocker.Add(new ViewLayoutSeparator(itemsPadding.Bottom), ViewDockStyle.Bottom);

            // The background of the pile is the image column
            Add(imageDocker);

            // The foreground of the pile is the stack of menu items
            Add(stackDocker);
        }
Пример #4
0
        /// <summary>
        /// Initialize a new instance of the PaletteContextMenuRedirect class.
        /// </summary>
        /// <param name="redirect">Inheritence redirection.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteContextMenuRedirect(PaletteRedirect redirect,
                                          NeedPaintHandler needPaint)
        {
            Debug.Assert(redirect != null);

            // Create the palette storage
            ControlInner              = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuInner, PaletteBorderStyle.ContextMenuInner, needPaint);
            ControlOuter              = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuOuter, PaletteBorderStyle.ContextMenuOuter, needPaint);
            Heading                   = new PaletteTripleRedirect(redirect, PaletteBackStyle.ContextMenuHeading, PaletteBorderStyle.ContextMenuHeading, PaletteContentStyle.ContextMenuHeading, needPaint);
            ItemHighlight             = new PaletteDoubleMetricRedirect(redirect, PaletteBackStyle.ContextMenuItemHighlight, PaletteBorderStyle.ContextMenuItemHighlight, needPaint);
            ItemImage                 = new PaletteTripleJustImageRedirect(redirect, PaletteBackStyle.ContextMenuItemImage, PaletteBorderStyle.ContextMenuItemImage, PaletteContentStyle.ContextMenuItemImage, needPaint);
            ItemImageColumn           = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuItemImageColumn, PaletteBorderStyle.ContextMenuItemImageColumn, needPaint);
            ItemShortcutTextRedirect  = new PaletteContentInheritRedirect(redirect, PaletteContentStyle.ContextMenuItemShortcutText);
            ItemShortcutText          = new PaletteContentJustShortText(ItemShortcutTextRedirect, needPaint);
            ItemSplit                 = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuItemSplit, PaletteBorderStyle.ContextMenuItemSplit, needPaint);
            ItemTextAlternateRedirect = new PaletteContentInheritRedirect(redirect, PaletteContentStyle.ContextMenuItemTextAlternate);
            ItemTextAlternate         = new PaletteContentJustText(ItemTextAlternateRedirect, needPaint);
            ItemTextStandardRedirect  = new PaletteContentInheritRedirect(redirect, PaletteContentStyle.ContextMenuItemTextStandard);
            ItemTextStandard          = new PaletteContentJustText(ItemTextStandardRedirect, needPaint);
            Separator                 = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuSeparator, PaletteBorderStyle.ContextMenuSeparator, needPaint);
        }
 /// <summary>
 /// Sets the inheritence parent.
 /// </summary>
 public void SetInherit(PaletteDoubleMetricRedirect inherit)
 {
     base.SetInherit(inherit);
     _inherit = inherit;
 }
 /// <summary>
 /// Initialize a new instance of the PaletteDoubleMetric class.
 /// </summary>
 /// <param name="inherit">Source for palette defaulted values.</param>
 public PaletteDoubleMetric(PaletteDoubleMetricRedirect inherit)
     : this(inherit, null)
 {
 }
Пример #7
0
 /// <summary>
 /// Initialize a new instance of the PaletteContextMenuItemStateHighlight class.
 /// </summary>
 /// <param name="redirectItemHighlight">Redirector for the ItemHighlight.</param>
 /// <param name="redirectItemSplit">Redirector for the ItemSplit.</param>
 public PaletteContextMenuItemStateHighlight(PaletteDoubleMetricRedirect redirectItemHighlight,
                                             PaletteDoubleRedirect redirectItemSplit)
 {
     ItemHighlight = new PaletteDoubleMetric(redirectItemHighlight);
     ItemSplit     = new PaletteDouble(redirectItemSplit);
 }