public SliceSettingsRow(PrinterConfig printer, SettingsContext settingsContext, SliceSettingData settingData, ThemeConfig theme, bool fullRowSelect = false) : base(settingData.PresentationName.Localize(), settingData.HelpText.Localize(), theme, fullRowSelect: fullRowSelect) { this.printer = printer; this.settingData = settingData; this.settingsContext = settingsContext; using (this.LayoutLock()) { this.AddChild(dataArea = new FlowLayoutWidget { VAnchor = VAnchor.Fit | VAnchor.Center, DebugShowBounds = debugLayout }); this.AddChild(unitsArea = new GuiWidget() { HAnchor = HAnchor.Absolute, VAnchor = VAnchor.Fit | VAnchor.Center, Width = 50 * GuiWidget.DeviceScale, DebugShowBounds = debugLayout }); // Populate unitsArea as appropriate // List elements contain list values in the field which normally contains label details, skip generation of invalid labels if (settingData.DataEditType != SliceSettingData.DataEditTypes.LIST && settingData.DataEditType != SliceSettingData.DataEditTypes.HARDWARE_PRESENT) { unitsArea.AddChild( new WrappedTextWidget(settingData.Units.Localize(), pointSize: theme.FontSize8, textColor: theme.TextColor) { Margin = new BorderDouble(5, 0), }); } restoreArea = new GuiWidget() { HAnchor = HAnchor.Absolute, VAnchor = VAnchor.Fit | VAnchor.Center, Width = 20 * GuiWidget.DeviceScale, DebugShowBounds = debugLayout }; this.AddChild(restoreArea); this.Name = settingData.SlicerConfigName + " Row"; if (settingData.ShowAsOverride) { restoreButton = theme.CreateSmallResetButton(); restoreButton.HAnchor = HAnchor.Right; restoreButton.Margin = 0; restoreButton.Name = "Restore " + settingData.SlicerConfigName; restoreButton.ToolTipText = "Restore Default".Localize(); restoreButton.Click += (sender, e) => { // Revert the user override settingsContext.ClearValue(settingData.SlicerConfigName); }; restoreArea.AddChild(restoreButton); restoreArea.Selectable = true; } } this.PerformLayout(); }