File tree Expand file tree Collapse file tree
filekit-dialogs/src/jvmMain/kotlin/io/github/vinceglb/filekit/dialogs
samples/sample-core/composeApp/src/desktopMain/kotlin/io/github/vinceglb/sample/core/compose Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<component name =" ProjectRunConfigurationManager" >
22 <configuration default =" false" name =" SampleCore Jvm" type =" GradleRunConfiguration" factoryName =" Gradle" >
33 <ExternalSystemSettings >
4+ <option name =" env" >
5+ <map >
6+ <entry key =" DEVELOPER_DIR" value =" /Applications/Xcode.app/Contents/Developer" />
7+ </map >
8+ </option >
49 <option name =" executionName" />
510 <option name =" externalProjectPath" value =" $PROJECT_DIR$" />
611 <option name =" externalSystemIdString" value =" GRADLE" />
Original file line number Diff line number Diff line change @@ -14,4 +14,5 @@ public actual data class FileKitDialogSettings(
1414public class FileKitMacOSSettings (
1515 public val resolvesAliases : Boolean? = null ,
1616 public val canCreateDirectories : Boolean = true ,
17+ public val windowSize : Pair <Int , Int >? = null ,
1718)
Original file line number Diff line number Diff line change @@ -101,6 +101,14 @@ internal class MacOSFilePicker : PlatformFilePicker {
101101 Foundation .invoke(openPanel, " setResolvesAliases:" , resolvesAliases)
102102 }
103103
104+ // Set window size
105+ println (" Setting window size: ${macOSSettings.windowSize} " )
106+ macOSSettings.windowSize?.let { (width, height) ->
107+ // Create NSSize structure and set content size
108+ val nsSize = Foundation .NSSize (width.toDouble(), height.toDouble())
109+ Foundation .invoke(openPanel, " setContentSize:" , nsSize)
110+ }
111+
104112 // Open the file picker
105113 val result = Foundation .invoke(openPanel, " runModal" )
106114
Original file line number Diff line number Diff line change @@ -581,10 +581,10 @@ internal object Foundation {
581581// var y: CoreGraphics.CGFloat = CGFloat(y)
582582// }
583583//
584- // @ Structure.FieldOrder("width", "height")
585- // class NSSize @JvmOverloads constructor(width: Double = 0.0, height: Double = 0.0) :
586- // Structure(), Structure.ByValue {
587- // var width: CoreGraphics.CGFloat = CGFloat( width)
588- // var height: CoreGraphics.CGFloat = CGFloat( height)
589- // }
584+ @com.sun.jna. Structure .FieldOrder (" width" , " height" )
585+ class NSSize @JvmOverloads constructor(width : Double = 0.0 , height : Double = 0.0 ) :
586+ com.sun.jna. Structure (), com.sun.jna. Structure .ByValue {
587+ @JvmField var width: Double = width
588+ @JvmField var height: Double = height
589+ }
590590}
Original file line number Diff line number Diff line change @@ -4,11 +4,17 @@ import androidx.compose.ui.window.Window
44import androidx.compose.ui.window.application
55import io.github.vinceglb.filekit.FileKit
66import io.github.vinceglb.filekit.dialogs.FileKitDialogSettings
7+ import io.github.vinceglb.filekit.dialogs.FileKitMacOSSettings
78
89fun main () = application {
910 FileKit .init (appId = " FileKitSampleCore" )
1011 Window (onCloseRequest = ::exitApplication, title = " Picker Core Sample" ) {
11- val dialogSettings = FileKitDialogSettings (this .window)
12+ val dialogSettings = FileKitDialogSettings (
13+ parentWindow = this .window,
14+ macOS = FileKitMacOSSettings (
15+ windowSize = Pair (500 , 500 )
16+ )
17+ )
1218 App (dialogSettings)
1319 }
1420}
You can’t perform that action at this time.
0 commit comments