-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔀 Fix icon don't be scaled after density changed (#239)
* Fix icon don't be scaled after density changed * Fix comments
- Loading branch information
Showing
9 changed files
with
86 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/JewelComposePanel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.jetbrains.jewel.bridge | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.CompositionLocalProvider | ||
import androidx.compose.runtime.ProvidableCompositionLocal | ||
import androidx.compose.runtime.staticCompositionLocalOf | ||
import androidx.compose.ui.awt.ComposePanel | ||
import org.jetbrains.jewel.bridge.actionSystem.ComponentDataProviderBridge | ||
import org.jetbrains.jewel.bridge.theme.SwingBridgeTheme | ||
import org.jetbrains.jewel.foundation.ExperimentalJewelApi | ||
import javax.swing.JComponent | ||
|
||
public fun JewelComposePanel( | ||
content: @Composable () -> Unit, | ||
): JComponent { | ||
return ComposePanel().apply { | ||
setContent { | ||
SwingBridgeTheme { | ||
CompositionLocalProvider(LocalComponent provides this@apply) { | ||
ComponentDataProviderBridge(this@apply, content = content) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@ExperimentalJewelApi | ||
public val LocalComponent: ProvidableCompositionLocal<JComponent> = staticCompositionLocalOf { | ||
error("CompositionLocal LocalComponent not provided") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters