Extract button factory options to new class

This commit is contained in:
John Lewin 2017-08-03 12:40:10 -07:00
parent 836ec72300
commit 4abea0ab0c
29 changed files with 459 additions and 318 deletions

View file

@ -63,7 +63,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
var buttonFactory = ApplicationController.Instance.Theme.ButtonFactory;
var initialMargin = buttonFactory.Margin;
buttonFactory.Margin = new BorderDouble(8, 0);
buttonFactory.Options.Margin = new BorderDouble(8, 0);
var searchPanel = new SearchInputBox()
{
@ -108,7 +108,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
searchInput.Focus();
}
};
buttonFactory.Margin = initialMargin;
buttonFactory.Options.Margin = initialMargin;
navBar.AddChild(searchButton);
var libraryContainerView = new ListView(libraryContext)

View file

@ -79,26 +79,25 @@ namespace MatterHackers.MatterControl.PrintLibrary
this.BackgroundColor = ApplicationController.Instance.Theme.TabBodyBackground;
this.AnchorAll();
textImageButtonFactory = new TextImageButtonFactory()
textImageButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions()
{
borderWidth = 0,
normalTextColor = ActiveTheme.Instance.PrimaryTextColor,
hoverTextColor = ActiveTheme.Instance.PrimaryTextColor,
pressedTextColor = ActiveTheme.Instance.PrimaryTextColor,
disabledTextColor = ActiveTheme.Instance.TabLabelUnselected,
disabledFillColor = new RGBA_Bytes()
};
BorderWidth = 0,
editButtonFactory = new TextImageButtonFactory()
Normal = new ButtonOptionSection() { TextColor = ActiveTheme.Instance.PrimaryTextColor },
Hover = new ButtonOptionSection() { TextColor = ActiveTheme.Instance.PrimaryTextColor },
Pressed = new ButtonOptionSection() { TextColor = ActiveTheme.Instance.PrimaryTextColor },
Disabled = new ButtonOptionSection() { TextColor = ActiveTheme.Instance.TabLabelUnselected, FillColor = new RGBA_Bytes() }
});
editButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions()
{
normalTextColor = ActiveTheme.Instance.PrimaryTextColor,
hoverTextColor = ActiveTheme.Instance.PrimaryTextColor,
disabledTextColor = ActiveTheme.Instance.TabLabelUnselected,
disabledFillColor = new RGBA_Bytes(),
pressedTextColor = ActiveTheme.Instance.PrimaryTextColor,
borderWidth = 0,
Normal = new ButtonOptionSection() { TextColor = ActiveTheme.Instance.PrimaryTextColor },
Hover = new ButtonOptionSection() { TextColor = ActiveTheme.Instance.PrimaryTextColor },
Disabled = new ButtonOptionSection() { TextColor = ActiveTheme.Instance.TabLabelUnselected, FillColor = new RGBA_Bytes() },
Pressed = new ButtonOptionSection() { TextColor = ActiveTheme.Instance.PrimaryTextColor },
BorderWidth = 0,
Margin = new BorderDouble(10, 0)
};
});
var allControls = new FlowLayoutWidget(FlowDirection.TopToBottom);