public override void CalculateMinimumSize(LayoutVariables vars) { LabelCIO labelCIO = (LabelCIO)_CIOs[LABEL_INDEX]; ControlBasedCIO stateCIO = (ControlBasedCIO)_CIOs[COMPONENT_INDEX]; System.Drawing.Size cioSize = stateCIO.GetMinimumSize(); if (_parent.IsVertical()) { _minSize = cioSize; if (labelCIO != null) { labelCIO.UseMinimumLabel(); System.Drawing.Size labelSize = labelCIO.GetMinimumSize(); _minSize.Height += labelSize.Height + vars.RowPadding; _minSize.Width = Math.Max(_minSize.Width, labelSize.Width); } } else { _minSize.Height = cioSize.Height; _minSize.Width = vars.RowPadding + (int)Math.Ceiling(cioSize.Width / (1.0 - vars.OneColLabelPcnt)); if (labelCIO != null) { _minSize.Height = Math.Max(_minSize.Height, labelCIO.GetMinimumSize().Height); } } }
public override void CalculateMinimumSize(LayoutVariables vars) { IEnumerator e = _rows.GetEnumerator(); _minSize = new System.Drawing.Size(0, 0); Row lastRow = null; while (e.MoveNext()) { ((Row)e.Current).CalculateMinimumSize(vars); System.Drawing.Size size = ((Row)e.Current).MinimumSize; _minSize.Width = Math.Max(size.Width, _minSize.Width); _minSize.Height += size.Height; if (lastRow != null) { int baselineSpace = (lastRow.MinimumSize.Height - lastRow.MaximumTextOffset) + ((Row)e.Current).MaximumTextOffset + vars.RowPadding; if (baselineSpace < vars.BaselineSpacing) { _minSize.Height += vars.BaselineSpacing - baselineSpace; } } lastRow = (Row)e.Current; } }
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); }
public override void DoLayout(LayoutVariables vars) { int[] minimum = new int[_panels.Count]; int[] preferred = new int[_panels.Count]; for (int i = 0; i < _panels.Count; i++) { minimum[i] = ((InterfaceNode)_panels[i]).MinimumSize.Height; preferred[i] = ((InterfaceNode)_panels[i]).PreferredSize.Height; } int[] heights = LayoutAlgorithms.AllocateSizeValues(_bounds.Height, minimum, preferred, vars.RowPadding); int height = 0; for (int i = 0; i < _panels.Count; i++) { InterfaceNode node = (InterfaceNode)_panels[i]; node.SetLocation(_bounds.X, _bounds.Y + height); node.SetSize(_bounds.Width, heights[i]); height += heights[i]; if ((i == (_panels.Count - 1)) && (height < _bounds.Height)) { node.SetSize(_bounds.Width, heights[i] + (_bounds.Height - height)); } node.DoLayout(vars); } }
public override void CalculateMinimumSize(LayoutVariables vars) { LabelCIO labelCIO = (LabelCIO)_CIOs[LABEL_INDEX]; StateLinkedCIO stateCIO1 = (StateLinkedCIO)_CIOs[COMPONENT1_INDEX]; StateLinkedCIO stateCIO2 = (StateLinkedCIO)_CIOs[COMPONENT2_INDEX]; System.Drawing.Size lblSize = new System.Drawing.Size(0, 0); if (labelCIO != null) { labelCIO.UseMinimumLabel(); lblSize = labelCIO.GetMinimumSize(); } System.Drawing.Size cio1Size = stateCIO1.GetMinimumSize(); System.Drawing.Size cio2Size = stateCIO2.GetMinimumSize(); if (_parent.IsVertical()) { _minSize.Height = lblSize.Height + cio1Size.Height + cio2Size.Height + 2 * vars.RowPadding; _minSize.Width = Math.Max(lblSize.Width, Math.Max(cio1Size.Width, cio2Size.Width)); } else { _minSize.Height = Math.Max(cio1Size.Height, cio2Size.Height); _minSize.Width = (int)Math.Ceiling((cio1Size.Width + cio2Size.Width + 2 * vars.RowPadding) / (1.0 - vars.OneColLabelPcnt)); } }
public override void DoLayout(LayoutVariables vars) { _lineCIO.GetControl().Size = new System.Drawing.Size(1, _bounds.Height); _lineCIO.GetControl().Location = new System.Drawing.Point(_lineLoc, 0); int[] minimum = new int[_panels.Count]; int[] preferred = new int[_panels.Count]; for (int i = 0; i < _panels.Count; i++) { minimum[i] = ((InterfaceNode)_panels[i]).MinimumSize.Width; preferred[i] = ((InterfaceNode)_panels[i]).PreferredSize.Width; } int[] widths = LayoutAlgorithms.AllocateSizeValues(_bounds.Width, minimum, preferred, vars.RowPadding); int width = 0; for (int i = 0; i < _panels.Count; i++) { InterfaceNode node = (InterfaceNode)_panels[i]; node.SetLocation(_bounds.X + width, _bounds.Y); node.SetSize(widths[i], _bounds.Height); width += widths[i]; if ((i == (_panels.Count - 1)) && (width < _bounds.Width)) { node.SetSize(widths[i] + (_bounds.Width - width), _bounds.Height); } node.DoLayout(vars); } }
/* * InterfaceNode Methods */ public override void AddComponents(ContainerCIO container, LayoutVariables vars) { Container = container; ((InterfaceNode)_panels[0]).AddComponents(_panel, vars); this.CalculateMinimumSize(vars); this.CalculatePreferredSize(vars); }
/* * 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); }
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; } }
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 DoLayout(LayoutVariables vars) { InterfaceNode node = (InterfaceNode)_panels[0]; // set bounds to the control bounds, which are automattically set by // the TabControl Control c = _panel.GetControl(); node.SetSize(c.Bounds.Width, c.Bounds.Height); node.SetLocation(0, 0); ((InterfaceNode)_panels[0]).DoLayout(vars); }
/* * Constructor */ public UIGeneratorCore(UIGenerator ui, ArrayList rulePhases, SmartCIOManager smartCIOManager, WidgetRegistry widgetRegistry) { _panel = new PanelCIO(); _layoutVars = new LayoutVariables(); _rulePhases = rulePhases; _smartCIOManager = smartCIOManager; _widgetRegistry = widgetRegistry; _ui = ui; }
public override void AddComponents(PUC.CIO.ContainerCIO container, LayoutVariables vars) { Container = container; IEnumerator e = _panels.GetEnumerator(); while (e.MoveNext()) { ((InterfaceNode)e.Current).AddComponents(container, vars); } this.CalculateMinimumSize(vars); this.CalculatePreferredSize(vars); }
public override void DoLayout(LayoutVariables vars) { IEnumerator e = _panels.GetEnumerator(); while (e.MoveNext()) { InterfaceNode node = (InterfaceNode)e.Current; node.SetSize(_bounds.Width, _bounds.Height); node.SetLocation(_bounds.X, _bounds.Y); node.DoLayout(vars); } }
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); }
public override void AddComponents(ContainerCIO container, LayoutVariables vars) { Container = container; Container.AddCIO(_panel); IEnumerator e = _rows.GetEnumerator(); while (e.MoveNext()) { ((Row)e.Current).AddComponents(_panel, vars); } this.CalculateMinimumSize(vars); this.CalculatePreferredSize(vars); }
/* * InterfaceNode Methods */ public override void CalculateMinimumSize(LayoutVariables vars) { IEnumerator e = _panels.GetEnumerator(); _minSize = new System.Drawing.Size(0, 0); while (e.MoveNext()) { ((InterfaceNode)e.Current).CalculateMinimumSize(vars); System.Drawing.Size size = ((InterfaceNode)e.Current).MinimumSize; _minSize.Width = Math.Max(size.Width, _minSize.Width); _minSize.Height += size.Height; } }
public override void DoLayout(LayoutVariables vars) { IEnumerator e = _panels.GetEnumerator(); Size minSize = GetTabbedCIO().GetMinimumSize(); Rectangle tabPanelBounds = new Rectangle(0, 0, _bounds.Width - minSize.Width, _bounds.Height - minSize.Height); while (e.MoveNext()) { InterfaceNode node = (InterfaceNode)e.Current; node.SetSize(tabPanelBounds.Width, tabPanelBounds.Height); node.SetLocation(tabPanelBounds.X, tabPanelBounds.Y); node.DoLayout(vars); } }
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); }
/* * 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); }
public override System.Drawing.Size GetPreferredSize(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.Drawing.Size ret = new System.Drawing.Size(0, 0); ret.Height = Math.Max(stateCIO1.GetPreferredSize().Height, stateCIO2.GetPreferredSize().Height); ret.Width = (labelCIO1 != null ? labelCIO1.GetPreferredSize().Width : 0) + stateCIO1.GetPreferredSize().Width + (labelCIO2 != null ? labelCIO2.GetPreferredSize().Width : 0) + stateCIO2.GetPreferredSize().Width; ret.Height += vars.RowPadding; ret.Width += 3 * vars.RowPadding; return(ret); }
/* * 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); }
public override void CalculatePreferredSize(LayoutVariables vars) { ((InterfaceNode)_panels[0]).CalculatePreferredSize(vars); _prefSize = ((InterfaceNode)_panels[0]).PreferredSize; }
public abstract void DoLayout(LayoutVariables vars);
public abstract void CalculatePreferredSize(LayoutVariables vars);
public abstract void CalculateMinimumSize(LayoutVariables vars);
/* * Abstract Methods */ public abstract void AddComponents(ContainerCIO container, LayoutVariables vars);
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); }
public override void CalculatePreferredSize(LayoutVariables vars) { ControlBasedCIO stateCIO = (ControlBasedCIO)_CIOs[COMPONENT_INDEX]; this.PreferredSize = stateCIO.GetPreferredSize(); }
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]); } }