Implement storage for palette border edge details.
Наследование: PaletteBack
Пример #1
0
        /// <summary>
        /// Initialize a new instance of the KryptonBorderEdge class.
        /// </summary>
        public KryptonBorderEdge()
        {
            // The label cannot take the focus
            SetStyle(ControlStyles.Selectable, false);

            // Set default label style
            _orientation = Orientation.Horizontal;

            // Create the palette storage
            _borderRedirect = new PaletteBorderInheritRedirect(Redirector, PaletteBorderStyle.ControlClient);
            _stateCommon = new PaletteBorderEdgeRedirect(_borderRedirect, NeedPaintDelegate);
            _stateDisabled = new PaletteBorderEdge(_stateCommon, NeedPaintDelegate);
            _stateNormal = new PaletteBorderEdge(_stateCommon, NeedPaintDelegate);
            _stateCurrent = _stateNormal;
            _state = PaletteState.Normal;

            // Our view contains just a simple canvas that covers entire client area
            _drawPanel = new ViewDrawPanel(_stateNormal);

            // Create the view manager instance
            ViewManager = new ViewManager(this, _drawPanel);

            // We want to be auto sized by default, but not the property default!
            AutoSize = true;
            AutoSizeMode = AutoSizeMode.GrowAndShrink;
        }
 /// <summary>
 /// Initialize a new instance of the PaletteRedirectBorderEdge 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 PaletteRedirectBorderEdge(IPalette target,
                                  PaletteBorderEdge disabled,
                                  PaletteBorderEdge normal)
     : base(target)
 {
     // Remember state specific inheritance
     _disabled = disabled;
     _normal = normal;
 }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupClusterEdge class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon..</param>
        /// <param name="palette">Palette source for drawing details.</param>
        public ViewDrawRibbonGroupClusterEdge(KryptonRibbon ribbon,
                                              PaletteBorderEdge palette)
            : base(palette, Orientation.Vertical)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(palette != null);

            _ribbon = ribbon;
            _palette = palette;
        }
        /// <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);
        }
Пример #5
0
 /// <summary>
 /// Initialize a new instance of the PaletteNavigatorNormabled class.
 /// </summary>
 /// <param name="redirect">Inheritence redirection instance.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteNavigator(PaletteNavigatorRedirect redirect,
                         NeedPaintHandler needPaint)
     : base(redirect, needPaint)
 {
     // Create the palette storage
     _palettePage = new PalettePage(redirect.PalettePage, needPaint);
     _paletteHeaderGroup = new PaletteNavigatorHeaderGroup(redirect.HeaderGroup, redirect.HeaderGroup.HeaderPrimary, redirect.HeaderGroup.HeaderSecondary, redirect.HeaderGroup.HeaderBar, redirect.HeaderGroup.HeaderOverflow, needPaint);
     _paletteCheckButton = new PaletteTriple(redirect.CheckButton, needPaint);
     _paletteOverflowButton = new PaletteTriple(redirect.OverflowButton, needPaint);
     _paletteMiniButton = new PaletteTriple(redirect.MiniButton, needPaint);
     _paletteBorderEdge = new PaletteBorderEdge(redirect.BorderEdge, needPaint);
     _paletteSeparator = new PaletteSeparatorPadding(redirect.Separator, redirect.Separator, needPaint);
     _paletteTab = new PaletteTabTriple(redirect.Tab, needPaint);
     _paletteRibbonTab = new PaletteRibbonTabContent(redirect.RibbonTab.TabDraw, redirect.RibbonTab.TabDraw, redirect.RibbonTab.Content, needPaint);
 }
Пример #6
0
 /// <summary>
 /// Initialize a new instance of the ViewLayoutOutlookFull class.
 /// </summary>
 /// <param name="viewBuilder">View builder reference.</param>
 /// <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 ViewLayoutOutlookFull(ViewBuilderOutlookBase viewBuilder,
                              VisualControl rootControl,
                              ViewBase viewportFiller,
                              PaletteBorderEdge paletteBorderEdge,
                              IPaletteMetric paletteMetrics,
                              PaletteMetricPadding metricPadding,
                              PaletteMetricInt metricOvers,
                              VisualOrientation orientation,
                              RelativePositionAlign alignment,
                              bool animateChange,
                              bool vertical,
                              NeedPaintHandler needPaintDelegate)
     : base(rootControl, viewportFiller, paletteBorderEdge, paletteMetrics, 
            metricPadding, metricOvers, orientation, alignment, animateChange, 
            vertical, needPaintDelegate)
 {
     Debug.Assert(viewBuilder != null);
     _viewBuilder = viewBuilder;
 }
Пример #7
0
        /// <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();
        }
Пример #8
0
        /// <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>
 /// Reset the redirection states to null.
 /// </summary>
 public virtual void ResetRedirectStates()
 {
     _disabled = null;
     _normal   = null;
 }
Пример #10
0
        /// <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);
        }
Пример #11
0
        /// <summary>
        /// Update the source palette for drawing.
        /// </summary>
        /// <param name="palette">Palette source for drawing details.</param>
        public void SetPalettes(PaletteBorderEdge palette)
        {
            Debug.Assert(palette != null);

            // Inherit from the newly provided palette
            _palette = palette;
            _borderForced.SetInherit(palette);

            // Give the forced palette to the base
            base.SetPalettes(_borderForced);
        }
 /// <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>
 /// 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;
 }
Пример #14
0
 /// <summary>
 /// Update the palettes being used by the view.
 /// </summary>
 /// <param name="borderEdge">Palette for the border edge.</param>
 public void SetPalettes(PaletteBorderEdge borderEdge)
 {
     BorderEdgeV.SetPalettes(borderEdge);
     BorderEdgeH.SetPalettes(borderEdge);
 }
 /// <summary>
 /// Update the palettes being used by the view.
 /// </summary>
 /// <param name="borderEdge">Palette for the border edge.</param>
 public void SetPalettes(PaletteBorderEdge borderEdge)
 {
     BorderEdgeV.SetPalettes(borderEdge);
     BorderEdgeH.SetPalettes(borderEdge);
 }
Пример #16
0
        /// <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));
        }
Пример #17
0
        /// <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 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
            _viewport.CounterAlignment = alignment;

            // We always want the viewport to fill any remainder space
            _viewport.FillSpace = true;

            // Put the provided element inside the viewport
            _viewport.Add(viewportFiller);

            // Hook into animation step events
            _viewport.AnimateStep += new EventHandler(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);
            _viewControl.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 += new EventHandler(OnScrollVChanged);
            _scrollbarH.ScrollChanged += new EventHandler(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);
        }
Пример #19
0
        /// <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>
 /// Reset the redirection states to null.
 /// </summary>
 public virtual void ResetRedirectStates()
 {
     _disabled = null;
     _normal = null;
 }
Пример #21
0
        /// <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));
        }
Пример #22
0
        /// <summary>
        /// Gets a value indicating if border should be drawn.
        /// </summary>
        /// <param name="style">Border style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>InheritBool value.</returns>
        public override InheritBool GetBorderDraw(PaletteBorderStyle style, PaletteState state)
        {
            PaletteBorderEdge inherit = GetInherit(state);

            return(inherit?.GetBackDraw(state) ?? Target.GetBorderDraw(style, state));
        }
Пример #23
0
        /// <summary>
        /// Raises the EnabledChanged event.
        /// </summary>
        /// <param name="e">An EventArgs that contains the event data.</param>
        protected override void OnEnabledChanged(EventArgs e)
        {
            // Cache the new state
            if (Enabled)
            {
                _stateCurrent = _stateNormal;
                _state = PaletteState.Normal;
            }
            else
            {
                _stateCurrent = _stateDisabled;
                _state = PaletteState.Disabled;
            }

            // Push correct palettes into the view
            _drawPanel.SetPalettes(_stateCurrent);

            // Update with latest enabled state
            _drawPanel.Enabled = Enabled;

            // Change in enabled state requires a layout and repaint
            PerformNeedPaint(true);

            // Let base class fire standard event
            base.OnEnabledChanged(e);
        }