diff src/name/blackcap/clipman/Osdep.kt @ 57:c6cccbe2f393

Port to OpenJDK 15 (mostly done).
author David Barts <n5jrn@me.com>
date Wed, 23 Mar 2022 23:56:29 -0700
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/name/blackcap/clipman/Osdep.kt	Wed Mar 23 23:56:29 2022 -0700
@@ -0,0 +1,20 @@
+/*
+ * OS-dependent code, Mac version.
+ */
+package name.blackcap.clipman
+
+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)
+        }
+    }
+}