commonMain.com.soywiz.korui.UiComboBox.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.util.*
import com.soywiz.korui.native.*
open class UiComboBox(app: UiApplication, val comboBox: NativeUiFactory.NativeComboBox = app.factory.createComboBox()) : UiComponent(app, comboBox) {
var items by RedirectMutableField(comboBox::items)
var selectedItem by RedirectMutableField(comboBox::selectedItem)
fun open() = comboBox.open()
fun close() = comboBox.close()
fun onChange(block: () -> Unit) = comboBox.onChange(block)
}
inline fun UiContainer.comboBox(selectedItem: T, items: List, block: UiComboBox.() -> Unit = {}): UiComboBox =
UiComboBox(app)
.also { it.parent = this }
.also { it.items = items }
.also { it.selectedItem = selectedItem }
.also(block)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy