|
|
|
@ -1,49 +1,33 @@
|
|
|
|
|
package org.jetbrains.compose.splitpane.demo |
|
|
|
|
|
|
|
|
|
import androidx.compose.desktop.DesktopTheme |
|
|
|
|
import androidx.compose.desktop.LocalAppWindow |
|
|
|
|
import androidx.compose.desktop.Window |
|
|
|
|
import androidx.compose.foundation.background |
|
|
|
|
import androidx.compose.foundation.layout.Box |
|
|
|
|
import androidx.compose.foundation.layout.fillMaxHeight |
|
|
|
|
import androidx.compose.foundation.layout.fillMaxSize |
|
|
|
|
import androidx.compose.foundation.layout.width |
|
|
|
|
import androidx.compose.material.MaterialTheme |
|
|
|
|
import androidx.compose.runtime.getValue |
|
|
|
|
import androidx.compose.runtime.mutableStateOf |
|
|
|
|
import androidx.compose.runtime.remember |
|
|
|
|
import androidx.compose.runtime.setValue |
|
|
|
|
import androidx.compose.ui.ExperimentalComposeUiApi |
|
|
|
|
import androidx.compose.ui.Modifier |
|
|
|
|
import androidx.compose.ui.composed |
|
|
|
|
import androidx.compose.ui.graphics.Color |
|
|
|
|
import androidx.compose.ui.graphics.SolidColor |
|
|
|
|
import androidx.compose.ui.input.pointer.pointerMoveFilter |
|
|
|
|
import androidx.compose.ui.input.pointer.PointerIcon |
|
|
|
|
import androidx.compose.ui.input.pointer.pointerIcon |
|
|
|
|
import androidx.compose.ui.unit.dp |
|
|
|
|
import androidx.compose.ui.window.singleWindowApplication |
|
|
|
|
import org.jetbrains.compose.splitpane.ExperimentalSplitPaneApi |
|
|
|
|
import org.jetbrains.compose.splitpane.HorizontalSplitPane |
|
|
|
|
import org.jetbrains.compose.splitpane.VerticalSplitPane |
|
|
|
|
import org.jetbrains.compose.splitpane.rememberSplitPaneState |
|
|
|
|
import java.awt.Cursor |
|
|
|
|
|
|
|
|
|
private fun Modifier.cursorForHorizontalResize( |
|
|
|
|
): Modifier = composed { |
|
|
|
|
var isHover by remember { mutableStateOf(false) } |
|
|
|
|
|
|
|
|
|
if (isHover) { |
|
|
|
|
LocalAppWindow.current.window.cursor = Cursor(Cursor.E_RESIZE_CURSOR) |
|
|
|
|
} else { |
|
|
|
|
LocalAppWindow.current.window.cursor = Cursor.getDefaultCursor() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pointerMoveFilter( |
|
|
|
|
onEnter = { isHover = true; true }, |
|
|
|
|
onExit = { isHover = false; true } |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
@OptIn(ExperimentalComposeUiApi::class) |
|
|
|
|
private fun Modifier.cursorForHorizontalResize(): Modifier = |
|
|
|
|
pointerIcon(PointerIcon(Cursor(Cursor.E_RESIZE_CURSOR))) |
|
|
|
|
|
|
|
|
|
@OptIn(ExperimentalSplitPaneApi::class) |
|
|
|
|
fun main() = Window( |
|
|
|
|
"SplitPane demo" |
|
|
|
|
fun main() = singleWindowApplication( |
|
|
|
|
title = "SplitPane demo" |
|
|
|
|
) { |
|
|
|
|
MaterialTheme { |
|
|
|
|
DesktopTheme { |
|
|
|
|