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

net.peanuuutz.fork.ui.scene.component.NativeWidgetMeasurePolicy.kt Maven / Gradle / Ivy

The newest version!
package net.peanuuutz.fork.ui.scene.component

import androidx.compose.runtime.Stable
import net.peanuuutz.fork.ui.ui.layout.Constraints
import net.peanuuutz.fork.ui.ui.unit.IntSize

// -------- NativeWidget --------

@Stable
fun interface NativeWidgetMeasurePolicy {
    fun measure(
        widget: W,
        constraints: Constraints
    ): IntSize
}

@Stable
val DefaultNativeWidgetMeasurePolicy: NativeWidgetMeasurePolicy =
    NativeWidgetMeasurePolicy { widget, _ -> IntSize(widget.width, widget.height) }

@Stable
val ErrorNativeWidgetMeasurePolicy: NativeWidgetMeasurePolicy =
    NativeWidgetMeasurePolicy { _, _ -> error("No NativeWidgetMeasurePolicy specified") }

// -------- DelegatingNativeWidget --------

typealias DelegatingNativeWidgetMeasurePolicy = NativeWidgetMeasurePolicy>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy