diff --git a/korge/src/korlibs/korge/ui/UIWindow.kt b/korge/src/korlibs/korge/ui/UIWindow.kt index 8708403a80..473e2f508a 100644 --- a/korge/src/korlibs/korge/ui/UIWindow.kt +++ b/korge/src/korlibs/korge/ui/UIWindow.kt @@ -19,12 +19,13 @@ import korlibs.time.* inline fun Container.uiWindow( title: String, size: Size = Size(256, 256), + resizable: Boolean = true, configure: @ViewDslMarker UIWindow.() -> Unit = {}, block: @ViewDslMarker Container.(UIWindow) -> Unit = {}, -): UIWindow = UIWindow(title, size).addTo(this).apply(configure).also { block(it.container.container, it) } +): UIWindow = UIWindow(title, size, resizable).addTo(this).apply(configure).also { block(it.container.container, it) } @KorgeExperimental -class UIWindow(title: String, size: Size = Size(256, 256)) : UIContainer(size) { +class UIWindow(title: String, size: Size = Size(256, 256), private var resizable: Boolean = true) : UIContainer(size) { private val titleHeight = 32.0 private val buttonSeparation = 6.0 val isFocused get() = this.index == (parent?.numChildren ?: 0) -1 @@ -235,7 +236,11 @@ class UIWindow(title: String, size: Size = Size(256, 256)) : UIContainer(size) { titleContainer.size(width, titleHeight) container.size(width, height - titleHeight) closeButton.position(width - titleHeight - buttonSeparation, buttonSeparation) - scaleHandlers.fastForEach { it.resized(width, height) } + + if (resizable){ + scaleHandlers.fastForEach { it.resized(width, height) } + } + } fun close() {