Browse Source

Merge branch 'sync/2010-10-01'

pull/1244/head v1.0.0-alpha4-build396
akurasov 3 years ago
parent
commit
64ec489bba
  1. 74
      components/SplitPane/demo/src/jvmMain/kotlin/org/jetbrains/compose/splitpane/demo/Main.kt
  2. 7
      components/SplitPane/library/src/desktopMain/kotlin/org/jetbrains/compose/splitpane/DesktopSplitter.kt
  3. 2
      components/gradle.properties
  4. 2
      compose/frameworks/support
  5. 5
      compose/gradle.properties
  6. 4
      tutorials/Mouse_Events/README.md
  7. 6
      tutorials/Window_API_new/README.md

74
components/SplitPane/demo/src/jvmMain/kotlin/org/jetbrains/compose/splitpane/demo/Main.kt

@ -12,7 +12,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.input.pointer.PointerIcon import androidx.compose.ui.input.pointer.PointerIcon
import androidx.compose.ui.input.pointer.pointerIcon import androidx.compose.ui.input.pointer.pointerHoverIcon
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.singleWindowApplication import androidx.compose.ui.window.singleWindowApplication
import org.jetbrains.compose.splitpane.ExperimentalSplitPaneApi import org.jetbrains.compose.splitpane.ExperimentalSplitPaneApi
@ -23,53 +23,51 @@ import java.awt.Cursor
@OptIn(ExperimentalComposeUiApi::class) @OptIn(ExperimentalComposeUiApi::class)
private fun Modifier.cursorForHorizontalResize(): Modifier = private fun Modifier.cursorForHorizontalResize(): Modifier =
pointerIcon(PointerIcon(Cursor(Cursor.E_RESIZE_CURSOR))) pointerHoverIcon(PointerIcon(Cursor(Cursor.E_RESIZE_CURSOR)))
@OptIn(ExperimentalSplitPaneApi::class) @OptIn(ExperimentalSplitPaneApi::class)
fun main() = singleWindowApplication( fun main() = singleWindowApplication(
title = "SplitPane demo" title = "SplitPane demo"
) { ) {
MaterialTheme { MaterialTheme {
DesktopTheme { val splitterState = rememberSplitPaneState()
val splitterState = rememberSplitPaneState() val hSplitterState = rememberSplitPaneState()
val hSplitterState = rememberSplitPaneState() HorizontalSplitPane(
HorizontalSplitPane( splitPaneState = splitterState
splitPaneState = splitterState ) {
) { first(20.dp) {
first(20.dp) { Box(Modifier.background(Color.Red).fillMaxSize())
Box(Modifier.background(Color.Red).fillMaxSize()) }
} second(50.dp) {
second(50.dp) { VerticalSplitPane(splitPaneState = hSplitterState) {
VerticalSplitPane(splitPaneState = hSplitterState) { first(50.dp) {
first(50.dp) { Box(Modifier.background(Color.Blue).fillMaxSize())
Box(Modifier.background(Color.Blue).fillMaxSize())
}
second(20.dp) {
Box(Modifier.background(Color.Green).fillMaxSize())
}
}
}
splitter {
visiblePart {
Box(
Modifier
.width(1.dp)
.fillMaxHeight()
.background(MaterialTheme.colors.background)
)
} }
handle { second(20.dp) {
Box( Box(Modifier.background(Color.Green).fillMaxSize())
Modifier
.markAsHandle()
.cursorForHorizontalResize()
.background(SolidColor(Color.Gray), alpha = 0.50f)
.width(9.dp)
.fillMaxHeight()
)
} }
} }
} }
splitter {
visiblePart {
Box(
Modifier
.width(1.dp)
.fillMaxHeight()
.background(MaterialTheme.colors.background)
)
}
handle {
Box(
Modifier
.markAsHandle()
.cursorForHorizontalResize()
.background(SolidColor(Color.Gray), alpha = 0.50f)
.width(9.dp)
.fillMaxHeight()
)
}
}
} }
} }
} }

7
components/SplitPane/library/src/desktopMain/kotlin/org/jetbrains/compose/splitpane/DesktopSplitter.kt

@ -8,16 +8,13 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.pointer.PointerIcon import androidx.compose.ui.input.pointer.*
import androidx.compose.ui.input.pointer.consumeAllChanges
import androidx.compose.ui.input.pointer.pointerIcon
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import java.awt.Cursor import java.awt.Cursor
@OptIn(ExperimentalComposeUiApi::class) @OptIn(ExperimentalComposeUiApi::class)
private fun Modifier.cursorForHorizontalResize(isHorizontal: Boolean): Modifier = private fun Modifier.cursorForHorizontalResize(isHorizontal: Boolean): Modifier =
pointerIcon(PointerIcon(Cursor(if (isHorizontal) Cursor.E_RESIZE_CURSOR else Cursor.S_RESIZE_CURSOR))) pointerHoverIcon(PointerIcon(Cursor(if (isHorizontal) Cursor.E_RESIZE_CURSOR else Cursor.S_RESIZE_CURSOR)))
@Composable @Composable
private fun DesktopSplitPaneSeparator( private fun DesktopSplitPaneSeparator(

2
components/gradle.properties

@ -4,4 +4,4 @@ android.enableJetifier=true
kotlin.code.style=official kotlin.code.style=official
# __LATEST_COMPOSE_RELEASE_VERSION__ # __LATEST_COMPOSE_RELEASE_VERSION__
compose.version=1.0.0-alpha4-build362 compose.version=0.0.0-sync-2010-10-01-build393

2
compose/frameworks/support

@ -1 +1 @@
Subproject commit 7c650696a232d5019754fdb00311544276bab78f Subproject commit 5a420a4cf4a52867f616ff08bcab5fc35504a149

5
compose/gradle.properties

@ -3,4 +3,7 @@ org.gradle.daemon=true
org.gradle.configureondemand=true org.gradle.configureondemand=true
org.gradle.parallel=true org.gradle.parallel=true
org.gradle.caching=true org.gradle.caching=true
org.gradle.vfs.watch=true org.gradle.vfs.watch=true
androidx.compose.multiplatformEnabled=true
androidx.compose.jsCompilerTestsEnabled=true
androidx.validateProjectStructure=false

4
tutorials/Mouse_Events/README.md

@ -78,11 +78,13 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.pointer.pointerMoveFilter import androidx.compose.ui.input.pointer.pointerMoveFilter
import androidx.compose.ui.window.singleWindowApplication import androidx.compose.ui.window.singleWindowApplication
@OptIn(ExperimentalComposeUiApi::class)
fun main() = singleWindowApplication { fun main() = singleWindowApplication {
var color by remember { mutableStateOf(Color(0, 0, 0)) } var color by remember { mutableStateOf(Color(0, 0, 0)) }
Box( Box(
@ -115,6 +117,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.pointer.pointerMoveFilter import androidx.compose.ui.input.pointer.pointerMoveFilter
@ -123,6 +126,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import androidx.compose.ui.window.singleWindowApplication import androidx.compose.ui.window.singleWindowApplication
@OptIn(ExperimentalComposeUiApi::class)
fun main() = singleWindowApplication { fun main() = singleWindowApplication {
Column( Column(
Modifier.background(Color.White), Modifier.background(Color.White),

6
tutorials/Window_API_new/README.md

@ -160,7 +160,7 @@ fun main() = application {
if (!isVisible) { if (!isVisible) {
Tray( Tray(
TrayIcon, TrayIcon,
hint = "Counter", tooltip = "Counter",
onAction = { isVisible = true }, onAction = { isVisible = true },
menu = { menu = {
Item("Exit", onClick = ::exitApplication) Item("Exit", onClick = ::exitApplication)
@ -386,9 +386,9 @@ Reading the state in composition is useful when you need to update UI, but there
```kotlin ```kotlin
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.snapshotFlow import androidx.compose.runtime.snapshotFlow
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.window.Window import androidx.compose.ui.window.Window
import androidx.compose.ui.window.WindowPosition import androidx.compose.ui.window.WindowPosition
import androidx.compose.ui.window.WindowSize
import androidx.compose.ui.window.application import androidx.compose.ui.window.application
import androidx.compose.ui.window.rememberWindowState import androidx.compose.ui.window.rememberWindowState
import kotlinx.coroutines.flow.filterNot import kotlinx.coroutines.flow.filterNot
@ -414,7 +414,7 @@ fun main() = application {
} }
} }
private fun onWindowResize(size: WindowSize) { private fun onWindowResize(size: DpSize) {
println("onWindowResize $size") println("onWindowResize $size")
} }

Loading…
Cancel
Save