UIFields should allow caller to specify text color

- Issue MatterHackers/MCCentral#2514
Adjust print popup menu for forced white background
This commit is contained in:
John Lewin 2017-12-29 09:10:37 -08:00
parent 1c0138d7c1
commit 2f42ee11b1
4 changed files with 19 additions and 8 deletions

View file

@ -67,12 +67,18 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
public class ToggleboxField : UIField
{
private CheckBox checkBoxWidget;
private Color textColor;
public ToggleboxField(Color textColor)
{
this.textColor = textColor;
}
public override void Initialize(int tabIndex)
{
var pixelWidth = this.ControlWidth + 6; // HACK: work around agg-bug where text fields are padding*2 bigger than ControlWidth
checkBoxWidget = ImageButtonFactory.CreateToggleSwitch(false, ActiveTheme.Instance.PrimaryTextColor, pixelWidth, pixelHeight: 24 * GuiWidget.DeviceScale, useStandardLabels: false);
checkBoxWidget = ImageButtonFactory.CreateToggleSwitch(false, textColor, pixelWidth, pixelHeight: 24 * GuiWidget.DeviceScale, useStandardLabels: false);
checkBoxWidget.VAnchor = VAnchor.Center;
checkBoxWidget.Name = this.Name;
checkBoxWidget.Margin = 0;

View file

@ -36,12 +36,14 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
public class DropMenuWrappedField
{
private UIField uiField;
private Color textColor;
private SliceSettingData settingData;
public DropMenuWrappedField(UIField uiField, SliceSettingData settingData)
public DropMenuWrappedField(UIField uiField, SliceSettingData settingData, Color textColor)
{
this.settingData = settingData;
this.uiField = uiField;
this.textColor = textColor;
}
public void SetValue(string newValue, bool userInitiated)
@ -59,7 +61,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
var totalContent = new FlowLayoutWidget();
var selectableOptions = new DropDownList("Custom", maxHeight: 200);
var selectableOptions = new DropDownList("Custom", textColor, maxHeight: 200);
selectableOptions.Margin = new BorderDouble(0, 0, 10, 0);
foreach (QuickMenuNameValue nameValue in settingData.QuickMenuSettings)

View file

@ -38,14 +38,16 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
public class ExtruderOffsetField : UIField
{
private SettingsContext settingsContext;
private Color textColor;
private string slicerConfigName;
private List<Vector2Field> childFields;
public ExtruderOffsetField(SettingsContext settingsContext, string slicerConfigName)
public ExtruderOffsetField(SettingsContext settingsContext, string slicerConfigName, Color textColor)
{
this.slicerConfigName = slicerConfigName;
this.settingsContext = settingsContext;
this.textColor = textColor;
//SaveCommaSeparatedIndexSetting(extruderOffset.ExtruderIndex, settingsContext, slicerConfigName, extruderOffset.Value.Replace(",", "x"));
}
@ -81,7 +83,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
};
column.AddChild(row);
var labelWidget = SliceSettingsWidget.CreateSettingsLabel($"Nozzle {i + 1}", "");
var labelWidget = SliceSettingsWidget.CreateSettingsLabel($"Nozzle {i + 1}", "", textColor);
labelWidget.Name = $"Nozzle {i}";
labelWidget.Margin = new BorderDouble(right: 60, left: 20);
row.AddChild(labelWidget);