|
|
@ -1,49 +1,33 @@ |
|
|
|
package org.jetbrains.compose.splitpane.demo |
|
|
|
package org.jetbrains.compose.splitpane.demo |
|
|
|
|
|
|
|
|
|
|
|
import androidx.compose.desktop.DesktopTheme |
|
|
|
import androidx.compose.desktop.DesktopTheme |
|
|
|
import androidx.compose.desktop.LocalAppWindow |
|
|
|
|
|
|
|
import androidx.compose.desktop.Window |
|
|
|
|
|
|
|
import androidx.compose.foundation.background |
|
|
|
import androidx.compose.foundation.background |
|
|
|
import androidx.compose.foundation.layout.Box |
|
|
|
import androidx.compose.foundation.layout.Box |
|
|
|
import androidx.compose.foundation.layout.fillMaxHeight |
|
|
|
import androidx.compose.foundation.layout.fillMaxHeight |
|
|
|
import androidx.compose.foundation.layout.fillMaxSize |
|
|
|
import androidx.compose.foundation.layout.fillMaxSize |
|
|
|
import androidx.compose.foundation.layout.width |
|
|
|
import androidx.compose.foundation.layout.width |
|
|
|
import androidx.compose.material.MaterialTheme |
|
|
|
import androidx.compose.material.MaterialTheme |
|
|
|
import androidx.compose.runtime.getValue |
|
|
|
import androidx.compose.ui.ExperimentalComposeUiApi |
|
|
|
import androidx.compose.runtime.mutableStateOf |
|
|
|
|
|
|
|
import androidx.compose.runtime.remember |
|
|
|
|
|
|
|
import androidx.compose.runtime.setValue |
|
|
|
|
|
|
|
import androidx.compose.ui.Modifier |
|
|
|
import androidx.compose.ui.Modifier |
|
|
|
import androidx.compose.ui.composed |
|
|
|
|
|
|
|
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.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.unit.dp |
|
|
|
|
|
|
|
import androidx.compose.ui.window.singleWindowApplication |
|
|
|
import org.jetbrains.compose.splitpane.ExperimentalSplitPaneApi |
|
|
|
import org.jetbrains.compose.splitpane.ExperimentalSplitPaneApi |
|
|
|
import org.jetbrains.compose.splitpane.HorizontalSplitPane |
|
|
|
import org.jetbrains.compose.splitpane.HorizontalSplitPane |
|
|
|
import org.jetbrains.compose.splitpane.VerticalSplitPane |
|
|
|
import org.jetbrains.compose.splitpane.VerticalSplitPane |
|
|
|
import org.jetbrains.compose.splitpane.rememberSplitPaneState |
|
|
|
import org.jetbrains.compose.splitpane.rememberSplitPaneState |
|
|
|
import java.awt.Cursor |
|
|
|
import java.awt.Cursor |
|
|
|
|
|
|
|
|
|
|
|
private fun Modifier.cursorForHorizontalResize( |
|
|
|
@OptIn(ExperimentalComposeUiApi::class) |
|
|
|
): Modifier = composed { |
|
|
|
private fun Modifier.cursorForHorizontalResize(): Modifier = |
|
|
|
var isHover by remember { mutableStateOf(false) } |
|
|
|
pointerIcon(PointerIcon(Cursor(Cursor.E_RESIZE_CURSOR))) |
|
|
|
|
|
|
|
|
|
|
|
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(ExperimentalSplitPaneApi::class) |
|
|
|
@OptIn(ExperimentalSplitPaneApi::class) |
|
|
|
fun main() = Window( |
|
|
|
fun main() = singleWindowApplication( |
|
|
|
"SplitPane demo" |
|
|
|
title = "SplitPane demo" |
|
|
|
) { |
|
|
|
) { |
|
|
|
MaterialTheme { |
|
|
|
MaterialTheme { |
|
|
|
DesktopTheme { |
|
|
|
DesktopTheme { |
|
|
|