aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/gui/WTightScrollPanel.kt
blob: e4c3989b31f6eaddf5e1dcd97609bcfce3eae196 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * 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.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)
    }
}