Exemple #1
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 #2
0
        /*
         * Process Method
         */

        public override ConcreteInteractionObject Process(ListItemNode node,
                                                          ConcreteInteractionObject cio,
                                                          UIGenerator ui)
        {
            if (node.Decorations[ItemDecision.DECISION_KEY] == null &&
                node is CIOListItemNode &&
                cio is ScrollingPanelCIO)
            {
                // the item node represents an appliance object and it will be
                // placed on the ScrollingPanelCIO
                CIOListItemNode   item  = (CIOListItemNode)node;
                ScrollingPanelCIO panel = (ScrollingPanelCIO)cio;
                LabelDictionary   labels;
                if (item.CIO is StateLinkedCIO)
                {
                    labels = ((ApplianceState)((StateLinkedCIO)item.CIO).GetApplObj()).Labels;
                }
                else if (item.CIO is SmartCIO)
                {
                    labels = ((SmartCIO)item.CIO).Labels;
                }

                // get information about the bottom of the current
                // panel's layout
                PanelLayoutDecision panelDecision =
                    (PanelLayoutDecision)node.Parent.Decorations[PanelLayoutDecision.DECISION_KEY];

                if (panelDecision == null)
                {
                    // make one
                    panelDecision = new PanelLayoutDecision();
                    node.Parent.Decorations.Add(PanelLayoutDecision.DECISION_KEY, panelDecision);
                }

                LabelCIO label = null;
                if (item.CIO.HasLabel())
                {
                    label = (LabelCIO)item.CIO.GetLabelCIO();
                    panel.AddCIO(label);
                }

                ControlBasedCIO control = (ControlBasedCIO)item.CIO;
                panel.AddCIO(control);

                // do some sizing here
                int width = ui.Size.Width - 2 * ui.LayoutVars.RowPadding - 5;

                if (item.CIO.HasLabel())
                {
                    // layout label CIO
                    label.GetControl().Location =
                        new System.Drawing.Point(ui.LayoutVars.RowPadding, panelDecision.Bottom);
                    label.GetControl().Size =
                        new System.Drawing.Size(width, label.GetMinimumSize().Height);
                    panelDecision.Bottom += label.GetControl().Size.Height + ui.LayoutVars.RowPadding;

                    label.FinalSizeNotify();
                }

                control.GetControl().Location =
                    new System.Drawing.Point(ui.LayoutVars.RowPadding, panelDecision.Bottom);
                control.GetControl().Size =
                    new System.Drawing.Size(width, ((ControlBasedCIO)item.CIO).GetMinimumSize().Height);
                panelDecision.Bottom += ((ControlBasedCIO)item.CIO).GetMinimumSize().Height + 2 * ui.LayoutVars.RowPadding;

                item.Decorations[ItemDecision.DECISION_KEY] =
                    new PanelItemDecision(item.CIO);
            }

            return(cio);
        }
        /*
         * InterfaceNode Methods
         */

        public override void SetLocation(int x, int y)
        {
            base.SetLocation(x, y);

            _tabbedPanel.GetControl().Location = new System.Drawing.Point(x, y);
        }
Exemple #4
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();
                }
            }
        }