From a5155e33f226fea9d1684db4b5831952c081dde2 Mon Sep 17 00:00:00 2001 From: nea Date: Mon, 31 Jul 2023 02:12:04 +0200 Subject: add back button --- .../kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt b/src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt index 83d95ca..61d23c0 100644 --- a/src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt +++ b/src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt @@ -20,7 +20,12 @@ package moe.nea.firmament.gui.config import io.github.cottonmc.cotton.gui.client.CottonClientScreen import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription +import io.github.cottonmc.cotton.gui.widget.WBox +import io.github.cottonmc.cotton.gui.widget.WButton +import io.github.cottonmc.cotton.gui.widget.WLabel +import io.github.cottonmc.cotton.gui.widget.data.Axis import io.github.cottonmc.cotton.gui.widget.data.Insets +import io.github.cottonmc.cotton.gui.widget.data.VerticalAlignment import moe.nea.jarvis.api.Point import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString @@ -193,6 +198,16 @@ abstract class ManagedConfig(val name: String) { val guiapp = GuiAppender(20, { requireNotNull(screen) { "Screen Accessor called too early" } }) latestGuiAppender = guiapp guiapp.panel.insets = Insets.ROOT_PANEL + guiapp.appendFullRow(WBox(Axis.HORIZONTAL).also { + it.add(WButton(Text.literal("←")).also { + it.setOnClick { + AllConfigsGui.showAllGuis() + } + }) + it.add(WLabel(Text.translatable("firmament.config.${name}")).also { + it.verticalAlignment = VerticalAlignment.CENTER + }) + }) sortedOptions.forEach { it.appendToGui(guiapp) } guiapp.reloadables.forEach { it() } lwgd.setRootPanel(guiapp.panel) -- cgit