view src/name/blackcap/imageprep/Osdep.kt @ 31:99a0eb385c9a default tip

Work around annoying Swing glitch.
author David Barts <n5jrn@me.com>
date Sat, 20 Aug 2022 09:19:49 -0700
parents 098c4f5507c7
children
line wrap: on
line source

/*
 * OS-dependent code, Mac version.
 */
package name.blackcap.imageprep

import java.awt.Desktop
import java.awt.desktop.AboutHandler
import java.awt.desktop.PreferencesHandler
import java.awt.desktop.QuitStrategy

fun setMacMenus() {
    if (OS.type == OS.MAC) {
        Desktop.getDesktop().run {
            setAboutHandler(AboutHandler({ showAboutDialog() }))
            setPreferencesHandler(
                PreferencesHandler({ Application.settingsDialog.setVisible(true) }))
            setQuitStrategy(QuitStrategy.CLOSE_ALL_WINDOWS)
        }
    }
}