Merge pull request #3368 from jlewin/design_tools

Add heading for page
This commit is contained in:
johnlewin 2018-05-31 06:54:13 -07:00 committed by GitHub
commit a0ff7fa653
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 64 additions and 62 deletions

View file

@ -224,7 +224,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
yield return new LastPageInstructions(
this,
"Done".Localize(),
"Print Leveling Wizard".Localize(),
string.Format(
"{0} {1}\n\n{2}\n{3}\n\n{4}",
"Congratulations!".Localize(),

View file

@ -47,11 +47,13 @@ namespace MatterHackers.MatterControl.CustomWidgets.TreeView
public TreeNode()
: base(FlowDirection.TopToBottom)
{
HAnchor = HAnchor.Fit | HAnchor.Left;
VAnchor = VAnchor.Fit;
var theme = ApplicationController.Instance.Theme;
TitleBar = new FlowLayoutWidget();
TitleBar.Click += (s, e) =>
this.HAnchor = HAnchor.Fit | HAnchor.Left;
this.VAnchor = VAnchor.Fit;
this.TitleBar = new FlowLayoutWidget();
this.TitleBar.Click += (s, e) =>
{
if (TreeView != null)
{
@ -59,7 +61,52 @@ namespace MatterHackers.MatterControl.CustomWidgets.TreeView
}
};
AddChild(TitleBar);
RebuildTitleBar();
// add a check box
expandWidget = new TreeExpandWidget(theme)
{
Expandable = GetNodeCount(false) != 0,
VAnchor = VAnchor.Fit,
Height = 16,
Width = 16
};
var expandCheckBox = new CheckBox(expandWidget)
{
Checked = this.Expanded,
VAnchor = VAnchor.Center,
};
this.ExpandedChanged += (s2, e2) =>
{
expandWidget.Expanded = this.Expanded;
expandCheckBox.Checked = this.Expanded;
};
expandCheckBox.CheckedStateChanged += (s3, e3) =>
{
Expanded = expandCheckBox.Checked;
};
this.TitleBar.AddChild(expandCheckBox);
// add a check box
if (Image != null)
{
this.TitleBar.AddChild(imageWidget = new ImageWidget(this.Image)
{
VAnchor = VAnchor.Center,
BackgroundColor = new Color(theme.Colors.PrimaryTextColor, 12),
Margin = 2,
Selectable = false
});
};
this.TitleBar.AddChild(textWidget = new TextWidget(this.Text, pointSize: theme.DefaultFontSize, textColor: theme.Colors.PrimaryTextColor)
{
Selectable = false,
AutoExpandBoundsToText = true,
VAnchor = VAnchor.Center
});
content = new FlowLayoutWidget(FlowDirection.TopToBottom)
{
@ -162,58 +209,6 @@ namespace MatterHackers.MatterControl.CustomWidgets.TreeView
expandWidget.Expandable = GetNodeCount(false) != 0;
}
private void RebuildTitleBar()
{
TitleBar.RemoveAllChildren();
var theme = ApplicationController.Instance.Theme;
// add a check box
expandWidget = new TreeExpandWidget(theme)
{
Expandable = GetNodeCount(false) != 0,
VAnchor = VAnchor.Fit,
Height = 16,
Width = 16
};
var expandCheckBox = new CheckBox(expandWidget)
{
Checked = this.Expanded,
VAnchor = VAnchor.Center,
};
this.ExpandedChanged += (s, e) =>
{
expandWidget.Expanded = this.Expanded;
expandCheckBox.Checked = this.Expanded;
};
expandCheckBox.CheckedStateChanged += (s, e) =>
{
Expanded = expandCheckBox.Checked;
};
this.TitleBar.AddChild(expandCheckBox);
// add a check box
if (Image != null)
{
this.TitleBar.AddChild(imageWidget = new ImageWidget(this.Image)
{
VAnchor = VAnchor.Center,
BackgroundColor = new Color(theme.Colors.PrimaryTextColor, 12),
Margin = 2,
Selectable = false
});
};
TitleBar.AddChild(textWidget = new TextWidget(this.Text, pointSize: theme.DefaultFontSize, textColor: theme.Colors.PrimaryTextColor)
{
Selectable = false,
AutoExpandBoundsToText = true,
VAnchor = VAnchor.Center
});
}
#region Properties
private ImageBuffer _image = new ImageBuffer(16, 16);

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2014, Kevin Pope
Copyright (c) 2018, Kevin Pope, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -40,7 +40,6 @@ using MatterHackers.MatterControl.PrintQueue;
namespace MatterHackers.MatterControl.PrintHistory
{
public class HistoryListView : FlowLayoutWidget, IListContentView
{
private ThemeConfig theme;
@ -48,6 +47,12 @@ namespace MatterHackers.MatterControl.PrintHistory
public int ThumbWidth { get; } = 50;
public int ThumbHeight { get; } = 50;
public HistoryListView()
: base(FlowDirection.TopToBottom)
{
this.theme = ApplicationController.Instance.Theme;
}
public HistoryListView(ThemeConfig theme)
: base(FlowDirection.TopToBottom)
{

View file

@ -224,8 +224,10 @@ namespace MatterHackers.MatterControl.CustomWidgets
// TODO: Resolve and implement
// Allow the container to draw an overlay - use signal interface or add method to interface?
//var iconWithOverlay = ActiveContainer.DrawOverlay()
this.imageWidget.Image = thumbnail;
if (this.imageWidget != null)
{
this.imageWidget.Image = thumbnail;
}
this.ImageSet?.Invoke(this, null);