Add reusable SearchButton helper

This commit is contained in:
John Lewin 2018-01-10 23:21:46 -08:00
parent b5abcfdbd1
commit 1b5f1daed1
3 changed files with 12 additions and 6 deletions

View file

@ -37,6 +37,7 @@ namespace MatterHackers.MatterControl
using Agg.Image;
using CustomWidgets;
using MatterHackers.Agg.Platform;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.PartPreviewWindow;
using MatterHackers.VectorMath;
@ -122,6 +123,14 @@ namespace MatterHackers.MatterControl
public int OverlayAlpha { get; set; } = 50;
public GuiWidget CreateSearchButton()
{
return new IconButton(AggContext.StaticData.LoadIcon("icon_search_24x24.png", 16, 16, IconColor.Theme), this)
{
ToolTipText = "Search".Localize(),
};
}
public Color InteractionLayerOverlayColor { get; private set; }
private EventHandler unregisterEvents;

View file

@ -138,12 +138,8 @@ namespace MatterHackers.MatterControl.PrintLibrary
navBar.AddChild(searchPanel);
var searchButton = new IconButton(AggContext.StaticData.LoadIcon("icon_search_24x24.png", 16, 16, IconColor.Theme), theme)
{
ToolTipText = "Search".Localize(),
Name = "Search Library Button",
};
searchButton.VisibleChanged += (s, e) => Console.WriteLine();
var searchButton = ApplicationController.Instance.Theme.CreateSearchButton();
searchButton.Name = "Search Library Button";
searchButton.Click += (s, e) =>
{
if (searchPanel.Visible)

View file

@ -335,6 +335,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
var editorWidget = editor.Create(scene.SelectedItem, view3DWidget, theme);
editorWidget.HAnchor = HAnchor.Stretch;
editorWidget.VAnchor = VAnchor.Fit;
editorWidget.Padding = 0;
editorPanel.AddChild(editorWidget);
}