Revert "Use TextButton in the simple case"

This reverts commit 2abbab9322.
Revert due to issues with MenuButtonFactory/buttons on white bg
This commit is contained in:
John Lewin 2018-01-12 17:11:31 -08:00
parent 01c076e452
commit c088d532d7

View file

@ -136,12 +136,18 @@ namespace MatterHackers.MatterControl
public Button Generate(string label, double fixedWidth = -1) 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, Margin = new BorderDouble(0),
VAnchor = VAnchor.Absolute Padding = new BorderDouble(0),
}; };
// Allow fixedWidth parameter to override local .FixedWith property // Allow fixedWidth parameter to override local .FixedWith property
@ -149,17 +155,17 @@ namespace MatterHackers.MatterControl
{ {
if (fixedWidth > 0) if (fixedWidth > 0)
{ {
button.HAnchor = HAnchor.Absolute; buttonViewWidget.Width = fixedWidth;
button.Width = fixedWidth; textImageButton.Width = fixedWidth;
} }
} }
else if (this.FixedWidth != 0) else if (this.FixedWidth != 0)
{ {
//Override the width if requested //Override the width if requested
button.HAnchor = HAnchor.Absolute; buttonViewWidget.Width = this.FixedWidth;
button.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) private ButtonViewStates getButtonView(string label, ImageBuffer normalImage = null, ImageBuffer hoverImage = null, ImageBuffer pressedImage = null, ImageBuffer disabledImage = null)