/// <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 ButtonSpecManagerBase 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="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 ButtonSpecManagerBase(Control control,
                                     PaletteRedirect redirector,
                                     ButtonSpecCollectionBase variableSpecs,
                                     ButtonSpecCollectionBase fixedSpecs,
                                     IPaletteMetric[] viewMetrics,
                                     PaletteMetricInt[] viewMetricIntOutside,
                                     PaletteMetricInt[] viewMetricIntInside,
                                     PaletteMetricPadding[] viewMetricPaddings,
                                     GetToolStripRenderer getRenderer,
                                     NeedPaintHandler needPaint)
        {
            Debug.Assert(control != null);
            Debug.Assert(redirector != null);
            Debug.Assert(getRenderer != null);

            // Store the provided paint notification delegate
            NeedPaint = needPaint;

            // Remember references
            _control              = control;
            _redirector           = redirector;
            _variableSpecs        = variableSpecs;
            _fixedSpecs           = fixedSpecs;
            _viewMetrics          = viewMetrics;
            _viewMetricIntOutside = viewMetricIntOutside;
            _viewMetricIntInside  = viewMetricIntInside;
            _viewMetricPaddings   = viewMetricPaddings;
            _getRenderer          = getRenderer;

            if (_viewMetrics != null)
            {
                _viewSpacers = new ListSpacers[_viewMetrics.Length];
            }

            // Default state
            _useMnemonic = true;

            // Create the lookup instance
            _specLookup = new ButtonSpecLookup();

            // If there is a variable collection to monitor
            if (_variableSpecs != null)
            {
                // Need to hook into changes in the button collection
                _variableSpecs.Inserted += new EventHandler <ButtonSpecEventArgs>(OnButtonSpecInserted);
                _variableSpecs.Removed  += new EventHandler <ButtonSpecEventArgs>(OnButtonSpecRemoved);
            }
        }
Exemplo n.º 3
0
        /// <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>
        /// 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();
        }