aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/gui/WTightScrollPanel.kt
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-06-03 14:24:48 +0200
committernea <nea@nea.moe>2023-06-03 14:24:48 +0200
commit9477a32ad577fc242fd83059826706fcea8c6f31 (patch)
tree900481bf5c9bc390b4101f946f6221b9995eccba /src/main/kotlin/moe/nea/firmament/gui/WTightScrollPanel.kt
parent06a8ace53c3c1fcce02e9a9d085b82acb8cecb71 (diff)
downloadfirmament-9477a32ad577fc242fd83059826706fcea8c6f31.tar.gz
firmament-9477a32ad577fc242fd83059826706fcea8c6f31.tar.bz2
firmament-9477a32ad577fc242fd83059826706fcea8c6f31.zip
Bad pets menu
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/gui/WTightScrollPanel.kt')
-rw-r--r--src/main/kotlin/moe/nea/firmament/gui/WTightScrollPanel.kt12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/gui/WTightScrollPanel.kt b/src/main/kotlin/moe/nea/firmament/gui/WTightScrollPanel.kt
new file mode 100644
index 0000000..e9905d8
--- /dev/null
+++ b/src/main/kotlin/moe/nea/firmament/gui/WTightScrollPanel.kt
@@ -0,0 +1,12 @@
+package moe.nea.firmament.gui
+
+import io.github.cottonmc.cotton.gui.widget.WPanel
+import io.github.cottonmc.cotton.gui.widget.WScrollPanel
+import io.github.cottonmc.cotton.gui.widget.WWidget
+
+class WTightScrollPanel(val widget: WWidget, val margin: Int = 3) : WScrollPanel(widget) {
+ override fun setSize(x: Int, y: Int) {
+ (widget as? WPanel)?.layout()
+ super.setSize(widget.width + 8 + margin, y)
+ }
+}