diff src/name/blackcap/imageprep/Osdep.kt @ 30:098c4f5507c7

Convert to JDK 15.
author David Barts <n5jrn@me.com>
date Mon, 13 Jun 2022 11:31:49 -0700
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/name/blackcap/imageprep/Osdep.kt	Mon Jun 13 11:31:49 2022 -0700
@@ -0,0 +1,20 @@
+/*
+ * 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)
+        }
+    }
+}