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

@ -48,8 +48,8 @@ namespace MatterHackers.MatterControl
{
headerLabel.Text = "Setup Options".Localize();
textImageButtonFactory.borderWidth = 1;
textImageButtonFactory.normalBorderColor = RGBA_Bytes.White;
textImageButtonFactory.Options.BorderWidth = 1;
textImageButtonFactory.Options.Normal.BorderColor = RGBA_Bytes.White;
contentRow.AddChild(new SetupPrinterView(this.textImageButtonFactory) { WizardPage = this });
contentRow.AddChild(new SetupAccountView(this.textImageButtonFactory));
@ -228,7 +228,7 @@ namespace MatterHackers.MatterControl
buttonContainer.AddChild(new HorizontalSpacer());
// the redeem design code button
textImageButtonFactory.disabledTextColor = new RGBA_Bytes(textImageButtonFactory.normalTextColor, 100);
textImageButtonFactory.Options.Disabled.TextColor = new RGBA_Bytes(textImageButtonFactory.normalTextColor, 100);
Button redeemPurchaseButton = textImageButtonFactory.Generate("Redeem Purchase".Localize());
redeemPurchaseButton.Enabled = true; // The library selector (the first library selected) is protected so we can't add to it.
redeemPurchaseButton.Name = "Redeem Code Button";

View file

@ -14,7 +14,7 @@ namespace MatterHackers.MatterControl
protected TextWidget headerLabel;
protected Button cancelButton;
protected TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory() { fontSize = 16 };
protected TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions() { FontSize = 16 });
protected TextImageButtonFactory whiteImageButtonFactory;
protected LinkButtonFactory linkButtonFactory = new LinkButtonFactory();
@ -27,33 +27,44 @@ namespace MatterHackers.MatterControl
public WizardPage(string unlocalizedTextForCancelButton = "Cancel", string unlocalizedTextForTitle = "Setup Wizard")
{
whiteImageButtonFactory = new TextImageButtonFactory()
whiteImageButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions()
{
normalFillColor = RGBA_Bytes.White,
disabledFillColor = RGBA_Bytes.White,
fontSize = 16,
borderWidth = 1,
Normal = new ButtonOptionSection()
{
FillColor = RGBA_Bytes.White,
BorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200),
TextColor = RGBA_Bytes.Black,
},
Disabled = new ButtonOptionSection()
{
FillColor = RGBA_Bytes.White,
TextColor = RGBA_Bytes.DarkGray,
},
Hover = new ButtonOptionSection()
{
BorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200),
TextColor = ActiveTheme.Instance.PrimaryTextColor,
},
Pressed = new ButtonOptionSection()
{
TextColor = ActiveTheme.Instance.PrimaryTextColor,
},
normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200),
hoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200),
disabledTextColor = RGBA_Bytes.DarkGray,
hoverTextColor = ActiveTheme.Instance.PrimaryTextColor,
normalTextColor = RGBA_Bytes.Black,
pressedTextColor = ActiveTheme.Instance.PrimaryTextColor,
FontSize = 16,
BorderWidth = 1,
FixedWidth = 200
};
});
if (!UserSettings.Instance.IsTouchScreen)
{
textImageButtonFactory = new TextImageButtonFactory()
textImageButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions()
{
normalTextColor = ActiveTheme.Instance.PrimaryTextColor,
hoverTextColor = ActiveTheme.Instance.PrimaryTextColor,
disabledTextColor = ActiveTheme.Instance.PrimaryTextColor,
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.PrimaryTextColor },
Pressed = new ButtonOptionSection() { TextColor = ActiveTheme.Instance.PrimaryTextColor },
BorderWidth = 0
});
linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor;
linkButtonFactory.fontSize = 10;