From c088d532d75f9136113f806fc0e2bb02a00b517b Mon Sep 17 00:00:00 2001 From: John Lewin Date: Fri, 12 Jan 2018 17:11:31 -0800 Subject: [PATCH] Revert "Use TextButton in the simple case" This reverts commit 2abbab932256efadc763bd1d74ac57e5344c38f8. Revert due to issues with MenuButtonFactory/buttons on white bg --- ControlElements/TextImageButtonFactory.cs | 24 ++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/ControlElements/TextImageButtonFactory.cs b/ControlElements/TextImageButtonFactory.cs index 65a1a9433..d82ea85ad 100644 --- a/ControlElements/TextImageButtonFactory.cs +++ b/ControlElements/TextImageButtonFactory.cs @@ -136,12 +136,18 @@ namespace MatterHackers.MatterControl public Button Generate(string label, double fixedWidth = -1) { - var theme = ApplicationController.Instance.Theme; + // Create button based on view container widget + var buttonViewWidget = new ButtonViewStates( + new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, Margin, null, fontSize: this.fontSize, height: this.FixedHeight, imageSpacing: ImageSpacing), + new TextImageWidget(label, hoverFillColor, hoverBorderColor, hoverTextColor, borderWidth, Margin, null, fontSize: this.fontSize, height: this.FixedHeight, imageSpacing: ImageSpacing), + new TextImageWidget(label, pressedFillColor, pressedBorderColor, pressedTextColor, borderWidth, Margin, null, fontSize: this.fontSize, height: this.FixedHeight, imageSpacing: ImageSpacing), + new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, Margin, null, fontSize: this.fontSize, height: this.FixedHeight, imageSpacing: ImageSpacing) + ); - var button = new TextButton(label, theme) + var textImageButton = new Button(0, 0, buttonViewWidget) { - BackgroundColor = theme.MinimalShade, - VAnchor = VAnchor.Absolute + Margin = new BorderDouble(0), + Padding = new BorderDouble(0), }; // Allow fixedWidth parameter to override local .FixedWith property @@ -149,17 +155,17 @@ namespace MatterHackers.MatterControl { if (fixedWidth > 0) { - button.HAnchor = HAnchor.Absolute; - button.Width = fixedWidth; + buttonViewWidget.Width = fixedWidth; + textImageButton.Width = fixedWidth; } } else if (this.FixedWidth != 0) { //Override the width if requested - button.HAnchor = HAnchor.Absolute; - button.Width = this.FixedWidth; + buttonViewWidget.Width = this.FixedWidth; + textImageButton.Width = this.FixedWidth; } - return button; + return textImageButton; } private ButtonViewStates getButtonView(string label, ImageBuffer normalImage = null, ImageBuffer hoverImage = null, ImageBuffer pressedImage = null, ImageBuffer disabledImage = null)