src/Pure/GUI/desktop_app.scala
author paulson <lp15@cam.ac.uk>
Fri, 03 Nov 2023 16:20:06 +0000
changeset 78890 d8045bc0544e
parent 75393 87ebf5a50283
permissions -rw-r--r--
Added Kronecker's approximation theorem. Requires adding Real_Asymp to HOL-Analysis. Funny syntax issue in Probability/Projective_Family

/*  Title:      Pure/GUI/desktop_app.scala
    Author:     Makarius

Support for desktop applications, notably on macOS.
*/

package isabelle

import java.awt.Desktop


object Desktop_App {
  def desktop_action(action: Desktop.Action, f: Desktop => Unit): Unit =
    if (Desktop.isDesktopSupported) {
      val desktop = Desktop.getDesktop
      if (desktop.isSupported(action)) f(desktop)
    }

  def about_handler(handler: => Unit): Unit =
    desktop_action(Desktop.Action.APP_ABOUT, _.setAboutHandler(_ => handler))
}