|
|
@ -147,11 +147,11 @@ import java.awt.image.BufferedImage |
|
|
|
|
|
|
|
|
|
|
|
@OptIn(ExperimentalComposeUiApi::class) |
|
|
|
@OptIn(ExperimentalComposeUiApi::class) |
|
|
|
fun main() = application { |
|
|
|
fun main() = application { |
|
|
|
val state = rememberWindowState() |
|
|
|
var isVisible by remember { mutableStateOf(true) } |
|
|
|
|
|
|
|
|
|
|
|
Window( |
|
|
|
Window( |
|
|
|
onCloseRequest = { state.isVisible = false }, |
|
|
|
onCloseRequest = { isVisible = false }, |
|
|
|
state, |
|
|
|
visible = isVisible, |
|
|
|
title = "Counter", |
|
|
|
title = "Counter", |
|
|
|
) { |
|
|
|
) { |
|
|
|
var counter by remember { mutableStateOf(0) } |
|
|
|
var counter by remember { mutableStateOf(0) } |
|
|
@ -164,13 +164,13 @@ fun main() = application { |
|
|
|
Text(counter.toString()) |
|
|
|
Text(counter.toString()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!state.isVisible && state.isOpen) { |
|
|
|
if (!isVisible) { |
|
|
|
Tray( |
|
|
|
Tray( |
|
|
|
remember { getTrayIcon() }, |
|
|
|
remember { getTrayIcon() }, |
|
|
|
hint = "Counter", |
|
|
|
hint = "Counter", |
|
|
|
onAction = { state.isVisible = true }, |
|
|
|
onAction = { isVisible = true }, |
|
|
|
menu = { |
|
|
|
menu = { |
|
|
|
Item("Exit", onClick = { state.isOpen = false }) |
|
|
|
Item("Exit", onClick = ::exitApplication) |
|
|
|
}, |
|
|
|
}, |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
@ -273,6 +273,7 @@ import androidx.compose.ui.Modifier |
|
|
|
import androidx.compose.ui.unit.dp |
|
|
|
import androidx.compose.ui.unit.dp |
|
|
|
import androidx.compose.ui.window.Window |
|
|
|
import androidx.compose.ui.window.Window |
|
|
|
import androidx.compose.ui.window.WindowPlacement |
|
|
|
import androidx.compose.ui.window.WindowPlacement |
|
|
|
|
|
|
|
import androidx.compose.ui.window.WindowPosition |
|
|
|
import androidx.compose.ui.window.application |
|
|
|
import androidx.compose.ui.window.application |
|
|
|
import androidx.compose.ui.window.rememberWindowState |
|
|
|
import androidx.compose.ui.window.rememberWindowState |
|
|
|
|
|
|
|
|
|
|
@ -429,12 +430,17 @@ import androidx.compose.runtime.remember |
|
|
|
import androidx.compose.ui.Alignment |
|
|
|
import androidx.compose.ui.Alignment |
|
|
|
import androidx.compose.ui.ExperimentalComposeUiApi |
|
|
|
import androidx.compose.ui.ExperimentalComposeUiApi |
|
|
|
import androidx.compose.ui.window.Dialog |
|
|
|
import androidx.compose.ui.window.Dialog |
|
|
|
|
|
|
|
import androidx.compose.ui.window.DialogState |
|
|
|
import androidx.compose.ui.window.Window |
|
|
|
import androidx.compose.ui.window.Window |
|
|
|
|
|
|
|
import androidx.compose.ui.window.WindowPosition |
|
|
|
|
|
|
|
import androidx.compose.ui.window.WindowState |
|
|
|
import androidx.compose.ui.window.application |
|
|
|
import androidx.compose.ui.window.application |
|
|
|
|
|
|
|
|
|
|
|
@OptIn(ExperimentalComposeUiApi::class) |
|
|
|
@OptIn(ExperimentalComposeUiApi::class) |
|
|
|
fun main() = application { |
|
|
|
fun main() = application { |
|
|
|
Window { |
|
|
|
Window( |
|
|
|
|
|
|
|
onCloseRequest = ::exitApplication, |
|
|
|
|
|
|
|
) { |
|
|
|
var isDialogOpen by remember { mutableStateOf(false) } |
|
|
|
var isDialogOpen by remember { mutableStateOf(false) } |
|
|
|
|
|
|
|
|
|
|
|
Button(onClick = { isDialogOpen = true }) { |
|
|
|
Button(onClick = { isDialogOpen = true }) { |
|
|
@ -444,7 +450,7 @@ fun main() = application { |
|
|
|
if (isDialogOpen) { |
|
|
|
if (isDialogOpen) { |
|
|
|
Dialog( |
|
|
|
Dialog( |
|
|
|
onCloseRequest = { isDialogOpen = false }, |
|
|
|
onCloseRequest = { isDialogOpen = false }, |
|
|
|
initialAlignment = Alignment.Center |
|
|
|
state = DialogState(position = WindowPosition(Alignment.Center)) |
|
|
|
) { |
|
|
|
) { |
|
|
|
// Dialog's content |
|
|
|
// Dialog's content |
|
|
|
} |
|
|
|
} |
|
|
|