Ejemplo n.º 1
0
        /// <summary>
        /// Initialize a new instance of the ButtonSpecView class.
        /// </summary>
        /// <param name="redirector">Palette redirector.</param>
        /// <param name="paletteMetric">Source for metric values.</param>
        /// <param name="metricPadding">Padding metric for border padding.</param>
        /// <param name="manager">Reference to owning manager.</param>
        /// <param name="buttonSpec">Access</param>
        public ButtonSpecView(PaletteRedirect redirector,
                              IPaletteMetric paletteMetric,
                              PaletteMetricPadding metricPadding,
                              ButtonSpecManagerBase manager,
                              ButtonSpec buttonSpec)
        {
            Debug.Assert(redirector != null);
            Debug.Assert(manager != null);
            Debug.Assert(buttonSpec != null);

            // Remember references
            _redirector = redirector;
            _manager = manager;
            _buttonSpec = buttonSpec;
            _finishDelegate = new EventHandler(OnFinishDelegate);

            // Create delegate for paint notifications
            NeedPaintHandler needPaint = new NeedPaintHandler(OnNeedPaint);

            // Intercept calls from the button for color remapping and instead use
            // the button spec defined map and the container foreground color
            _remapPalette = _manager.CreateButtonSpecRemap(redirector, buttonSpec);

            // Use a redirector to get button values directly from palette
            _palette = new PaletteTripleRedirect(_remapPalette,
                                                 PaletteBackStyle.ButtonButtonSpec,
                                                 PaletteBorderStyle.ButtonButtonSpec,
                                                 PaletteContentStyle.ButtonButtonSpec,
                                                 needPaint);

            // Create the view for displaying a button
            _viewButton = new ViewDrawButton(_palette, _palette, _palette, _palette,
                                             paletteMetric, this, VisualOrientation.Top, false);

            // Associate the view with the source component (for design time support)
            if (buttonSpec.AllowComponent)
                _viewButton.Component = buttonSpec;

            // Use a view center to place button in centre of given space
            _viewCenter = new ViewLayoutCenter(paletteMetric, metricPadding, VisualOrientation.Top);
            _viewCenter.Add(_viewButton);

            // Create a controller for managing button behavior
            ButtonSpecViewControllers controllers = CreateController(_viewButton, needPaint, new MouseEventHandler(OnClick));
            _viewButton.MouseController = controllers.MouseController;
            _viewButton.SourceController = controllers.SourceController;
            _viewButton.KeyController = controllers.KeyController;

            // We need notifying whenever a button specification property changes
            _buttonSpec.ButtonSpecPropertyChanged += new PropertyChangedEventHandler(OnPropertyChanged);

            // Associate the button spec with the view that is drawing it
            _buttonSpec.SetView(_viewButton);

            // Finally update view with current button spec settings
            UpdateButtonStyle();
            UpdateVisible();
            UpdateEnabled();
            UpdateChecked();
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawSeparator class.
        /// </summary>
        /// <param name="paletteDisabled">Palette source for the disabled state.</param>
        /// <param name="paletteNormal">Palette source for the normal state.</param>
        /// <param name="paletteTracking">Palette source for the tracking state.</param>
        /// <param name="palettePressed">Palette source for the pressed state.</param>
        /// <param name="metricDisabled">Palette source for disabled metric values.</param>
        /// <param name="metricNormal">Palette source for normal metric values.</param>
        /// <param name="metricTracking">Palette source for tracking metric values.</param>
        /// <param name="metricPressed">Palette source for pressed metric values.</param>
        /// <param name="metricPadding">Metric used to get padding values.</param>
        /// <param name="orientation">Visual orientation of the content.</param>
        public ViewDrawSeparator(IPaletteDouble paletteDisabled, IPaletteDouble paletteNormal,
                                 IPaletteDouble paletteTracking, IPaletteDouble palettePressed,
                                 IPaletteMetric metricDisabled,  IPaletteMetric metricNormal,
                                 IPaletteMetric metricTracking,  IPaletteMetric metricPressed,
                                 PaletteMetricPadding metricPadding,
                                 Orientation orientation)
        {
            Debug.Assert(paletteDisabled != null);
            Debug.Assert(paletteNormal != null);
            Debug.Assert(paletteTracking != null);
            Debug.Assert(palettePressed != null);
            Debug.Assert(metricDisabled != null);
            Debug.Assert(metricNormal != null);
            Debug.Assert(metricTracking != null);
            Debug.Assert(metricPressed != null);

            // Remember the source information
            _paletteDisabled = paletteDisabled;
            _paletteNormal = paletteNormal;
            _paletteTracking = paletteTracking;
            _palettePressed = palettePressed;
            _metricDisabled = metricDisabled;
            _metricNormal = metricNormal;
            _metricTracking = metricTracking;
            _metricPressed = metricPressed;
            _metricPadding = metricPadding;
            _orientation = orientation;

            // Default other state
            _length = 0;
        }
 /// <summary>
 /// Initialize a new instance of the ButtonSpecViewAppButton class.
 /// </summary>
 /// <param name="redirector">Palette redirector.</param>
 /// <param name="paletteMetric">Source for metric values.</param>
 /// <param name="metricPadding">Padding metric for border padding.</param>
 /// <param name="manager">Reference to owning manager.</param>
 /// <param name="buttonSpec">Access</param>
 public ButtonSpecViewAppButton(PaletteRedirect redirector,
                                IPaletteMetric paletteMetric,
                                PaletteMetricPadding metricPadding,
                                ButtonSpecManagerBase manager,
                                ButtonSpec buttonSpec)
     : base(redirector, paletteMetric, metricPadding, manager, buttonSpec)
 {
 }
 /// <summary>
 /// Create the button spec view appropriate for the button spec.
 /// </summary>
 /// <param name="redirector">Redirector for acquiring palette values.</param>
 /// <param name="viewPaletteMetric">Target metric providers.</param>
 /// <param name="viewMetricPadding">Target metric padding.</param>
 /// <param name="buttonSpec">ButtonSpec instance.</param>
 /// <returns>ButtonSpecView derived class.</returns>
 protected override ButtonSpecView CreateButtonSpecView(PaletteRedirect redirector, 
                                                        IPaletteMetric viewPaletteMetric, 
                                                        PaletteMetricPadding viewMetricPadding, 
                                                        ButtonSpec buttonSpec)
 {
     return new ButtonSpecViewRibbon(redirector, viewPaletteMetric,
                                     viewMetricPadding, this, buttonSpec);
 }
Ejemplo n.º 6
0
        /// <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 PaletteRedirectTripleMetric class.
 /// </summary>
 /// <param name="target">Initial palette target for redirection.</param>
 /// <param name="disabled">Redirection for disabled state requests.</param>
 /// <param name="disableMetric">Redirection for disabled metric requests.</param>
 /// <param name="normal">Redirection for normal state requests.</param>
 /// <param name="normalMetric">Redirection for normal metric requests.</param>
 public PaletteRedirectTripleMetric(IPalette target,
                                    IPaletteTriple disabled, IPaletteMetric disableMetric,
                                    IPaletteTriple normal, IPaletteMetric normalMetric)
     : base(target, disabled, normal)
 {
     // Remember state specific inheritance
     _disabled = disableMetric;
     _normal = normalMetric;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Initialize a new instance of the PaletteSplitContainer class.
 /// </summary>
 /// <param name="inheritSplitContainer">Source for inheriting back/border defaulted values.</param>
 /// <param name="inheritSeparator">Source for inheriting separator defaulted values.</param>
 /// <param name="inheritMetric">Source for inheriting separator metric values.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteSplitContainer(IPaletteDouble inheritSplitContainer,
                              IPaletteDouble inheritSeparator,
                              IPaletteMetric inheritMetric,
                              NeedPaintHandler needPaint)
     : base(inheritSplitContainer, needPaint)
 {
     // Create the embedded separator palette information
     _separator = new PaletteSeparatorPadding(inheritSeparator, inheritMetric, needPaint);
 }
        /// <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;
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Initialize a new instance of the ViewDrawButton class.
 /// </summary>
 /// <param name="paletteDisabled">Palette source for the disabled state.</param>
 /// <param name="paletteNormal">Palette source for the normal state.</param>
 /// <param name="paletteTracking">Palette source for the tracking state.</param>
 /// <param name="palettePressed">Palette source for the pressed state.</param>
 /// <param name="paletteMetric">Palette source for metric values.</param>
 /// <param name="buttonValues">Source for content values.</param>
 /// <param name="orientation">Visual orientation of the content.</param>
 /// <param name="useMnemonic">Use mnemonics.</param>
 public ViewDrawButton(IPaletteTriple paletteDisabled,
                       IPaletteTriple paletteNormal,
                       IPaletteTriple paletteTracking,
                       IPaletteTriple palettePressed,
                       IPaletteMetric paletteMetric,
                       IContentValues buttonValues,
                       VisualOrientation orientation,
                       bool useMnemonic)
     : this(paletteDisabled, paletteNormal, paletteTracking, palettePressed,
            paletteNormal, paletteTracking, palettePressed, paletteMetric,
            buttonValues, orientation, useMnemonic)
 {
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Initialize a new instance of the ViewLayoutCenter class.
        /// </summary>
        /// <param name="paletteMetric">Target for recovering metric values.</param>
        /// <param name="metricPadding">Metric to use for border padding.</param>
        /// <param name="orientation">Orientation of the element.</param>
        /// <param name="childElement">Optional element to add as child.</param>
        public ViewLayoutCenter(IPaletteMetric paletteMetric,
                                PaletteMetricPadding metricPadding,
                                VisualOrientation orientation,
                                ViewBase childElement)
        {
            // Remember provided values
            _paletteMetric = paletteMetric;
            _metricPadding = metricPadding;
            _orientation = orientation;

            if (childElement != null)
                Add(childElement);
        }
        /// <summary>
        /// Initialize a new instance of the PaletteSeparatorPadding class.
        /// </summary>
        /// <param name="inheritDouble">Source for inheriting border and background values.</param>
        /// <param name="inheritMetric">Source for inheriting metric values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteSeparatorPadding(IPaletteDouble inheritDouble,
                                       IPaletteMetric inheritMetric,
                                       NeedPaintHandler needPaint)
            : base(inheritDouble, needPaint)
        {
            Debug.Assert(inheritDouble != null);
            Debug.Assert(inheritMetric != null);

            // Remember the inheritance
            _inherit = inheritMetric;

            // Set default value for padding property
            _separatorPadding = CommonHelper.InheritPadding;
        }
 /// <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 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)
 {
 }
Ejemplo n.º 15
0
 /// <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 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)
 {
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Initialize a new instance of the PaletteHeaderGroup class.
        /// </summary>
        /// <param name="inheritHeaderGroup">Source for inheriting palette defaulted values.</param>
        /// <param name="inheritHeaderPrimary">Source for inheriting primary header defaulted values.</param>
        /// <param name="inheritHeaderSecondary">Source for inheriting secondary header defaulted values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteHeaderGroup(PaletteHeaderGroupRedirect inheritHeaderGroup,
                                  PaletteHeaderPaddingRedirect inheritHeaderPrimary,
                                  PaletteHeaderPaddingRedirect inheritHeaderSecondary,
                                  NeedPaintHandler needPaint)
            : base(inheritHeaderGroup, needPaint)
        {
            Debug.Assert(inheritHeaderGroup != null);
            Debug.Assert(inheritHeaderPrimary != null);
            Debug.Assert(inheritHeaderSecondary != null);

            // Remember the inheritance
            _inherit = inheritHeaderGroup;

            // Create the palette storage
            _paletteHeaderPrimary = new PaletteTripleMetric(inheritHeaderPrimary, needPaint);
            _paletteHeaderSecondary = new PaletteTripleMetric(inheritHeaderSecondary, needPaint);
        }
Ejemplo n.º 18
0
        /// <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>
 /// 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;
 }
Ejemplo n.º 20
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawMonthUpDown class.
        /// </summary>
        /// <param name="paletteState">Palette source for states.</param>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="buttonValues">Source for content values.</param>
        /// <param name="glyph">Glyph to be drawn.</param>
        /// <param name="needPaintHandler">Delegate for requests repainting.</param>
        public ViewDrawMonthUpDown(IPaletteTriple paletteState,
                                   IPaletteMetric paletteMetric,
                                   IContentValues buttonValues,
                                   DrawMonthCalendarGlyph glyph,
                                   NeedPaintHandler needPaintHandler)
            : base(paletteState, paletteState, paletteState, paletteState, 
                   paletteMetric, buttonValues, VisualOrientation.Top, false)
        {
            _glyph = glyph;

            // Assign a controller to handle visual interaction
            _controller = new ButtonController(this, needPaintHandler);
            _controller.Click += new MouseEventHandler(OnButtonClick);
            _controller.MouseSelect += new MouseEventHandler(OnButtonMouseSelect);
            _controller.Repeat = true;
            _controller.ClickOnDown = true;
            MouseController = _controller;
        }
Ejemplo n.º 21
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;
 }
Ejemplo n.º 22
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawSplitCanvas class.
        /// </summary>
        /// <param name="paletteBack">Palette source for the background.</param>		
        /// <param name="paletteBorder">Palette source for the border.</param>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="metricPadding">Matric used to get padding values.</param>
        /// <param name="orientation">Visual orientation of the content.</param>
        public ViewDrawSplitCanvas(IPaletteBack paletteBack,
							       IPaletteBorder paletteBorder,
							       IPaletteMetric paletteMetric,
							       PaletteMetricPadding metricPadding,
							       VisualOrientation orientation)
        {
            // Cache the starting values
            _paletteBorder = paletteBorder;
            _paletteBack = paletteBack;
            _paletteBackDraw = new PaletteBackInheritForced(_paletteBack);
            _paletteBackDraw.ForceDraw = InheritBool.True;
            _paletteBackLight = new PaletteBackLightenColors(_paletteBack);
            _paletteMetric = paletteMetric;
            _paletteBorderNormal = paletteBorder;
            _paletteBackNormal = paletteBack;
            _metricPadding = metricPadding;
            _orientation = orientation;
            _drawTabBorder = false;
            _drawCanvas = true;
            _splitter = false;
        }
 /// <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 ViewDrawButton class.
        /// </summary>
        /// <param name="dateTimePicker">Owning control.</param>
        /// <param name="paletteState">Palette source for states.</param>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="buttonValues">Source for content values.</param>
        /// <param name="glyph">Glyph to be drawn.</param>
        /// <param name="needPaintHandler">Delegate for requests repainting.</param>
        /// <param name="repeat">Should button repeat.</param>
        public ViewDrawDateTimeButton(KryptonDateTimePicker dateTimePicker,
                                      IPaletteTriple paletteState,
                                      IPaletteMetric paletteMetric,
                                      IContentValues buttonValues,
                                      DrawDateTimeGlyph glyph,
                                      NeedPaintHandler needPaintHandler,
                                      bool repeat)
            : base(paletteState, paletteState, paletteState, paletteState, 
                   paletteMetric, buttonValues, VisualOrientation.Top, false)
        {
            _dateTimePicker = dateTimePicker;
            _glyph = glyph;

            // Assign a controller to handle visual interaction
            _controller = new ButtonController(this, needPaintHandler);
            _controller.BecomesFixed = !repeat;
            _controller.Click += new MouseEventHandler(OnButtonClick);
            _controller.MouseSelect += new MouseEventHandler(OnButtonMouseSelect);
            _controller.Repeat = repeat;
            _controller.ClickOnDown = true;
            MouseController = _controller;
        }
Ejemplo n.º 25
0
        /// <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;
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawButton class.
        /// </summary>
        /// <param name="dateTimePicker">Owning control.</param>
        /// <param name="paletteState">Palette source for states.</param>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="buttonValues">Source for content values.</param>
        /// <param name="glyph">Glyph to be drawn.</param>
        /// <param name="needPaintHandler">Delegate for requests repainting.</param>
        /// <param name="repeat">Should button repeat.</param>
        public ViewDrawDateTimeButton(KryptonDateTimePicker dateTimePicker,
                                      IPaletteTriple paletteState,
                                      IPaletteMetric paletteMetric,
                                      IContentValues buttonValues,
                                      DrawDateTimeGlyph glyph,
                                      NeedPaintHandler needPaintHandler,
                                      bool repeat)
            : base(paletteState, paletteState, paletteState, paletteState,
                   paletteMetric, buttonValues, VisualOrientation.Top, false)
        {
            _dateTimePicker = dateTimePicker;
            _glyph          = glyph;

            // Assign a controller to handle visual interaction
            _controller = new ButtonController(this, needPaintHandler)
            {
                BecomesFixed = !repeat
            };
            _controller.Click       += OnButtonClick;
            _controller.MouseSelect += OnButtonMouseSelect;
            _controller.Repeat       = repeat;
            _controller.ClickOnDown  = true;
            MouseController          = _controller;
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Gets a boolean metric value.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <param name="metric">Requested metric.</param>
        /// <returns>InheritBool value.</returns>
        public override InheritBool GetMetricBool(PaletteState state, PaletteMetricBool metric)
        {
            IPaletteMetric inherit = GetInherit(state);

            return(inherit?.GetMetricBool(state, metric) ?? Target.GetMetricBool(state, metric));
        }
Ejemplo n.º 28
0
 /// <summary>
 /// Sets the inheritence parent.
 /// </summary>
 /// <param name="inheritHeader">Source for inheriting.</param>
 public void SetInherit(PaletteForm inheritHeader)
 {
     base.SetInherit(inheritHeader);
     _inherit = inheritHeader;
     _paletteHeader.SetInherit(inheritHeader.Header);
 }
        /// <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 += 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)
            {
                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);
        }
Ejemplo n.º 30
0
 /// <summary>
 /// Initialize a new instance of the ViewLayoutCenter class.
 /// </summary>
 /// <param name="paletteMetric">Target for recovering metric values.</param>
 /// <param name="metricPadding">Metric to use for border padding.</param>
 /// <param name="orientation">Orientation of the element.</param>
 public ViewLayoutCenter(IPaletteMetric paletteMetric,
                         PaletteMetricPadding metricPadding,
                         VisualOrientation orientation)
     : this(paletteMetric, metricPadding, orientation, null)
 {
 }
Ejemplo n.º 31
0
 /// <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>
 /// Create the button spec view appropriate for the button spec.
 /// </summary>
 /// <param name="redirector">Redirector for acquiring palette values.</param>
 /// <param name="viewPaletteMetric">Target metric providers.</param>
 /// <param name="viewMetricPadding">Target metric padding.</param>
 /// <param name="buttonSpec">ButtonSpec instance.</param>
 /// <returns>ButtonSpecView derived class.</returns>
 protected override ButtonSpecView CreateButtonSpecView(PaletteRedirect redirector,
                                                        IPaletteMetric viewPaletteMetric,
                                                        PaletteMetricPadding viewMetricPadding,
                                                        ButtonSpec buttonSpec) =>
 new ButtonSpecViewRibbon(redirector, viewPaletteMetric,
                          viewMetricPadding, this, buttonSpec);
Ejemplo n.º 33
0
        /// <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>
 /// Create the button spec view appropriate for the button spec.
 /// </summary>
 /// <param name="redirector">Redirector for acquiring palette values.</param>
 /// <param name="viewPaletteMetric">Target metric providers.</param>
 /// <param name="viewMetricPadding">Target metric padding.</param>
 /// <param name="buttonSpec">ButtonSpec instance.</param>
 /// <returns>ButtonSpecView derived class.</returns>
 protected virtual ButtonSpecView CreateButtonSpecView(PaletteRedirect redirector,
                                                       IPaletteMetric viewPaletteMetric,
                                                       PaletteMetricPadding viewMetricPadding,
                                                       ButtonSpec buttonSpec) =>
 /// <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;
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Reset the redirection states to null.
 /// </summary>
 public void ResetRedirectStates()
 {
     _disabled = null;
     _normal   = null;
 }
Ejemplo n.º 37
0
        /// <summary>
        /// Gets a padding metric value.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <param name="metric">Requested metric.</param>
        /// <returns>Padding value.</returns>
        public override Padding GetMetricPadding(PaletteState state, PaletteMetricPadding metric)
        {
            IPaletteMetric inherit = GetInherit(state);

            return(inherit?.GetMetricPadding(state, metric) ?? Target.GetMetricPadding(state, metric));
        }
Ejemplo n.º 38
0
 /// <summary>
 /// Updates the metrics source and metric to use.
 /// </summary>
 /// <param name="paletteMetric">Source for aquiring metrics.</param>
 public void SetMetrics(IPaletteMetric paletteMetric)
 {
     _paletteMetric = paletteMetric;
 }
        /// <summary>
        /// Initialize a new instance of the ViewDrawButton class.
        /// </summary>
        /// <param name="paletteDisabled">Palette source for the disabled state.</param>
        /// <param name="paletteNormal">Palette source for the normal state.</param>
        /// <param name="paletteTracking">Palette source for the tracking state.</param>
        /// <param name="palettePressed">Palette source for the pressed state.</param>
        /// <param name="paletteCheckedNormal">Palette source for the normal checked state.</param>
        /// <param name="paletteCheckedTracking">Palette source for the tracking checked state.</param>
        /// <param name="paletteCheckedPressed">Palette source for the pressed checked state.</param>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="buttonValues">Source for content values.</param>
        /// <param name="orientation">Visual orientation of the content.</param>
        /// <param name="useMnemonic">Use mnemonics.</param>
        public ViewDrawButton(IPaletteTriple paletteDisabled,
                              IPaletteTriple paletteNormal,
                              IPaletteTriple paletteTracking,
                              IPaletteTriple palettePressed,
                              IPaletteTriple paletteCheckedNormal,
                              IPaletteTriple paletteCheckedTracking,
                              IPaletteTriple paletteCheckedPressed,
                              IPaletteMetric paletteMetric,
                              IContentValues buttonValues,
                              VisualOrientation orientation,
                              bool useMnemonic)
        {
            // Remember the source information
            _paletteDisabled        = paletteDisabled;
            _paletteNormal          = paletteNormal;
            _paletteTracking        = paletteTracking;
            _palettePressed         = palettePressed;
            _paletteCheckedNormal   = paletteCheckedNormal;
            _paletteCheckedTracking = paletteCheckedTracking;
            _paletteCheckedPressed  = paletteCheckedPressed;
            CurrentPalette          = _paletteNormal;

            // Default to not being checked
            Checked           = false;
            AllowUncheck      = true;
            _dropDown         = false;
            _splitter         = false;
            _dropDownPosition = VisualOrientation.Right;

            // Create the drop down view
            _drawDropDown       = new ViewLayoutCenter(1);
            _drawDropDownButton = new ViewDrawDropDownButton();
            _drawDropDown.Add(_drawDropDownButton);
            _drawOuterSeparator = new ViewLayoutSeparator(1);

            // Create the view used to draw the split edge
            _edgeRedirect    = new PaletteBorderEdgeRedirect(_paletteNormal.PaletteBorder, null);
            _drawSplitBorder = new ViewDrawBorderEdge(new PaletteBorderEdge(_edgeRedirect, null), CommonHelper.VisualToOrientation(orientation));

            // Our view contains background and border with content inside
            _drawContent = new ViewDrawContent(_paletteNormal.PaletteContent, buttonValues, orientation);
            _drawCanvas  = new ViewDrawSplitCanvas(_paletteNormal.PaletteBack, _paletteNormal.PaletteBorder, paletteMetric, PaletteMetricPadding.None, orientation);

            // Use a docker layout to organize the contents of the canvas
            LayoutDocker = new ViewLayoutDocker
            {
                { _drawContent, ViewDockStyle.Fill },
                { _drawSplitBorder, ViewDockStyle.Right },
                { _drawDropDown, ViewDockStyle.Right },
                { _drawOuterSeparator, ViewDockStyle.Right }
            };
            LayoutDocker.Tag = this;

            // Pass the mnemonic default to the content view
            _drawContent.UseMnemonic = useMnemonic;

            // Place the content inside the canvas
            _drawCanvas.Add(LayoutDocker);

            // Set initial view element visible states
            UpdateDropDown();

            // Place the canvas inside ourself
            Add(_drawCanvas);
        }
Ejemplo n.º 40
0
 /// <summary>
 /// Set the redirection states.
 /// </summary>
 /// <param name="disableMetric">Redirection for disabled metric requests.</param>
 /// <param name="normalMetric">Redirection for normal metric requests.</param>
 public void SetRedirectStates(IPaletteMetric disableMetric,
                               IPaletteMetric normalMetric)
 {
     _disabled = disableMetric;
     _normal   = normalMetric;
 }
        /// <summary>
        /// Reset the redirection states to null.
        /// </summary>
        public override void ResetRedirectStates()
        {
            base.ResetRedirectStates();

            _disabled = null;
            _normal = null;
        }
Ejemplo n.º 42
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));
        }
        /// <summary>
        /// Set the redirection states.
        /// </summary>
        /// <param name="disabled">Redirection for disabled state requests.</param>
        /// <param name="disableMetric">Redirection for disabled metric requests.</param>
        /// <param name="normal">Redirection for normal state requests.</param>
        /// <param name="normalMetric">Redirection for normal metric requests.</param>
        public void SetRedirectStates(IPaletteTriple disabled,
                                      IPaletteMetric disableMetric,
                                      IPaletteTriple normal,
                                      IPaletteMetric normalMetric)
        {
            base.SetRedirectStates(disabled, normal);

            _disabled = disableMetric;
            _normal = normalMetric;
        }
 /// <summary>
 /// Updates the metrics source and metric to use.
 /// </summary>
 /// <param name="paletteMetric">Source for aquiring metrics.</param>
 public void SetMetrics(IPaletteMetric paletteMetric)
 {
     _paletteMetric = paletteMetric;
 }
        /// <summary>
        /// Set the redirection states.
        /// </summary>
        /// <param name="disabled">Redirection for disabled state requests.</param>
        /// <param name="disableMetric">Redirection for disabled metric requests.</param>
        /// <param name="normal">Redirection for normal state requests.</param>
        /// <param name="normalMetric">Redirection for normal metric requests.</param>
        public void SetRedirectStates(IPaletteDouble disabled,
                                      IPaletteMetric disableMetric,
                                      IPaletteDouble normal,
                                      IPaletteMetric normalMetric)
        {
            base.SetRedirectStates(disabled, normal);

            _disabled = disableMetric;
            _normal = normalMetric;
            _pressed = null;
            _tracking = null;
        }
Ejemplo n.º 46
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>
        /// Set the redirection states.
        /// </summary>
        /// <param name="disabled">Redirection for disabled state requests.</param>
        /// <param name="disableMetric">Redirection for disabled metric requests.</param>
        /// <param name="normal">Redirection for normal state requests.</param>
        /// <param name="normalMetric">Redirection for normal metric requests.</param>
        /// <param name="pressed">Redirection for pressed state requests.</param>
        /// <param name="pressedMetric">Redirection for pressed metric requests.</param>
        /// <param name="tracking">Redirection for tracking state requests.</param>
        /// <param name="trackingMetric">Redirection for tracking metric requests.</param>
        public void SetRedirectStates(IPaletteDouble disabled,
                                      IPaletteMetric disableMetric,
                                      IPaletteDouble normal,
                                      IPaletteMetric normalMetric,
                                      IPaletteDouble pressed,
                                      IPaletteMetric pressedMetric,
                                      IPaletteDouble tracking,
                                      IPaletteMetric trackingMetric)
        {
            base.SetRedirectStates(disabled, normal, pressed, tracking);

            _disabled = disableMetric;
            _normal = normalMetric;
            _pressed = pressedMetric;
            _tracking = trackingMetric;
        }
        /// <summary>
        /// Initialize a new instance of the ButtonSpecView class.
        /// </summary>
        /// <param name="redirector">Palette redirector.</param>
        /// <param name="paletteMetric">Source for metric values.</param>
        /// <param name="metricPadding">Padding metric for border padding.</param>
        /// <param name="manager">Reference to owning manager.</param>
        /// <param name="buttonSpec">Access</param>
        public ButtonSpecView(PaletteRedirect redirector,
                              IPaletteMetric paletteMetric,
                              PaletteMetricPadding metricPadding,
                              ButtonSpecManagerBase manager,
                              ButtonSpec buttonSpec)
        {
            Debug.Assert(redirector != null);
            Debug.Assert(manager != null);
            Debug.Assert(buttonSpec != null);

            // Remember references
            _redirector     = redirector;
            Manager         = manager;
            ButtonSpec      = buttonSpec;
            _finishDelegate = OnFinishDelegate;

            // Create delegate for paint notifications
            NeedPaintHandler needPaint = OnNeedPaint;

            // Intercept calls from the button for color remapping and instead use
            // the button spec defined map and the container foreground color
            RemapPalette = Manager.CreateButtonSpecRemap(redirector, buttonSpec);

            // Use a redirector to get button values directly from palette
            _palette = new PaletteTripleRedirect(RemapPalette,
                                                 PaletteBackStyle.ButtonButtonSpec,
                                                 PaletteBorderStyle.ButtonButtonSpec,
                                                 PaletteContentStyle.ButtonButtonSpec,
                                                 needPaint);


            // Create the view for displaying a button
            ViewButton = new ViewDrawButton(_palette, _palette, _palette, _palette,
                                            paletteMetric, this, VisualOrientation.Top, false);

            // Associate the view with the source component (for design time support)
            if (buttonSpec.AllowComponent)
            {
                ViewButton.Component = buttonSpec;
            }

            // Use a view center to place button in centre of given space
            ViewCenter = new ViewLayoutCenter(paletteMetric, metricPadding, VisualOrientation.Top)
            {
                ViewButton
            };

            // Create a controller for managing button behavior
            ButtonSpecViewControllers controllers = CreateController(ViewButton, needPaint, OnClick);

            ViewButton.MouseController  = controllers.MouseController;
            ViewButton.SourceController = controllers.SourceController;
            ViewButton.KeyController    = controllers.KeyController;

            // We need notifying whenever a button specification property changes
            ButtonSpec.ButtonSpecPropertyChanged += OnPropertyChanged;

            // Associate the button spec with the view that is drawing it
            ButtonSpec.SetView(ViewButton);

            // Finally update view with current button spec settings
            UpdateButtonStyle();
            UpdateVisible();
            UpdateEnabled();
            UpdateChecked();
        }
Ejemplo n.º 49
0
 /// <summary>
 /// Initialize a new instance of the PaletteSplitContainer class.
 /// </summary>
 /// <param name="inheritSplitContainer">Source for inheriting back/border defaulted values.</param>
 /// <param name="inheritSeparator">Source for inheriting separator defaulted values.</param>
 /// <param name="inheritMetric">Source for inheriting separator metric values.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteSplitContainer(IPaletteDouble inheritSplitContainer,
                              IPaletteDouble inheritSeparator,
                              IPaletteMetric inheritMetric,
                              NeedPaintHandler needPaint)
     : base(inheritSplitContainer, needPaint) =>