mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-21 21:30:20 +07:00
Restore the button's style correctly (#7683)
This commit is contained in:
@ -46,12 +46,14 @@ private class RestorableTextButtonStyle(
|
||||
baseStyle: TextButtonStyle,
|
||||
val restoreStyle: ButtonStyle
|
||||
) : TextButtonStyle(baseStyle)
|
||||
|
||||
/** Disable a [Button] by setting its [touchable][Button.touchable] and [color][Button.color] properties. */
|
||||
fun Button.disable() {
|
||||
touchable= Touchable.disabled
|
||||
touchable = Touchable.disabled
|
||||
val oldStyle = style
|
||||
val disabledStyle = BaseScreen.skin.get("disabled", TextButtonStyle::class.java)
|
||||
style = RestorableTextButtonStyle(disabledStyle, oldStyle)
|
||||
if (oldStyle !is RestorableTextButtonStyle)
|
||||
style = RestorableTextButtonStyle(disabledStyle, oldStyle)
|
||||
}
|
||||
/** Enable a [Button] by setting its [touchable][Button.touchable] and [color][Button.color] properties. */
|
||||
fun Button.enable() {
|
||||
|
Reference in New Issue
Block a user