blob: 1469880cd8755f40c4bacef81de9ccc1221cad9d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/*
* SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
package moe.nea.firmament.gui
import io.github.cottonmc.cotton.gui.widget.WPanel
import io.github.cottonmc.cotton.gui.widget.WPanelWithInsets
import io.github.cottonmc.cotton.gui.widget.WWidget
class WSplitPanel(val left: WWidget, val right: WWidget) : WPanelWithInsets() {
init {
left.parent = this
right.parent = this
children.add(left)
children.add(right)
}
override fun layout() {
expandToFit(left, insets)
expandToFit(right, insets)
(left as? WPanel)?.layout()
(right as? WPanel)?.layout()
left.setLocation(insets.left, insets.top)
right.setLocation(width - insets.right - right.width, insets.top)
}
}
|