aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/gui/WSpacer.kt
blob: 8cdc4b8519ec032a10f23e5587506f277e12c009 (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
/*
 * 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.WWidget

class WSpacer(val child: WWidget, val spaceLeft: Int) : WPanel() {
    init {
        children.add(child)
        child.setLocation(spaceLeft, 0)
    }

    override fun getWidth(): Int {
        return child.width + spaceLeft
    }

    override fun getHeight(): Int {
        return child.height
    }
}