Пример #1
0
 /// <summary>
 /// Populate values from the base palette.
 /// </summary>
 public void PopulateFromBase()
 {
     RibbonAppButton.PopulateFromBase();
     RibbonAppMenuOuter.PopulateFromBase(PaletteState.Normal);
     RibbonAppMenuInner.PopulateFromBase(PaletteState.Normal);
     RibbonAppMenuDocs.PopulateFromBase(PaletteState.Normal);
     RibbonAppMenuDocsTitle.PopulateFromBase(PaletteState.Normal);
     RibbonAppMenuDocsEntry.PopulateFromBase(PaletteState.Normal);
     RibbonGeneral.PopulateFromBase();
     RibbonGroupArea.PopulateFromBase();
     RibbonGroupButtonText.PopulateFromBase();
     RibbonGroupCheckBoxText.PopulateFromBase();
     RibbonGroupNormalBorder.PopulateFromBase();
     RibbonGroupNormalTitle.PopulateFromBase();
     RibbonGroupCollapsedBack.PopulateFromBase();
     RibbonGroupCollapsedBorder.PopulateFromBase();
     RibbonGroupCollapsedFrameBorder.PopulateFromBase();
     RibbonGroupCollapsedFrameBack.PopulateFromBase();
     RibbonGroupCollapsedText.PopulateFromBase();
     RibbonGroupRadioButtonText.PopulateFromBase();
     RibbonGroupLabelText.PopulateFromBase();
     RibbonQATFullbar.PopulateFromBase(PaletteState.Normal);
     RibbonQATMinibar.PopulateFromBase();
     RibbonQATOverflow.PopulateFromBase(PaletteState.Normal);
     RibbonTab.PopulateFromBase();
     RibbonGalleryBack.PopulateFromBase(PaletteState.Normal);
     RibbonGalleryBorder.PopulateFromBase(PaletteState.Normal);
 }
Пример #2
0
        /// <summary>
        ///  Initialize a new instance of the VisualPopupAppMenu class.
        /// </summary>
        /// <param name="ribbon">Owning ribbon instance.</param>
        /// <param name="appButton">Originating app button instance.</param>
        /// <param name="palette">Local palette setting to use initially.</param>
        /// <param name="paletteMode">Palette mode setting to use initially.</param>
        /// <param name="redirector">Redirector used for obtaining palette values.</param>
        /// <param name="rectAppButtonTopHalf">Screen location of the upper half of the app button.</param>
        /// <param name="rectAppButtonBottomHalf">Screen location of the lower half of the app button.</param>
        /// <param name="keyboardActivated">Was the context menu activated by a keyboard action.</param>
        public VisualPopupAppMenu(KryptonRibbon ribbon,
                                  RibbonAppButton appButton,
                                  IPalette palette,
                                  PaletteMode paletteMode,
                                  PaletteRedirect redirector,
                                  Rectangle rectAppButtonTopHalf,
                                  Rectangle rectAppButtonBottomHalf,
                                  bool keyboardActivated)
            : base(true)
        {
            // Remember incoming state
            _redirector = redirector;
            _ribbon = ribbon;
            _rectAppButtonTopHalf = rectAppButtonTopHalf;
            _rectAppButtonBottomHalf = rectAppButtonBottomHalf;

            // Create the view manager instance with root element
            ViewManager = new ViewContextMenuManager(this, new ViewLayoutNull());

            // Set the initial resolved palette to the appropriate setting
            if (palette != null)
                SetPalette(palette);
            else
                SetPalette(KryptonManager.GetPaletteForMode(paletteMode));

            // Set of context menu columns
            _viewColumns = new ViewLayoutStack(true);

            // Create provider instance
            _provider = new AppButtonMenuProvider((ViewContextMenuManager)ViewManager,
                                                  _ribbon.RibbonAppButton.AppButtonMenuItems,
                                                  _viewColumns, palette, paletteMode,
                                                  redirector, NeedPaintDelegate);

            _provider.Closing += new CancelEventHandler(OnProviderClosing);
            _provider.Close += new EventHandler<CloseReasonEventArgs>(OnProviderClose);
            _provider.Dispose += new EventHandler(OnProviderClose);

            CreateAppButtonBottom();
            CreateButtonSpecView();
            CreateContextMenuView(appButton);
            CreateRecentDocumentsView();
            CreateInnerBacking(CreateInsideCanvas());
            CreateOuterBacking();
            CreateOutsideDocker();
            CreateButtonManager(appButton);

            ViewManager.Root = _drawOutsideDocker;

            // With keyboard activate we select the first valid item
            if (keyboardActivated)
                ((ViewContextMenuManager)ViewManager).KeyDown();
        }
Пример #3
0
        /// <summary>
        ///  Initialize a new instance of the VisualPopupAppMenu class.
        /// </summary>
        /// <param name="ribbon">Owning ribbon instance.</param>
        /// <param name="appButton">Originating app button instance.</param>
        /// <param name="palette">Local palette setting to use initially.</param>
        /// <param name="paletteMode">Palette mode setting to use initially.</param>
        /// <param name="redirector">Redirector used for obtaining palette values.</param>
        /// <param name="rectAppButtonTopHalf">Screen location of the upper half of the app button.</param>
        /// <param name="rectAppButtonBottomHalf">Screen location of the lower half of the app button.</param>
        /// <param name="keyboardActivated">Was the context menu activated by a keyboard action.</param>
        public VisualPopupAppMenu(KryptonRibbon ribbon,
                                  RibbonAppButton appButton,
                                  IPalette palette,
                                  PaletteMode paletteMode,
                                  PaletteRedirect redirector,
                                  Rectangle rectAppButtonTopHalf,
                                  Rectangle rectAppButtonBottomHalf,
                                  bool keyboardActivated)
            : base(true)
        {
            // Remember incoming state
            Redirector               = redirector;
            _ribbon                  = ribbon;
            _rectAppButtonTopHalf    = rectAppButtonTopHalf;
            _rectAppButtonBottomHalf = rectAppButtonBottomHalf;

            // Create the view manager instance with root element
            ViewManager = new ViewContextMenuManager(this, new ViewLayoutNull());

            // Set the initial resolved palette to the appropriate setting
            SetPalette(palette ?? KryptonManager.GetPaletteForMode(paletteMode));

            // Set of context menu columns
            _viewColumns = new ViewLayoutStack(true);

            // Create provider instance
            _provider = new AppButtonMenuProvider((ViewContextMenuManager)ViewManager,
                                                  _ribbon.RibbonAppButton.AppButtonMenuItems,
                                                  _viewColumns, palette, paletteMode,
                                                  redirector, NeedPaintDelegate);

            _provider.Closing += OnProviderClosing;
            _provider.Close   += OnProviderClose;
            _provider.Dispose += OnProviderClose;

            CreateAppButtonBottom();
            CreateButtonSpecView();
            CreateContextMenuView(appButton);
            CreateRecentDocumentsView();
            CreateInnerBacking(CreateInsideCanvas());
            CreateOuterBacking();
            CreateOutsideDocker();
            CreateButtonManager(appButton);

            ViewManager.Root = _drawOutsideDocker;

            // With keyboard activate we select the first valid item
            if (keyboardActivated)
            {
                ((ViewContextMenuManager)ViewManager).KeyDown();
            }
        }
Пример #4
0
        private void CreateButtonManager(RibbonAppButton appButton)
        {
            _buttonManager = new ButtonSpecManagerLayoutAppButton((ViewContextMenuManager)ViewManager,
                                                                  this, Redirector, appButton.AppButtonSpecs, null,
                                                                  new[] { _viewButtonSpecDocker },
                                                                  new IPaletteMetric[] { _ribbon.StateCommon },
                                                                  new[] { PaletteMetricInt.None },
                                                                  new[] { PaletteMetricPadding.RibbonAppButton },
                                                                  CreateToolStripRenderer,
                                                                  OnButtonSpecPaint);

            _buttonManager.RecreateButtons();
        }
Пример #5
0
        private void CreateContextMenuView(RibbonAppButton appButton)
        {
            // Ask the top level collection to generate the child view elements
            KryptonContextMenuCollection topCollection = new();
            KryptonContextMenuItems      topItems      = new()
            {
                ImageColumn = false
            };

            topCollection.Add(topItems);
            foreach (KryptonContextMenuItemBase item in appButton.AppButtonMenuItems)
            {
                topItems.Items.Add(item);
            }
            topCollection.GenerateView(_provider, this, _viewColumns, true, true);
        }
Пример #6
0
 private void CreateContextMenuView(RibbonAppButton appButton)
 {
     // Ask the top level collection to generate the child view elements
     KryptonContextMenuCollection topCollection = new KryptonContextMenuCollection();
     KryptonContextMenuItems topItems = new KryptonContextMenuItems();
     topItems.ImageColumn = false;
     topCollection.Add(topItems);
     foreach (KryptonContextMenuItemBase item in appButton.AppButtonMenuItems)
         topItems.Items.Add(item);
     topCollection.GenerateView(_provider, this, _viewColumns, true, true);
 }
Пример #7
0
        private void CreateButtonManager(RibbonAppButton appButton)
        {
            _buttonManager = new ButtonSpecManagerLayoutAppButton((ViewContextMenuManager)ViewManager,
                                                                  this, _redirector, appButton.AppButtonSpecs, null,
                                                                  new ViewLayoutDocker[] { _viewButtonSpecDocker },
                                                                  new IPaletteMetric[] { _ribbon.StateCommon },
                                                                  new PaletteMetricInt[] { PaletteMetricInt.None },
                                                                  new PaletteMetricPadding[] { PaletteMetricPadding.RibbonAppButton },
                                                                  new GetToolStripRenderer(CreateToolStripRenderer),
                                                                  new NeedPaintHandler(OnButtonSpecPaint));

            _buttonManager.RecreateButtons();
        }