@Override public void setStyle(ButtonStyle style) { if (!(style instanceof MenuItemStyle)) throw new IllegalArgumentException("style must be a MenuItemStyle."); super.setStyle(style); this.style = (MenuItemStyle) style; if (label != null) { TextButtonStyle textButtonStyle = (TextButtonStyle) style; LabelStyle labelStyle = label.getStyle(); labelStyle.font = textButtonStyle.font; labelStyle.fontColor = textButtonStyle.fontColor; label.setStyle(labelStyle); } }
@Override public void draw(Batch batch, float parentAlpha) { Color fontColor; if (isDisabled() && style.disabledFontColor != null) fontColor = style.disabledFontColor; else if (isPressed() && style.downFontColor != null) fontColor = style.downFontColor; else if (isChecked() && style.checkedFontColor != null) fontColor = (isOver() && style.checkedOverFontColor != null) ? style.checkedOverFontColor : style.checkedFontColor; else if (isOver() && style.overFontColor != null) fontColor = style.overFontColor; else fontColor = style.fontColor; if (fontColor != null) label.getStyle().fontColor = fontColor; if (isDisabled()) shortcutLabel.getStyle().fontColor = style.disabledFontColor; else shortcutLabel.getStyle().fontColor = shortcutLabelColor; if (image != null && generateDisabledImage) { if (isDisabled()) image.setColor(Color.GRAY); else image.setColor(Color.WHITE); } super.draw(batch, parentAlpha); }