Extract button factory options to new class
This commit is contained in:
parent
836ec72300
commit
4abea0ab0c
29 changed files with 459 additions and 318 deletions
|
|
@ -69,7 +69,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
bool haveFilterRunning = !string.IsNullOrEmpty(currentContainer.KeywordFilter);
|
||||
|
||||
var initialMargin = buttonFactory.Margin;
|
||||
buttonFactory.Margin = new BorderDouble(8, 0);
|
||||
buttonFactory.Options.Margin = new BorderDouble(8, 0);
|
||||
|
||||
var icon = LibraryProviderHelpers.LoadInvertIcon("FileDialog", "up_folder_20.png");
|
||||
//icon = LibraryProviderHelpers.ResizeImage(icon, 20, 20);
|
||||
|
|
@ -85,7 +85,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
}
|
||||
};
|
||||
|
||||
buttonFactory.Margin = initialMargin;
|
||||
buttonFactory.Options.Margin = initialMargin;
|
||||
|
||||
this.AddChild(upbutton);
|
||||
|
||||
|
|
|
|||
|
|
@ -171,16 +171,15 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
protected EventHandler unregisterEvents;
|
||||
private static PrintingWindow instance;
|
||||
|
||||
private TextImageButtonFactory buttonFactory = new TextImageButtonFactory()
|
||||
private TextImageButtonFactory buttonFactory = new TextImageButtonFactory(new ButtonFactoryOptions()
|
||||
{
|
||||
fontSize = 15,
|
||||
invertImageLocation = false,
|
||||
normalTextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
hoverTextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
disabledTextColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 100),
|
||||
disabledFillColor = RGBA_Bytes.Transparent,
|
||||
pressedTextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
};
|
||||
FontSize = 15,
|
||||
InvertImageLocation = false,
|
||||
Normal = new ButtonOptionSection() { TextColor = ActiveTheme.Instance.PrimaryTextColor },
|
||||
Hover = new ButtonOptionSection() { TextColor = ActiveTheme.Instance.PrimaryTextColor },
|
||||
Disabled = new ButtonOptionSection() { TextColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 100), FillColor = RGBA_Bytes.Transparent },
|
||||
Pressed = new ButtonOptionSection() { TextColor = ActiveTheme.Instance.PrimaryTextColor },
|
||||
});
|
||||
|
||||
private AverageMillisecondTimer millisecondTimer = new AverageMillisecondTimer();
|
||||
private Stopwatch totalDrawTime = new Stopwatch();
|
||||
|
|
|
|||
|
|
@ -81,17 +81,23 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private Button CreateDefaultButton(string buttonText)
|
||||
{
|
||||
var buttonFactory = new TextImageButtonFactory()
|
||||
var buttonFactory = new TextImageButtonFactory(new ButtonFactoryOptions()
|
||||
{
|
||||
FixedHeight = 30 * GuiWidget.DeviceScale,
|
||||
normalFillColor = RGBA_Bytes.White,
|
||||
normalTextColor = RGBA_Bytes.Black,
|
||||
hoverTextColor = RGBA_Bytes.Black,
|
||||
hoverFillColor = new RGBA_Bytes(255, 255, 255, 200),
|
||||
borderWidth = 1,
|
||||
normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200),
|
||||
hoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200)
|
||||
};
|
||||
Normal = new ButtonOptionSection()
|
||||
{
|
||||
FillColor = RGBA_Bytes.White,
|
||||
TextColor = RGBA_Bytes.Black,
|
||||
BorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200),
|
||||
},
|
||||
Hover = new ButtonOptionSection()
|
||||
{
|
||||
TextColor = RGBA_Bytes.Black,
|
||||
FillColor = new RGBA_Bytes(255, 255, 255, 200),
|
||||
BorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200)
|
||||
},
|
||||
BorderWidth = 1,
|
||||
});
|
||||
|
||||
return buttonFactory.Generate(buttonText, centerText: true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
extraTextScaling = 1.33333;
|
||||
}
|
||||
textImageButtonFactory.fontSize = extraTextScaling * textImageButtonFactory.fontSize;
|
||||
textImageButtonFactory.Options.FontSize = extraTextScaling * textImageButtonFactory.fontSize;
|
||||
|
||||
FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
topToBottom.AnchorAll();
|
||||
|
|
@ -86,11 +86,11 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
topToBottom.AddChild(headerRow);
|
||||
|
||||
textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
textImageButtonFactory.disabledTextColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 100);
|
||||
textImageButtonFactory.disabledFillColor = new RGBA_Bytes(0, 0, 0, 0);
|
||||
textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
textImageButtonFactory.Options.Normal.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
textImageButtonFactory.Options.Hover.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
textImageButtonFactory.Options.Disabled.TextColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 100);
|
||||
textImageButtonFactory.Options.Disabled.FillColor = new RGBA_Bytes(0, 0, 0, 0);
|
||||
textImageButtonFactory.Options.Pressed.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
|
||||
AnchorAll();
|
||||
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue