Finish switch to new toggle controls

- Issue MatterHackers/MCCentral#3043
Remove current ToggleSwitch factory to resolve differing types
This commit is contained in:
John Lewin 2018-04-06 13:26:17 -07:00
parent e33406aca0
commit 8dfeeac3cd
3 changed files with 13 additions and 60 deletions

View file

@ -41,59 +41,6 @@ namespace MatterHackers.MatterControl
{
public bool InvertImageColor { get; set; } = true;
public static CheckBox CreateToggleSwitch(bool initialState)
{
return CreateToggleSwitch(initialState, ActiveTheme.Instance.PrimaryTextColor);
}
public static CheckBox CreateToggleSwitch(bool initialState, Color textColor, bool useStandardLabels = true)
{
return CreateToggleSwitch(
initialState,
textColor,
60 * GuiWidget.DeviceScale,
24 * GuiWidget.DeviceScale,
useStandardLabels);
}
public static CheckBox CreateToggleSwitch(bool initialState, Color textColor, double pixelWidth, double pixelHeight, bool useStandardLabels = true)
{
return CreateToggleSwitch(
initialState,
textColor,
new Color(textColor, 70),
pixelWidth,
pixelHeight,
useStandardLabels);
}
public static CheckBox CreateToggleSwitch(bool initialState, Color textColor, Color borderColor, double pixelWidth, double pixelHeight, bool useStandardLabels = true)
{
string on = "On".Localize();
string off = "Off".Localize();
if (!useStandardLabels)
{
on = "";
off = "";
}
return new CheckBox(
new ToggleSwitchView(
on,
off,
pixelWidth,
pixelHeight,
ActiveTheme.Instance.PrimaryBackgroundColor,
new Color(220, 220, 220),
ActiveTheme.Instance.PrimaryAccentColor,
textColor,
borderColor))
{
Checked = initialState,
};
}
public Button Generate(ImageBuffer normalImage, ImageBuffer hoverImage, ImageBuffer pressedImage = null, ImageBuffer disabledImage = null)
{
if(hoverImage == null)