|
|
@ -2,6 +2,7 @@ import androidx.compose.runtime.Composable |
|
|
|
import androidx.compose.runtime.key |
|
|
|
import androidx.compose.runtime.key |
|
|
|
import androidx.compose.runtime.rememberCoroutineScope |
|
|
|
import androidx.compose.runtime.rememberCoroutineScope |
|
|
|
import androidx.compose.ui.ExperimentalComposeUiApi |
|
|
|
import androidx.compose.ui.ExperimentalComposeUiApi |
|
|
|
|
|
|
|
import androidx.compose.ui.window.ApplicationScope |
|
|
|
import androidx.compose.ui.window.MenuScope |
|
|
|
import androidx.compose.ui.window.MenuScope |
|
|
|
import androidx.compose.ui.window.Tray |
|
|
|
import androidx.compose.ui.window.Tray |
|
|
|
import common.LocalAppResources |
|
|
|
import common.LocalAppResources |
|
|
@ -9,7 +10,7 @@ import kotlinx.coroutines.launch |
|
|
|
import window.NotepadWindow |
|
|
|
import window.NotepadWindow |
|
|
|
|
|
|
|
|
|
|
|
@Composable |
|
|
|
@Composable |
|
|
|
fun NotepadApplication(state: NotepadApplicationState) { |
|
|
|
fun ApplicationScope.NotepadApplication(state: NotepadApplicationState) { |
|
|
|
if (state.settings.isTrayEnabled && state.windows.isNotEmpty()) { |
|
|
|
if (state.settings.isTrayEnabled && state.windows.isNotEmpty()) { |
|
|
|
ApplicationTray(state) |
|
|
|
ApplicationTray(state) |
|
|
|
} |
|
|
|
} |
|
|
@ -23,11 +24,11 @@ fun NotepadApplication(state: NotepadApplicationState) { |
|
|
|
|
|
|
|
|
|
|
|
@OptIn(ExperimentalComposeUiApi::class) |
|
|
|
@OptIn(ExperimentalComposeUiApi::class) |
|
|
|
@Composable |
|
|
|
@Composable |
|
|
|
private fun ApplicationTray(state: NotepadApplicationState) { |
|
|
|
private fun ApplicationScope.ApplicationTray(state: NotepadApplicationState) { |
|
|
|
Tray( |
|
|
|
Tray( |
|
|
|
LocalAppResources.current.icon, |
|
|
|
LocalAppResources.current.icon, |
|
|
|
state = state.tray, |
|
|
|
state = state.tray, |
|
|
|
hint = "Notepad", |
|
|
|
tooltip = "Notepad", |
|
|
|
menu = { ApplicationMenu(state) } |
|
|
|
menu = { ApplicationMenu(state) } |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|