/// <summary>
        /// Initialize a new instance of the ViewLayoutViewport class.
        /// </summary>
        /// <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>
        public ViewLayoutViewport(IPaletteMetric paletteMetrics,
                                  PaletteMetricPadding metricPadding,
                                  PaletteMetricInt metricOvers,
                                  VisualOrientation orientation,
                                  RelativePositionAlign alignment,
                                  bool animateChange)
        {
            // Remember the source information
            _paletteMetrics = paletteMetrics;
            _metricPadding = metricPadding;
            _metricOvers = metricOvers;
            _orientation = orientation;
            _alignment = alignment;
            _animateChange = animateChange;

            // Default other state
            _offset = Point.Empty;
            _extent = Size.Empty;
            _rightToLeft = RightToLeft.No;
            _rightToLeftLayout = false;
            _fillSpace = false;
            _counterAlignment = RelativePositionAlign.Far;

            // Create a timer for animation effect
            _animationTimer = new Timer();
            _animationTimer.Interval = _animationInterval;
            _animationTimer.Tick += new EventHandler(OnAnimationTick);
        }
        /// <summary>
        /// Initialize a new instance of the ViewLayoutMetricSpacer class.
        /// </summary>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="metricInt">Metric used to get spacer size.</param>
        public ViewLayoutMetricSpacer(IPaletteMetric paletteMetric,
                                      PaletteMetricInt metricInt)
        {
            Debug.Assert(paletteMetric != null);

            // Remember the source information
            _paletteMetric = paletteMetric;
            _metricInt = metricInt;
        }
 /// <summary>
 /// Initialize a new instance of the ButtonSpecManagerDraw class.
 /// </summary>
 /// <param name="control">Control that owns the button manager.</param>
 /// <param name="redirector">Palette redirector.</param>
 /// <param name="variableSpecs">Variable set of button specifications.</param>
 /// <param name="fixedSpecs">Fixed set of button specifications.</param>
 /// <param name="viewDockers">Array of target view dockers.</param>
 /// <param name="viewMetrics">Array of target metric providers.</param>
 /// <param name="viewMetricInt">Array of target metrics for outside/inside spacer size.</param>
 /// <param name="viewMetricPaddings">Array of target metrics for button padding.</param>
 /// <param name="getRenderer">Delegate for returning a tool strip renderer.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public ButtonSpecManagerDraw(Control control,
                              PaletteRedirect redirector,
                              ButtonSpecCollectionBase variableSpecs,
                              ButtonSpecCollectionBase fixedSpecs,
                              ViewDrawDocker[] viewDockers,
                              IPaletteMetric[] viewMetrics,
                              PaletteMetricInt[] viewMetricInt,
                              PaletteMetricPadding[] viewMetricPaddings,
                              GetToolStripRenderer getRenderer,
                              NeedPaintHandler needPaint)
     : this(control, redirector, variableSpecs, fixedSpecs, 
            viewDockers, viewMetrics, viewMetricInt, viewMetricInt,
            viewMetricPaddings, getRenderer, needPaint)
 {
 }
 /// <summary>
 /// Initialize a new instance of the ButtonSpecManagerLayoutRibbon class.
 /// </summary>
 /// <param name="ribbon">Ribbon that owns the button manager.</param>
 /// <param name="redirector">Palette redirector.</param>
 /// <param name="variableSpecs">Variable set of button specifications.</param>
 /// <param name="fixedSpecs">Fixed set of button specifications.</param>
 /// <param name="viewDockers">Array of target view dockers.</param>
 /// <param name="viewMetrics">Array of target metric providers.</param>
 /// <param name="viewMetricInt">Array of target metrics for outside/inside spacer size.</param>
 /// <param name="viewMetricPaddings">Array of target metrics for button padding.</param>
 /// <param name="getRenderer">Delegate for returning a tool strip renderer.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public ButtonSpecManagerLayoutRibbon(KryptonRibbon ribbon,
                                      PaletteRedirect redirector,
                                      ButtonSpecCollectionBase variableSpecs,
                                      ButtonSpecCollectionBase fixedSpecs,
                                      ViewLayoutDocker[] viewDockers,
                                      IPaletteMetric[] viewMetrics,
                                      PaletteMetricInt[] viewMetricInt,
                                      PaletteMetricPadding[] viewMetricPaddings,
                                      GetToolStripRenderer getRenderer,
                                      NeedPaintHandler needPaint)
     : base(ribbon, redirector, variableSpecs, fixedSpecs,
            viewDockers, viewMetrics, viewMetricInt,
            viewMetricPaddings, getRenderer, needPaint)
 {
 }
 /// <summary>
 /// Initialize a new instance of the ButtonSpecNavManagerLayoutBar class.
 /// </summary>
 /// <param name="control">Control that owns the button manager.</param>
 /// <param name="redirector">Palette redirector.</param>
 /// <param name="variableSpecs">Variable set of button specifications.</param>
 /// <param name="viewDockers">Array of target view dockers.</param>
 /// <param name="viewMetrics">Array of target metric providers.</param>
 /// <param name="viewMetricIntOutside">Array of target metrics for outside spacer size.</param>
 /// <param name="viewMetricIntInside">Array of target metrics for inside spacer size.</param>
 /// <param name="viewMetricPaddings">Array of target metrics for button padding.</param>
 /// <param name="getRenderer">Delegate for returning a tool strip renderer.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public ButtonSpecNavManagerLayoutBar(Control control,
                                      PaletteRedirect redirector,
                                      ButtonSpecCollectionBase variableSpecs,
                                      ViewLayoutDocker[] viewDockers,
                                      IPaletteMetric[] viewMetrics,
                                      PaletteMetricInt[] viewMetricIntOutside,
                                      PaletteMetricInt[] viewMetricIntInside,
                                      PaletteMetricPadding[] viewMetricPaddings,
                                      GetToolStripRenderer getRenderer,
                                      NeedPaintHandler needPaint)
     : this(control, redirector, variableSpecs,
            null, viewDockers, viewMetrics, 
            viewMetricIntOutside, viewMetricIntInside,
            viewMetricPaddings, getRenderer, needPaint)
 {
 }
 /// <summary>
 /// Initialize a new instance of the ViewLayoutBarForTabs class.
 /// </summary>
 /// <param name="paletteMetric">Palette source for metric values.</param>
 /// <param name="metricGap">Metric for gap between each child item.</param>
 /// <param name="itemSizing">Method used to calculate item size.</param>
 /// <param name="itemAlignment">Method used to align items within lines.</param>
 /// <param name="barMultiline">Multline showing of items.</param>
 /// <param name="itemMinimumSize">Maximum allowed item size.</param>
 /// <param name="itemMaximumSize">Minimum allowed item size.</param>
 /// <param name="barMinimumHeight">Minimum height of the bar.</param>
 /// <param name="tabBorderStyle">Tab border style.</param>
 /// <param name="reorderSelectedLine">Should line with selection be reordered.</param>
 public ViewLayoutBarForTabs(IPaletteMetric paletteMetric,
                             PaletteMetricInt metricGap,
                             BarItemSizing itemSizing,
                             RelativePositionAlign itemAlignment,
                             BarMultiline barMultiline,
                             Size itemMinimumSize,
                             Size itemMaximumSize,
                             int barMinimumHeight,
                             TabBorderStyle tabBorderStyle,
                             bool reorderSelectedLine)
     : base(paletteMetric, metricGap, itemSizing, 
            itemAlignment, barMultiline, itemMinimumSize,
            itemMaximumSize, barMinimumHeight, tabBorderStyle,
            reorderSelectedLine)
 {
 }
 /// <summary>
 /// Initialize a new instance of the ButtonSpecManagerLayoutAppButton class.
 /// </summary>
 /// <param name="viewManager">Reference to context menu view manager.</param>
 /// <param name="control">Control that owns the button manager.</param>
 /// <param name="redirector">Palette redirector.</param>
 /// <param name="variableSpecs">Variable set of button specifications.</param>
 /// <param name="fixedSpecs">Fixed set of button specifications.</param>
 /// <param name="viewDockers">Array of target view dockers.</param>
 /// <param name="viewMetrics">Array of target metric providers.</param>
 /// <param name="viewMetricInt">Array of target metrics for outside/inside spacer size.</param>
 /// <param name="viewMetricPaddings">Array of target metrics for button padding.</param>
 /// <param name="getRenderer">Delegate for returning a tool strip renderer.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public ButtonSpecManagerLayoutAppButton(ViewContextMenuManager viewManager,
                                         Control control,
                                         PaletteRedirect redirector,
                                         ButtonSpecCollectionBase variableSpecs,
                                         ButtonSpecCollectionBase fixedSpecs,
                                         ViewLayoutDocker[] viewDockers,
                                         IPaletteMetric[] viewMetrics,
                                         PaletteMetricInt[] viewMetricInt,
                                         PaletteMetricPadding[] viewMetricPaddings,
                                         GetToolStripRenderer getRenderer,
                                         NeedPaintHandler needPaint)
     : base(control, redirector, variableSpecs, fixedSpecs,
            viewDockers, viewMetrics, viewMetricInt,
            viewMetricPaddings, getRenderer, needPaint)
 {
     _viewManager = viewManager;
 }
 /// <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;
 }
 /// <summary>
 /// Initialize a new instance of the ButtonSpecNavManagerLayoutHeaderBar class.
 /// </summary>
 /// <param name="control">Control that owns the button manager.</param>
 /// <param name="redirector">Palette redirector.</param>
 /// <param name="variableSpecs">Variable set of button specifications.</param>
 /// <param name="fixedSpecs">Fixed set of button specifications.</param>
 /// <param name="viewDockers">Array of target view dockers.</param>
 /// <param name="viewMetrics">Array of target metric providers.</param>
 /// <param name="viewMetricIntOutside">Array of target metrics for outside spacer size.</param>
 /// <param name="viewMetricIntInside">Array of target metrics for inside spacer size.</param>
 /// <param name="viewMetricPaddings">Array of target metrics for button padding.</param>
 /// <param name="getRenderer">Delegate for returning a tool strip renderer.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 /// <param name="paletteContent">Palette source for color remapping.</param>
 /// <param name="paletteState">Palette state for color remapping.</param>
 public ButtonSpecNavManagerLayoutHeaderBar(Control control,
                                            PaletteRedirect redirector,
                                            ButtonSpecCollectionBase variableSpecs,
                                            ButtonSpecCollectionBase fixedSpecs,
                                            ViewLayoutDocker[] viewDockers,
                                            IPaletteMetric[] viewMetrics,
                                            PaletteMetricInt[] viewMetricIntOutside,
                                            PaletteMetricInt[] viewMetricIntInside,
                                            PaletteMetricPadding[] viewMetricPaddings,
                                            GetToolStripRenderer getRenderer,
                                            NeedPaintHandler needPaint,
                                            IPaletteContent paletteContent,
                                            PaletteState paletteState)
     : base(control, redirector, variableSpecs, fixedSpecs, 
            viewDockers, viewMetrics, viewMetricIntOutside,
            viewMetricIntInside, viewMetricPaddings, getRenderer, 
            needPaint)
 {
     // Remember initial palette settings needed for color remapping
     _paletteContent = paletteContent;
     _paletteState = paletteState;
 }
 /// <summary>
 /// Initialize a new instance of the ViewLayoutBar class.
 /// </summary>
 /// <param name="paletteMetric">Palette source for metric values.</param>
 /// <param name="metricGap">Metric for gap between each child item.</param>
 /// <param name="itemSizing">Method used to calculate item size.</param>
 /// <param name="itemAlignment">Method used to align items within lines.</param>
 /// <param name="barMultiline">Multline showing of items.</param>
 /// <param name="itemMinimumSize">Maximum allowed item size.</param>
 /// <param name="itemMaximumSize">Minimum allowed item size.</param>
 /// <param name="barMinimumHeight">Minimum height of the bar.</param>
 /// <param name="reorderSelectedLine">Should line with selection be reordered.</param>
 public ViewLayoutBar(IPaletteMetric paletteMetric,
                      PaletteMetricInt metricGap,
                      BarItemSizing itemSizing,
                      RelativePositionAlign itemAlignment,
                      BarMultiline barMultiline,
                      Size itemMinimumSize,
                      Size itemMaximumSize,
                      int barMinimumHeight,
                      bool reorderSelectedLine)
     : this(paletteMetric, metricGap, itemSizing, 
            itemAlignment, barMultiline, itemMinimumSize, 
            itemMaximumSize, barMinimumHeight, 
            TabBorderStyle.RoundedOutsizeMedium,
            reorderSelectedLine)
 {
 }
 /// <summary>
 /// Updates the metrics source and metric to use.
 /// </summary>
 /// <param name="paletteMetric">Palette source for metric values.</param>
 /// <param name="metricGap">Metric for gap between each child item.</param>
 public void SetMetrics(IPaletteMetric paletteMetric,
                        PaletteMetricInt metricGap)
 {
     _paletteMetric = paletteMetric;
     _metricGap = metricGap;
 }
 /// <summary>
 /// Gets an integer metric value.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <param name="metric">Requested metric.</param>
 /// <returns>Integer value.</returns>
 public virtual int GetMetricInt(PaletteState state, PaletteMetricInt metric) =>
 // Always pass onto the inheritance
 _inherit.GetMetricInt(state, metric);
        /// <summary>
        /// Initialize a new instance of the ViewLayoutBar class.
        /// </summary>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="metricGap">Metric for gap between each child item.</param>
        /// <param name="itemSizing">Method used to calculate item size.</param>
        /// <param name="itemAlignment">Method used to align items within lines.</param>
        /// <param name="barMultiline">Multline showing of items.</param>
        /// <param name="itemMinimumSize">Maximum allowed item size.</param>
        /// <param name="itemMaximumSize">Minimum allowed item size.</param>
        /// <param name="barMinimumHeight">Minimum height of the bar.</param>
        /// <param name="tabBorderStyle">Tab border style.</param>
        /// <param name="reorderSelectedLine">Should line with selection be reordered.</param>
        public ViewLayoutBar(IPaletteMetric paletteMetric,
                             PaletteMetricInt metricGap,
                             BarItemSizing itemSizing,
                             RelativePositionAlign itemAlignment,
                             BarMultiline barMultiline,
                             Size itemMinimumSize,
                             Size itemMaximumSize,
                             int barMinimumHeight,
                             TabBorderStyle tabBorderStyle,
                             bool reorderSelectedLine)
        {
            // Remember the source information
            _paletteMetric = paletteMetric;
            _metricGap = metricGap;
            _itemSizing = itemSizing;
            _itemAlignment = itemAlignment;
            _itemMinimumSize = itemMinimumSize;
            _itemMaximumSize = itemMaximumSize;
            _barMinimumHeight = barMinimumHeight;
            _tabBorderStyle = tabBorderStyle;
            _barMultiline = barMultiline;
            _reorderSelectedLine = reorderSelectedLine;

            // Default other state
            _orientation = VisualOrientation.Top;
            _itemOrientation = VisualOrientation.Top;
        }
 /// <summary>
 /// Gets an integer metric value.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <param name="metric">Requested metric.</param>
 /// <returns>Integer value.</returns>
 public int GetMetricInt(PaletteState state, PaletteMetricInt metric)
 {
     return(_metricRedirect.GetMetricInt(state, metric));
 }
Beispiel #15
0
 /// <summary>
 /// Gets an integer metric value.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <param name="metric">Requested metric.</param>
 /// <returns>Integer value.</returns>
 public abstract int GetMetricInt(PaletteState state, PaletteMetricInt metric);
 /// <summary>
 /// Gets an integer metric value.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <param name="metric">Requested metric.</param>
 /// <returns>Integer value.</returns>
 public override int GetMetricInt(PaletteState state, PaletteMetricInt metric)
 {
     // Pass onto the inheritance
     return _redirect.GetMetricInt(state, metric);
 }
 /// <summary>
 /// Gets an integer metric value.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <param name="metric">Requested metric.</param>
 /// <returns>Integer value.</returns>
 public virtual int GetMetricInt(PaletteState state, PaletteMetricInt metric)
 {
     // Always pass onto the inheritance
     return(_inherit.GetMetricInt(state, metric));
 }
 /// <summary>
 /// Updates the metrics source and metric to use.
 /// </summary>
 /// <param name="paletteMetric">Source for aquiring metrics.</param>
 /// <param name="metricPadding">Actual padding metric to use.</param>
 /// <param name="metricOvers">Actual overs metric to use.</param>
 public void SetMetrics(IPaletteMetric paletteMetric,
                        PaletteMetricPadding metricPadding,
                        PaletteMetricInt metricOvers)
 {
     _paletteMetrics = paletteMetric;
     _metricPadding = metricPadding;
     _metricOvers = metricOvers;
 }
Beispiel #19
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
            _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);
        }
 /// <summary>
 /// Gets an integer metric value.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <param name="metric">Requested metric.</param>
 /// <returns>Integer value.</returns>
 public virtual int GetMetricInt(PaletteState state, PaletteMetricInt metric)
 {
     // Pass onto the inheritance
     return(_redirect.GetMetricInt(state, metric));
 }
Beispiel #21
0
        /// <summary>
        /// Gets an integer metric value.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <param name="metric">Requested metric.</param>
        /// <returns>Integer value.</returns>
        public override int GetMetricInt(PaletteState state, PaletteMetricInt metric)
        {
            IPaletteMetric inherit = GetInherit(state);

            return(inherit?.GetMetricInt(state, metric) ?? Target.GetMetricInt(state, metric));
        }
Beispiel #22
0
 /// <summary>
 /// Gets an integer metric value.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <param name="metric">Requested metric.</param>
 /// <returns>Integer value.</returns>
 public int GetMetricInt(PaletteState state, PaletteMetricInt metric)
 {
     // Pass onto the inheritance
     return(_inherit.GetMetricInt(state, metric));
 }
Beispiel #23
0
 /// <summary>
 /// Updates the metrics source and metric to use.
 /// </summary>
 /// <param name="paletteMetric">Source for aquiring metrics.</param>
 /// <param name="metricInt">Actual integer metric to use.</param>
 public void SetMetrics(IPaletteMetric paletteMetric,
                        PaletteMetricInt metricInt)
 {
     _paletteMetric = paletteMetric;
     _metricInt     = metricInt;
 }
 /// <summary>
 /// Updates the metrics source and metric to use.
 /// </summary>
 /// <param name="paletteMetric">Source for aquiring metrics.</param>
 /// <param name="metricInt">Actual integer metric to use.</param>
 public void SetMetrics(IPaletteMetric paletteMetric,
                        PaletteMetricInt metricInt)
 {
     _paletteMetric = paletteMetric;
     _metricInt = metricInt;
 }
        /// <summary>
        /// Gets an integer metric value.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <param name="metric">Requested metric.</param>
        /// <returns>Integer value.</returns>
        public virtual int GetMetricInt(PaletteState state, PaletteMetricInt metric)
        {
            switch (metric)
            {
                case PaletteMetricInt.BarButtonEdgeInside:
                    if (ButtonEdgeInside != -1)
                        return ButtonEdgeInside;
                    break;
                case PaletteMetricInt.BarButtonEdgeOutside:
                    if (ButtonEdgeOutside != -1)
                        return ButtonEdgeOutside;
                    break;
                case PaletteMetricInt.CheckButtonGap:
                    if (CheckButtonGap != -1)
                        return CheckButtonGap;
                    break;
                case PaletteMetricInt.RibbonTabGap:
                    if (RibbonTabGap != -1)
                        return RibbonTabGap;
                    break;
            }

            // Always pass onto the inheritance
            return _redirect.GetMetricInt(state, metric);
        }
Beispiel #26
0
 /// <summary>
 /// Updates the metrics source and metric to use.
 /// </summary>
 /// <param name="paletteMetric">Palette source for metric values.</param>
 /// <param name="metricGap">Metric for gap between each child item.</param>
 public void SetMetrics(IPaletteMetric paletteMetric,
                        PaletteMetricInt metricGap)
 {
     _paletteMetric = paletteMetric;
     _metricGap     = metricGap;
 }
 /// <summary>
 /// Initialize a new instance of the ButtonSpecNavManagerLayoutBar class.
 /// </summary>
 /// <param name="control">Control that owns the button manager.</param>
 /// <param name="redirector">Palette redirector.</param>
 /// <param name="variableSpecs">Variable set of button specifications.</param>
 /// <param name="fixedSpecs">Fixed set of button specifications.</param>
 /// <param name="viewDockers">Array of target view dockers.</param>
 /// <param name="viewMetrics">Array of target metric providers.</param>
 /// <param name="viewMetricIntOutside">Array of target metrics for outside spacer size.</param>
 /// <param name="viewMetricIntInside">Array of target metrics for inside spacer size.</param>
 /// <param name="viewMetricPaddings">Array of target metrics for button padding.</param>
 /// <param name="getRenderer">Delegate for returning a tool strip renderer.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public ButtonSpecNavManagerLayoutBar(Control control,
                                      PaletteRedirect redirector,
                                      ButtonSpecCollectionBase variableSpecs,
                                      ButtonSpecCollectionBase fixedSpecs,
                                      ViewLayoutDocker[] viewDockers,
                                      IPaletteMetric[] viewMetrics,
                                      PaletteMetricInt[] viewMetricIntOutside,
                                      PaletteMetricInt[] viewMetricIntInside,
                                      PaletteMetricPadding[] viewMetricPaddings,
                                      GetToolStripRenderer getRenderer,
                                      NeedPaintHandler needPaint)
     : base(control, redirector, variableSpecs, fixedSpecs, 
            viewDockers, viewMetrics, viewMetricIntOutside,
            viewMetricIntInside, viewMetricPaddings, getRenderer, 
            needPaint)
 {
     _remapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.LabelPanel;
 }
 /// <summary>
 /// Gets an integer metric value.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <param name="metric">Requested metric.</param>
 /// <returns>Integer value.</returns>
 public virtual int GetMetricInt(PaletteState state, PaletteMetricInt metric)
 {
     // Always pass onto the inheritance
     return _redirect.GetMetricInt(state, metric);
 }
        /// <summary>
        /// Gets an integer metric value.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <param name="metric">Requested metric.</param>
        /// <returns>Integer value.</returns>
        public override int GetMetricInt(PaletteState state, PaletteMetricInt metric)
        {
            IPaletteMetric inherit = GetInherit(state);

            if (inherit != null)
                return inherit.GetMetricInt(state, metric);
            else
                return Target.GetMetricInt(state, metric);
        }
        /// <summary>
        /// Gets an integer metric value.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <param name="metric">Requested metric.</param>
        /// <returns>Integer value.</returns>
        public override int GetMetricInt(PaletteState state, PaletteMetricInt metric)
        {
            switch (metric)
            {
                case PaletteMetricInt.PageButtonInset:
                    if (_paletteMetrics.PageButtonSpecInset != -1)
                        return _paletteMetrics.PageButtonSpecInset;
                    break;
            }

            // Pass onto the inheritance
            return base.GetMetricInt(state, metric);
        }
        /// <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);
        }
        /// <summary>
        /// Gets an integer metric value.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <param name="metric">Requested metric.</param>
        /// <returns>Integer value.</returns>
        public override int GetMetricInt(PaletteState state, PaletteMetricInt metric)
        {
            // Is this the metric we provide?
            if (metric == PaletteMetricInt.BarButtonEdgeOutside)
            {
                if (ButtonEdgeOutside != -1)
                    return ButtonEdgeOutside;
            }
            else if (metric == PaletteMetricInt.BarButtonEdgeInside)
            {
                if (ButtonEdgeInside != -1)
                    return ButtonEdgeInside;
            }
            else if (metric == PaletteMetricInt.CheckButtonGap)
            {
                if (CheckButtonGap != -1)
                    return CheckButtonGap;
            }
            else if (metric == PaletteMetricInt.RibbonTabGap)
            {
                if (RibbonTabGap != -1)
                    return RibbonTabGap;
            }

            // Pass onto the inheritance
            return _redirect.GetMetricInt(state, metric);
        }
        /// <summary>
        /// Initialize a new instance of the ButtonSpecManagerDraw class.
        /// </summary>
        /// <param name="control">Control that owns the button manager.</param>
        /// <param name="redirector">Palette redirector.</param>
        /// <param name="variableSpecs">Variable set of button specifications.</param>
        /// <param name="fixedSpecs">Fixed set of button specifications.</param>
        /// <param name="viewDockers">Array of target view dockers.</param>
        /// <param name="viewMetrics">Array of target metric providers.</param>
        /// <param name="viewMetricIntOutside">Array of target metrics for outside spacer size.</param>
        /// <param name="viewMetricIntInside">Array of target metrics for inside spacer size.</param>
        /// <param name="viewMetricPaddings">Array of target metrics for button padding.</param>
        /// <param name="getRenderer">Delegate for returning a tool strip renderer.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ButtonSpecManagerDraw(Control control,
                                     PaletteRedirect redirector,
                                     ButtonSpecCollectionBase variableSpecs,
                                     ButtonSpecCollectionBase fixedSpecs,
                                     ViewDrawDocker[] viewDockers,
                                     IPaletteMetric[] viewMetrics,
                                     PaletteMetricInt[] viewMetricIntOutside,
                                     PaletteMetricInt[] viewMetricIntInside,
                                     PaletteMetricPadding[] viewMetricPaddings,
                                     GetToolStripRenderer getRenderer,
                                     NeedPaintHandler needPaint)
            : base(control, redirector, variableSpecs, fixedSpecs, 
                   viewMetrics, viewMetricIntOutside, viewMetricIntInside,
                   viewMetricPaddings, getRenderer, needPaint)
        {
            Debug.Assert(viewDockers != null);
            Debug.Assert(viewDockers.Length == viewMetrics.Length);
            Debug.Assert(viewDockers.Length == viewMetricPaddings.Length);

            // Remember references
            _viewDockers = viewDockers;

            Construct();
        }
        /// <summary>
        /// Initialize a new instance of the ButtonSpecManagerLayout class.
        /// </summary>
        /// <param name="control">Control that owns the button manager.</param>
        /// <param name="redirector">Palette redirector.</param>
        /// <param name="variableSpecs">Variable set of button specifications.</param>
        /// <param name="fixedSpecs">Fixed set of button specifications.</param>
        /// <param name="viewDockers">Array of target view dockers.</param>
        /// <param name="viewMetrics">Array of target metric providers.</param>
        /// <param name="viewMetricIntOutside">Array of target metrics for outside spacer size.</param>
        /// <param name="viewMetricIntInside">Array of target metrics for inside spacer size.</param>
        /// <param name="viewMetricPaddings">Array of target metrics for button padding.</param>
        /// <param name="getRenderer">Delegate for returning a tool strip renderer.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ButtonSpecManagerLayout(Control control,
                                       PaletteRedirect redirector,
                                       ButtonSpecCollectionBase variableSpecs,
                                       ButtonSpecCollectionBase fixedSpecs,
                                       ViewLayoutDocker[] viewDockers,
                                       IPaletteMetric[] viewMetrics,
                                       PaletteMetricInt[] viewMetricIntOutside,
                                       PaletteMetricInt[] viewMetricIntInside,
                                       PaletteMetricPadding[] viewMetricPaddings,
                                       GetToolStripRenderer getRenderer,
                                       NeedPaintHandler needPaint)
            : base(control, redirector, variableSpecs, fixedSpecs, 
                   viewMetrics, viewMetricIntOutside, viewMetricIntInside,
                   viewMetricPaddings, getRenderer, needPaint)
        {
            // Remember references
            _viewDockers = viewDockers;

            Construct();
        }
        /// <summary>
        /// Gets an integer metric value.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <param name="metric">Requested metric.</param>
        /// <returns>Integer value.</returns>
        public override int GetMetricInt(PaletteState state, PaletteMetricInt metric)
        {
            switch (metric)
            {
                case PaletteMetricInt.PageButtonInset:
                case PaletteMetricInt.RibbonTabGap:
                case PaletteMetricInt.HeaderButtonEdgeInsetCalendar:
                    return 2;
                case PaletteMetricInt.CheckButtonGap:
                    return 5;
                case PaletteMetricInt.HeaderButtonEdgeInsetForm:
                    return 4;
                case PaletteMetricInt.HeaderButtonEdgeInsetInputControl:
                    return 1;
                case PaletteMetricInt.HeaderButtonEdgeInsetPrimary:
                case PaletteMetricInt.HeaderButtonEdgeInsetSecondary:
                case PaletteMetricInt.HeaderButtonEdgeInsetDockInactive:
                case PaletteMetricInt.HeaderButtonEdgeInsetDockActive:
                case PaletteMetricInt.HeaderButtonEdgeInsetCustom1:
                case PaletteMetricInt.HeaderButtonEdgeInsetCustom2:
                case PaletteMetricInt.BarButtonEdgeOutside:
                case PaletteMetricInt.BarButtonEdgeInside:
                    return 3;
                case PaletteMetricInt.None:
                    return 0;
                default:
                    // Should never happen!
                    Debug.Assert(false);
                    break;
            }

            return -1;
        }
 /// <summary>
 /// Gets an integer metric value.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <param name="metric">Requested metric.</param>
 /// <returns>Integer value.</returns>
 public int GetMetricInt(PaletteState state, PaletteMetricInt metric)
 {
     return _metricRedirect.GetMetricInt(state, metric);
 }
        /// <summary>
        /// Gets an integer metric value.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <param name="metric">Requested metric.</param>
        /// <returns>Integer value.</returns>
        public override int GetMetricInt(PaletteState state, PaletteMetricInt metric)
        {
            // Is this the metric we provide?
            if ((metric == PaletteMetricInt.HeaderButtonEdgeInsetPrimary) ||
                (metric == PaletteMetricInt.HeaderButtonEdgeInsetSecondary) ||
                (metric == PaletteMetricInt.HeaderButtonEdgeInsetDockInactive) ||
                (metric == PaletteMetricInt.HeaderButtonEdgeInsetDockActive) ||
                (metric == PaletteMetricInt.HeaderButtonEdgeInsetForm) ||
                (metric == PaletteMetricInt.HeaderButtonEdgeInsetInputControl) ||
                (metric == PaletteMetricInt.HeaderButtonEdgeInsetCustom1) ||
                (metric == PaletteMetricInt.HeaderButtonEdgeInsetCustom2))
            {
                // If the user has defined an actual value to use
                if (ButtonEdgeInset != -1)
                    return ButtonEdgeInset;
            }

            // Pass onto the inheritance
            return _redirect.GetMetricInt(state, metric);
        }
 /// <summary>
 /// Gets an integer metric value.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <param name="metric">Requested metric.</param>
 /// <returns>Integer value.</returns>
 public virtual int GetMetricInt(PaletteState state, PaletteMetricInt metric)
 {
     return _target.GetMetricInt(state, metric);
 }
 /// <summary>
 /// Gets an integer metric value.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <param name="metric">Requested metric.</param>
 /// <returns>Integer value.</returns>
 public int GetMetricInt(PaletteState state, PaletteMetricInt metric)
 {
     // Pass onto the inheritance
     return _inherit.GetMetricInt(state, metric);
 }
Beispiel #40
0
 /// <summary>
 /// Gets an integer metric value.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <param name="metric">Requested metric.</param>
 /// <returns>Integer value.</returns>
 public virtual int GetMetricInt(PaletteState state, PaletteMetricInt metric) =>
 // Pass onto the inheritance
 _redirect.GetMetricInt(state, metric);