Demand dependency in constructor

This commit is contained in:
John Lewin 2018-05-21 16:42:40 -07:00
parent 9a2afeecf6
commit ee30939dde
6 changed files with 17 additions and 16 deletions

View file

@ -166,7 +166,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
SimpleTabs tabControl = null;
if (this.ControlIsPinned)
{
var resizePage = new LeftResizeContainer()
var resizePage = new LeftResizeContainer(theme)
{
Width = this.ConstrainedWidth,
VAnchor = VAnchor.Stretch,
@ -230,7 +230,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
}
else // control is floating
{
var resizeContainer = new LeftResizeContainer()
var resizeContainer = new LeftResizeContainer(theme)
{
Width = this.ConstrainedWidth,
VAnchor = VAnchor.Stretch,

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2017, Lars Brubaker, John Lewin
Copyright (c) 2018, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -40,17 +40,18 @@ namespace MatterHackers.MatterControl.CustomWidgets
private int _splitterHeight;
internal BottomResizeContainer()
internal BottomResizeContainer(ThemeConfig theme)
: base (FlowDirection.TopToBottom)
{
this.HAnchor = HAnchor.Absolute;
this.Cursor = Cursors.HSplit;
SplitterHeigt = 10;
this.SplitterHeight = theme.SplitterWidth;
this.SpliterBarColor = theme.SplitterBackground;
}
public Color SpliterBarColor { get; set; } = ActiveTheme.Instance.TertiaryBackgroundColor;
public Color SpliterBarColor { get; set; }
public int SplitterHeigt
public int SplitterHeight
{
get => _splitterHeight;
set
@ -66,14 +67,13 @@ namespace MatterHackers.MatterControl.CustomWidgets
public override void OnDraw(Graphics2D graphics2D)
{
graphics2D.FillRectangle(LocalBounds.Left, LocalBounds.Bottom, LocalBounds.Right, LocalBounds.Bottom + this.SplitterHeigt, this.SpliterBarColor);
graphics2D.FillRectangle(LocalBounds.Left, LocalBounds.Bottom, LocalBounds.Right, LocalBounds.Bottom + this.SplitterHeigt, Color.Black);
graphics2D.FillRectangle(LocalBounds.Left, LocalBounds.Bottom, LocalBounds.Right, LocalBounds.Bottom + this.SplitterHeight, this.SpliterBarColor);
base.OnDraw(graphics2D);
}
public override void OnMouseDown(MouseEventArgs mouseEvent)
{
if (mouseEvent.Position.Y < this.SplitterHeigt)
if (mouseEvent.Position.Y < this.SplitterHeight)
{
mouseDownOnBar = true;
mouseDownY = TransformToScreenSpace(mouseEvent.Position).Y;

View file

@ -40,15 +40,16 @@ namespace MatterHackers.MatterControl.CustomWidgets
private int _splitterWidth;
internal LeftResizeContainer()
internal LeftResizeContainer(ThemeConfig theme)
: base (FlowDirection.TopToBottom)
{
this.HAnchor = HAnchor.Absolute;
this.Cursor = Cursors.VSplit;
SplitterWidth = 10;
this.SplitterWidth = theme.SplitterWidth;
this.SpliterBarColor = theme.SplitterBackground;
}
public Color SpliterBarColor { get; set; } = ActiveTheme.Instance.TertiaryBackgroundColor;
public Color SpliterBarColor { get; set; }
public int SplitterWidth
{

View file

@ -163,7 +163,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
var modelViewSidePanel = view3DWidget.Descendants<LeftResizeContainer>().FirstOrDefault();
gcodeContainer = new LeftResizeContainer()
gcodeContainer = new LeftResizeContainer(theme)
{
Width = printer?.ViewState.SelectedObjectPanelWidth ?? 200,
VAnchor = VAnchor.Stretch,

View file

@ -290,7 +290,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
editorPanel.CloseAllChildren();
// Add the tree view container. eventually we may want to make this a stretch container of some type
var treeViewContainer = new BottomResizeContainer()
var treeViewContainer = new BottomResizeContainer(theme)
{
HAnchor = HAnchor.Stretch,
VAnchor = VAnchor.Absolute

View file

@ -151,7 +151,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
VAnchor = VAnchor.Stretch,
};
modelViewSidePanel = new LeftResizeContainer()
modelViewSidePanel = new LeftResizeContainer(theme)
{
Width = printer?.ViewState.SelectedObjectPanelWidth ?? 200,
VAnchor = VAnchor.Stretch,