Skip to content

Commit

Permalink
Create NoTheme JewelComposePanel versions (#588)
Browse files Browse the repository at this point in the history
Useful for those cases where you want to have your own theme.
  • Loading branch information
rock3r authored Sep 9, 2024
1 parent baf8f81 commit b74dcb2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ide-laf-bridge/api/ide-laf-bridge.api
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ public final class org/jetbrains/jewel/bridge/JewelBridgeException$KeysNotFoundE
}

public final class org/jetbrains/jewel/bridge/JewelComposePanelKt {
public static final fun JewelComposeNoThemePanel (Lkotlin/jvm/functions/Function2;)Ljavax/swing/JComponent;
public static final fun JewelComposePanel (Lkotlin/jvm/functions/Function2;)Ljavax/swing/JComponent;
public static final fun JewelToolWindowComposePanel (Lkotlin/jvm/functions/Function2;)Ljavax/swing/JComponent;
public static final fun JewelToolWindowNoThemeComposePanel (Lkotlin/jvm/functions/Function2;)Ljavax/swing/JComponent;
public static final fun getLocalComponent ()Landroidx/compose/runtime/ProvidableCompositionLocal;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,30 @@ public fun JewelToolWindowComposePanel(content: @Composable () -> Unit): JCompon
}
}

@ExperimentalJewelApi
@Suppress("ktlint:standard:function-naming", "FunctionName") // Swing to Compose bridge API
public fun JewelComposeNoThemePanel(content: @Composable () -> Unit): JComponent =
createJewelComposePanel { jewelPanel ->
setContent {
CompositionLocalProvider(LocalComponent provides this@createJewelComposePanel) {
ComponentDataProviderBridge(jewelPanel, content = content)
}
}
}

@ExperimentalJewelApi
@Suppress("ktlint:standard:function-naming", "FunctionName") // Swing to Compose bridge API
public fun JewelToolWindowNoThemeComposePanel(content: @Composable () -> Unit): JComponent =
createJewelComposePanel { jewelPanel ->
setContent {
Compose17IJSizeBugWorkaround {
CompositionLocalProvider(LocalComponent provides this@createJewelComposePanel) {
ComponentDataProviderBridge(jewelPanel, content = content)
}
}
}
}

private fun createJewelComposePanel(config: ComposePanel.(JewelComposePanel) -> Unit): JewelComposePanel {
val jewelPanel = JewelComposePanel()
jewelPanel.layout = BorderLayout()
Expand Down

0 comments on commit b74dcb2

Please sign in to comment.