Nikolay Igotti
3 years ago
5 changed files with 34 additions and 14 deletions
@ -1,9 +1,9 @@ |
|||||||
package org.jetbrains.compose.app.demo |
package org.jetbrains.compose.app.demo |
||||||
|
|
||||||
import androidx.compose.material.Text |
import androidx.compose.material.Text |
||||||
import org.jetbrains.compose.app.application |
import org.jetbrains.compose.app.app |
||||||
|
|
||||||
fun main() = application( |
fun main() = app( |
||||||
title = "App demo" |
title = "App demo" |
||||||
) { |
) { |
||||||
Text("Hi") |
Text("Hi") |
@ -0,0 +1,14 @@ |
|||||||
|
package org.jetbrains.compose.app |
||||||
|
|
||||||
|
import androidx.compose.runtime.Composable |
||||||
|
|
||||||
|
fun app(name: String = "application", title: String = "Compose Application", body: @Composable () -> Unit) { |
||||||
|
appImpl(name, title, body) |
||||||
|
} |
||||||
|
|
||||||
|
internal expect fun appImpl(name: String, title: String, body: @Composable () -> Unit) |
||||||
|
|
||||||
|
// TODO: not sure if having abstract here is a good idea |
||||||
|
expect abstract class EmbedderContext |
||||||
|
|
||||||
|
expect fun embed(context: EmbedderContext, body: @Composable () -> Unit) |
@ -0,0 +1,16 @@ |
|||||||
|
package org.jetbrains.compose.app |
||||||
|
|
||||||
|
import androidx.compose.runtime.Composable |
||||||
|
import androidx.compose.ui.window.singleWindowApplication |
||||||
|
import javax.swing.JComponent |
||||||
|
|
||||||
|
actual fun appImpl(name: String, title: String, body: @Composable () -> Unit) { |
||||||
|
singleWindowApplication { |
||||||
|
body() |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
actual typealias EmbedderContext = JComponent |
||||||
|
actual fun embed(context: EmbedderContext, body: @Composable () -> Unit) { |
||||||
|
TODO("implement me") |
||||||
|
} |
@ -1,10 +0,0 @@ |
|||||||
package org.jetbrains.compose.app |
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable |
|
||||||
import androidx.compose.ui.window.singleWindowApplication |
|
||||||
|
|
||||||
fun application(name: String = "application", title: String = "Compose Application", body: @Composable () -> Unit) { |
|
||||||
singleWindowApplication { |
|
||||||
body() |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue