Re-wrote toggle switch to be a view for checkbox.
This commit is contained in:
parent
1298163600
commit
f3f921ab4f
11 changed files with 29 additions and 125 deletions
|
|
@ -11,8 +11,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
protected RGBA_Bytes separatorLineColor;
|
||||
protected FlowLayoutWidget mainContainer;
|
||||
|
||||
protected ToggleSwitchFactory toggleSwitchFactory = new ToggleSwitchFactory();
|
||||
|
||||
public SettingsViewBase(string title)
|
||||
: base(new TextWidget(title, pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor))
|
||||
{
|
||||
|
|
@ -43,21 +41,5 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
|
||||
this.linkButtonFactory.fontSize = 11;
|
||||
}
|
||||
|
||||
protected ToggleSwitch GenerateToggleSwitch(GuiWidget parentContainer, bool initiallyChecked)
|
||||
{
|
||||
TextWidget toggleLabel = new TextWidget(initiallyChecked ? "On" : "Off", pointSize: 10, textColor: ActiveTheme.Instance.PrimaryTextColor);
|
||||
toggleLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
|
||||
toggleLabel.Margin = new BorderDouble(right: 4);
|
||||
|
||||
ToggleSwitch toggleSwitch = toggleSwitchFactory.GenerateGivenTextWidget(toggleLabel, "On", "Off", initiallyChecked);
|
||||
toggleSwitch.VAnchor = Agg.UI.VAnchor.ParentCenter;
|
||||
toggleSwitch.SwitchState = initiallyChecked;
|
||||
|
||||
parentContainer.AddChild(toggleLabel);
|
||||
parentContainer.AddChild(toggleSwitch);
|
||||
|
||||
return toggleSwitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue