public TextButton(string text, TextButtonStyle style) : base(style) { SetStyle(style); label = new Label(text, style.Font, style.FontColor, style.FontScaleX, style.FontScaleY); label.SetAlignment(UI.Align.Center); Add(label).Expand().Fill(); SetSize(PreferredWidth, PreferredHeight); }
public TextButton(string text, TextButtonStyle style) : base(style) { setStyle(style); label = new Label(text, style.font, style.fontColor); label.setAlignment(Align.center); add(label).expand().fill(); setSize(preferredWidth, preferredHeight); }
public TextButton( string text, TextButtonStyle style ) : base( style ) { setStyle( style ); label = new Label( text, style.font, style.fontColor ); label.setAlignment( Align.center ); add( label ).expand().fill(); setSize( preferredWidth, preferredHeight ); }
public override void setStyle(ButtonStyle style) { Assert.isTrue(style is TextButtonStyle, "style must be a TextButtonStyle"); base.setStyle(style); this.style = (TextButtonStyle)style; if (label != null) { var textButtonStyle = (TextButtonStyle)style; var labelStyle = label.getStyle(); labelStyle.font = textButtonStyle.font; labelStyle.fontColor = textButtonStyle.fontColor; label.setStyle(labelStyle); } }
public override void SetStyle(ButtonStyle style) { Insist.IsTrue(style is TextButtonStyle, "style must be a TextButtonStyle"); base.SetStyle(style); this.style = (TextButtonStyle)style; if (label != null) { var textButtonStyle = (TextButtonStyle)style; var labelStyle = label.GetStyle(); labelStyle.Font = textButtonStyle.Font; labelStyle.FontColor = textButtonStyle.FontColor; label.SetStyle(labelStyle); } }
public override void setStyle( ButtonStyle style ) { Assert.isTrue( style is TextButtonStyle, "style must be a TextButtonStyle" ); base.setStyle( style ); this.style = (TextButtonStyle)style; if( label != null ) { var textButtonStyle = (TextButtonStyle)style; var labelStyle = label.getStyle(); labelStyle.font = textButtonStyle.font; labelStyle.fontColor = textButtonStyle.fontColor; label.setStyle( labelStyle ); } }
/** Adds a text button to the button table. * @param object The object that will be passed to {@link #result(Object)} if this button is clicked. May be null. */ public Button AddButton(string text, TextButtonStyle buttonStyle) { return(AddButton(new TextButton(text, buttonStyle))); }
/// <summary> /// creates a default Skin that can be used for quick mockups. Includes button, textu button, checkbox, progress bar and slider styles. /// </summary> /// <returns>The default skin.</returns> public static Skin CreateDefaultSkin() { var skin = new Skin(); // define our colors var buttonColor = new Color(78, 91, 98); var buttonOver = new Color(168, 207, 115); var buttonDown = new Color(244, 23, 135); var overFontColor = new Color(85, 127, 27); var downFontColor = new Color(255, 255, 255); var checkedOverFontColor = new Color(247, 217, 222); var checkboxOn = new Color(168, 207, 115); var checkboxOff = new Color(63, 63, 63); var checkboxOver = new Color(130, 130, 130); var checkboxOverFontColor = new Color(220, 220, 220); var barBg = new Color(78, 91, 98); var barKnob = new Color(25, 144, 188); var barKnobOver = new Color(168, 207, 115); var barKnobDown = new Color(244, 23, 135); var windowColor = new Color(17, 17, 17); var textFieldFontColor = new Color(220, 220, 220); var textFieldCursorColor = new Color(83, 170, 116); var textFieldSelectionColor = new Color(180, 52, 166); var textFieldBackgroundColor = new Color(22, 22, 22); var scrollPaneScrollBarColor = new Color(44, 44, 44); var scrollPaneKnobColor = new Color(241, 156, 0); var listBoxBackgroundColor = new Color(20, 20, 20); var listBoxSelectionColor = new Color(241, 156, 0); var listBoxHoverSelectionColor = new Color(120, 78, 0); var selectBoxBackgroundColor = new Color(10, 10, 10); // add all our styles var buttonStyle = new ButtonStyle { Up = new PrimitiveDrawable(buttonColor, 10), Over = new PrimitiveDrawable(buttonOver), Down = new PrimitiveDrawable(buttonDown) }; skin.Add("default", buttonStyle); var textButtonStyle = new TextButtonStyle { Up = new PrimitiveDrawable(buttonColor, 6, 2), Over = new PrimitiveDrawable(buttonOver), Down = new PrimitiveDrawable(buttonDown), OverFontColor = overFontColor, DownFontColor = downFontColor, PressedOffsetX = 1, PressedOffsetY = 1 }; skin.Add("default", textButtonStyle); var toggleButtonStyle = new TextButtonStyle { Up = new PrimitiveDrawable(buttonColor, 10, 5), Over = new PrimitiveDrawable(buttonOver), Down = new PrimitiveDrawable(buttonDown), Checked = new PrimitiveDrawable(new Color(255, 0, 0, 255)), CheckedOverFontColor = checkedOverFontColor, OverFontColor = overFontColor, DownFontColor = downFontColor, PressedOffsetX = 1, PressedOffsetY = 1 }; skin.Add("toggle", toggleButtonStyle); var checkboxStyle = new CheckBoxStyle { CheckboxOn = new PrimitiveDrawable(30, checkboxOn), CheckboxOff = new PrimitiveDrawable(30, checkboxOff), CheckboxOver = new PrimitiveDrawable(30, checkboxOver), OverFontColor = checkboxOverFontColor, DownFontColor = downFontColor, PressedOffsetX = 1, PressedOffsetY = 1 }; skin.Add("default", checkboxStyle); var progressBarStyle = new ProgressBarStyle { Background = new PrimitiveDrawable(14, barBg), KnobBefore = new PrimitiveDrawable(14, barKnobOver) }; skin.Add("default", progressBarStyle); var sliderStyle = new SliderStyle { Background = new PrimitiveDrawable(6, barBg), Knob = new PrimitiveDrawable(14, barKnob), KnobOver = new PrimitiveDrawable(14, barKnobOver), KnobDown = new PrimitiveDrawable(14, barKnobDown) }; skin.Add("default", sliderStyle); var windowStyle = new WindowStyle { Background = new PrimitiveDrawable(windowColor) }; skin.Add("default", windowStyle); var textFieldStyle = TextFieldStyle.Create(textFieldFontColor, textFieldCursorColor, textFieldSelectionColor, textFieldBackgroundColor); skin.Add("default", textFieldStyle); var labelStyle = new LabelStyle(); skin.Add("default", labelStyle); var scrollPaneStyle = new ScrollPaneStyle { VScroll = new PrimitiveDrawable(6, 0, scrollPaneScrollBarColor), VScrollKnob = new PrimitiveDrawable(6, 50, scrollPaneKnobColor), HScroll = new PrimitiveDrawable(0, 6, scrollPaneScrollBarColor), HScrollKnob = new PrimitiveDrawable(50, 6, scrollPaneKnobColor) }; skin.Add("default", scrollPaneStyle); var listBoxStyle = new ListBoxStyle { FontColorHovered = new Color(255, 255, 255), Selection = new PrimitiveDrawable(listBoxSelectionColor, 5, 5), HoverSelection = new PrimitiveDrawable(listBoxHoverSelectionColor, 5, 5), Background = new PrimitiveDrawable(listBoxBackgroundColor) }; skin.Add("default", listBoxStyle); var selectBoxStyle = new SelectBoxStyle { ListStyle = listBoxStyle, ScrollStyle = scrollPaneStyle, Background = new PrimitiveDrawable(selectBoxBackgroundColor, 4, 4) }; skin.Add("default", selectBoxStyle); var textTooltipStyle = new TextTooltipStyle { LabelStyle = new LabelStyle(listBoxBackgroundColor), Background = new PrimitiveDrawable(checkboxOn, 4, 2) }; skin.Add("default", textTooltipStyle); return(skin); }
public NumberFieldStyle(BitmapFont font, Color fontColor, IDrawable cursor, IDrawable selection, IDrawable background, TextButtonStyle decreaseButtonStyle, TextButtonStyle increaseButtonStyle) : base(font, fontColor, cursor, selection, background) { this.DecreaseButtonStyle = decreaseButtonStyle; this.IncreaseButtonStyle = increaseButtonStyle; }
/// <summary> /// creates a default Skin that can be used for quick mockups. Includes button, textu button, checkbox, progress bar and slider styles. /// </summary> /// <returns>The default skin.</returns> public static Skin createDefaultSkin() { var skin = new Skin(); // define our colors var buttonColor = new Color(78, 91, 98); var buttonOver = new Color(168, 207, 115); var buttonDown = new Color(244, 23, 135); var overFontColor = new Color(85, 127, 27); var downFontColor = new Color(255, 255, 255); var checkedOverFontColor = new Color(247, 217, 222); var checkboxOn = new Color(168, 207, 115); var checkboxOff = new Color(63, 63, 63); var checkboxOver = new Color(130, 130, 130); var checkboxOverFontColor = new Color(220, 220, 220); var barBg = new Color(78, 91, 98); var barKnob = new Color(25, 144, 188); var barKnobOver = new Color(168, 207, 115); var barKnobDown = new Color(244, 23, 135); var windowColor = new Color(17, 17, 17); // add all our styles var buttonStyle = new ButtonStyle { up = new PrimitiveDrawable(buttonColor, 10), over = new PrimitiveDrawable(buttonOver), down = new PrimitiveDrawable(buttonDown) }; skin.add("default", buttonStyle); var textButtonStyle = new TextButtonStyle { up = new PrimitiveDrawable(buttonColor, 10, 5), over = new PrimitiveDrawable(buttonOver), down = new PrimitiveDrawable(buttonDown), overFontColor = overFontColor, downFontColor = downFontColor, pressedOffsetX = 1, pressedOffsetY = 1 }; skin.add("default", textButtonStyle); var toggleButtonStyle = new TextButtonStyle { up = new PrimitiveDrawable(buttonColor, 10, 5), over = new PrimitiveDrawable(buttonOver), down = new PrimitiveDrawable(buttonDown), checkked = new PrimitiveDrawable(new Color(255, 0, 0, 255)), checkedOverFontColor = checkedOverFontColor, overFontColor = overFontColor, downFontColor = downFontColor, pressedOffsetX = 1, pressedOffsetY = 1 }; skin.add("toggle", toggleButtonStyle); var checkboxStyle = new CheckBoxStyle { checkboxOn = new PrimitiveDrawable(30, checkboxOn), checkboxOff = new PrimitiveDrawable(30, checkboxOff), checkboxOver = new PrimitiveDrawable(30, checkboxOver), overFontColor = checkboxOverFontColor, downFontColor = downFontColor, pressedOffsetX = 1, pressedOffsetY = 1 }; skin.add("default", checkboxStyle); var progressBarStyle = new ProgressBarStyle { background = new PrimitiveDrawable(20, barBg), knobBefore = new PrimitiveDrawable(20, barKnobOver) }; skin.add("default", progressBarStyle); var sliderStyle = new SliderStyle { background = new PrimitiveDrawable(20, barBg), knob = new PrimitiveDrawable(30, barKnob), knobOver = new PrimitiveDrawable(30, barKnobOver), knobDown = new PrimitiveDrawable(30, barKnobDown) }; skin.add("default", sliderStyle); var windowStyle = new WindowStyle { background = new PrimitiveDrawable(windowColor) }; skin.add("default", windowStyle); return(skin); }
/** Adds a text button to the button table. * @param object The object that will be passed to {@link #result(Object)} if this button is clicked. May be null. */ public Button addButton( string text, TextButtonStyle buttonStyle ) { return addButton( new TextButton( text, buttonStyle ) ); }
/** Adds a text button to the button table. * @param object The object that will be passed to {@link #result(Object)} if this button is clicked. May be null. */ public Button addButton(String text, TextButtonStyle buttonStyle) { return(addButton(new TextButton(text, buttonStyle))); }