/// <summary> /// Perform drawing of a separator glyph. /// </summary> /// <param name="context">Render context.</param> /// <param name="displayRect">Display area available for drawing.</param> /// <param name="paletteBack">Background palette details.</param> /// <param name="paletteBorder">Border palette details.</param> /// <param name="orientation">Visual orientation of the content.</param> /// <param name="state">State associated with rendering.</param> /// <param name="canMove">Can the separator be moved.</param> public override void DrawSeparator(RenderContext context, Rectangle displayRect, IPaletteBack paletteBack, IPaletteBorder paletteBorder, Orientation orientation, PaletteState state, bool canMove) { // Let base class perform standard processing base.DrawSeparator(context, displayRect, paletteBack, paletteBorder, orientation, state, canMove); // If we are drawing the background then draw grab handles on top if (paletteBack.GetBackDraw(state) == InheritBool.True) { // Only draw grab handle if the user can move the separator if (canMove) DrawGrabHandleGlyph(context, displayRect, orientation, state); } }
/// <summary> /// Initialize a new instance of the ViewDrawForm class. /// </summary> /// <param name="paletteBack">Palette source for the background.</param> /// <param name="paletteBorder">Palette source for the border.</param> public ViewDrawForm(IPaletteBack paletteBack, IPaletteBorder paletteBorder) : base(paletteBack, paletteBorder) { // Create a status strip we can position for rendering _renderStrip = new StatusStrip(); }
/// <summary> /// Initialize a new instance of the PaletteBackInheritNode class. /// </summary> /// <param name="inherit">Background palette to inherit from.</param> public PaletteBackInheritNode(IPaletteBack inherit) { Debug.Assert(inherit != null); // Remember inheritance border _inherit = inherit; }
/// <summary> /// Initialize a new instance of the ViewDrawDocker 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 metrics.</param> /// <param name="metricOverlay">Metric to use for border overlay.</param> public ViewDrawDocker(IPaletteBack paletteBack, IPaletteBorder paletteBorder, IPaletteMetric paletteMetric, PaletteMetricBool metricOverlay) : this(paletteBack, paletteBorder, paletteMetric, metricOverlay, PaletteMetricPadding.None, VisualOrientation.Top) { }
/// <summary> /// Initialize a new instance of the ViewDrawRibbonAppMenu class. /// </summary> /// <param name="paletteBack">Palette source for the background.</param> /// <param name="paletteBorder">Palette source for the border.</param> /// <param name="fixedElement">Element to display at provided screen rect.</param> /// <param name="fixedScreenRect">Screen rectangle for showing the element at.</param> public ViewDrawRibbonAppMenu(IPaletteBack paletteBack, IPaletteBorder paletteBorder, ViewBase fixedElement, Rectangle fixedScreenRect) : base(paletteBack, paletteBorder) { _fixedElement = fixedElement; _fixedScreenRect = fixedScreenRect; }
/// <summary> /// Initialize a new instance of the PaletteBack class. /// </summary> /// <param name="inherit">Source for inheriting defaulted values.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteBack(IPaletteBack inherit, NeedPaintHandler needPaint) { // Remember inheritance _inherit = inherit; // Store the provided paint notification delegate NeedPaint = needPaint; }
/// <summary> /// Initialize a new instance of the ViewDrawCanvas class. /// </summary> /// <param name="paletteBack">Palette source for the background.</param> /// <param name="paletteBorder">Palette source for the border.</param> /// <param name="orientation">Visual orientation of the content.</param> public ViewDrawCanvas(IPaletteBack paletteBack, IPaletteBorder paletteBorder, VisualOrientation orientation) : this(paletteBack, paletteBorder, null, PaletteMetricPadding.HeaderGroupPaddingPrimary, orientation) { }
/// <summary> /// Initialize a new instance of the ViewDrawMenuImageCanvas class. /// </summary> /// <param name="paletteBack">Palette source for the background.</param> /// <param name="paletteBorder">Palette source for the border.</param> /// <param name="columnIndex">Menu item column index.</param> /// <param name="zeroHeight">Should the height be forced to zero.</param> public ViewDrawMenuImageCanvas(IPaletteBack paletteBack, IPaletteBorder paletteBorder, int columnIndex, bool zeroHeight) : base(paletteBack, paletteBorder, VisualOrientation.Top) { _columnIndex = columnIndex; _overridePreferredWidth = 0; _zeroHeight = zeroHeight; }
/// <summary> /// Initialize a new instance of the PaletteBackInheritForced class. /// </summary> /// <param name="inherit">Background palette to inherit from.</param> public PaletteBackInheritForced(IPaletteBack inherit) { Debug.Assert(inherit != null); // Remember inheritance border _inherit = inherit; // Default values _borderIgnoreNormal = false; _forceGraphicsHint = PaletteGraphicsHint.Inherit; }
/// <summary> /// Initialize a new instance of the ViewDrawRibbonPanel class. /// </summary> /// <param name="ribbon">Reference to owning ribbon instance.</param> /// <param name="paletteBack">Reference to palette for obtaining background colors.</param> /// <param name="paintDelegate">Delegate for generating repaints.</param> public ViewDrawRibbonPanel(KryptonRibbon ribbon, IPaletteBack paletteBack, NeedPaintHandler paintDelegate) : base(paletteBack) { _ribbon = ribbon; _paintDelegate = paintDelegate; _compBlend = new Blend(); _compBlend.Positions = new float[] { 0.0f, 0.4f, 1.0f }; _compBlend.Factors = new float[] { 0.0f, 0.87f, 1.0f }; }
/// <summary> /// Initialize a new instance of the ViewDrawRibbonKeyTip class. /// </summary> /// <param name="keyTipInfo">Key tip information to display.</param> /// <param name="paletteBack">Background palette for appearance.</param> /// <param name="paletteBorder">Border palette for appearance.</param> /// <param name="paletteContent">Content palette for appearance.</param> public ViewDrawRibbonKeyTip(KeyTipInfo keyTipInfo, IPaletteBack paletteBack, IPaletteBorder paletteBorder, IPaletteContent paletteContent) : base(paletteBack, paletteBorder) { _keyTipInfo = keyTipInfo; // Create view for the key tip text _drawContent = new ViewDrawContent(paletteContent, this, VisualOrientation.Top); // Add content as filler for ourself Add(_drawContent, ViewDockStyle.Fill); }
/// <summary> /// Initialize a new instance of the PaletteInputControlBackStates class. /// </summary> /// <param name="inherit">Source for inheriting defaulted values.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteInputControlBackStates(IPaletteBack inherit, NeedPaintHandler needPaint) { Debug.Assert(inherit != null); // Remember inheritance _inherit = inherit; // Store the provided paint notification delegate NeedPaint = needPaint; // Default the initial values _color1 = Color.Empty; }
/// <summary> /// Initialize a new instance of the PaletteBackInheritOverride class. /// </summary> /// <param name="primary">First choice inheritence.</param> /// <param name="backup">Backup inheritence.</param> public PaletteBackInheritOverride(IPaletteBack primary, IPaletteBack backup) { Debug.Assert(primary != null); Debug.Assert(backup != null); // Store incoming alternatives _primary = primary; _backup = backup; // Default other state _apply = true; _override = true; _state = PaletteState.Normal; }
/// <summary> /// Initialize a new instance of the ViewDrawCanvas 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 ViewDrawCanvas(IPaletteBack paletteBack, IPaletteBorder paletteBorder, IPaletteMetric paletteMetric, PaletteMetricPadding metricPadding, VisualOrientation orientation) { // Cache the starting values _paletteBorder = paletteBorder; _paletteBack = paletteBack; _paletteMetric = paletteMetric; _metricPadding = metricPadding; _orientation = orientation; _includeBorderEdge = orientation; _applyIncludeBorderEdge = false; _drawTabBorder = false; _drawCanvas = true; }
/// <summary> /// Perform drawing of a ribbon cluster edge. /// </summary> /// <param name="shape">Ribbon shape.</param> /// <param name="context">Render context.</param> /// <param name="displayRect">Display area available for drawing.</param> /// <param name="paletteBack">Palette used for recovering drawing details.</param> /// <param name="state">State associated with rendering.</param> public override void DrawRibbonClusterEdge(PaletteRibbonShape shape, RenderContext context, Rectangle displayRect, IPaletteBack paletteBack, PaletteState state) { Debug.Assert(context != null); Debug.Assert(paletteBack != null); // Get the first border color Color borderColor = paletteBack.GetBackColor1(state); // We want to lighten it by merging with white Color lightColor = CommonHelper.MergeColors(borderColor, BORDER_PERCENT, Color.White, WHITE_PERCENT); // Draw inside of the border edge in a lighter version of the border using (SolidBrush drawBrush = new SolidBrush(lightColor)) context.Graphics.FillRectangle(drawBrush, displayRect); }
/// <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; }
/// <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; }
/// <summary> /// Initialize a new instance of the PaletteRedirectBack class. /// </summary> /// <param name="target">Initial palette target for redirection.</param> /// <param name="disabled">Redirection for disabled state requests.</param> /// <param name="normal">Redirection for normal state requests.</param> /// <param name="pressed">Redirection for pressed state requests.</param> /// <param name="tracking">Redirection for tracking state requests.</param> /// <param name="checkedNormal">Redirection for checked normal state requests.</param> /// <param name="checkedPressed">Redirection for checked pressed state requests.</param> /// <param name="checkedTracking">Redirection for checked tracking state requests.</param> /// <param name="focusOverride">Redirection for focus override state requests.</param> /// <param name="normalDefaultOverride">Redirection for normal default override state requests.</param> public PaletteRedirectBack(IPalette target, IPaletteBack disabled, IPaletteBack normal, IPaletteBack pressed, IPaletteBack tracking, IPaletteBack checkedNormal, IPaletteBack checkedPressed, IPaletteBack checkedTracking, IPaletteBack focusOverride, IPaletteBack normalDefaultOverride) : base(target) { // Remember state specific inheritance _disabled = disabled; _normal = normal; _pressed = pressed; _tracking = tracking; _checkedNormal = checkedNormal; _checkedPressed = checkedPressed; _checkedTracking = checkedTracking; _focusOverride = focusOverride; _normalDefaultOverride = normalDefaultOverride; }
/// <summary> /// Initialize a new instance of the ViewDrawGroupBoxDocker class. /// </summary> /// <param name="paletteBack">Palette source for the background.</param> /// <param name="paletteBorder">Palette source for the border.</param> public ViewDrawGroupBoxDocker(IPaletteBack paletteBack, IPaletteBorder paletteBorder) : base(paletteBack, paletteBorder) { _overlap = 0.5; }
/// <summary> /// Update the source palettes for drawing. /// </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 the metric.</param> public virtual void SetPalettes(IPaletteBack paletteBack, IPaletteBorder paletteBorder, IPaletteMetric paletteMetric) { Debug.Assert(paletteBorder != null); Debug.Assert(paletteBack != null); // Use newly provided palettes _paletteBack = paletteBack; // If not using a forced override decorator, then just store the new border palette // otherwise we update the decorator with the palette as the new inheritance to use if (_borderForced == null) _paletteBorder = paletteBorder; else _borderForced.SetInherit(paletteBorder); _paletteMetric = paletteMetric; }
/// <summary> /// Set the redirection states. /// </summary> /// <param name="disabled">Redirection for disabled state requests.</param> /// <param name="normal">Redirection for normal state requests.</param> public virtual void SetRedirectStates(IPaletteBack disabled, IPaletteBack normal) { _disabled = disabled; _normal = normal; }
/// <summary> /// Draw background to fill the specified path. /// </summary> /// <param name="context">Rendering context.</param> /// <param name="rect">Target rectangle that encloses path.</param> /// <param name="path">Graphics path.</param> /// <param name="palette">Palette used for drawing.</param> /// <param name="orientation">Visual orientation of the background.</param> /// <param name="state">State associated with rendering.</param> /// <param name="memento">Cache used for drawing.</param> public abstract IDisposable DrawBack(RenderContext context, Rectangle rect, GraphicsPath path, IPaletteBack palette, VisualOrientation orientation, PaletteState state, IDisposable memento);
/// <summary> /// Initialize a new instance of the ViewDrawPanel class. /// </summary> /// <param name="paletteBack">Palette source for the background.</param> public ViewDrawPanel(IPaletteBack paletteBack) { Debug.Assert(paletteBack != null); _paletteBack = paletteBack; _orientation = VisualOrientation.Top; }
/// <summary> /// Gets a value indicating if background should be drawn. /// </summary> /// <param name="style">Background style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>InheritBool value.</returns> public override InheritBool GetBackDraw(PaletteBackStyle style, PaletteState state) { IPaletteBack inherit = GetInherit(state); return(inherit?.GetBackDraw(state) ?? Target.GetBackDraw(style, state)); }
/// <summary> /// Initialize a new instance of the ViewDrawDocker 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 metrics.</param> public ViewDrawDocker(IPaletteBack paletteBack, IPaletteBorder paletteBorder, IPaletteMetric paletteMetric) : this(paletteBack, paletteBorder, paletteMetric, PaletteMetricBool.None) { }
/// <summary> /// Gets the graphics drawing hint for the background. /// </summary> /// <param name="style">Border style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>PaletteGraphicsHint value.</returns> public override PaletteGraphicsHint GetBackGraphicsHint(PaletteBackStyle style, PaletteState state) { IPaletteBack inherit = GetInherit(state); return(inherit?.GetBackGraphicsHint(state) ?? Target.GetBackGraphicsHint(style, state)); }
private void RenderCollapsedPressedBefore(RenderContext context) { switch (_lastRibbonShape) { default: case PaletteRibbonShape.Office2007: { IPaletteBack paletteBack = _ribbon.StateCommon.RibbonGroupCollapsedButton.PaletteBack; IPaletteBorder paletteBorder = _ribbon.StateCommon.RibbonGroupCollapsedButton.PaletteBorder; // Do we need to draw the background? if (paletteBack.GetBackDraw(PaletteState.Pressed) == InheritBool.True) { // Get the border path which the background is clipped to drawing within using (GraphicsPath borderPath = context.Renderer.RenderStandardBorder.GetBackPath(context, ClientRectangle, paletteBorder, VisualOrientation.Top, PaletteState.Pressed)) { Padding borderPadding = context.Renderer.RenderStandardBorder.GetBorderRawPadding(paletteBorder, PaletteState.Pressed, VisualOrientation.Top); // Apply the padding depending on the orientation Rectangle enclosingRect = CommonHelper.ApplyPadding(VisualOrientation.Top, ClientRectangle, borderPadding); // Render the background inside the border path _mementoStandardBack = context.Renderer.RenderStandardBack.DrawBack(context, enclosingRect, borderPath, paletteBack, VisualOrientation.Top, PaletteState.Pressed, _mementoStandardBack); } } // Do we need to draw the border? if (paletteBorder.GetBorderDraw(PaletteState.Pressed) == InheritBool.True) { context.Renderer.RenderStandardBorder.DrawBorder(context, ClientRectangle, paletteBorder, VisualOrientation.Top, PaletteState.Pressed); } } break; case PaletteRibbonShape.Office2010: { Rectangle drawRect = ClientRectangle; IPaletteRibbonBack paletteBack = _ribbon.StatePressed.RibbonGroupCollapsedBack; IPaletteRibbonBack paletteBorder = _ribbon.StatePressed.RibbonGroupCollapsedBorder; PaletteState state = PaletteState.Pressed; // Are we a group inside a context tab? if ((_ribbon.SelectedTab != null) && !string.IsNullOrEmpty(_ribbon.SelectedTab.ContextName)) { state = PaletteState.ContextPressed; } // Draw the group border _paletteContextBack.SetInherit(paletteBorder); _mementoRibbonBack1 = context.Renderer.RenderRibbon.DrawRibbonBack(_ribbon.RibbonShape, context, drawRect, state, _paletteContextBack, VisualOrientation.Top, false, _mementoRibbonBack1); Rectangle backRect = drawRect; backRect.Inflate(-2, -2); // Draw the inside background _mementoRibbonBack2 = context.Renderer.RenderRibbon.DrawRibbonBack(_ribbon.RibbonShape, context, backRect, state, paletteBack, VisualOrientation.Top, false, _mementoRibbonBack2); } break; } }
/// <summary> /// Initialize a new instance of the PaletteBackColor1 class. /// </summary> /// <param name="inherit">Source for inheriting defaulted values.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteBackColor1(IPaletteBack inherit, NeedPaintHandler needPaint) : base(inherit, needPaint) { }
/// <summary> /// Perform drawing of a separator glyph. /// </summary> /// <param name="context">Render context.</param> /// <param name="displayRect">Display area available for drawing.</param> /// <param name="paletteBack">Background palette details.</param> /// <param name="paletteBorder">Border palette details.</param> /// <param name="orientation">Visual orientation of the content.</param> /// <param name="state">State associated with rendering.</param> /// <param name="canMove">Can the separator be moved.</param> public abstract void DrawSeparator(RenderContext context, Rectangle displayRect, IPaletteBack paletteBack, IPaletteBorder paletteBorder, Orientation orientation, PaletteState state, bool canMove);
/// <summary> /// Sets the inheritence parent. /// </summary> public void SetInherit(IPaletteBack inherit) { _inherit = inherit; }
/// <summary> /// Initialize a new instance of the PaletteBackLightenColors class. /// </summary> /// <param name="inherit"></param> public PaletteBackLightenColors(IPaletteBack inherit) { Inherit = inherit; }
/// <summary> /// Gets the background image style. /// </summary> /// <param name="style">Background style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Image style value.</returns> public override PaletteImageStyle GetBackImageStyle(PaletteBackStyle style, PaletteState state) { IPaletteBack inherit = GetInherit(state); return(inherit?.GetBackImageStyle(state) ?? Target.GetBackImageStyle(style, state)); }
/// <summary> /// Update the source palettes for drawing. /// </summary> /// <param name="paletteBack">Palette source for the background.</param> /// <param name="paletteBorder">Palette source for the border.</param> public virtual void SetPalettes(IPaletteBack paletteBack, IPaletteBorder paletteBorder) { SetPalettes(paletteBack, paletteBorder, null); }
/// <summary> /// Gets the color background angle. /// </summary> /// <param name="style">Background style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Angle used for color drawing.</returns> public override float GetBackColorAngle(PaletteBackStyle style, PaletteState state) { IPaletteBack inherit = GetInherit(state); return(inherit?.GetBackColorAngle(state) ?? Target.GetBackColorAngle(style, state)); }
/// <summary> /// Initialize a new instance of the ViewDrawPanel class. /// </summary> /// <param name="paletteBack">Palette source for the background.</param> public ViewDrawPanel(IPaletteBack paletteBack) { Debug.Assert(paletteBack != null); _paletteBack = paletteBack; VisualOrientation = VisualOrientation.Top; }
/// <summary> /// Update the source palettes for drawing. /// </summary> /// <param name="paletteBack">Palette source for the background.</param> public void SetPalettes(IPaletteBack paletteBack) { Debug.Assert(paletteBack != null); // Use newly provided palettes _paletteBack = paletteBack; }
/// <summary> /// Initialize a new instance of the PaletteRedirectBack class. /// </summary> /// <param name="target">Initial palette target for redirection.</param> /// <param name="disabled">Redirection for disabled state requests.</param> /// <param name="normal">Redirection for normal state requests.</param> public PaletteRedirectBack(IPalette target, IPaletteBack disabled, IPaletteBack normal) : this(target, disabled, normal, null, null, null, null, null, null, null) { }
private void DrawBackground(IPaletteBack paletteBack, RenderContext context, Rectangle rect, PaletteState state) { // Do we need to draw the background? if (paletteBack.GetBackDraw(state) == InheritBool.True) { // Get the border path which the background is clipped to drawing within using (GraphicsPath borderPath = context.Renderer.RenderStandardBorder.GetBackPath(context, rect, _paletteBorder, VisualOrientation.Top, state)) { Padding borderPadding = context.Renderer.RenderStandardBorder.GetBorderRawPadding(_paletteBorder, state, VisualOrientation.Top); // Apply the padding depending on the orientation Rectangle enclosingRect = CommonHelper.ApplyPadding(VisualOrientation.Top, rect, borderPadding); // Render the background inside the border path _mementoBack = context.Renderer.RenderStandardBack.DrawBack(context, enclosingRect, borderPath, paletteBack, VisualOrientation.Top, state, _mementoBack); } } }
private void DrawBackground(RenderContext context, Rectangle rect, IPaletteBack paletteBack, IPaletteBorder paletteBorder, PaletteState state) { GraphicsPath borderPath; Padding borderPadding; // Ask the border renderer for a path that encloses the border if (DrawTabBorder) { borderPath = context.Renderer.RenderTabBorder.GetTabBackPath(context, rect, paletteBorder, Orientation, state, TabBorderStyle); borderPadding = Padding.Empty; } else { borderPath = context.Renderer.RenderStandardBorder.GetBackPath(context, rect, paletteBorder, Orientation, state); borderPadding = context.Renderer.RenderStandardBorder.GetBorderRawPadding(paletteBorder, state, Orientation); } // Apply the padding depending on the orientation Rectangle enclosingRect = CommonHelper.ApplyPadding(_orientation, rect, borderPadding); // Render the background inside the border path _mementoBack = context.Renderer.RenderStandardBack.DrawBack(context, enclosingRect, borderPath, paletteBack, _orientation, state, _mementoBack); borderPath.Dispose(); }
/// <summary> /// Initialize a new instance of the PaletteBackLightenColors class. /// </summary> /// <param name="inherit"></param> public PaletteBackLightenColors(IPaletteBack inherit) { _inherit = inherit; }
/// <summary> /// Gets the image alignment. /// </summary> /// <param name="style">Background style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Image alignment style.</returns> public override PaletteRectangleAlign GetBackImageAlign(PaletteBackStyle style, PaletteState state) { IPaletteBack inherit = GetInherit(state); return(inherit?.GetBackImageAlign(state) ?? Target.GetBackImageAlign(style, state)); }
/// <summary> /// Perform drawing of a ribbon cluster edge. /// </summary> /// <param name="shape">Ribbon shape.</param> /// <param name="context">Render context.</param> /// <param name="displayRect">Display area available for drawing.</param> /// <param name="paletteBack">Palette used for recovering drawing details.</param> /// <param name="state">State associated with rendering.</param> public abstract void DrawRibbonClusterEdge(PaletteRibbonShape shape, RenderContext context, Rectangle displayRect, IPaletteBack paletteBack, PaletteState state);
/// <summary> /// Gets and sets the palette to inherit from. /// </summary> public void SetInherit(IPaletteBack paletteBack) { Debug.Assert(paletteBack != null); _inherit = paletteBack; }
/// <summary> /// Evaluate if transparent painting is needed for background or border palettes. /// </summary> /// <param name="paletteBack">Background palette to test.</param> /// <param name="paletteBorder">Background palette to test.</param> /// <param name="state">Element state associated with palette.</param> /// <returns>True if transparent painting required.</returns> public abstract bool EvalTransparentPaint(IPaletteBack paletteBack, IPaletteBorder paletteBorder, PaletteState state);
/// <summary> /// Perform rendering before child elements are rendered. /// </summary> /// <param name="context">Rendering context.</param> public override void RenderBefore(RenderContext context) { // Update the enabled state of the button Enabled = _ribbon.Enabled; IPaletteBack paletteBack = _ribbon.StateCommon.RibbonGroupDialogButton.PaletteBack; IPaletteBorder paletteBorder = _ribbon.StateCommon.RibbonGroupDialogButton.PaletteBorder; IPaletteRibbonGeneral paletteGeneral = _ribbon.StateCommon.RibbonGeneral; if (_ribbon.RibbonShape == PaletteRibbonShape.NeoAxis) { paletteBack = _ribbon.StateCommon.RibbonQATButton.PaletteBack; paletteBorder = _ribbon.StateCommon.RibbonQATButton.PaletteBorder; paletteGeneral = _ribbon.StateCommon.RibbonGeneral; } // Do we need to draw the background? if (paletteBack.GetBackDraw(State) == InheritBool.True) { // Get the border path which the background is clipped to drawing within using (GraphicsPath borderPath = context.Renderer.RenderStandardBorder.GetBackPath(context, ClientRectangle, paletteBorder, VisualOrientation.Top, State)) { Padding borderPadding = context.Renderer.RenderStandardBorder.GetBorderRawPadding(paletteBorder, State, VisualOrientation.Top); // Apply the padding depending on the orientation Rectangle enclosingRect = CommonHelper.ApplyPadding(VisualOrientation.Top, ClientRectangle, borderPadding); // Render the background inside the border path _mementoBack = context.Renderer.RenderStandardBack.DrawBack(context, enclosingRect, borderPath, paletteBack, VisualOrientation.Top, State, _mementoBack); } } // Do we need to draw the border? if (paletteBorder.GetBorderDraw(State) == InheritBool.True) { context.Renderer.RenderStandardBorder.DrawBorder(context, ClientRectangle, paletteBorder, VisualOrientation.Top, State); } // Find the content area inside the button rectangle Rectangle contentRect = ClientRectangle; var contentSize = new Size(-(ClientRectangle.Width - _imageSize.Width) / 2, -(ClientRectangle.Height - _imageSize.Height) / 2); contentRect.Inflate(contentSize); bool isMinibar = _ribbon.QATLocation == QATLocation.Above; // Decide if we are drawing an overflow or context arrow image if (Overflow) { context.Renderer.RenderGlyph.DrawRibbonOverflow(_ribbon.RibbonShape, context, contentRect, paletteGeneral, State); } else { context.Renderer.RenderGlyph.DrawRibbonContextArrow(_ribbon.RibbonShape, context, contentRect, paletteGeneral, State, isMinibar); } }