Flatten factory options, use constructor syntax for cloning
This commit is contained in:
parent
a0730df5f0
commit
a2002a4043
4 changed files with 189 additions and 221 deletions
|
|
@ -135,10 +135,10 @@ namespace MatterHackers.MatterControl
|
|||
DefaultThumbView.ThumbColor = new RGBA_Bytes(theme.PrimaryTextColor, 30);
|
||||
|
||||
var commonOptions = new ButtonFactoryOptions();
|
||||
commonOptions.Normal.TextColor = theme.PrimaryTextColor;
|
||||
commonOptions.Hover.TextColor = theme.PrimaryTextColor;
|
||||
commonOptions.Pressed.TextColor = theme.PrimaryTextColor;
|
||||
commonOptions.Disabled.TextColor = theme.TertiaryBackgroundColor;
|
||||
commonOptions.NormalTextColor = theme.PrimaryTextColor;
|
||||
commonOptions.HoverTextColor = theme.PrimaryTextColor;
|
||||
commonOptions.PressedTextColor = theme.PrimaryTextColor;
|
||||
commonOptions.DisabledTextColor = theme.TertiaryBackgroundColor;
|
||||
commonOptions.Margin = new BorderDouble(14, 0);
|
||||
commonOptions.FontSize = 12;
|
||||
commonOptions.ImageSpacing = 8;
|
||||
|
|
@ -147,55 +147,55 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
this.ButtonFactory = new TextImageButtonFactory(commonOptions);
|
||||
|
||||
this.NoMarginWhite = new TextImageButtonFactory(commonOptions.Clone(options =>
|
||||
this.NoMarginWhite = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
options.Margin = 0;
|
||||
options.AllowThemeToAdjustImage = false;
|
||||
}));
|
||||
|
||||
this.SmallMarginButtonFactory = new TextImageButtonFactory(commonOptions.Clone(options =>
|
||||
{
|
||||
options.Margin = new BorderDouble(8, 0);
|
||||
options.ImageSpacing = 6;
|
||||
}));
|
||||
|
||||
this.RadioButtons = new TextImageButtonFactory(commonOptions.Clone(options =>
|
||||
{
|
||||
options.BorderWidth = 1;
|
||||
options.CheckedBorderColor = RGBA_Bytes.White;
|
||||
options.AllowThemeToAdjustImage = false;
|
||||
}));
|
||||
|
||||
var commonGray = commonOptions.Clone(options =>
|
||||
{
|
||||
options.Normal.TextColor = RGBA_Bytes.Black;
|
||||
options.Normal.FillColor = RGBA_Bytes.LightGray;
|
||||
options.Hover.TextColor = RGBA_Bytes.Black;
|
||||
options.Pressed.TextColor = RGBA_Bytes.Black;
|
||||
options.Pressed.FillColor = RGBA_Bytes.LightGray;
|
||||
Margin = 0,
|
||||
AllowThemeToAdjustImage = false
|
||||
});
|
||||
|
||||
this.MenuButtonFactory = new TextImageButtonFactory(commonGray.Clone(options =>
|
||||
this.SmallMarginButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
options.Margin = new BorderDouble(8, 0);
|
||||
}));
|
||||
Margin = new BorderDouble(8, 0),
|
||||
ImageSpacing = 6
|
||||
});
|
||||
|
||||
this.GrayButtonFactory = new TextImageButtonFactory(commonOptions.Clone(options =>
|
||||
this.RadioButtons = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
options.Normal.TextColor = theme.PrimaryTextColor;
|
||||
options.Normal.FillColor = RGBA_Bytes.Gray;
|
||||
}));
|
||||
BorderWidth = 1,
|
||||
CheckedBorderColor = RGBA_Bytes.White,
|
||||
AllowThemeToAdjustImage = false
|
||||
});
|
||||
|
||||
var commonGray = new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
NormalTextColor = RGBA_Bytes.Black,
|
||||
NormalFillColor = RGBA_Bytes.LightGray,
|
||||
HoverTextColor = RGBA_Bytes.Black,
|
||||
PressedTextColor = RGBA_Bytes.Black,
|
||||
PressedFillColor = RGBA_Bytes.LightGray,
|
||||
};
|
||||
|
||||
this.MenuButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonGray)
|
||||
{
|
||||
Margin = new BorderDouble(8, 0)
|
||||
});
|
||||
|
||||
this.GrayButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
NormalTextColor = theme.PrimaryTextColor,
|
||||
NormalFillColor = RGBA_Bytes.Gray
|
||||
});
|
||||
|
||||
int viewControlsButtonHeight = (UserSettings.Instance.IsTouchScreen) ? 40 : 0;
|
||||
|
||||
this.ViewControlsButtonFactory = new TextImageButtonFactory(commonOptions.Clone(options =>
|
||||
this.ViewControlsButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
options.Disabled.TextColor = theme.PrimaryTextColor;
|
||||
options.FixedHeight = viewControlsButtonHeight;
|
||||
options.FixedWidth = viewControlsButtonHeight;
|
||||
options.AllowThemeToAdjustImage = false;
|
||||
options.CheckedBorderColor = RGBA_Bytes.White;
|
||||
}));
|
||||
DisabledTextColor = theme.PrimaryTextColor,
|
||||
FixedHeight = viewControlsButtonHeight,
|
||||
FixedWidth = viewControlsButtonHeight,
|
||||
AllowThemeToAdjustImage = false,
|
||||
CheckedBorderColor = RGBA_Bytes.White
|
||||
});
|
||||
|
||||
this.MicroButton = new TextImageButtonFactory(new ButtonFactoryOptions()
|
||||
{
|
||||
|
|
@ -206,15 +206,15 @@ namespace MatterHackers.MatterControl
|
|||
CheckedBorderColor = ActiveTheme.Instance.PrimaryTextColor
|
||||
});
|
||||
|
||||
this.MicroButtonMenu = new TextImageButtonFactory(commonGray.Clone(options =>
|
||||
this.MicroButtonMenu = new TextImageButtonFactory(new ButtonFactoryOptions(commonGray)
|
||||
{
|
||||
options.FixedHeight = 20 * GuiWidget.DeviceScale;
|
||||
options.FixedWidth = 30 * GuiWidget.DeviceScale;
|
||||
options.FontSize = 8;
|
||||
options.Margin = 0;
|
||||
options.BorderWidth = 1;
|
||||
options.CheckedBorderColor = RGBA_Bytes.Black;
|
||||
}));
|
||||
FixedHeight = 20 * GuiWidget.DeviceScale,
|
||||
FixedWidth = 30 * GuiWidget.DeviceScale,
|
||||
FontSize = 8,
|
||||
Margin = 0,
|
||||
BorderWidth = 1,
|
||||
CheckedBorderColor = RGBA_Bytes.Black
|
||||
});
|
||||
|
||||
#region PartPreviewWidget
|
||||
if (UserSettings.Instance.IsTouchScreen)
|
||||
|
|
@ -228,103 +228,91 @@ namespace MatterHackers.MatterControl
|
|||
shortButtonHeight = 30;
|
||||
}
|
||||
|
||||
WhiteButtonFactory = new TextImageButtonFactory(commonOptions.Clone(options =>
|
||||
WhiteButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
options.FixedWidth = sideBarButtonWidth;
|
||||
options.FixedHeight = shortButtonHeight;
|
||||
FixedWidth = sideBarButtonWidth,
|
||||
FixedHeight = shortButtonHeight,
|
||||
|
||||
options.Normal.TextColor = RGBA_Bytes.Black;
|
||||
options.Normal.FillColor = RGBA_Bytes.White;
|
||||
options.Normal.BorderColor = new RGBA_Bytes(theme.PrimaryTextColor, 200);
|
||||
NormalTextColor = RGBA_Bytes.Black,
|
||||
NormalFillColor = RGBA_Bytes.White,
|
||||
NormalBorderColor = new RGBA_Bytes(theme.PrimaryTextColor, 200),
|
||||
|
||||
options.Hover.TextColor = RGBA_Bytes.Black;
|
||||
options.Hover.FillColor = new RGBA_Bytes(255, 255, 255, 200);
|
||||
options.Hover.BorderColor = new RGBA_Bytes(theme.PrimaryTextColor, 200);
|
||||
HoverTextColor = RGBA_Bytes.Black,
|
||||
HoverFillColor = new RGBA_Bytes(255, 255, 255, 200),
|
||||
HoverBorderColor = new RGBA_Bytes(theme.PrimaryTextColor, 200),
|
||||
|
||||
options.BorderWidth = 1;
|
||||
}));
|
||||
BorderWidth = 1,
|
||||
});
|
||||
|
||||
ExpandMenuOptionFactory = new TextImageButtonFactory(commonOptions.Clone(options =>
|
||||
ExpandMenuOptionFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
options.Hover.TextColor = theme.PrimaryTextColor;
|
||||
options.Hover.FillColor = new RGBA_Bytes(255, 255, 255, 50);
|
||||
HoverTextColor = theme.PrimaryTextColor,
|
||||
HoverFillColor = new RGBA_Bytes(255, 255, 255, 50),
|
||||
|
||||
options.Pressed.TextColor = theme.PrimaryTextColor;
|
||||
options.Pressed.FillColor = new RGBA_Bytes(255, 255, 255, 50);
|
||||
PressedTextColor = theme.PrimaryTextColor,
|
||||
PressedFillColor = new RGBA_Bytes(255, 255, 255, 50),
|
||||
|
||||
options.Disabled.TextColor = theme.PrimaryTextColor;
|
||||
options.Disabled.FillColor = new RGBA_Bytes(255, 255, 255, 50);
|
||||
options.FixedWidth = sideBarButtonWidth;
|
||||
}));
|
||||
DisabledTextColor = theme.PrimaryTextColor,
|
||||
DisabledFillColor = new RGBA_Bytes(255, 255, 255, 50),
|
||||
FixedWidth = sideBarButtonWidth,
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
#region ImageConverter
|
||||
imageConverterButtonFactory = new TextImageButtonFactory(commonOptions.Clone(options =>
|
||||
imageConverterButtonFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
options.FixedWidth = 185;
|
||||
options.FixedHeight = 30;
|
||||
FixedWidth = 185,
|
||||
FixedHeight = 30,
|
||||
|
||||
options.Normal.FillColor = RGBA_Bytes.White;
|
||||
options.Normal.TextColor = RGBA_Bytes.Black;
|
||||
options.Normal.BorderColor = new RGBA_Bytes(theme.PrimaryTextColor, 200);
|
||||
NormalFillColor = RGBA_Bytes.White,
|
||||
NormalTextColor = RGBA_Bytes.Black,
|
||||
NormalBorderColor = new RGBA_Bytes(theme.PrimaryTextColor, 200),
|
||||
|
||||
options.Hover.FillColor = new RGBA_Bytes(255, 255, 255, 200);
|
||||
options.Hover.TextColor = RGBA_Bytes.Black;
|
||||
options.Hover.BorderColor = new RGBA_Bytes(theme.PrimaryTextColor, 200);
|
||||
HoverFillColor = new RGBA_Bytes(255, 255, 255, 200),
|
||||
HoverTextColor = RGBA_Bytes.Black,
|
||||
HoverBorderColor = new RGBA_Bytes(theme.PrimaryTextColor, 200),
|
||||
|
||||
options.BorderWidth = 1;
|
||||
}));
|
||||
BorderWidth = 1,
|
||||
});
|
||||
|
||||
imageConverterExpandMenuOptionFactory = new TextImageButtonFactory(commonOptions.Clone(options =>
|
||||
imageConverterExpandMenuOptionFactory = new TextImageButtonFactory(new ButtonFactoryOptions(commonOptions)
|
||||
{
|
||||
options.FixedWidth = 200;
|
||||
FixedWidth = 200,
|
||||
|
||||
options.Normal.TextColor = theme.PrimaryTextColor;
|
||||
NormalTextColor = theme.PrimaryTextColor,
|
||||
|
||||
options.Hover.TextColor = theme.PrimaryTextColor;
|
||||
options.Hover.FillColor = new RGBA_Bytes(255, 255, 255, 50);
|
||||
HoverTextColor = theme.PrimaryTextColor,
|
||||
HoverFillColor = new RGBA_Bytes(255, 255, 255, 50),
|
||||
|
||||
options.Disabled.TextColor = theme.PrimaryTextColor;
|
||||
options.Disabled.FillColor = new RGBA_Bytes(255, 255, 255, 50);
|
||||
DisabledTextColor = theme.PrimaryTextColor,
|
||||
DisabledFillColor = new RGBA_Bytes(255, 255, 255, 50),
|
||||
|
||||
options.Pressed.TextColor = theme.PrimaryTextColor;
|
||||
options.Pressed.FillColor = new RGBA_Bytes(255, 255, 255, 50);
|
||||
}));
|
||||
PressedTextColor = theme.PrimaryTextColor,
|
||||
PressedFillColor = new RGBA_Bytes(255, 255, 255, 50),
|
||||
});
|
||||
|
||||
// TODO: Need to remain based default ButtonFactionOptions constructor until reviewed for styling issues
|
||||
var disableableControlOptions = new ButtonFactoryOptions()
|
||||
{
|
||||
Normal = new ButtonOptionSection()
|
||||
{
|
||||
FillColor = RGBA_Bytes.White,
|
||||
TextColor = RGBA_Bytes.Black,
|
||||
},
|
||||
Hover = new ButtonOptionSection()
|
||||
{
|
||||
TextColor = theme.PrimaryTextColor
|
||||
},
|
||||
Disabled = new ButtonOptionSection()
|
||||
{
|
||||
FillColor = RGBA_Bytes.White,
|
||||
TextColor = RGBA_Bytes.DarkGray
|
||||
},
|
||||
Pressed = new ButtonOptionSection()
|
||||
{
|
||||
TextColor = ActiveTheme.Instance.PrimaryTextColor
|
||||
},
|
||||
NormalFillColor = RGBA_Bytes.White,
|
||||
NormalTextColor = RGBA_Bytes.Black,
|
||||
HoverTextColor = theme.PrimaryTextColor,
|
||||
DisabledFillColor = RGBA_Bytes.White,
|
||||
DisabledTextColor = RGBA_Bytes.DarkGray,
|
||||
PressedTextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
FixedHeight = 25 * GuiWidget.DeviceScale,
|
||||
FontSize = 11
|
||||
};
|
||||
|
||||
this.DisableableControlBase = new TextImageButtonFactory(disableableControlOptions);
|
||||
this.HomingButtons = new TextImageButtonFactory(disableableControlOptions.Clone(options =>
|
||||
this.HomingButtons = new TextImageButtonFactory(new ButtonFactoryOptions(disableableControlOptions)
|
||||
{
|
||||
options.BorderWidth = 1;
|
||||
options.Normal.BorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200);
|
||||
options.Hover.BorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200);
|
||||
options.Normal.FillColor = new RGBA_Bytes(180, 180, 180);
|
||||
}));
|
||||
BorderWidth = 1,
|
||||
NormalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200),
|
||||
HoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200),
|
||||
NormalFillColor = new RGBA_Bytes(180, 180, 180),
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MatterHackers.Agg.PlatformAbstract;
|
||||
using MatterHackers.Agg.UI;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
|
|
@ -22,26 +21,26 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
var menuFactory = new DropDownMenuFactory()
|
||||
{
|
||||
normalFillColor = this.Options.Normal.FillColor,
|
||||
hoverFillColor = this.Options.Hover.FillColor,
|
||||
pressedFillColor = this.Options.Pressed.FillColor,
|
||||
normalBorderColor = this.Options.Normal.BorderColor,
|
||||
hoverBorderColor = this.Options.Hover.BorderColor,
|
||||
pressedBorderColor = this.Options.Pressed.BorderColor,
|
||||
disabledBorderColor = this.Options.Disabled.BorderColor,
|
||||
normalTextColor = this.Options.Normal.TextColor,
|
||||
hoverTextColor = this.Options.Hover.TextColor,
|
||||
pressedTextColor = this.Options.Pressed.TextColor,
|
||||
disabledTextColor = this.Options.Disabled.TextColor,
|
||||
normalFillColor = this.Options.NormalFillColor,
|
||||
hoverFillColor = this.Options.HoverFillColor,
|
||||
pressedFillColor = this.Options.PressedFillColor,
|
||||
normalBorderColor = this.Options.NormalBorderColor,
|
||||
hoverBorderColor = this.Options.HoverBorderColor,
|
||||
pressedBorderColor = this.Options.PressedBorderColor,
|
||||
disabledBorderColor = this.Options.DisabledBorderColor,
|
||||
normalTextColor = this.Options.NormalTextColor,
|
||||
hoverTextColor = this.Options.HoverTextColor,
|
||||
pressedTextColor = this.Options.PressedTextColor,
|
||||
disabledTextColor = this.Options.DisabledTextColor,
|
||||
FixedWidth = 20,
|
||||
};
|
||||
|
||||
DropDownMenu menu = menuFactory.Generate(actions: actions.Skip(1).ToList(), direction: direction);
|
||||
menu.Height = FixedHeight;
|
||||
menu.BorderColor = this.Options.Normal.BorderColor;
|
||||
menu.HoverArrowColor = this.Options.Hover.TextColor;
|
||||
menu.NormalArrowColor = this.Options.Normal.TextColor;
|
||||
menu.BackgroundColor = this.Options.Normal.FillColor;
|
||||
menu.BorderColor = this.Options.NormalBorderColor;
|
||||
menu.HoverArrowColor = this.Options.HoverTextColor;
|
||||
menu.NormalArrowColor = this.Options.NormalTextColor;
|
||||
menu.BackgroundColor = this.Options.NormalFillColor;
|
||||
|
||||
// TODO: Why?
|
||||
if (actions.Count > 1)
|
||||
|
|
|
|||
|
|
@ -53,22 +53,22 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
// Private getters act as proxies to new options class
|
||||
public BorderDouble Margin => Options.Margin;
|
||||
public RGBA_Bytes normalFillColor => Options.Normal.FillColor;
|
||||
public RGBA_Bytes hoverFillColor => Options.Hover.FillColor;
|
||||
public RGBA_Bytes pressedFillColor => Options.Pressed.FillColor;
|
||||
public RGBA_Bytes disabledFillColor => Options.Disabled.FillColor;
|
||||
public RGBA_Bytes normalFillColor => Options.NormalFillColor;
|
||||
public RGBA_Bytes hoverFillColor => Options.HoverFillColor;
|
||||
public RGBA_Bytes pressedFillColor => Options.PressedFillColor;
|
||||
public RGBA_Bytes disabledFillColor => Options.DisabledFillColor;
|
||||
|
||||
public RGBA_Bytes normalBorderColor => Options.Normal.BorderColor;
|
||||
public RGBA_Bytes hoverBorderColor => Options.Hover.BorderColor;
|
||||
public RGBA_Bytes pressedBorderColor => Options.Pressed.BorderColor;
|
||||
public RGBA_Bytes disabledBorderColor => Options.Disabled.BorderColor;
|
||||
public RGBA_Bytes normalBorderColor => Options.NormalBorderColor;
|
||||
public RGBA_Bytes hoverBorderColor => Options.HoverBorderColor;
|
||||
public RGBA_Bytes pressedBorderColor => Options.PressedBorderColor;
|
||||
public RGBA_Bytes disabledBorderColor => Options.DisabledBorderColor;
|
||||
|
||||
public RGBA_Bytes checkedBorderColor => Options.CheckedBorderColor;
|
||||
|
||||
public RGBA_Bytes normalTextColor => Options.Normal.TextColor;
|
||||
public RGBA_Bytes hoverTextColor => Options.Hover.TextColor;
|
||||
public RGBA_Bytes pressedTextColor => Options.Pressed.TextColor;
|
||||
public RGBA_Bytes disabledTextColor => Options.Disabled.TextColor;
|
||||
public RGBA_Bytes normalTextColor => Options.NormalTextColor;
|
||||
public RGBA_Bytes hoverTextColor => Options.HoverTextColor;
|
||||
public RGBA_Bytes pressedTextColor => Options.PressedTextColor;
|
||||
public RGBA_Bytes disabledTextColor => Options.DisabledTextColor;
|
||||
|
||||
public double fontSize => Options.FontSize;
|
||||
public double borderWidth => Options.BorderWidth;
|
||||
|
|
@ -473,10 +473,21 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public class ButtonFactoryOptions
|
||||
{
|
||||
public ButtonOptionSection Normal { get; set; }
|
||||
public ButtonOptionSection Hover { get; set; }
|
||||
public ButtonOptionSection Pressed { get; set; }
|
||||
public ButtonOptionSection Disabled { get; set; }
|
||||
public RGBA_Bytes NormalFillColor { get; set; }
|
||||
public RGBA_Bytes NormalBorderColor { get; set; }
|
||||
public RGBA_Bytes NormalTextColor { get; set; }
|
||||
|
||||
public RGBA_Bytes HoverFillColor { get; set; }
|
||||
public RGBA_Bytes HoverBorderColor { get; set; }
|
||||
public RGBA_Bytes HoverTextColor { get; set; }
|
||||
|
||||
public RGBA_Bytes PressedFillColor { get; set; }
|
||||
public RGBA_Bytes PressedBorderColor { get; set; }
|
||||
public RGBA_Bytes PressedTextColor { get; set; }
|
||||
|
||||
public RGBA_Bytes DisabledFillColor { get; set; }
|
||||
public RGBA_Bytes DisabledBorderColor { get; set; }
|
||||
public RGBA_Bytes DisabledTextColor { get; set; }
|
||||
|
||||
public double FontSize { get; set; } = 12;
|
||||
public double BorderWidth { get; set; } = 1;
|
||||
|
|
@ -495,82 +506,51 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
this.Margin = new BorderDouble(6, 0);
|
||||
|
||||
this.Normal = new ButtonOptionSection()
|
||||
{
|
||||
TextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
FillColor = new RGBA_Bytes(0, 0, 0, 30),
|
||||
BorderColor = new RGBA_Bytes(255, 255, 255, 0)
|
||||
};
|
||||
this.NormalTextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
this.NormalFillColor = new RGBA_Bytes(0, 0, 0, 30);
|
||||
this.NormalBorderColor = new RGBA_Bytes(255, 255, 255, 0);
|
||||
|
||||
this.Hover = new ButtonOptionSection()
|
||||
{
|
||||
TextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
FillColor = new RGBA_Bytes(0, 0, 0, 80),
|
||||
BorderColor = new RGBA_Bytes(0, 0, 0, 0)
|
||||
};
|
||||
this.HoverTextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
this.HoverFillColor = new RGBA_Bytes(0, 0, 0, 80);
|
||||
this.HoverBorderColor = new RGBA_Bytes(0, 0, 0, 0);
|
||||
|
||||
this.Pressed = new ButtonOptionSection()
|
||||
{
|
||||
TextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
FillColor = new RGBA_Bytes(0, 0, 0, 0),
|
||||
BorderColor = new RGBA_Bytes(0, 0, 0, 0)
|
||||
};
|
||||
this.PressedTextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
this.PressedFillColor = new RGBA_Bytes(0, 0, 0, 0);
|
||||
this.PressedBorderColor = new RGBA_Bytes(0, 0, 0, 0);
|
||||
|
||||
this.Disabled = new ButtonOptionSection()
|
||||
{
|
||||
|
||||
TextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
FillColor = new RGBA_Bytes(255, 255, 255, 50),
|
||||
BorderColor = new RGBA_Bytes(0, 0, 0, 0)
|
||||
};
|
||||
this.DisabledTextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
this.DisabledFillColor = new RGBA_Bytes(255, 255, 255, 50);
|
||||
this.DisabledBorderColor = new RGBA_Bytes(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public ButtonFactoryOptions Clone(Action<ButtonFactoryOptions> callback)
|
||||
public ButtonFactoryOptions(ButtonFactoryOptions cloneSource)
|
||||
{
|
||||
var newItem = new ButtonFactoryOptions();
|
||||
this.AllowThemeToAdjustImage = cloneSource.AllowThemeToAdjustImage;
|
||||
this.BorderWidth = cloneSource.BorderWidth;
|
||||
this.CheckedBorderColor = cloneSource.CheckedBorderColor;
|
||||
this.FixedHeight = cloneSource.FixedHeight;
|
||||
this.FixedWidth = cloneSource.FixedWidth;
|
||||
this.FlowDirection = cloneSource.FlowDirection;
|
||||
this.FontSize = cloneSource.FontSize;
|
||||
this.ImageSpacing = cloneSource.ImageSpacing;
|
||||
this.InvertImageLocation = cloneSource.InvertImageLocation;
|
||||
this.Margin = cloneSource.Margin;
|
||||
|
||||
newItem.AllowThemeToAdjustImage = this.AllowThemeToAdjustImage;
|
||||
newItem.BorderWidth = this.BorderWidth;
|
||||
newItem.CheckedBorderColor = this.CheckedBorderColor;
|
||||
newItem.FixedHeight = this.FixedHeight;
|
||||
newItem.FixedWidth = this.FixedWidth;
|
||||
newItem.FlowDirection = this.FlowDirection;
|
||||
newItem.FontSize = this.FontSize;
|
||||
newItem.ImageSpacing = this.ImageSpacing;
|
||||
newItem.InvertImageLocation = this.InvertImageLocation;
|
||||
newItem.Margin = this.Margin;
|
||||
this.NormalTextColor = cloneSource.NormalTextColor;
|
||||
this.NormalFillColor = cloneSource.NormalFillColor;
|
||||
this.NormalBorderColor = cloneSource.NormalBorderColor;
|
||||
|
||||
newItem.Normal = new ButtonOptionSection()
|
||||
{
|
||||
TextColor = this.Normal.TextColor,
|
||||
FillColor = this.Normal.FillColor,
|
||||
BorderColor = this.Normal.BorderColor
|
||||
};
|
||||
this.HoverTextColor = cloneSource.HoverTextColor;
|
||||
this.HoverFillColor = cloneSource.HoverFillColor;
|
||||
this.HoverBorderColor = cloneSource.HoverBorderColor;
|
||||
|
||||
newItem.Hover = new ButtonOptionSection()
|
||||
{
|
||||
TextColor = this.Hover.TextColor,
|
||||
FillColor = this.Hover.FillColor,
|
||||
BorderColor = this.Hover.BorderColor
|
||||
};
|
||||
this.PressedTextColor = cloneSource.PressedTextColor;
|
||||
this.PressedFillColor = cloneSource.PressedFillColor;
|
||||
this.PressedBorderColor = cloneSource.PressedBorderColor;
|
||||
|
||||
newItem.Pressed = new ButtonOptionSection()
|
||||
{
|
||||
TextColor = this.Pressed.TextColor,
|
||||
FillColor = this.Pressed.FillColor,
|
||||
BorderColor = this.Pressed.BorderColor
|
||||
};
|
||||
|
||||
newItem.Disabled = new ButtonOptionSection()
|
||||
{
|
||||
TextColor = this.Disabled.TextColor,
|
||||
FillColor = this.Disabled.FillColor,
|
||||
BorderColor = this.Disabled.BorderColor
|
||||
};
|
||||
|
||||
callback(newItem);
|
||||
|
||||
return newItem;
|
||||
this.DisabledTextColor = cloneSource.DisabledTextColor;
|
||||
this.DisabledFillColor = cloneSource.DisabledFillColor;
|
||||
this.DisabledBorderColor = cloneSource.DisabledBorderColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -175,10 +175,11 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
{
|
||||
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 },
|
||||
NormalTextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
HoverTextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
DisabledTextColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 100),
|
||||
DisabledFillColor = RGBA_Bytes.Transparent,
|
||||
PressedTextColor = ActiveTheme.Instance.PrimaryTextColor
|
||||
});
|
||||
|
||||
private AverageMillisecondTimer millisecondTimer = new AverageMillisecondTimer();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue