Extends the ViewLayoutDocker by drawing the ribbon application button recent docs background.
Inheritance: ComponentFactory.Krypton.Toolkit.ViewLayoutDocker
        private void CreateRecentDocumentsView()
        {
            // Do we need to add the recent docs view?
            if (_ribbon.RibbonAppButton.AppButtonShowRecentDocs)
            {
                // Create a dummy vertical menu separator for separating recent documents from menu items
                KryptonContextMenuSeparator dummySep1 = new KryptonContextMenuSeparator
                {
                    Horizontal = false
                };
                _viewColumns.Add(new ViewDrawMenuSeparator(dummySep1, _provider.ProviderStateCommon.Separator));
                _viewColumns.Add(new ViewLayoutSeparator(0, _ribbon.RibbonAppButton.AppButtonMinRecentSize.Height));

                // Use a layout that draws the background color of the recent docs area
                ViewDrawRibbonAppMenuDocs recentDocsBack = new ViewDrawRibbonAppMenuDocs(_ribbon);
                _viewColumns.Add(recentDocsBack);

                // Stack the document entries vertically
                ViewLayoutStack documentStack = new ViewLayoutStack(false);
                recentDocsBack.Add(documentStack);

                // Use fixed width separator to enforce a minimum width to column
                documentStack.Add(new ViewLayoutSeparator(_ribbon.RibbonAppButton.AppButtonMinRecentSize.Width, 0));

                // Add the recent document title
                documentStack.Add(new ViewDrawRibbonRecentDocs(_ribbon));

                // Followed by a horizontal separator
                KryptonContextMenuSeparator dummySep2 = new KryptonContextMenuSeparator();
                documentStack.Add(new ViewDrawMenuSeparator(dummySep2, _provider.ProviderStateCommon.Separator));
                documentStack.Add(new ViewLayoutSeparator(2));

                // Then generate an item per recent document entry
                int index = 1;
                foreach (KryptonRibbonRecentDoc recentDoc in _ribbon.RibbonAppButton.AppButtonRecentDocs)
                {
                    documentStack.Add(new ViewDrawRibbonAppMenuRecentDec(_ribbon, _provider, recentDoc, _ribbon.RibbonAppButton.AppButtonMaxRecentSize.Width, NeedPaintDelegate, index++));
                }

                // Add separator entry which is then used to fill remained space
                documentStack.Add(new ViewLayoutSeparator(1));

                // Update provider with element to use as the fixed size for submenus
                _provider.FixedViewBase = recentDocsBack;
            }
        }
示例#2
0
        private void CreateRecentDocumentsView()
        {
            // Do we need to add the recent docs view?
            if (_ribbon.RibbonAppButton.AppButtonShowRecentDocs)
            {
                // Create a dummy vertical menu separator for separating recent documents from menu items
                KryptonContextMenuSeparator dummySep1 = new KryptonContextMenuSeparator();
                dummySep1.Horizontal = false;
                _viewColumns.Add(new ViewDrawMenuSeparator(dummySep1, _provider.ProviderStateCommon.Separator));
                _viewColumns.Add(new ViewLayoutSeparator(0, _ribbon.RibbonAppButton.AppButtonMinRecentSize.Height));

                // Use a layout that draws the background color of the recent docs area
                ViewDrawRibbonAppMenuDocs recentDocsBack = new ViewDrawRibbonAppMenuDocs(_ribbon);
                _viewColumns.Add(recentDocsBack);

                // Stack the document entries vertically
                ViewLayoutStack documentStack = new ViewLayoutStack(false);
                recentDocsBack.Add(documentStack);

                // Use fixed width separator to enforce a minimum width to column
                documentStack.Add(new ViewLayoutSeparator(_ribbon.RibbonAppButton.AppButtonMinRecentSize.Width, 0));

                // Add the recent document title
                documentStack.Add(new ViewDrawRibbonRecentDocs(_ribbon));

                // Followed by a horizontal separator
                KryptonContextMenuSeparator dummySep2 = new KryptonContextMenuSeparator();
                documentStack.Add(new ViewDrawMenuSeparator(dummySep2, _provider.ProviderStateCommon.Separator));
                documentStack.Add(new ViewLayoutSeparator(2));

                // Then generate an item per recent document entry
                int index = 1;
                foreach (KryptonRibbonRecentDoc recentDoc in _ribbon.RibbonAppButton.AppButtonRecentDocs)
                    documentStack.Add(new ViewDrawRibbonAppMenuRecentDec(_ribbon, _provider, recentDoc, _ribbon.RibbonAppButton.AppButtonMaxRecentSize.Width, NeedPaintDelegate, index++));

                // Add separator entry which is then used to fill remained space
                documentStack.Add(new ViewLayoutSeparator(1));

                // Update provider with element to use as the fixed size for submenus
                _provider.FixedViewBase = recentDocsBack;
            }
        }