commonMain.com.soywiz.korui.UiCheckBox.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of korgw Show documentation
Show all versions of korgw Show documentation
Portable UI with accelerated graphics support for Kotlin
package com.soywiz.korui
import com.soywiz.korio.lang.*
import com.soywiz.korio.util.*
import com.soywiz.korui.native.*
open class UiCheckBox(app: UiApplication, val checkBox: NativeUiFactory.NativeCheckBox = app.factory.createCheckBox()) : UiComponent(app, checkBox) {
var text by RedirectMutableField(checkBox::text)
var checked by RedirectMutableField(checkBox::checked)
fun onChange(block: UiCheckBox.(Boolean) -> Unit) = checkBox.onChange { block(this, checked) }
}
inline fun UiContainer.checkBox(text: String = "CheckBox", checked: Boolean = false, block: UiCheckBox.() -> Unit = {}): UiCheckBox {
return UiCheckBox(app)
.also { it.text = text }
.also { it.checked = checked }
.also { it.parent = this }.also(block)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy