net.peanuuutz.fork.ui.scene.component.NativeWidgetMeasurePolicy.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fork-ui Show documentation
Show all versions of fork-ui Show documentation
Comprehensive API designed for Minecraft modders
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>