Inceptum/launcher-gtk/src/main/kotlin/io/gitlab/jfronny/inceptum/gtk/util/UIExt.kt

42 lines
1.0 KiB
Kotlin

package io.gitlab.jfronny.inceptum.gtk.util
import io.gitlab.jfronny.inceptum.gtk.control.ILabel
import org.gnome.adw.ActionRow
import org.gnome.gtk.*
var Widget.margin: Int
set(value) {
marginVertical = value
marginHorizontal = value
}
get() = throw NotImplementedError()
var Widget.marginVertical: Int
set(value) {
marginTop = value
marginBottom = value
}
get() = throw NotImplementedError()
var Widget.marginHorizontal: Int
set(value) {
marginStart = value
marginEnd = value
}
get() = throw NotImplementedError()
var MessageDialog.markup: String
set(value) { setMarkup(value) }
get() = throw NotImplementedError()
fun ActionRow.fixSubtitle() = ILabel.theme(firstChild!!.lastChild!!.prevSibling!!.lastChild as Label, ILabel.Mode.SUBTITLE)
// Work around a segfault with empty entries
var Entry.kText: String?
get() = text
set(value) {
if (value == "") buffer.clear()
else text = value
}
fun EntryBuffer.clear() = deleteText(0, length)