aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/gui/config/KeyBindingHandler.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/gui/config/KeyBindingHandler.kt')
-rw-r--r--src/main/kotlin/gui/config/KeyBindingHandler.kt8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/kotlin/gui/config/KeyBindingHandler.kt b/src/main/kotlin/gui/config/KeyBindingHandler.kt
index 7ec7e81..0cf0c46 100644
--- a/src/main/kotlin/gui/config/KeyBindingHandler.kt
+++ b/src/main/kotlin/gui/config/KeyBindingHandler.kt
@@ -30,7 +30,7 @@ class KeyBindingHandler(val name: String, val managedConfig: ManagedConfig) :
return Json.decodeFromJsonElement(element)
}
- override fun emitGuiElements(opt: ManagedOption<SavedKeyBinding>, guiAppender: GuiAppender) {
+ fun createButtonComponent(opt: ManagedOption<SavedKeyBinding>): FirmButtonComponent {
lateinit var button: FirmButtonComponent
val sm = KeyBindingStateManager(
{ opt.value },
@@ -67,7 +67,11 @@ class KeyBindingHandler(val name: String, val managedConfig: ManagedConfig) :
}
}
sm.updateLabel()
- guiAppender.appendLabeledRow(opt.labelText, button)
+ return button
+ }
+
+ override fun emitGuiElements(opt: ManagedOption<SavedKeyBinding>, guiAppender: GuiAppender) {
+ guiAppender.appendLabeledRow(opt.labelText, createButtonComponent(opt))
}
}