/// <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(PaletteBorderEdge disabled, PaletteBorderEdge normal) { _disabled = disabled; _normal = normal; }
/// <summary> /// Gets the border image style. /// </summary> /// <param name="style">Border style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Image style value.</returns> public override PaletteImageStyle GetBorderImageStyle(PaletteBorderStyle style, PaletteState state) { PaletteBorderEdge inherit = GetInherit(state); return(inherit?.GetBackImageStyle(state) ?? Target.GetBorderImageStyle(style, state)); }
/// <summary> /// Gets the image border alignment. /// </summary> /// <param name="style">Border style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Image alignment style.</returns> public override PaletteRectangleAlign GetBorderImageAlign(PaletteBorderStyle style, PaletteState state) { PaletteBorderEdge inherit = GetInherit(state); return(inherit?.GetBackImageAlign(state) ?? Target.GetBorderImageAlign(style, state)); }
/// <summary> /// Gets the border width. /// </summary> /// <param name="style">Border style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Integer width.</returns> public override int GetBorderWidth(PaletteBorderStyle style, PaletteState state) { PaletteBorderEdge inherit = GetInherit(state); return(inherit?.GetBorderWidth(state) ?? Target.GetBorderWidth(style, state)); }
/// <summary> /// Gets the color border angle. /// </summary> /// <param name="style">Border style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Angle used for color drawing.</returns> public override float GetBorderColorAngle(PaletteBorderStyle style, PaletteState state) { PaletteBorderEdge inherit = GetInherit(state); return(inherit?.GetBackColorAngle(state) ?? Target.GetBorderColorAngle(style, state)); }
/// <summary> /// Gets the graphics drawing hint for the border. /// </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 GetBorderGraphicsHint(PaletteBorderStyle style, PaletteState state) { PaletteBorderEdge inherit = GetInherit(state); return(inherit?.GetBackGraphicsHint(state) ?? Target.GetBorderGraphicsHint(style, state)); }
/// <summary> /// Initialize a new instance of the ViewDrawMonth class. /// </summary> /// <param name="calendar">Reference to calendar provider.</param> /// <param name="months">Reference to months instance.</param> /// <param name="redirector">Redirector for getting values.</param> /// <param name="needPaintDelegate">Delegate for requesting paint changes.</param> public ViewDrawMonth(IKryptonMonthCalendar calendar, ViewLayoutMonths months, PaletteRedirect redirector, NeedPaintHandler needPaintDelegate) : base(false) { _calendar = calendar; _months = months; // Add a header for showing the month/year value _drawContent = new ViewDrawContent(_calendar.StateNormal.Header.Content, this, VisualOrientation.Top); _borderForced = new PaletteBorderInheritForced(_calendar.StateNormal.Header.Border); _borderForced.ForceBorderEdges(PaletteDrawBorders.None); _drawHeader = new ViewDrawDocker(_calendar.StateNormal.Header.Back, _borderForced, null) { { _drawContent, ViewDockStyle.Fill } }; Add(_drawHeader); // Create the left/right arrows for moving the months _arrowPrev = new ButtonSpecCalendar(this, PaletteButtonSpecStyle.Previous, RelativeEdgeAlign.Near); _arrowNext = new ButtonSpecCalendar(this, PaletteButtonSpecStyle.Next, RelativeEdgeAlign.Far); _arrowPrev.Click += OnPrevMonth; _arrowNext.Click += OnNextMonth; _buttonSpecs = new CalendarButtonSpecCollection(this) { _arrowPrev, _arrowNext }; // Using a button spec manager to add the buttons to the header _buttonManager = new ButtonSpecManagerDraw(_calendar.CalendarControl, redirector, null, _buttonSpecs, new ViewDrawDocker[] { _drawHeader }, new IPaletteMetric[] { _calendar.StateCommon }, new PaletteMetricInt[] { PaletteMetricInt.HeaderButtonEdgeInsetCalendar }, new PaletteMetricPadding[] { PaletteMetricPadding.None }, _calendar.GetToolStripDelegate, needPaintDelegate); // Create stacks for holding display items ViewLayoutStack namesStack = new ViewLayoutStack(true); ViewLayoutStack weeksStack = new ViewLayoutStack(true); ViewLayoutStack daysStack = new ViewLayoutStack(false); _numberStack = new ViewLayoutStack(false); weeksStack.Add(_numberStack); weeksStack.Add(daysStack); // Add day names _drawMonthDayNames = new ViewDrawMonthDayNames(_calendar, _months); _drawWeekCorner = new ViewLayoutWeekCorner(_calendar, _months, _calendar.StateNormal.Header.Border); namesStack.Add(_drawWeekCorner); namesStack.Add(_drawMonthDayNames); Add(namesStack); Add(weeksStack); // Add border between week numbers and days area _borderEdgeRedirect = new PaletteBorderEdgeRedirect(_calendar.StateNormal.Header.Border, null); _borderEdge = new PaletteBorderEdge(_borderEdgeRedirect, null); _drawBorderEdge = new ViewDrawBorderEdge(_borderEdge, Orientation.Vertical); _drawWeekNumbers = new ViewDrawWeekNumbers(_calendar, _months); ViewLayoutDocker borderLeftDock = new ViewLayoutDocker { { _drawWeekNumbers, ViewDockStyle.Left }, { new ViewLayoutSeparator(0, 4), ViewDockStyle.Top }, { _drawBorderEdge, ViewDockStyle.Fill }, { new ViewLayoutSeparator(0, 4), ViewDockStyle.Bottom } }; _numberStack.Add(borderLeftDock); // Add border between day names and individual days PaletteBorderEdgeRedirect borderEdgeRedirect = new PaletteBorderEdgeRedirect(_calendar.StateNormal.Header.Border, null); PaletteBorderEdge borderEdge = new PaletteBorderEdge(borderEdgeRedirect, null); ViewDrawBorderEdge drawBorderEdge = new ViewDrawBorderEdge(borderEdge, Orientation.Horizontal); ViewLayoutDocker borderTopDock = new ViewLayoutDocker { { new ViewLayoutSeparator(4, 1), ViewDockStyle.Left }, { drawBorderEdge, ViewDockStyle.Fill }, { new ViewLayoutSeparator(4, 1), ViewDockStyle.Right }, { new ViewLayoutSeparator(1, 3), ViewDockStyle.Bottom } }; daysStack.Add(borderTopDock); // Add the actual individual days ViewDrawMonthDays = new ViewDrawMonthDays(_calendar, _months); daysStack.Add(ViewDrawMonthDays); // Adding buttons manually means we have to ask for buttons to be created _buttonManager.RecreateButtons(); }
/// <summary> /// Initialize a new instance of the ViewLayoutScrollViewport class. /// </summary> /// <param name="rootControl">Top level visual control.</param> /// <param name="viewportFiller">View element to place inside viewport.</param> /// <param name="paletteBorderEdge">Palette for use with the border edge.</param> /// <param name="paletteMetrics">Palette source for metrics.</param> /// <param name="metricPadding">Metric used to get view padding.</param> /// <param name="metricOvers">Metric used to get overposition.</param> /// <param name="orientation">Orientation for the viewport children.</param> /// <param name="alignment">Alignment of the children within the viewport.</param> /// <param name="animateChange">Animate changes in the viewport.</param> /// <param name="vertical">Is the viewport vertical.</param> /// <param name="needPaintDelegate">Delegate for notifying paint requests.</param> public ViewLayoutScrollViewport(VisualControl rootControl, ViewBase viewportFiller, PaletteBorderEdge paletteBorderEdge, IPaletteMetric paletteMetrics, PaletteMetricPadding metricPadding, PaletteMetricInt metricOvers, VisualOrientation orientation, RelativePositionAlign alignment, bool animateChange, bool vertical, NeedPaintHandler needPaintDelegate) { Debug.Assert(rootControl != null); Debug.Assert(viewportFiller != null); Debug.Assert(needPaintDelegate != null); // We need a way to notify changes in layout _needPaintDelegate = needPaintDelegate; // By default we are showing the contained viewport in vertical scrolling _viewportVertical = vertical; // Our initial visual orientation should match the parameter Orientation = orientation; // Create the child viewport Viewport = new ViewLayoutViewport(paletteMetrics, metricPadding, metricOvers, ViewportOrientation(_viewportVertical), alignment, animateChange) { // Default to same alignment for both directions CounterAlignment = alignment, // We always want the viewport to fill any remainder space FillSpace = true }; // Put the provided element inside the viewport Viewport.Add(viewportFiller); // Hook into animation step events Viewport.AnimateStep += OnAnimateStep; // To prevent the contents of the viewport from being able to draw outside // the viewport (such as having child controls) we use a ViewLayoutControl // that uses a child control to restrict the drawing region. ViewControl = new ViewLayoutControl(rootControl, Viewport) { InDesignMode = rootControl.InDesignMode }; // Create the scrollbar and matching border edge ScrollbarV = new ViewDrawScrollBar(true); ScrollbarH = new ViewDrawScrollBar(false); BorderEdgeV = new ViewDrawBorderEdge(paletteBorderEdge, System.Windows.Forms.Orientation.Vertical); BorderEdgeH = new ViewDrawBorderEdge(paletteBorderEdge, System.Windows.Forms.Orientation.Horizontal); // Hook into scroll position changes ScrollbarV.ScrollChanged += OnScrollVChanged; ScrollbarH.ScrollChanged += OnScrollHChanged; // Add with appropriate docking style Add(ViewControl, ViewDockStyle.Fill); Add(BorderEdgeV, ViewDockStyle.Right); Add(BorderEdgeH, ViewDockStyle.Bottom); Add(ScrollbarV, ViewDockStyle.Right); Add(ScrollbarH, ViewDockStyle.Bottom); }