All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.soywiz.korui.UiComboBox.kt Maven / Gradle / Ivy

There is a newer version: 4.0.10
Show newest version
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