| 72981 |      1 | /*  Title:      Pure/GUI/desktop_app.scala
 | 
|  |      2 |     Author:     Makarius
 | 
|  |      3 | 
 | 
|  |      4 | Support for desktop applications, notably on macOS.
 | 
|  |      5 | */
 | 
|  |      6 | 
 | 
|  |      7 | package isabelle
 | 
|  |      8 | 
 | 
|  |      9 | import java.awt.Desktop
 | 
|  |     10 | 
 | 
|  |     11 | 
 | 
| 75393 |     12 | object Desktop_App {
 | 
| 72981 |     13 |   def desktop_action(action: Desktop.Action, f: Desktop => Unit): Unit =
 | 
|  |     14 |     if (Desktop.isDesktopSupported) {
 | 
|  |     15 |       val desktop = Desktop.getDesktop
 | 
|  |     16 |       if (desktop.isSupported(action)) f(desktop)
 | 
|  |     17 |     }
 | 
|  |     18 | 
 | 
|  |     19 |   def about_handler(handler: => Unit): Unit =
 | 
|  |     20 |     desktop_action(Desktop.Action.APP_ABOUT, _.setAboutHandler(_ => handler))
 | 
|  |     21 | }
 |