Example #1
0
        /// <summary>
        /// Add the spacing views into the indexed docker.
        /// </summary>
        /// <param name="i">Index of docker.</param>
        /// <param name="spacerL">Spacer for the left side.</param>
        /// <param name="spacerR">Spacer for the right side.</param>
        protected override void AddSpacersToDocker(int i,
                                                   ViewLayoutMetricSpacer spacerL,
                                                   ViewLayoutMetricSpacer spacerR)
        {
            // Get the indexed instance
            ViewDrawDocker viewDocker = _viewDockers[i];

            // Add them into the view docker instance
            viewDocker.Add(spacerL, ViewDockStyle.Left);
            viewDocker.Add(spacerR, ViewDockStyle.Right);
        }
        /// <summary>
        /// Perform once only construction.
        /// </summary>
        public void Construct()
        {
            // Only add button spacers if we have metrics to control them
            if (_viewMetrics != null)
            {
                // Add button spacers into each of the view dockers
                for (int i = 0; i < _viewMetrics.Length; i++)
                {
                    // Get access to the matching docker/metrics/metric triple
                    IPaletteMetric   viewMetric           = _viewMetrics[i];
                    PaletteMetricInt viewMetricIntOutside = _viewMetricIntOutside[i];

                    // Create storage for the spacers
                    _viewSpacers[i] = new ListSpacers();

                    // Always create the outside edge spacers
                    ViewLayoutMetricSpacer spacerL1 = new ViewLayoutMetricSpacer(viewMetric, viewMetricIntOutside);
                    ViewLayoutMetricSpacer spacerR1 = new ViewLayoutMetricSpacer(viewMetric, viewMetricIntOutside);
                    spacerL1.Visible = spacerR1.Visible = false;

                    // Add the spacers to the docker instance
                    AddSpacersToDocker(i, spacerL1, spacerR1);

                    // Remember the spacers for future reference
                    _viewSpacers[i].AddRange(new ViewLayoutMetricSpacer[] { spacerL1, spacerR1 });

                    if (UseInsideSpacers)
                    {
                        PaletteMetricInt viewMetricIntInside = _viewMetricIntInside[i];

                        // Create the inside edge spacers
                        ViewLayoutMetricSpacer spacerL2 = new ViewLayoutMetricSpacer(viewMetric, viewMetricIntInside);
                        ViewLayoutMetricSpacer spacerR2 = new ViewLayoutMetricSpacer(viewMetric, viewMetricIntInside);
                        spacerL2.Visible = spacerR2.Visible = false;

                        // Add them into the view docker instance
                        AddSpacersToDocker(i, spacerL2, spacerR2);

                        // Remember the spacers for future reference
                        _viewSpacers[i].AddRange(new ViewLayoutMetricSpacer[] { spacerL2, spacerR2 });
                    }
                }
            }
        }
 /// <summary>
 /// Add the spacing views into the indexed docker.
 /// </summary>
 /// <param name="i">Index of docker.</param>
 /// <param name="spacerL">Spacer for the left side.</param>
 /// <param name="spacerR">Spacer for the right side.</param>
 protected abstract void AddSpacersToDocker(int i, ViewLayoutMetricSpacer spacerL, ViewLayoutMetricSpacer spacerR);