/// <summary>
        /// Initialize a new instance of the ViewLayoutRibbonTabsArea class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="redirect">Reference to redirector for palette settings.</param>
        /// <param name="captionArea">Reference to the caption area.</param>
        /// <param name="layoutContexts">Reference to layout of the context area.</param>
        /// <param name="needPaintDelegate">Delegate for notifying paint/layout changes.</param>
        public ViewLayoutRibbonTabsArea(KryptonRibbon ribbon,
                                        PaletteRedirect redirect,
                                        ViewDrawRibbonCaptionArea captionArea,
                                        ViewLayoutRibbonContextTitles layoutContexts,
                                        NeedPaintHandler needPaintDelegate)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(redirect != null);
            Debug.Assert(layoutContexts != null);
            Debug.Assert(captionArea != null);
            Debug.Assert(needPaintDelegate != null);

            // Remember incoming references
            _ribbon              = ribbon;
            _captionArea         = captionArea;
            _appButtonController = captionArea.AppButtonController;
            _appTabController    = captionArea.AppTabController;
            _layoutContexts      = layoutContexts;
            _needPaintDelegate   = needPaintDelegate;

            // Default other state
            _setVisible         = true;
            _lastAppButtonClick = DateTime.MinValue;

            CreateController();
            CreateButtonSpecs();
            CreateViewElements(redirect);
            SetupParentMonitoring();
        }
        private void CreateViewElements()
        {
            // Create redirector for the accessing the background palette
            _redirectCaption = new PaletteDoubleRedirect(_redirect, PaletteBackStyle.HeaderForm, PaletteBorderStyle.HeaderForm, NeedPaintDelegate);

            // Create a top half for use in KryptonForm and another for use inside this caption area
            _captionAppButton = new ViewLayoutRibbonAppButton(_ribbon, false);
            _otherAppButton   = new ViewLayoutRibbonAppButton(_ribbon, false);

            // Connect up the application button controller to the two button elements
            _appButtonController = new AppButtonController(_ribbon)
            {
                Target1 = _captionAppButton.AppButton,
                Target2 = _otherAppButton.AppButton
            };
            _appButtonController.NeedPaint   += new NeedPaintHandler(OnAppButtonNeedPaint);
            _captionAppButton.MouseController = _appButtonController;
            _otherAppButton.MouseController   = _appButtonController;
            _appTabController            = new AppTabController(_ribbon);
            _appTabController.NeedPaint += new NeedPaintHandler(OnAppButtonNeedPaint);

            // When not showing the app button we show this spacer instead
            _spaceInsteadOfAppButton = new ViewLayoutSeparator(0)
            {
                Visible = false
            };

            // Quick access toolbar, minibar versions
            _captionQAT    = new ViewLayoutRibbonQATMini(_ribbon, _needIntegratedDelegate);
            _nonCaptionQAT = new ViewLayoutRibbonQATMini(_ribbon, NeedPaintDelegate);

            // Layout needed to position and draw the context titles
            _contextTiles = new ViewLayoutRibbonContextTitles(_ribbon, this)
            {
                ReverseRenderOrder = true
            };

            // Create composition right border and attach to composition area
            _compRightBorder = new ViewDrawRibbonCompoRightBorder();
            _compositionArea.CompRightBorder = _compRightBorder;

            // Place app button on left side and fill remainder with context titles
            Add(_contextTiles, ViewDockStyle.Fill);
            Add(_nonCaptionQAT, ViewDockStyle.Left);
            Add(_otherAppButton, ViewDockStyle.Left);

            // Update base class to use correct palette interface
            base.SetPalettes(_redirectCaption.PaletteBack, _redirectCaption.PaletteBorder);
        }