Exemple #1
0
        /*
         * InterfaceNode Methods
         */

        public override void AddComponents(ContainerCIO container, LayoutVariables vars)
        {
            Container = container;
            ((InterfaceNode)_panels[0]).AddComponents(_panel, vars);

            this.CalculateMinimumSize(vars);
            this.CalculatePreferredSize(vars);
        }
Exemple #2
0
        /*
         * Member Methods
         */

        public override void AddComponents(ContainerCIO container, LayoutVariables vars)
        {
            ControlBasedCIO stateCIO = (ControlBasedCIO)_CIOs[COMPONENT_INDEX];

            container.AddCIO(stateCIO);

            _maxTextOffset = stateCIO.GetControlOffset().Y;
            this.CalculateMinimumSize(vars);
            this.CalculatePreferredSize(vars);
        }
Exemple #3
0
        /*
         * Constructor
         */

        public InterfaceNode()
        {
            _container = null;

            _bounds = new System.Drawing.Rectangle(0, 0, 0, 0);
            _parent = null;

            _minSize  = new System.Drawing.Size(0, 0);
            _prefSize = null;
        }
Exemple #4
0
        /*
         * Member Methods
         */

        public override void AddComponents(ContainerCIO container)
        {
            LabelCIO       labelCIO1 = (LabelCIO)_CIOs[LABEL1_INDEX];
            StateLinkedCIO stateCIO1 = (StateLinkedCIO)_CIOs[COMPONENT1_INDEX];
            LabelCIO       labelCIO2 = (LabelCIO)_CIOs[LABEL2_INDEX];
            StateLinkedCIO stateCIO2 = (StateLinkedCIO)_CIOs[COMPONENT2_INDEX];

            container.AddCIO(labelCIO1);
            container.AddCIO(stateCIO1);
            container.AddCIO(labelCIO2);
            container.AddCIO(stateCIO2);
        }
Exemple #5
0
        public override void DoLayout(ContainerCIO container, LayoutVariables vars)
        {
            ControlBasedCIO stateCIO = (ControlBasedCIO)_CIOs[COMPONENT_INDEX];

            System.Windows.Forms.Control control = stateCIO.GetControl();
            control.Bounds = this.GetBounds();

            if (stateCIO is LabelLinkedCIO)
            {
                ((Label)control).TextAlign = System.Drawing.ContentAlignment.TopCenter;
            }
        }
Exemple #6
0
        public override int DoLayout(ContainerCIO container, int topY, LayoutVariables vars)
        {
            LabelCIO       labelCIO1 = (LabelCIO)_CIOs[LABEL1_INDEX];
            StateLinkedCIO stateCIO1 = (StateLinkedCIO)_CIOs[COMPONENT1_INDEX];
            LabelCIO       labelCIO2 = (LabelCIO)_CIOs[LABEL2_INDEX];
            StateLinkedCIO stateCIO2 = (StateLinkedCIO)_CIOs[COMPONENT2_INDEX];

            System.Windows.Forms.Label label = (Label)labelCIO1.GetControl();
            Control control = stateCIO1.GetControl();

            System.Drawing.Size prefSize1 = stateCIO1.GetPreferredSize();
            System.Drawing.Size prefSize2 = stateCIO2.GetPreferredSize();

            int rowHeight      = Math.Max(prefSize1.Height, prefSize2.Height);
            int columnWidth    = (container.InternalSize.Width - 3 * vars.RowPadding) / 2;
            int col1LabelWidth = (int)Math.Round(columnWidth * vars.TwoColLabel1Pcnt);
            int col1CompWidth  = columnWidth - col1LabelWidth;
            int col2LabelWidth = (int)Math.Round(columnWidth * vars.TwoColLabel2Pcnt);
            int col2CompWidth  = columnWidth = col2LabelWidth;

            control          = stateCIO1.GetControl();
            control.Size     = new System.Drawing.Size(col1CompWidth, rowHeight);
            control.Location = new System.Drawing.Point(col1LabelWidth + 2 * vars.RowPadding,
                                                        topY - stateCIO1.GetControlOffset().Y);

            if (labelCIO1 != null)
            {
                label           = (Label)labelCIO1.GetControl();
                label.TextAlign = System.Drawing.ContentAlignment.TopRight;
                label.Size      = new System.Drawing.Size(col1LabelWidth, rowHeight);
                label.Location  = new System.Drawing.Point(vars.RowPadding,
                                                           topY - labelCIO1.GetControlOffset().Y);
                labelCIO1.SetLabelText();
            }

            control          = stateCIO2.GetControl();
            control.Size     = new System.Drawing.Size(col2CompWidth, rowHeight);
            control.Location = new System.Drawing.Point(columnWidth + col2LabelWidth + 3 * vars.RowPadding,
                                                        topY - stateCIO2.GetControlOffset().Y);

            if (labelCIO2 != null)
            {
                label           = (Label)labelCIO2.GetControl();
                label.TextAlign = System.Drawing.ContentAlignment.TopRight;
                label.Size      = new System.Drawing.Size(col2LabelWidth, rowHeight);
                label.Location  = new System.Drawing.Point(columnWidth + 2 * vars.RowPadding,
                                                           topY - labelCIO2.GetControlOffset().Y);
                labelCIO2.SetLabelText();
            }

            return(1);
        }
        public override void AddComponents(ContainerCIO container, LayoutVariables vars)
        {
            Container = container;
            Container.AddCIO(_tabbedPanel);

            IEnumerator e = _panels.GetEnumerator();

            while (e.MoveNext())
            {
                ((InterfaceNode)e.Current).AddComponents(container, vars);
            }

            this.CalculateMinimumSize(vars);
            this.CalculatePreferredSize(vars);
        }
Exemple #8
0
        /*
         * Member Methods
         */

        public override void AddComponents(ContainerCIO container, LayoutVariables vars)
        {
            LabelCIO        labelCIO = (LabelCIO)_CIOs[LABEL_INDEX];
            ControlBasedCIO stateCIO = (ControlBasedCIO)_CIOs[COMPONENT_INDEX];

            container.AddCIO(labelCIO);
            container.AddCIO(stateCIO);

            if (labelCIO != null)
            {
                _maxTextOffset = Math.Max(labelCIO.GetControlOffset().Y, stateCIO.GetControlOffset().Y);
            }
            else
            {
                _maxTextOffset = stateCIO.GetControlOffset().Y;
            }

            this.CalculateMinimumSize(vars);
            this.CalculatePreferredSize(vars);
        }
Exemple #9
0
        /*
         * Member Methods
         */

        public override void AddComponents(ContainerCIO container, LayoutVariables vars)
        {
            LabelCIO       labelCIO  = (LabelCIO)_CIOs[LABEL_INDEX];
            StateLinkedCIO stateCIO1 = (StateLinkedCIO)_CIOs[COMPONENT1_INDEX];
            StateLinkedCIO stateCIO2 = (StateLinkedCIO)_CIOs[COMPONENT2_INDEX];

            if (labelCIO != null)
            {
                container.AddCIO(labelCIO);
            }

            container.AddCIO(stateCIO1);
            container.AddCIO(stateCIO2);

            _maxTextOffset = Math.Max(stateCIO1.GetControlOffset().Y, stateCIO2.GetControlOffset().Y);

            if (labelCIO != null)
            {
                _maxTextOffset = Math.Max(labelCIO.GetControlOffset().Y, _maxTextOffset);
            }

            this.CalculateMinimumSize(vars);
            this.CalculatePreferredSize(vars);
        }
Exemple #10
0
        /*
         * Abstract Methods
         */

        public abstract void AddComponents(ContainerCIO container, LayoutVariables vars);
Exemple #11
0
        public override void DoLayout(ContainerCIO container, LayoutVariables vars)
        {
            LabelCIO       labelCIO  = (LabelCIO)_CIOs[LABEL_INDEX];
            StateLinkedCIO stateCIO1 = (StateLinkedCIO)_CIOs[COMPONENT1_INDEX];
            StateLinkedCIO stateCIO2 = (StateLinkedCIO)_CIOs[COMPONENT2_INDEX];

            System.Windows.Forms.Label label = null;

            if (labelCIO != null)
            {
                label = (Label)labelCIO.GetControl();
            }

            Control control1 = stateCIO1.GetControl();
            Control control2 = stateCIO2.GetControl();

            if (_parent.IsVertical())
            {
                int[] minHeights  = null;
                int[] prefHeights = null;
                int[] heights     = null;

                if (labelCIO != null)
                {
                    labelCIO.UseMinimumLabel();
                    labelCIO.SetAlignment(System.Drawing.ContentAlignment.TopCenter);

                    // determine size allocations based on bounds, and minimum and preferred sizes
                    // Height is the dimension to allocate in this case
                    minHeights = new int[3] {
                        labelCIO.GetMinimumSize().Height,
                                                  stateCIO1.GetMinimumSize().Height,
                                                  stateCIO2.GetMinimumSize().Height
                    };
                    prefHeights = new int[3] {
                        labelCIO.GetPreferredSize().Height,
                                                    stateCIO1.GetPreferredSize().Height,
                                                    stateCIO2.GetPreferredSize().Height
                    };

                    heights =
                        LayoutAlgorithms.AllocateSizeValues(_bounds.Height, minHeights, prefHeights, vars.RowPadding);

                    label.Size     = new System.Drawing.Size(_bounds.Width, heights[0]);
                    label.Location = new System.Drawing.Point(_bounds.X, _bounds.Y);
                    labelCIO.SetLabelText();
                }
                else
                {
                    minHeights = new int[3] {
                        0,
                        stateCIO1.GetMinimumSize().Height,
                        stateCIO2.GetMinimumSize().Height
                    };
                    prefHeights = new int[3] {
                        0,
                        stateCIO1.GetPreferredSize().Height,
                        stateCIO2.GetPreferredSize().Height
                    };

                    heights =
                        LayoutAlgorithms.AllocateSizeValues(_bounds.Height, minHeights, prefHeights, vars.RowPadding);
                }

                control1.Size     = new System.Drawing.Size(_bounds.Width, heights[1]);
                control1.Location = new System.Drawing.Point(_bounds.X, label.Size.Height + label.Location.Y + vars.RowPadding);

                if (stateCIO1 is LabelLinkedCIO)
                {
                    ((Label)control1).TextAlign = System.Drawing.ContentAlignment.TopCenter;
                }

                control2.Size     = new System.Drawing.Size(_bounds.Width, heights[2]);
                control2.Location = new System.Drawing.Point(_bounds.X, control1.Size.Height + control1.Location.Y + vars.RowPadding);

                if (stateCIO2 is LabelLinkedCIO)
                {
                    ((Label)control2).TextAlign = System.Drawing.ContentAlignment.TopCenter;
                }
            }
            else
            {
                int labelWidth = (int)Math.Round(vars.OneColLabelPcnt * (_bounds.Width - vars.RowPadding));
                int compWidth  = (_bounds.Width - labelWidth) / 2 - vars.RowPadding;

                int[] textOffsets =
                    LayoutAlgorithms.GetTextHeightOffsets(LayoutAlgorithms.GetArrayFromArrayList(_CIOs));

                if (labelCIO != null)
                {
                    label.TextAlign = System.Drawing.ContentAlignment.TopRight;
                    label.Size      = new System.Drawing.Size(labelWidth, _bounds.Height);
                    label.Location  = new System.Drawing.Point(_bounds.X, _bounds.Y + textOffsets[0]);
                    labelCIO.SetLabelText();
                }

                control1.Size     = new System.Drawing.Size(compWidth, _bounds.Height);
                control1.Location = new System.Drawing.Point(_bounds.X + labelWidth + vars.RowPadding,
                                                             _bounds.Y + textOffsets[1]);

                control2.Size     = new System.Drawing.Size(compWidth, _bounds.Height);
                control2.Location = new System.Drawing.Point(control1.Location.X + compWidth + vars.RowPadding,
                                                             _bounds.Y + textOffsets[2]);
            }
        }
Exemple #12
0
        /*
         * Constructor
         */

        public TabPanelNode(TabbedPanelCIO cio, GroupNode g)
        {
            _panel = cio;
            AddPanel(new PanelNode(g));
        }
Exemple #13
0
 public abstract void DoLayout(ContainerCIO container,
                               LayoutVariables vars);
Exemple #14
0
        public override void DoLayout(ContainerCIO container, LayoutVariables vars)
        {
            LabelCIO        labelCIO = (LabelCIO)_CIOs[LABEL_INDEX];
            ControlBasedCIO stateCIO = (ControlBasedCIO)_CIOs[COMPONENT_INDEX];

            System.Windows.Forms.Label label = null;
            Control control = stateCIO.GetControl();
            int     topY    = 0;

            if (_parent.IsVertical())
            {
                if (labelCIO != null)
                {
                    labelCIO.UseMinimumLabel();
                    label = (Label)labelCIO.GetControl();
                    labelCIO.SetAlignment(System.Drawing.ContentAlignment.TopCenter);
                    label.Size     = new System.Drawing.Size(_bounds.Width, labelCIO.GetMinimumSize().Height);
                    label.Location = new System.Drawing.Point(_bounds.X, _bounds.Y);
                    labelCIO.SetLabelText();

                    topY = label.Size.Height + vars.RowPadding;
                }

                if (stateCIO is LabelLinkedCIO)
                {
                    ((Label)control).TextAlign = System.Drawing.ContentAlignment.TopCenter;
                }

                int[] size = LayoutAlgorithms.AllocateSizeValues(
                    _bounds.Height - topY,
                    new int[1] {
                    stateCIO.GetMinimumSize().Height
                },
                    new int[1] {
                    stateCIO.GetPreferredSize().Height
                },
                    vars.RowPadding);

                control.Size     = new System.Drawing.Size(_bounds.Width, size[0]);
                control.Location = new System.Drawing.Point(_bounds.X, _bounds.Y + topY);
            }
            else
            {
                int labelWidth = (int)Math.Round(vars.OneColLabelPcnt * (_bounds.Width - vars.RowPadding));
                int compWidth  = _bounds.Width - labelWidth - vars.RowPadding;

                int[] textOffsets =
                    LayoutAlgorithms.GetTextHeightOffsets(LayoutAlgorithms.GetArrayFromArrayList(_CIOs));

                control.Size     = new System.Drawing.Size(compWidth, _bounds.Height);
                control.Location = new System.Drawing.Point(_bounds.X + labelWidth + vars.RowPadding,
                                                            _bounds.Y + textOffsets[1]);

                if (labelCIO != null)
                {
                    labelCIO.UseMinimumLabel();
                    label           = (Label)labelCIO.GetControl();
                    label.TextAlign = System.Drawing.ContentAlignment.TopRight;
                    label.Size      = new System.Drawing.Size(labelWidth, _bounds.Height - textOffsets[0]);
                    label.Location  = new System.Drawing.Point(_bounds.X, _bounds.Y + textOffsets[0]);
                    labelCIO.SetLabelText();
                }
            }
        }