Return inhertied values unless empty in which case return the context color.
Inheritance: IPaletteRibbonBack, IPaletteRibbonText
Exemple #1
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonTab class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="layoutTabs">Reference to view used for layout out tabs.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonTab(KryptonRibbon ribbon,
                                 ViewLayoutRibbonTabs layoutTabs,
                                 NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(layoutTabs != null);
            Debug.Assert(needPaint != null);

            // Cache incoming values
            Ribbon = ribbon;
            ViewLayoutRibbonTabs = layoutTabs;
            _needPaint           = needPaint;

            // Create overrides for handling a focus state
            _paletteGeneral                      = ribbon.StateCommon.RibbonGeneral;
            _overrideStateNormal                 = new PaletteRibbonDoubleInheritOverride(Ribbon.OverrideFocus.RibbonTab, Ribbon.OverrideFocus.RibbonTab, Ribbon.StateNormal.RibbonTab, Ribbon.StateNormal.RibbonTab, PaletteState.FocusOverride);
            _overrideStateTracking               = new PaletteRibbonDoubleInheritOverride(Ribbon.OverrideFocus.RibbonTab, Ribbon.OverrideFocus.RibbonTab, Ribbon.StateTracking.RibbonTab, Ribbon.StateTracking.RibbonTab, PaletteState.FocusOverride);
            _overrideStateCheckedNormal          = new PaletteRibbonDoubleInheritOverride(Ribbon.OverrideFocus.RibbonTab, Ribbon.OverrideFocus.RibbonTab, Ribbon.StateCheckedNormal.RibbonTab, Ribbon.StateCheckedNormal.RibbonTab, PaletteState.FocusOverride);
            _overrideStateCheckedTracking        = new PaletteRibbonDoubleInheritOverride(Ribbon.OverrideFocus.RibbonTab, Ribbon.OverrideFocus.RibbonTab, Ribbon.StateCheckedTracking.RibbonTab, Ribbon.StateCheckedTracking.RibbonTab, PaletteState.FocusOverride);
            _overrideStateContextTracking        = new PaletteRibbonDoubleInheritOverride(Ribbon.OverrideFocus.RibbonTab, Ribbon.OverrideFocus.RibbonTab, Ribbon.StateContextTracking.RibbonTab, Ribbon.StateContextTracking.RibbonTab, PaletteState.FocusOverride);
            _overrideStateContextCheckedNormal   = new PaletteRibbonDoubleInheritOverride(Ribbon.OverrideFocus.RibbonTab, Ribbon.OverrideFocus.RibbonTab, Ribbon.StateContextCheckedNormal.RibbonTab, Ribbon.StateContextCheckedNormal.RibbonTab, PaletteState.FocusOverride);
            _overrideStateContextCheckedTracking = new PaletteRibbonDoubleInheritOverride(Ribbon.OverrideFocus.RibbonTab, Ribbon.OverrideFocus.RibbonTab, Ribbon.StateContextCheckedTracking.RibbonTab, Ribbon.StateContextCheckedTracking.RibbonTab, PaletteState.FocusOverride);
            _overrideCurrent                     = _overrideStateNormal;

            // Create and default the setup of the context colors provider
            _paletteContextCurrent = new PaletteRibbonContextDouble(Ribbon);
            _paletteContextCurrent.SetInherit(_overrideCurrent);

            // Use a class to convert from ribbon tab to content interface
            _contentProvider = new RibbonTabToContent(_paletteGeneral, _paletteContextCurrent);

            // Use a controller to change state because of mouse movement
            RibbonTabController controller = new RibbonTabController(Ribbon, this, _needPaint);

            controller.Click        += OnTabClicked;
            controller.ContextClick += OnTabContextClicked;
            MouseController          = controller;
            SourceController         = controller;
            KeyController            = controller;

            // Associate this view with the source component (required for design time selection)
            Component = _ribbonTab;

            // Create and add the draw content for display inside the tab
            Add(new ViewDrawContent(_contentProvider, this, VisualOrientation.Top, true, false));

            // Create the state specific memento array
            _mementos = new IDisposable[Enum.GetValues(typeof(PaletteState)).Length];
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonTab class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="layoutTabs">Reference to view used for layout out tabs.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonTab(KryptonRibbon ribbon,
                                 ViewLayoutRibbonTabs layoutTabs,
                                 NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(layoutTabs != null);
            Debug.Assert(needPaint != null);

            // Cache incoming values
            _ribbon = ribbon;
            _layoutTabs = layoutTabs;
            _needPaint = needPaint;

            // Create overrides for handling a focus state
            _paletteGeneral = ribbon.StateCommon.RibbonGeneral;
            _overrideStateNormal = new PaletteRibbonDoubleInheritOverride(_ribbon.OverrideFocus.RibbonTab, _ribbon.OverrideFocus.RibbonTab, _ribbon.StateNormal.RibbonTab, _ribbon.StateNormal.RibbonTab, PaletteState.FocusOverride);
            _overrideStateTracking = new PaletteRibbonDoubleInheritOverride(_ribbon.OverrideFocus.RibbonTab, _ribbon.OverrideFocus.RibbonTab, _ribbon.StateTracking.RibbonTab, _ribbon.StateTracking.RibbonTab, PaletteState.FocusOverride);
            _overrideStateCheckedNormal = new PaletteRibbonDoubleInheritOverride(_ribbon.OverrideFocus.RibbonTab, _ribbon.OverrideFocus.RibbonTab, _ribbon.StateCheckedNormal.RibbonTab, _ribbon.StateCheckedNormal.RibbonTab, PaletteState.FocusOverride);
            _overrideStateCheckedTracking = new PaletteRibbonDoubleInheritOverride(_ribbon.OverrideFocus.RibbonTab, _ribbon.OverrideFocus.RibbonTab, _ribbon.StateCheckedTracking.RibbonTab, _ribbon.StateCheckedTracking.RibbonTab, PaletteState.FocusOverride);
            _overrideStateContextTracking = new PaletteRibbonDoubleInheritOverride(_ribbon.OverrideFocus.RibbonTab, _ribbon.OverrideFocus.RibbonTab, _ribbon.StateContextTracking.RibbonTab, _ribbon.StateContextTracking.RibbonTab, PaletteState.FocusOverride);
            _overrideStateContextCheckedNormal = new PaletteRibbonDoubleInheritOverride(_ribbon.OverrideFocus.RibbonTab, _ribbon.OverrideFocus.RibbonTab, _ribbon.StateContextCheckedNormal.RibbonTab, _ribbon.StateContextCheckedNormal.RibbonTab, PaletteState.FocusOverride);
            _overrideStateContextCheckedTracking = new PaletteRibbonDoubleInheritOverride(_ribbon.OverrideFocus.RibbonTab, _ribbon.OverrideFocus.RibbonTab, _ribbon.StateContextCheckedTracking.RibbonTab, _ribbon.StateContextCheckedTracking.RibbonTab, PaletteState.FocusOverride);
            _overrideCurrent = _overrideStateNormal;

            // Create and default the setup of the context colors provider
            _paletteContextCurrent = new PaletteRibbonContextDouble(_ribbon);
            _paletteContextCurrent.SetInherit(_overrideCurrent);

            // Use a class to convert from ribbon tab to content interface
            _contentProvider = new RibbonTabToContent(_paletteGeneral, _paletteContextCurrent);

            // Use a controller to change state because of mouse movement
            RibbonTabController controller = new RibbonTabController(_ribbon, this, _needPaint);
            controller.Click += new MouseEventHandler(OnTabClicked);
            controller.ContextClick += new MouseEventHandler(OnTabContextClicked);
            MouseController = controller;
            SourceController = controller;
            KeyController = controller;

            // Associate this view with the source component (required for design time selection)
            Component = _ribbonTab;

            // Create and add the draw content for display inside the tab
            Add(new ViewDrawContent(_contentProvider, this, VisualOrientation.Top, true, false));

            // Create the state specific memento array
            _mementos = new IDisposable[Enum.GetValues(typeof(PaletteState)).Length];
        }