mattercontrol/ActionBar/ActionBarPlus.cs

55 lines
1.3 KiB
C#
Raw Normal View History

2015-04-08 15:20:10 -07:00
using MatterHackers.Agg;
2014-01-29 19:09:30 -08:00
using MatterHackers.Agg.UI;
using MatterHackers.MatterControl.ActionBar;
2015-04-08 15:20:10 -07:00
using MatterHackers.MatterControl.PrintQueue;
using System;
2014-01-29 19:09:30 -08:00
namespace MatterHackers.MatterControl
{
2015-04-08 15:20:10 -07:00
public class ActionBarPlus : FlowLayoutWidget
{
private QueueDataView queueDataView;
public ActionBarPlus(QueueDataView queueDataView)
: base(FlowDirection.TopToBottom)
{
this.queueDataView = queueDataView;
this.Create();
}
2015-04-08 15:20:10 -07:00
private event EventHandler unregisterEvents;
2014-01-29 19:09:30 -08:00
2015-04-08 15:20:10 -07:00
public void Create()
{
// Set Display Attributes
this.HAnchor = HAnchor.ParentLeftRight;
this.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
2014-01-29 19:09:30 -08:00
2015-04-08 15:20:10 -07:00
// Add Child Elements
if (ActiveTheme.Instance.DisplayMode == ActiveTheme.ApplicationDisplayType.Responsive)
{
this.AddChild(new ActionBar.PrinterActionRow());
}
this.AddChild(new PrintStatusRow(queueDataView));
this.Padding = new BorderDouble(bottom: 6);
2014-01-29 19:09:30 -08:00
2015-04-08 15:20:10 -07:00
// Add Handlers
ActiveTheme.Instance.ThemeChanged.RegisterEvent(ThemeChanged, ref unregisterEvents);
}
2015-04-08 15:20:10 -07:00
public void ThemeChanged(object sender, EventArgs e)
{
this.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
this.Invalidate();
}
2014-01-29 19:09:30 -08:00
2015-04-08 15:20:10 -07:00
public override void OnClosed(EventArgs e)
{
if (unregisterEvents != null)
{
unregisterEvents(this, null);
}
base.OnClosed(e);
}
}
2014-01-29 19:09:30 -08:00
}