Add versioned about box, set title
[fanfix.git] / src / jexer / TApplication.java
index 971f6f8fa572ff243645975966243dc9ff25f598..91d2e98d7c039da4aeb9d01c84bb33385f762772 100644 (file)
@@ -370,6 +370,15 @@ public class TApplication implements Runnable {
      */
     private Backend backend;
 
+    /**
+     * Get the Backend.
+     *
+     * @return the Backend
+     */
+    public final Backend getBackend() {
+        return backend;
+    }
+
     /**
      * Get the Screen.
      *
@@ -1514,6 +1523,15 @@ public class TApplication implements Runnable {
         return false;
     }
 
+    /**
+     * Display the about dialog.
+     */
+    protected void showAboutDialog() {
+        messageBox("About", "Jexer Version " +
+            this.getClass().getPackage().getImplementationVersion(),
+            TMessageBox.Type.OK);
+    }
+
     /**
      * Method that TApplication subclasses can override to handle menu
      * events.
@@ -1549,6 +1567,10 @@ public class TApplication implements Runnable {
             closeAllWindows();
             return true;
         }
+        if (menu.getId() == TMenu.MID_ABOUT) {
+            showAboutDialog();
+            return true;
+        }
         return false;
     }
 
@@ -1752,6 +1774,24 @@ public class TApplication implements Runnable {
         return windowMenu;
     }
 
+    /**
+     * Convenience function to add a default "Help" menu.
+     *
+     * @return the new menu
+     */
+    public final TMenu addHelpMenu() {
+        TMenu helpMenu = addMenu("&Help");
+        helpMenu.addDefaultItem(TMenu.MID_HELP_CONTENTS);
+        helpMenu.addDefaultItem(TMenu.MID_HELP_INDEX);
+        helpMenu.addDefaultItem(TMenu.MID_HELP_SEARCH);
+        helpMenu.addDefaultItem(TMenu.MID_HELP_PREVIOUS);
+        helpMenu.addDefaultItem(TMenu.MID_HELP_HELP);
+        helpMenu.addDefaultItem(TMenu.MID_HELP_ACTIVE_FILE);
+        helpMenu.addSeparator();
+        helpMenu.addDefaultItem(TMenu.MID_ABOUT);
+        return helpMenu;
+    }
+
     /**
      * Close all open windows.
      */