public Button Generate(string label, double fixedWidth = -1) { // 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 * GuiWidget.DeviceScale, imageSpacing: ImageSpacing), new TextImageWidget(label, hoverFillColor, hoverBorderColor, hoverTextColor, borderWidth, Margin, null, fontSize: this.fontSize, height: this.FixedHeight * GuiWidget.DeviceScale, imageSpacing: ImageSpacing), new TextImageWidget(label, pressedFillColor, pressedBorderColor, pressedTextColor, borderWidth, Margin, null, fontSize: this.fontSize, height: this.FixedHeight * GuiWidget.DeviceScale, imageSpacing: ImageSpacing), new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, Margin, null, fontSize: this.fontSize, height: this.FixedHeight * GuiWidget.DeviceScale, imageSpacing: ImageSpacing) ); var textImageButton = new Button(0, 0, buttonViewWidget) { Margin = new BorderDouble(0), Padding = new BorderDouble(0), }; // Allow fixedWidth parameter to override local .FixedWith property if (fixedWidth != -1) { if (fixedWidth > 0) { buttonViewWidget.Width = fixedWidth; textImageButton.Width = fixedWidth; } } else if (this.FixedWidth != 0) { //Override the width if requested buttonViewWidget.Width = this.FixedWidth; textImageButton.Width = this.FixedWidth; } return(textImageButton); }
public Button Generate(ImageBuffer normalImage, ImageBuffer hoverImage, ImageBuffer pressedImage = null, ImageBuffer disabledImage = null) { if (hoverImage == null) { hoverImage = normalImage; } if (pressedImage == null) { pressedImage = hoverImage; } if (disabledImage == null) { disabledImage = normalImage; } var buttonViewWidget = new ButtonViewStates( new ImageWidget(normalImage), new ImageWidget(hoverImage), new ImageWidget(pressedImage), new ImageWidget(disabledImage) ); //Create button based on view container widget return(new Button(0, 0, buttonViewWidget) { Margin = new BorderDouble(0), Padding = new BorderDouble(0) }); }
private ButtonViewStates GetButtonView(string label) { //Create the multi-state button view var buttonViewStates = new ButtonViewStates( new MoveButtonWidget(label, Colors.Text.Normal) { BackgroundColor = Colors.Fill.Normal, BorderWidth = this.BorderWidth }, new MoveButtonWidget(label, Colors.Text.Hover) { BackgroundColor = Colors.Fill.Hover, BorderWidth = this.BorderWidth }, new MoveButtonWidget(label, Colors.Text.Pressed) { BackgroundColor = Colors.Fill.Pressed, BorderWidth = this.BorderWidth }, new MoveButtonWidget(label, Colors.Text.Disabled) { BackgroundColor = Colors.Fill.Disabled, BorderWidth = this.BorderWidth } ); buttonViewStates.HAnchor = HAnchor.ParentLeftRight; buttonViewStates.VAnchor = VAnchor.ParentBottomTop; return(buttonViewStates); }
public TooltipButton GenerateTooltipButton(string label, string normalImageName = null, string hoverImageName = null, string pressedImageName = null, string disabledImageName = null) { //Create button based on view container widget ButtonViewStates buttonViewWidget = getButtonView(label, normalImageName, hoverImageName, pressedImageName, disabledImageName); TooltipButton textImageButton = new TooltipButton(0, 0, buttonViewWidget); textImageButton.Margin = new BorderDouble(0); textImageButton.Padding = new BorderDouble(0); //Override the width if requested if (this.FixedWidth != 0) { buttonViewWidget.Width = this.FixedWidth; textImageButton.Width = this.FixedWidth; } //Override the height if requested buttonViewWidget.Height = this.FixedHeight; textImageButton.Height = this.FixedHeight; textImageButton.MouseEnterBounds += new EventHandler(onEnterTooltipButton); textImageButton.MouseLeaveBounds += new EventHandler(onExitTooltipButton); return(textImageButton); }
private ButtonViewStates getButtonView(string label, ImageBuffer normalImage = null, ImageBuffer hoverImage = null, ImageBuffer pressedImage = null, ImageBuffer disabledImage = null, bool centerText = false) { if (hoverImage == null && normalImage != null) { hoverImage = new ImageBuffer(normalImage); } if (pressedImage == null && hoverImage != null) { pressedImage = new ImageBuffer(hoverImage); } if (disabledImage == null && normalImage != null) { disabledImage = new ImageBuffer(normalImage); } if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage) { if (normalImage != null) { InvertLightness.DoInvertLightness(normalImage); } if (pressedImage != null) { InvertLightness.DoInvertLightness(pressedImage); } if (hoverImage != null) { InvertLightness.DoInvertLightness(hoverImage); } if (disabledImage != null) { InvertLightness.DoInvertLightness(disabledImage); } } if (invertImageLocation) { flowDirection = FlowDirection.RightToLeft; } else { flowDirection = FlowDirection.LeftToRight; } //Create the multi-state button view ButtonViewStates buttonViewWidget = new ButtonViewStates( new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText, imageSpacing: ImageSpacing), new TextImageWidget(label, hoverFillColor, hoverBorderColor, hoverTextColor, borderWidth, Margin, hoverImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText, imageSpacing: ImageSpacing), new TextImageWidget(label, pressedFillColor, pressedBorderColor, pressedTextColor, borderWidth, Margin, pressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText, imageSpacing: ImageSpacing), new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, Margin, disabledImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText, imageSpacing: ImageSpacing) ); return(buttonViewWidget); }
public MoveButton Generate(string label, PrinterConnectionAndCommunication.Axis axis, double movementFeedRate) { //Create button based on view container widget ButtonViewStates buttonViewWidget = GetButtonView(label); MoveButton textImageButton = new MoveButton(0, 0, buttonViewWidget, axis, movementFeedRate); textImageButton.Margin = new BorderDouble(0); textImageButton.Padding = new BorderDouble(0); return(textImageButton); }
public ExtrudeButton Generate(string label, double movementFeedRate, int extruderNumber = 0) { //Create button based on view container widget ButtonViewStates buttonViewWidget = GetButtonView(label); ExtrudeButton textImageButton = new ExtrudeButton(0, 0, buttonViewWidget, movementFeedRate, extruderNumber); textImageButton.Margin = new BorderDouble(0); textImageButton.Padding = new BorderDouble(0); return(textImageButton); }
private ButtonViewStates GetButtonView(string label) { //Create the multi-state button view ButtonViewStates buttonViewWidget = new ButtonViewStates( new MoveButtonWidget(label, normalFillColor, normalTextColor), new MoveButtonWidget(label, hoverFillColor, hoverTextColor), new MoveButtonWidget(label, pressedFillColor, pressedTextColor), new MoveButtonWidget(label, disabledFillColor, disabledTextColor) ); return(buttonViewWidget); }
private ButtonViewStates CreateButtonViewStates(string label) { //Create the multi-state button view ButtonViewStates buttonViewWidget = new ButtonViewStates( new DropDownButtonBase(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, Margin, fontSize, FlowDirection.LeftToRight, FixedHeight), new DropDownButtonBase(label, hoverFillColor, hoverBorderColor, hoverTextColor, borderWidth, Margin, fontSize, FlowDirection.LeftToRight, FixedHeight), new DropDownButtonBase(label, pressedFillColor, pressedBorderColor, pressedTextColor, borderWidth, Margin, fontSize, FlowDirection.LeftToRight, FixedHeight), new DropDownButtonBase(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, Margin, fontSize, FlowDirection.LeftToRight, FixedHeight) ); buttonViewWidget.Padding = new BorderDouble(0, 0); return(buttonViewWidget); }
public PrinterSelectButton() { this.HAnchor = HAnchor.ParentLeftRight; //Widgets to show during the four button states PrinterSelectViewBase buttonWidgetPressed = getButtonWidgetNormal(); PrinterSelectViewBase buttonWidgetHover = getButtonWidgetHover(); PrinterSelectViewBase buttonWidgetNormal = getButtonWidgetNormal(); PrinterSelectViewBase buttonWidgetDisabled = getButtonWidgetNormal(); //Create container for the three state widgets for the button ButtonViewStates buttonView = new ButtonViewStates(buttonWidgetNormal, buttonWidgetHover, buttonWidgetPressed, buttonWidgetDisabled); buttonView.HAnchor = HAnchor.ParentLeftRight; this.ToolTipText = "Select a printer".Localize(); this.Name = "Select a Printer Button"; Margin = DefaultMargin; OriginRelativeParent = new Vector2(0, 0); if (buttonView != null) { buttonView.Selectable = false; AddChild(buttonView); HAnchor = HAnchor.FitToChildren; VAnchor = VAnchor.FitToChildren; if (LocalBounds.Left != 0 || LocalBounds.Bottom != 0) { // let's make sure that a button has 0, 0 at the lower left // move the children so they will fit with 0, 0 at the lower left foreach (GuiWidget child in Children) { child.OriginRelativeParent = child.OriginRelativeParent + new Vector2(-LocalBounds.Left, -LocalBounds.Bottom); } HAnchor = HAnchor.FitToChildren; VAnchor = VAnchor.FitToChildren; } MinimumSize = new Vector2(Width, Height); } }
public Button Generate(string normalImageName, string hoverImageName, string pressedImageName = null, string disabledImageName = null) { if (pressedImageName == null) { pressedImageName = hoverImageName; } if (disabledImageName == null) { disabledImageName = normalImageName; } Agg.Image.ImageBuffer normalImage = new Agg.Image.ImageBuffer(); Agg.Image.ImageBuffer pressedImage = new Agg.Image.ImageBuffer(); Agg.Image.ImageBuffer hoverImage = new Agg.Image.ImageBuffer(); Agg.Image.ImageBuffer disabledImage = new Agg.Image.ImageBuffer(); ImageIO.LoadImageData(this.GetImageLocation(normalImageName), normalImage); ImageIO.LoadImageData(this.GetImageLocation(pressedImageName), pressedImage); ImageIO.LoadImageData(this.GetImageLocation(hoverImageName), hoverImage); ImageIO.LoadImageData(this.GetImageLocation(disabledImageName), disabledImage); if (!ActiveTheme.Instance.IsDarkTheme && invertImageColor) { InvertLightness.DoInvertLightness(normalImage); InvertLightness.DoInvertLightness(pressedImage); InvertLightness.DoInvertLightness(hoverImage); InvertLightness.DoInvertLightness(disabledImage); } //normalImage.NewGraphics2D().Line(0, 0, normalImage.Width, normalImage.Height, RGBA_Bytes.Violet); //pressedImage.NewGraphics2D().Line(0, 0, normalImage.Width, normalImage.Height, RGBA_Bytes.Violet); ButtonViewStates buttonViewWidget = new ButtonViewStates( new ImageWidget(normalImage), new ImageWidget(hoverImage), new ImageWidget(pressedImage), new ImageWidget(disabledImage) ); //Create button based on view container widget Button imageButton = new Button(0, 0, buttonViewWidget); imageButton.Margin = new BorderDouble(0); imageButton.Padding = new BorderDouble(0); return(imageButton); }
public Button Generate(string normalImageName, string hoverImageName, string pressedImageName = null, string disabledImageName = null) { if (pressedImageName == null) { pressedImageName = hoverImageName; } if (disabledImageName == null) { disabledImageName = normalImageName; } Agg.Image.ImageBuffer normalImage = StaticData.Instance.LoadIcon(normalImageName); Agg.Image.ImageBuffer pressedImage = StaticData.Instance.LoadIcon(pressedImageName); Agg.Image.ImageBuffer hoverImage = StaticData.Instance.LoadIcon(hoverImageName); Agg.Image.ImageBuffer disabledImage = StaticData.Instance.LoadIcon(disabledImageName); if (!ActiveTheme.Instance.IsDarkTheme && invertImageColor) { InvertLightness.DoInvertLightness(normalImage); InvertLightness.DoInvertLightness(pressedImage); InvertLightness.DoInvertLightness(hoverImage); InvertLightness.DoInvertLightness(disabledImage); } if (ActiveTheme.Instance.IsTouchScreen) { //normalImage.NewGraphics2D().Line(0, 0, normalImage.Width, normalImage.Height, RGBA_Bytes.Violet); RoundedRect rect = new RoundedRect(pressedImage.GetBounds(), 0); pressedImage.NewGraphics2D().Render(new Stroke(rect, 3), ActiveTheme.Instance.PrimaryTextColor); } ButtonViewStates buttonViewWidget = new ButtonViewStates( new ImageWidget(normalImage), new ImageWidget(hoverImage), new ImageWidget(pressedImage), new ImageWidget(disabledImage) ); //Create button based on view container widget Button imageButton = new Button(0, 0, buttonViewWidget); imageButton.Margin = new BorderDouble(0); imageButton.Padding = new BorderDouble(0); return(imageButton); }
public Button Generate(string label, string normalImageName = null, string hoverImageName = null, string pressedImageName = null, string disabledImageName = null, bool centerText = false) { //Create button based on view container widget ButtonViewStates buttonViewWidget = getButtonView(label, normalImageName, hoverImageName, pressedImageName, disabledImageName, centerText); Button textImageButton = new Button(0, 0, buttonViewWidget); textImageButton.Margin = new BorderDouble(0); textImageButton.Padding = new BorderDouble(0); //Override the width if requested if (this.FixedWidth != 0) { buttonViewWidget.Width = this.FixedWidth; textImageButton.Width = this.FixedWidth; } return(textImageButton); }
public Button Generate(string buttonText) { //Widgets to show during the four button states LinkButtonViewBase buttonWidgetPressed = getButtonWidgetPressed(buttonText); LinkButtonViewBase buttonWidgetHover = getButtonWidgetHover(buttonText); LinkButtonViewBase buttonWidgetNormal = getButtonWidgetNormal(buttonText); LinkButtonViewBase buttonWidgetDisabled = getButtonWidgetDisabled(buttonText); //Create container for the three state widgets for the button ButtonViewStates buttonViewWidget = new ButtonViewStates(buttonWidgetNormal, buttonWidgetHover, buttonWidgetPressed, buttonWidgetDisabled); //Create button based on view container widget return(new Button(0, 0, buttonViewWidget) { Margin = margin, Cursor = Cursors.Hand, }); }
public Button Generate(string buttonText) { //Widgets to show during the four button states ControlButtonViewBase buttonWidgetPressed = getButtonWidgetPressed(buttonText); ControlButtonViewBase buttonWidgetHover = getButtonWidgetHover(buttonText); ControlButtonViewBase buttonWidgetNormal = getButtonWidgetNormal(buttonText); ControlButtonViewBase buttonWidgetDisabled = getButtonWidgetDisabled(buttonText); //Create container for the three state widgets for the button ButtonViewStates buttonViewWidget = new ButtonViewStates(buttonWidgetNormal, buttonWidgetHover, buttonWidgetPressed, buttonWidgetDisabled); //Create button based on view container widget Button controlButton = new Button(0, 0, buttonViewWidget); controlButton.Margin = margin; return(controlButton); }
public Button Generate(string normalImageName, string hoverImageName, string pressedImageName = null, string disabledImageName = null) { if (pressedImageName == null) { pressedImageName = hoverImageName; } if (disabledImageName == null) { disabledImageName = normalImageName; } Agg.Image.ImageBuffer normalImage = StaticData.Instance.LoadIcon(normalImageName); Agg.Image.ImageBuffer pressedImage = StaticData.Instance.LoadIcon(pressedImageName); Agg.Image.ImageBuffer hoverImage = StaticData.Instance.LoadIcon(hoverImageName); Agg.Image.ImageBuffer disabledImage = StaticData.Instance.LoadIcon(disabledImageName); if (!ActiveTheme.Instance.IsDarkTheme && invertImageColor) { InvertLightness.DoInvertLightness(normalImage); InvertLightness.DoInvertLightness(pressedImage); InvertLightness.DoInvertLightness(hoverImage); InvertLightness.DoInvertLightness(disabledImage); } ButtonViewStates buttonViewWidget = new ButtonViewStates( new ImageWidget(normalImage), new ImageWidget(hoverImage), new ImageWidget(pressedImage), new ImageWidget(disabledImage) ); //Create button based on view container widget Button imageButton = new Button(0, 0, buttonViewWidget); imageButton.Margin = new BorderDouble(0); imageButton.Padding = new BorderDouble(0); return(imageButton); }
public Button Generate(ImageBuffer normalImage, ImageBuffer hoverImage, ImageBuffer pressedImage = null, ImageBuffer disabledImage = null) { if (hoverImage == null) { hoverImage = normalImage; } if (pressedImage == null) { pressedImage = hoverImage; } if (disabledImage == null) { disabledImage = normalImage; } if (!ActiveTheme.Instance.IsDarkTheme && InvertImageColor) { normalImage.InvertLightness(); pressedImage.InvertLightness(); hoverImage.InvertLightness(); disabledImage.InvertLightness(); } ButtonViewStates buttonViewWidget = new ButtonViewStates( new ImageWidget(normalImage), new ImageWidget(hoverImage), new ImageWidget(pressedImage), new ImageWidget(disabledImage) ); //Create button based on view container widget Button imageButton = new Button(0, 0, buttonViewWidget); imageButton.Margin = new BorderDouble(0); imageButton.Padding = new BorderDouble(0); return(imageButton); }
public Button GenerateTooltipButton(string label, ImageBuffer normalImageName, ImageBuffer hoverImageName = null, ImageBuffer pressedImageName = null, ImageBuffer disabledImageName = null) { //Create button based on view container widget ButtonViewStates buttonViewWidget = getButtonView(label, normalImageName, hoverImageName, pressedImageName, disabledImageName); Button textImageButton = new Button(0, 0, buttonViewWidget); textImageButton.Margin = new BorderDouble(0); textImageButton.Padding = new BorderDouble(0); //Override the width if requested if (this.FixedWidth != 0) { buttonViewWidget.Width = this.FixedWidth; textImageButton.Width = this.FixedWidth; } //Override the height if requested buttonViewWidget.Height = this.FixedHeight; textImageButton.Height = this.FixedHeight; return(textImageButton); }
private ButtonViewStates getButtonView(string label, ImageBuffer normalImage = null, ImageBuffer hoverImage = null, ImageBuffer pressedImage = null, ImageBuffer disabledImage = null, bool centerText = false) { if (hoverImage == null && normalImage != null) { hoverImage = new ImageBuffer(normalImage); } if (pressedImage == null && hoverImage != null) { pressedImage = new ImageBuffer(hoverImage); } if (disabledImage == null && normalImage != null) { // Generate the disabled image by lowering the alpha disabledImage = normalImage.Multiply(new RGBA_Bytes(255, 255, 255, 150)); } if (ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage) { if (normalImage != null) { // make copies so we don't change source data normalImage = new ImageBuffer(normalImage); normalImage.InvertLightness(); } if (pressedImage != null) { pressedImage.InvertLightness(); pressedImage = new ImageBuffer(pressedImage); } if (hoverImage != null) { hoverImage = new ImageBuffer(hoverImage); hoverImage.InvertLightness(); } if (disabledImage != null) { disabledImage = new ImageBuffer(disabledImage); disabledImage.InvertLightness(); } } if (invertImageLocation) { flowDirection = FlowDirection.RightToLeft; } else { flowDirection = FlowDirection.LeftToRight; } //Create the multi-state button view ButtonViewStates buttonViewWidget = new ButtonViewStates( new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText, imageSpacing: ImageSpacing), new TextImageWidget(label, hoverFillColor, hoverBorderColor, hoverTextColor, borderWidth, Margin, hoverImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText, imageSpacing: ImageSpacing), new TextImageWidget(label, pressedFillColor, pressedBorderColor, pressedTextColor, borderWidth, Margin, pressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText, imageSpacing: ImageSpacing), new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, Margin, disabledImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText, imageSpacing: ImageSpacing) ); return(buttonViewWidget); }
private ButtonViewStates getButtonView(string label, string normalImageName = null, string hoverImageName = null, string pressedImageName = null, string disabledImageName = null, bool centerText = false) { if (hoverImageName == null) { hoverImageName = normalImageName; } if (pressedImageName == null) { pressedImageName = hoverImageName; } if (disabledImageName == null) { disabledImageName = normalImageName; } ImageBuffer normalImage = new ImageBuffer(); ImageBuffer pressedImage = new ImageBuffer(); ImageBuffer hoverImage = new ImageBuffer(); ImageBuffer disabledImage = new ImageBuffer(); if (normalImageName != null) { ImageBMPIO.LoadImageData(this.GetImageLocation(normalImageName), normalImage); } if (hoverImageName != null) { ImageBMPIO.LoadImageData(this.GetImageLocation(pressedImageName), pressedImage); } if (pressedImageName != null) { ImageBMPIO.LoadImageData(this.GetImageLocation(hoverImageName), hoverImage); } if (disabledImageName != null) { ImageBMPIO.LoadImageData(this.GetImageLocation(disabledImageName), disabledImage); } if (invertImageLocation) { flowDirection = FlowDirection.RightToLeft; } else { flowDirection = FlowDirection.LeftToRight; } //Create the multi-state button view ButtonViewStates buttonViewWidget = new ButtonViewStates( new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText), new TextImageWidget(label, hoverFillColor, hoverBorderColor, hoverTextColor, borderWidth, Margin, hoverImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText), new TextImageWidget(label, pressedFillColor, pressedBorderColor, pressedTextColor, borderWidth, Margin, pressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText), new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, Margin, disabledImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText) ); return(buttonViewWidget); }