|
|
@ -187,7 +187,7 @@ To get the properties of a window, it is enough to have a link to the current or |
|
|
|
1. Using the global environment: |
|
|
|
1. Using the global environment: |
|
|
|
|
|
|
|
|
|
|
|
```kotlin |
|
|
|
```kotlin |
|
|
|
import androidx.compose.desktop.AppWindowAmbient |
|
|
|
import androidx.compose.desktop.LocalAppWindow |
|
|
|
import androidx.compose.desktop.Window |
|
|
|
import androidx.compose.desktop.Window |
|
|
|
import androidx.compose.foundation.layout.Box |
|
|
|
import androidx.compose.foundation.layout.Box |
|
|
|
import androidx.compose.foundation.layout.Column |
|
|
|
import androidx.compose.foundation.layout.Column |
|
|
@ -203,7 +203,7 @@ fun main() { |
|
|
|
val windowPos = mutableStateOf(IntOffset.Zero) |
|
|
|
val windowPos = mutableStateOf(IntOffset.Zero) |
|
|
|
|
|
|
|
|
|
|
|
Window { |
|
|
|
Window { |
|
|
|
val current = AppWindowAmbient.current |
|
|
|
val current = LocalAppWindow.current |
|
|
|
|
|
|
|
|
|
|
|
// Content |
|
|
|
// Content |
|
|
|
Box( |
|
|
|
Box( |
|
|
@ -214,10 +214,8 @@ fun main() { |
|
|
|
Text(text = "Location: ${windowPos.value}") |
|
|
|
Text(text = "Location: ${windowPos.value}") |
|
|
|
Button( |
|
|
|
Button( |
|
|
|
onClick = { |
|
|
|
onClick = { |
|
|
|
if (current != null) { |
|
|
|
|
|
|
|
windowPos.value = IntOffset(current.x, current.y) |
|
|
|
windowPos.value = IntOffset(current.x, current.y) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
) { |
|
|
|
) { |
|
|
|
Text(text = "Print window location") |
|
|
|
Text(text = "Print window location") |
|
|
|
} |
|
|
|
} |
|
|
@ -281,14 +279,14 @@ Using the following methods, you can change the properties of the AppWindow: |
|
|
|
6. setMenuBar(menuBar: MenuBar) - window menu bar |
|
|
|
6. setMenuBar(menuBar: MenuBar) - window menu bar |
|
|
|
|
|
|
|
|
|
|
|
```kotlin |
|
|
|
```kotlin |
|
|
|
import androidx.compose.desktop.AppWindowAmbient |
|
|
|
import androidx.compose.desktop.LocalAppWindow |
|
|
|
import androidx.compose.desktop.Window |
|
|
|
import androidx.compose.desktop.Window |
|
|
|
import androidx.compose.material.Text |
|
|
|
import androidx.compose.material.Text |
|
|
|
import androidx.compose.material.Button |
|
|
|
import androidx.compose.material.Button |
|
|
|
|
|
|
|
|
|
|
|
fun main() { |
|
|
|
fun main() { |
|
|
|
Window { |
|
|
|
Window { |
|
|
|
val window = AppWindowAmbient.current!! |
|
|
|
val window = LocalAppWindow.current |
|
|
|
// Content |
|
|
|
// Content |
|
|
|
Button( |
|
|
|
Button( |
|
|
|
onClick = { |
|
|
|
onClick = { |
|
|
|