Allow the background values to be forced to fixed values.
Наследование: PaletteBackInherit
Пример #1
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawBorderEdge class.
        /// </summary>
        /// <param name="palette">Palette source for drawing details.</param>
        /// <param name="orientation">Initial orientation of the border.</param>
        public ViewDrawBorderEdge(PaletteBorderEdge palette,
                                  Orientation orientation)
            : base(palette)
        {
            Debug.Assert(palette != null);

            // Remember initial settings
            _palette    = palette;
            Orientation = orientation;

            // Create the forced border and override the graphics hint
            _borderForced = new PaletteBackInheritForced(palette);
            _borderForced.ForceGraphicsHint = PaletteGraphicsHint.None;
            base.SetPalettes(_borderForced);
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawBorderEdge class.
        /// </summary>
        /// <param name="palette">Palette source for drawing details.</param>
        /// <param name="orientation">Initial orientation of the border.</param>
        public ViewDrawBorderEdge(PaletteBorderEdge palette,
                                  Orientation orientation)
            : base(palette)
        {
            Debug.Assert(palette != null);

            // Remember initial settings
            _palette = palette;
            Orientation = orientation;

            // Create the forced border and override the graphics hint
            _borderForced = new PaletteBackInheritForced(palette);
            _borderForced.ForceGraphicsHint = PaletteGraphicsHint.None;
            base.SetPalettes(_borderForced);
        }
Пример #3
0
 /// <summary>
 /// Initialize a new instance of the ViewDrawSplitCanvas class.
 /// </summary>
 /// <param name="paletteBack">Palette source for the background.</param>
 /// <param name="paletteBorder">Palette source for the border.</param>
 /// <param name="paletteMetric">Palette source for metric values.</param>
 /// <param name="metricPadding">Matric used to get padding values.</param>
 /// <param name="orientation">Visual orientation of the content.</param>
 public ViewDrawSplitCanvas(IPaletteBack paletteBack,
                            IPaletteBorder paletteBorder,
                            IPaletteMetric paletteMetric,
                            PaletteMetricPadding metricPadding,
                            VisualOrientation orientation)
 {
     // Cache the starting values
     PaletteBorder    = paletteBorder;
     PaletteBack      = paletteBack;
     _paletteBackDraw = new PaletteBackInheritForced(PaletteBack)
     {
         ForceDraw = InheritBool.True
     };
     _paletteBackLight = new PaletteBackLightenColors(PaletteBack);
     PaletteMetric     = paletteMetric;
     _metricPadding    = metricPadding;
     Orientation       = orientation;
     DrawTabBorder     = false;
     DrawCanvas        = true;
     Splitter          = false;
 }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupButtonBackBorder class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="groupItem">Reference to owning group item.</param>
        /// <param name="paletteBack">Palette to use for the background.</param>
        /// <param name="paletteBorder">Palette to use for the border.</param>
        /// <param name="constantBorder">Should the border be a constant normal state.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupButtonBackBorder(KryptonRibbon ribbon,
                                                   KryptonRibbonGroupItem groupItem,
                                                   IPaletteBack paletteBack,
                                                   IPaletteBorder paletteBorder,
                                                   bool constantBorder,
                                                   NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(groupItem != null);
            Debug.Assert(paletteBack != null);
            Debug.Assert(paletteBorder != null);

            // Remember incoming references
            _ribbon = ribbon;
            _groupItem = groupItem;
            _paletteBack = paletteBack;
            _paletteBackDraw = new PaletteBackInheritForced(paletteBack);
            _paletteBackDraw.ForceDraw = InheritBool.True;
            _paletteBackLight = new PaletteBackLightenColors(paletteBack);
            _paletteBorderAll = new PaletteBorderInheritForced(paletteBorder);
            _paletteBorderAll.ForceBorderEdges(PaletteDrawBorders.All);
            _paletteBorder = paletteBorder;
            _constantBorder = constantBorder;

            // Default other fields
            _checked = false;
            _drawNonTrackingAreas = true;

            // Create delegate used to process end of click action
            _finishDelegate = new EventHandler(ActionFinished);

            // Attach a controller to this element for the pressing of the button
            _controller = new GroupButtonController(_ribbon, this, needPaint);
            _controller.Click += new EventHandler(OnClick);
            _controller.ContextClick += new MouseEventHandler(OnContextClick);
            _controller.DropDown += new EventHandler(OnDropDown);
            MouseController = _controller;
            SourceController = _controller;
            KeyController = _controller;
        }
Пример #5
0
        /// <summary>
        /// Initialize a new instance of the KryptonGroupPanel class.
        /// </summary>
        /// <param name="alignControl">Container control for alignment.</param>
        /// <param name="stateCommon">Common appearance state to inherit from.</param>
        /// <param name="stateDisabled">Disabled appearance state.</param>
        /// <param name="stateNormal">Normal appearance state.</param>
        /// <param name="layoutHandler">Callback delegate for layout processing.</param>
        public KryptonGroupPanel(Control alignControl,
                                 PaletteDoubleRedirect stateCommon,
                                 PaletteDouble stateDisabled,
                                 PaletteDouble stateNormal,
                                 NeedPaintHandler layoutHandler)
            : base(stateCommon, stateDisabled, stateNormal)
        {
            // Remember the delegate used to notify layouts
            _layoutHandler = layoutHandler;

            // Create the forced overrides to enforce the graphics option we want
            _forcedDisabled = new PaletteBackInheritForced(stateDisabled.Back);
            _forcedNormal   = new PaletteBackInheritForced(stateNormal.Back);

            // We never allow the anti alias option as it prevent transparent background working
            _forcedDisabled.ForceGraphicsHint = PaletteGraphicsHint.None;
            _forcedNormal.ForceGraphicsHint   = PaletteGraphicsHint.None;

            // Set the correct initial palettes
            ViewDrawPanel.SetPalettes(Enabled ? _forcedNormal : _forcedDisabled);

            // Make sure the alignment of the group panel is as that of the parent
            ViewManager.AlignControl = alignControl;
        }
Пример #6
0
        /// <summary>
        /// Initialize a new instance of the KryptonGroupPanel class.
        /// </summary>
        /// <param name="alignControl">Container control for alignment.</param>
        /// <param name="stateCommon">Common appearance state to inherit from.</param>
        /// <param name="stateDisabled">Disabled appearance state.</param>
        /// <param name="stateNormal">Normal appearance state.</param>
        /// <param name="layoutHandler">Callback delegate for layout processing.</param>
        public KryptonGroupPanel(Control alignControl,
                                 PaletteDoubleRedirect stateCommon,
                                 PaletteDouble stateDisabled,
                                 PaletteDouble stateNormal,
                                 NeedPaintHandler layoutHandler)
            : base(stateCommon, stateDisabled, stateNormal)
        {
            // Remember the delegate used to notify layouts
            _layoutHandler = layoutHandler;

            // Create the forced overrides to enforce the graphics option we want
            _forcedDisabled = new PaletteBackInheritForced(stateDisabled.Back);
            _forcedNormal = new PaletteBackInheritForced(stateNormal.Back);

            // We never allow the anti alias option as it prevent transparent background working
            _forcedDisabled.ForceGraphicsHint = PaletteGraphicsHint.None;
            _forcedNormal.ForceGraphicsHint = PaletteGraphicsHint.None;

            // Set the correct initial palettes
            ViewDrawPanel.SetPalettes(Enabled ? _forcedNormal : _forcedDisabled);

            // Make sure the alignment of the group panel is as that of the parent
            ViewManager.AlignControl = alignControl;
        }
Пример #7
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawSplitCanvas class.
        /// </summary>
        /// <param name="paletteBack">Palette source for the background.</param>		
        /// <param name="paletteBorder">Palette source for the border.</param>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="metricPadding">Matric used to get padding values.</param>
        /// <param name="orientation">Visual orientation of the content.</param>
        public ViewDrawSplitCanvas(IPaletteBack paletteBack,
							       IPaletteBorder paletteBorder,
							       IPaletteMetric paletteMetric,
							       PaletteMetricPadding metricPadding,
							       VisualOrientation orientation)
        {
            // Cache the starting values
            _paletteBorder = paletteBorder;
            _paletteBack = paletteBack;
            _paletteBackDraw = new PaletteBackInheritForced(_paletteBack);
            _paletteBackDraw.ForceDraw = InheritBool.True;
            _paletteBackLight = new PaletteBackLightenColors(_paletteBack);
            _paletteMetric = paletteMetric;
            _paletteBorderNormal = paletteBorder;
            _paletteBackNormal = paletteBack;
            _metricPadding = metricPadding;
            _orientation = orientation;
            _drawTabBorder = false;
            _drawCanvas = true;
            _splitter = false;
        }
        private void CreateView()
        {
            // Override the palette provided values
            _backForced = new PaletteBackInheritForced(_ribbon.StateCommon.RibbonGroupClusterButton.PaletteBack);
            _borderForced = new PaletteBorderInheritForced(_ribbon.StateCommon.RibbonGroupClusterButton.PaletteBorder);

            // Create the background and border view
            _viewMediumSmall = new ViewDrawRibbonGroupButtonBackBorder(_ribbon, _ribbonButton, _backForced,  _borderForced, true, _needPaint);
            _viewMediumSmall.SplitVertical = false;
            _viewMediumSmall.Click += new EventHandler(OnSmallButtonClick);
            _viewMediumSmall.DropDown += new EventHandler(OnSmallButtonDropDown);

            if (_ribbon.InDesignMode)
                _viewMediumSmall.ContextClick += new MouseEventHandler(OnContextClick);

            // Create the layout docker for the contents of the button
            ViewLayoutDocker contentLayout = new ViewLayoutDocker();

            // Create the image and drop down content
            _viewMediumSmallImage = new ViewDrawRibbonGroupClusterButtonImage(_ribbon, _ribbonButton);
            _viewMediumSmallText1 = new ViewDrawRibbonGroupClusterButtonText(_ribbon, _ribbonButton);
            _viewMediumSmallText1.Visible = (_currentSize != GroupItemSize.Small);
            _viewMediumSmallDropArrow = new ViewDrawRibbonDropArrow(_ribbon);
            _viewMediumSmallText2Sep1 = new ViewLayoutRibbonSeparator(3, false);
            _viewMediumSmallText2Sep2 = new ViewLayoutRibbonSeparator(3, false);
            ViewLayoutRibbonCenterPadding imagePadding = new ViewLayoutRibbonCenterPadding(_smallImagePadding);
            imagePadding.Add(_viewMediumSmallImage);

            // Layout the content in the center of a row
            _viewMediumSmallCenter = new ViewLayoutRibbonRowCenter();
            _viewMediumSmallCenter.Add(imagePadding);
            _viewMediumSmallCenter.Add(_viewMediumSmallText1);
            _viewMediumSmallCenter.Add(_viewMediumSmallText2Sep1);
            _viewMediumSmallCenter.Add(_viewMediumSmallDropArrow);
            _viewMediumSmallCenter.Add(_viewMediumSmallText2Sep2);

            // Use content as only fill item
            contentLayout.Add(_viewMediumSmallCenter, ViewDockStyle.Fill);

            // Add the content into the background and border
            _viewMediumSmall.Add(contentLayout);

            // Create controller for intercepting events to determine tool tip handling
            _viewMediumSmall.MouseController = new ToolTipController(_ribbon.TabsArea.ButtonSpecManager.ToolTipManager,
                                                                     _viewMediumSmall, _viewMediumSmall.MouseController);

            // Provide back reference to the button definition
            _ribbonButton.ClusterButtonView = _viewMediumSmall;

            // Define the actual view
            Add(_viewMediumSmall);
        }