Make use of WFixedPanel for the config gui
This commit is contained in:
25
src/main/kotlin/moe/nea/firmament/gui/WFixedPanel.kt
Normal file
25
src/main/kotlin/moe/nea/firmament/gui/WFixedPanel.kt
Normal file
@@ -0,0 +1,25 @@
|
||||
package moe.nea.firmament.gui
|
||||
|
||||
import io.github.cottonmc.cotton.gui.widget.WPanel
|
||||
import io.github.cottonmc.cotton.gui.widget.WWidget
|
||||
|
||||
class WFixedPanel() : WPanel() {
|
||||
var child: WWidget
|
||||
set(value) {
|
||||
children.clear()
|
||||
setSize(0, 0)
|
||||
children.add(value)
|
||||
}
|
||||
get() = children.single()
|
||||
|
||||
constructor(child: WWidget) : this() {
|
||||
this.child = child
|
||||
}
|
||||
|
||||
override fun layout() {
|
||||
setSize(0, 0)
|
||||
super.layout()
|
||||
}
|
||||
|
||||
override fun canResize(): Boolean = false
|
||||
}
|
||||
Reference in New Issue
Block a user