122 lines
3.8 KiB
C#
122 lines
3.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
using MatterHackers.Agg;
|
|
using MatterHackers.Agg.UI;
|
|
using MatterHackers.Agg.Font;
|
|
using MatterHackers.VectorMath;
|
|
|
|
namespace MatterHackers.MatterControl
|
|
{
|
|
public class AltGroupBox : FlowLayoutWidget
|
|
{
|
|
GuiWidget groupBoxLabel;
|
|
RGBA_Bytes borderColor = RGBA_Bytes.Black;
|
|
GuiWidget clientArea;
|
|
|
|
public RGBA_Bytes TextColor
|
|
{
|
|
get
|
|
{
|
|
TextWidget textBox = groupBoxLabel as TextWidget;
|
|
if (textBox != null)
|
|
{
|
|
return textBox.TextColor;
|
|
}
|
|
return RGBA_Bytes.White;
|
|
}
|
|
set
|
|
{
|
|
TextWidget textBox = groupBoxLabel as TextWidget;
|
|
if (textBox != null)
|
|
{
|
|
textBox.TextColor = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public RGBA_Bytes BorderColor
|
|
{
|
|
get
|
|
{
|
|
return this.borderColor;
|
|
}
|
|
set
|
|
{
|
|
this.borderColor = value;
|
|
}
|
|
}
|
|
|
|
public GuiWidget ClientArea
|
|
{
|
|
get
|
|
{
|
|
return clientArea;
|
|
}
|
|
}
|
|
|
|
public AltGroupBox()
|
|
: this("")
|
|
{
|
|
}
|
|
|
|
public AltGroupBox(GuiWidget groupBoxLabel)
|
|
: base(FlowDirection.TopToBottom)
|
|
{
|
|
this.Padding = new BorderDouble(5);
|
|
this.Margin = new BorderDouble(0);
|
|
this.groupBoxLabel = groupBoxLabel;
|
|
this.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
|
|
this.BackgroundColor = ActiveTheme.Instance.TertiaryBackgroundColor;
|
|
|
|
|
|
groupBoxLabel.Margin = new BorderDouble(0);
|
|
groupBoxLabel.HAnchor = HAnchor.ParentLeftRight;
|
|
base.AddChild(groupBoxLabel);
|
|
|
|
clientArea = new GuiWidget(HAnchor.ParentLeftRight, VAnchor.FitToChildren);
|
|
base.AddChild(clientArea);
|
|
|
|
}
|
|
|
|
public AltGroupBox(string title)
|
|
: this(new TextWidget(title, pointSize:12))
|
|
{
|
|
}
|
|
|
|
public override void AddChild(GuiWidget childToAdd, int indexInChildrenList = -1)
|
|
{
|
|
clientArea.AddChild(childToAdd, indexInChildrenList);
|
|
}
|
|
|
|
public override string Text
|
|
{
|
|
get
|
|
{
|
|
return groupBoxLabel.Text;
|
|
}
|
|
set
|
|
{
|
|
groupBoxLabel.Text = value;
|
|
}
|
|
}
|
|
|
|
public override void OnDraw(Graphics2D graphics2D)
|
|
{
|
|
RectangleDouble localBounds = LocalBounds;
|
|
//// bottom
|
|
//graphics2D.Line(localBounds.Left + lineInset, localBounds.Bottom + lineInset, localBounds.Left + Width - lineInset, localBounds.Bottom + lineInset, this.borderColor);
|
|
//// left
|
|
//graphics2D.Line(localBounds.Left + lineInset, localBounds.Bottom + lineInset, localBounds.Left + lineInset, localBounds.Bottom + Height - lineInset, this.borderColor);
|
|
//// right
|
|
//graphics2D.Line(localBounds.Left + Width - lineInset, localBounds.Bottom + lineInset, localBounds.Left + Width - lineInset, localBounds.Bottom + Height - lineInset, this.borderColor);
|
|
//// top
|
|
//graphics2D.Line(localBounds.Left + lineInset, localBounds.Bottom + Height - lineInset, groupBoxLabel.BoundsRelativeToParent.Left - 2, localBounds.Bottom + Height - lineInset, this.borderColor);
|
|
//graphics2D.Line(groupBoxLabel.BoundsRelativeToParent.Right + 2, localBounds.Bottom + Height - lineInset, localBounds.Left + Width - lineInset, localBounds.Bottom + Height - lineInset, this.borderColor);
|
|
|
|
base.OnDraw(graphics2D);
|
|
}
|
|
}
|
|
}
|