diff options
author | nea <romangraef@gmail.com> | 2022-10-22 00:34:22 +0200 |
---|---|---|
committer | nea <romangraef@gmail.com> | 2022-10-22 00:34:22 +0200 |
commit | f85c449ed586c7ced780423943e55bfa5abaeb0f (patch) | |
tree | 0c5f59c73cc9e5fcb07de6e3f1f102e2413def27 /src/main/kotlin/moe/nea/notenoughupdates/gui/ConfigGui.kt | |
parent | c98d4693f1fc9dcae8d78cb33e6233629f4cb2e7 (diff) | |
download | firmament-f85c449ed586c7ced780423943e55bfa5abaeb0f.tar.gz firmament-f85c449ed586c7ced780423943e55bfa5abaeb0f.tar.bz2 firmament-f85c449ed586c7ced780423943e55bfa5abaeb0f.zip |
rudimentary config gui (again)
Diffstat (limited to 'src/main/kotlin/moe/nea/notenoughupdates/gui/ConfigGui.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/notenoughupdates/gui/ConfigGui.kt | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/gui/ConfigGui.kt b/src/main/kotlin/moe/nea/notenoughupdates/gui/ConfigGui.kt index a5453a9..06d0ad0 100644 --- a/src/main/kotlin/moe/nea/notenoughupdates/gui/ConfigGui.kt +++ b/src/main/kotlin/moe/nea/notenoughupdates/gui/ConfigGui.kt @@ -9,11 +9,11 @@ import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment import io.github.cottonmc.cotton.gui.widget.data.Insets import io.github.cottonmc.cotton.gui.widget.data.VerticalAlignment import moe.nea.notenoughupdates.NotEnoughUpdates -import moe.nea.notenoughupdates.util.config.ConfigHolder +import moe.nea.notenoughupdates.util.data.DataHolder import net.minecraft.text.Text import kotlin.reflect.KMutableProperty1 -class ConfigGui<K>(val holder: ConfigHolder<K>, val build: ConfigGui<K>.() -> Unit) : LightweightGuiDescription() { +class ConfigGui<K>(val holder: DataHolder<K>, val build: ConfigGui<K>.() -> Unit) : LightweightGuiDescription() { private val root = WGridPanelWithPadding(verticalPadding = 4) private val reloadables = mutableListOf<(() -> Unit)>() @@ -43,9 +43,9 @@ class ConfigGui<K>(val holder: ConfigHolder<K>, val build: ConfigGui<K>.() -> Un fun toggle(text: Text, prop: KMutableProperty1<K, Boolean>) { val toggle = WToggleButton(text) - reloadables.add { toggle.toggle = prop.get(holder.config) } + reloadables.add { toggle.toggle = prop.get(holder.data) } toggle.setOnToggle { - prop.set(holder.config, true) + prop.set(holder.data, true) holder.markDirty() } root.add(toggle, 5, col, 6, 1) @@ -72,11 +72,11 @@ class ConfigGui<K>(val holder: ConfigHolder<K>, val build: ConfigGui<K>.() -> Un val textfield = WTextField(background) textfield.isEditable = true reloadables.add { - textfield.text = prop.get(holder.config) + textfield.text = prop.get(holder.data) } textfield.maxLength = maxLength textfield.setChangedListener { - prop.set(holder.config, it) + prop.set(holder.data, it) holder.markDirty() } root.add(textfield, 5, col, 6, 11) |