public override void CalculatePreferredSize(LayoutVariables vars)
        {
            IEnumerator e = _panels.GetEnumerator();

            int prefWidth  = 0;
            int prefHeight = 0;

            while (e.MoveNext())
            {
                ((InterfaceNode)e.Current).CalculatePreferredSize(vars);
                PreferredSize size = ((InterfaceNode)e.Current).PreferredSize;

                if (prefWidth == PreferredSize.INFINITE || size.Width == PreferredSize.INFINITE)
                {
                    prefWidth = PreferredSize.INFINITE;
                }
                else
                {
                    prefWidth = Math.Max(size.Width, prefWidth);
                }

                if (prefHeight == PreferredSize.INFINITE || size.Height == PreferredSize.INFINITE)
                {
                    prefHeight = PreferredSize.INFINITE;
                }
                else
                {
                    prefHeight += size.Height;
                }
            }

            _prefSize = new PUC.Layout.PreferredSize(prefWidth, prefHeight);
        }
Exemple #2
0
        public override void CalculatePreferredSize(LayoutVariables vars)
        {
            IEnumerator e = _rows.GetEnumerator();

            int prefWidth  = 0;
            int prefHeight = 0;

            Row lastRow = null;

            while (e.MoveNext())
            {
                ((Row)e.Current).CalculatePreferredSize(vars);

                PreferredSize size = ((Row)e.Current).PreferredSize;

                if (prefWidth == PreferredSize.INFINITE || size.Width == PreferredSize.INFINITE)
                {
                    prefWidth = PreferredSize.INFINITE;
                }
                else
                {
                    prefWidth = Math.Max(size.Width, prefWidth);
                }

                if (prefHeight == PreferredSize.INFINITE || size.Height == PreferredSize.INFINITE)
                {
                    prefHeight = PreferredSize.INFINITE;
                }
                else
                {
                    prefHeight += size.Height;

                    if (lastRow != null)
                    {
                        int baselineSpace = (lastRow.PreferredSize.Height - lastRow.MaximumTextOffset) +
                                            ((Row)e.Current).MaximumTextOffset + vars.RowPadding;

                        if (baselineSpace < vars.BaselineSpacing)
                        {
                            prefHeight += vars.BaselineSpacing - baselineSpace;
                        }
                    }

                    lastRow = (Row)e.Current;
                }
            }

            _prefSize = new PUC.Layout.PreferredSize(prefWidth, prefHeight);
        }
Exemple #3
0
        public override void CalculatePreferredSize(LayoutVariables vars)
        {
            LabelCIO        labelCIO = (LabelCIO)_CIOs[LABEL_INDEX];
            ControlBasedCIO stateCIO = (ControlBasedCIO)_CIOs[COMPONENT_INDEX];

            PreferredSize cioSize = stateCIO.GetPreferredSize();
            int           prefWidth = cioSize.Width, prefHeight = cioSize.Height;

            if (_parent.IsVertical())
            {
                if (labelCIO != null)
                {
                    labelCIO.UseMinimumLabel();
                    PreferredSize labelSize = labelCIO.GetPreferredSize();

                    if (prefHeight != PreferredSize.INFINITE)
                    {
                        prefHeight += labelSize.Height + vars.RowPadding;
                    }

                    if (prefWidth != PreferredSize.INFINITE)
                    {
                        prefWidth = Math.Max(prefWidth, labelSize.Width);
                    }
                }
            }
            else
            {
                if (prefWidth != PreferredSize.INFINITE)
                {
                    prefWidth = vars.RowPadding +
                                (int)Math.Ceiling(prefWidth / (1.0 - vars.OneColLabelPcnt));
                }

                if (labelCIO != null && prefHeight != PreferredSize.INFINITE)
                {
                    prefHeight = Math.Max(labelCIO.GetPreferredSize().Height, prefHeight);
                }
            }

            _prefSize = new PreferredSize(prefWidth, prefHeight);
        }
Exemple #4
0
 void SetSource()
 {
     Control.Source = image.ToWpfScale(ParentScale, PreferredSize.ToEtoSize());
 }
Exemple #5
0
        public override void CalculatePreferredSize(LayoutVariables vars)
        {
            LabelCIO       labelCIO  = (LabelCIO)_CIOs[LABEL_INDEX];
            StateLinkedCIO stateCIO1 = (StateLinkedCIO)_CIOs[COMPONENT1_INDEX];
            StateLinkedCIO stateCIO2 = (StateLinkedCIO)_CIOs[COMPONENT2_INDEX];

            int prefWidth = 0, prefHeight = 0;

            PreferredSize lblSize = new PreferredSize(0, 0);

            if (labelCIO != null)
            {
                labelCIO.UseMinimumLabel();
                lblSize = labelCIO.GetPreferredSize();
            }

            PreferredSize cio1Size = stateCIO1.GetPreferredSize();
            PreferredSize cio2Size = stateCIO2.GetPreferredSize();

            if (lblSize.Height == PreferredSize.INFINITE ||
                cio1Size.Height == PreferredSize.INFINITE ||
                cio2Size.Height == PreferredSize.INFINITE)
            {
                prefHeight = PreferredSize.INFINITE;
            }

            if (lblSize.Width == PreferredSize.INFINITE ||
                cio1Size.Width == PreferredSize.INFINITE ||
                cio2Size.Width == PreferredSize.INFINITE)
            {
                prefWidth = PreferredSize.INFINITE;
            }


            if (_parent.IsVertical())
            {
                if (prefHeight != PreferredSize.INFINITE)
                {
                    prefHeight = lblSize.Height + cio1Size.Height +
                                 cio2Size.Height + 2 * vars.RowPadding;
                }

                if (prefWidth != PreferredSize.INFINITE)
                {
                    prefWidth = Math.Max(lblSize.Width,
                                         Math.Max(cio1Size.Width, cio2Size.Width));
                }
            }
            else
            {
                if (prefHeight != PreferredSize.INFINITE)
                {
                    prefHeight = Math.Max(cio1Size.Height, cio2Size.Height);
                }

                if (prefWidth != PreferredSize.INFINITE)
                {
                    prefWidth =
                        (int)Math.Ceiling((cio1Size.Width + cio2Size.Width + 2 * vars.RowPadding) / (1.0 - vars.OneColLabelPcnt));
                }
            }

            _prefSize = new PUC.Layout.PreferredSize(prefWidth, prefHeight);
        }